Commit Graph

5860 Commits

Author SHA1 Message Date
Antoine Pitrou 9ea1c8d7d7 Issue #10517: After fork(), reinitialize the TLS used by the PyGILState_*
APIs, to avoid a crash with the pthread implementation in RHEL 5.  Patch
by Charles-François Natali.
2011-04-27 19:30:16 +02:00
Antoine Pitrou 0c759febb6 Issue #10517: After fork(), reinitialize the TLS used by the PyGILState_*
APIs, to avoid a crash with the pthread implementation in RHEL 5.  Patch
by Charles-François Natali.
2011-04-27 19:28:05 +02:00
Victor Stinner 66299a49f0 Fix compilation of _testembed.c without threads 2011-04-26 23:37:02 +02:00
Victor Stinner b90db4caf0 Issue #11918: OS/2 and VMS are no more supported because of the lack of
maintainer.
2011-04-26 22:48:24 +02:00
Antoine Pitrou eec60603a8 Issue #10914: Add a minimal embedding test to test_capi. 2011-04-25 21:23:26 +02:00
Antoine Pitrou 8e60577693 Issue #10914: Add a minimal embedding test to test_capi. 2011-04-25 21:21:07 +02:00
Antoine Pitrou f645451d78 Issue #11856: Speed up parsing of JSON numbers. 2011-04-25 19:16:06 +02:00
Victor Stinner c2824d41c3 Issue #11915: threading.RLock()._release_save() raises a RuntimeError if the
lock was not acquired.
2011-04-24 23:41:33 +02:00
Antoine Pitrou 877509aef4 Issue #11382: Trivial system calls, such as dup() or pipe(), needn't
release the GIL.  Patch by Charles-François Natali.
2011-04-23 17:21:13 +02:00
Victor Stinner a154b5cea4 Simplify _count_elements() in _collections
PyIter_Next() cannot return a PyExc_StopIteration: it clears this exception.
2011-04-20 23:23:52 +02:00
Victor Stinner 754851f456 Issue #11223: Add threading._info() function providing informations about the
thread implementation.

Skip test_lock_acquire_interruption() and test_rlock_acquire_interruption() of
test_threadsignals if a thread lock is implemented using a POSIX mutex and a
POSIX condition variable. A POSIX condition variable cannot be interrupted by a
signal (e.g. on Linux, the futex system call is restarted).
2011-04-19 23:58:51 +02:00
Victor Stinner cf2a807831 faulthandler: don't use sigprocmask()
It has an undefined behaviour with threads, only use pthread_sigmask() if
it is available (and not broken).
2011-04-19 23:30:57 +02:00
Giampaolo Rodola' ff1a73590d os.sendfile(): on Linux if offset parameter is passed as NULL we were erroneously returning a (bytes_sent, None) tuple instead of bytes_sent 2011-04-19 09:47:16 +02:00
Victor Stinner ce16be91dc (Merge 3.2) Issue #11768: The signal handler of the signal module only calls
Py_AddPendingCall() for the first signal to fix a deadlock on reentrant or
parallel calls. PyErr_SetInterrupt() writes also into the wake up file.
2011-04-18 16:30:17 +02:00
Victor Stinner 27026f87d8 (Merge 3.1) Issue #11768: The signal handler of the signal module only calls
Py_AddPendingCall() for the first signal to fix a deadlock on reentrant or
parallel calls. PyErr_SetInterrupt() writes also into the wake up file.
2011-04-18 16:28:39 +02:00
Victor Stinner 6c9b35bfe2 Issue #11768: The signal handler of the signal module only calls
Py_AddPendingCall() for the first signal to fix a deadlock on reentrant or
parallel calls. PyErr_SetInterrupt() writes also into the wake up file.
2011-04-18 16:25:56 +02:00
Nadeem Vawda ea4b46f9a9 Fix 64-bit safety issue in BZ2Compressor and BZ2Decompressor. 2011-04-12 23:02:42 +02:00
Ezio Melotti d60b74cb66 Merge with 3.2. 2011-04-11 03:51:14 +03:00
Ezio Melotti fdb2df49bd Remove unnecessary call to PyErr_Clear. 2011-04-11 03:48:57 +03:00
Antoine Pitrou 131a6414dd Issue #11757: select.select() now raises ValueError when a negative timeout
is passed (previously, a select.error with EINVAL would be raised).  Patch
by Charles-François Natali.
2011-04-09 23:49:58 +02:00
Raymond Hettinger a56328680d Fix nit (make spelling consistent in prototype) 2011-04-09 12:57:00 -07:00
Victor Stinner a4de6d885f Improve faulthandler.enable(all_threads=True)
faulthandler.enable(all_threads=True) dumps the tracebacks even if it is not
possible to get the state of the current thread

Create also the get_thread_state() subfunction to factorize the code.
2011-04-09 00:47:23 +02:00
Victor Stinner c790a5346d faulthandler: dump_tracebacks_later() displays also the timeout 2011-04-08 13:39:59 +02:00
Victor Stinner 941893291a faulthandler: fix variable name, timeout_ms => timeout_us
The comment was already correct.
2011-04-08 13:00:31 +02:00
Victor Stinner de10f4054b faulthandler: one more time, fix usage of locks in the watchdog thread
* Write a new test to ensure that dump_tracebacks_later() still works if
   it was already called and then cancelled before
 * Don't use a variable to check the status of the thread, only rely on locks
 * The thread only releases cancel_event if it was able to acquire it (if
   the timer was interrupted)
 * The main thread always hold this lock. It is only released when
   faulthandler_thread() is interrupted until this thread exits, or at Python
   exit.
2011-04-08 12:57:06 +02:00
Victor Stinner cfa7123ef1 faulthandler: fix unregister() if it is called before register()
Fix a crash: don't read from NULL.
2011-04-08 12:48:15 +02:00
Victor Stinner ff4cd88266 faulthandler: fix compilating without threads 2011-04-07 11:50:25 +02:00
Victor Stinner 44e31baf95 faulthandler: we don't use (or need) SA_SIGINFO flag of sigaction() 2011-04-07 11:39:03 +02:00
Victor Stinner 9699440b57 faulthandler: check PyThreadState_Get() result in dump_tracebacks_later()
Cleanup also the code
2011-04-07 11:37:19 +02:00
Senthil Kumaran 736975a771 merge from 3.2 2011-04-06 14:16:08 +08:00
Senthil Kumaran ae664fb528 Merge from 3.1 2011-04-06 14:11:09 +08:00
Senthil Kumaran 8f377a3bbe Issue #10762: Guard against invalid/non-supported format string '%f' on Windows. Patch Santoso Wijaya. 2011-04-06 12:54:06 +08:00
Alexander Belopolsky 28deea1fa5 Issue #11576: Fixed timedelta subtraction glitch on big timedelta values 2011-04-05 20:43:15 -04:00
Alexander Belopolsky b6f5ec7370 Issue #11576: Fixed timedelta subtraction glitch on big timedelta values 2011-04-05 20:07:38 -04:00
Benjamin Peterson 3bd9729dc9 implement tp_clear 2011-04-05 17:25:14 -05:00
Victor Stinner 446c8d59c5 Issue #11707: Fix compilation errors with Visual Studio
Fix also a compiler (gcc) warning.
2011-04-05 12:21:35 +02:00
Raymond Hettinger 7ab9e22e34 Issue #11707: Fast C version of functools.cmp_to_key() 2011-04-05 02:33:54 -07:00
Victor Stinner 7f2fee3640 Issue #10785: Store the filename as Unicode in the Python parser. 2011-04-05 00:39:01 +02:00
Victor Stinner da9edae1f4 Issue #11753: faulthandler thread uses pthread_sigmask()
The thread must not receive any signal. If the thread receives a signal,
sem_timedwait() is interrupted and returns EINTR, but in this case,
PyThread_acquire_lock_timed() retries sem_timedwait() and the main thread is
not aware of the signal. The problem is that some tests expect that the main
thread receives the signal, not faulthandler handler, which should be
invisible.

On Linux, the signal looks to be received by the main thread, whereas on
FreeBSD, it can be any thread.
2011-04-04 11:05:21 +02:00
Antoine Pitrou 5bfa0622ec Issue #11688: Add sqlite3.Connection.set_trace_callback(). Patch by Torsten Landschoff. 2011-04-04 00:12:04 +02:00
Antoine Pitrou a7caec74aa Merge fix for issue #11746 2011-04-03 18:16:50 +02:00
Antoine Pitrou 9c25486093 Issue #11746: Fix SSLContext.load_cert_chain() to accept elliptic curve private keys. 2011-04-03 18:15:34 +02:00
Antoine Pitrou 37dc5f85b8 Issue #5863: Rewrite BZ2File in pure Python, and allow it to accept
file-like objects using a new `fileobj` constructor argument.  Patch by
Nadeem Vawda.
2011-04-03 17:05:46 +02:00
Victor Stinner 44378d46f6 Issue #11393: signal of user signal displays tracebacks even if tstate==NULL
* faulthandler_user() displays the tracebacks of all threads even if it is
   unable to get the state of the current thread
 * test_faulthandler: only release the GIL in test_gil_released() check
 * create check_signum() subfunction
2011-04-01 15:37:12 +02:00
Victor Stinner a01ca12a52 Issue #11393: Fix faulthandler.disable() and add a test 2011-04-01 12:56:17 +02:00
Victor Stinner d727e23243 Issue #11393: The fault handler handles also SIGABRT 2011-04-01 12:13:55 +02:00
Victor Stinner bc6a4db66d Issue #11393: fault handler uses raise(signum) for SIGILL on Windows 2011-04-01 12:08:57 +02:00
Victor Stinner f309134eff Issue #11393: fix usage of locks in faulthandler
* faulthandler_cancel_dump_tracebacks_later() is responsible to set running
   to zero (so we don't need the volatile keyword anymore)
 * release locks if PyThread_start_new_thread() fails

assert(thread.running == 0) was wrong in a corner case
2011-04-01 03:16:51 +02:00
Victor Stinner a4d4f1b4cb Issue #11393: New try to fix faulthandler_thread()
Always release the cancel join.

Fix also another corner case: _PyFaulthandler_Fini() called after setting
running variable to zero, but before releasing the join lock.
2011-04-01 03:00:05 +02:00
Victor Stinner 1c76b7f5e5 Issue #11393: Fix faulthandler_thread(): release cancel lock before join lock
If the thread releases the join lock before the cancel lock, the thread may
sometimes still be alive at cancel_dump_tracebacks_later() exit. So the cancel
lock may be destroyed while the thread is still alive, whereas the thread will
try to release the cancel lock, which just crash.

Another minor fix: the thread doesn't release the cancel lock if it didn't
acquire it.
2011-04-01 02:28:22 +02:00