Commit Graph

5951 Commits

Author SHA1 Message Date
Kurt B. Kaiser bc3e13818b Merge from 3.1 2011-05-11 13:48:54 -04:00
Kurt B. Kaiser e147806da9 Issue #1028: Tk returns invalid Unicode null in %A: UnicodeDecodeError.
With Tk < 8.5 _tkinter.c:PythonCmd() raised UnicodeDecodeError, caused IDLE to
exit.  Converted to valid Unicode null in PythonCmd().
2011-05-11 12:24:17 -04:00
Ezio Melotti f8d6fd605d #12051: merge with 3.2. 2011-05-11 01:23:41 +03:00
Ezio Melotti f188bc5d46 #12051: merge with 3.1. 2011-05-11 01:10:27 +03:00
Ezio Melotti 136726537f #12051: Fix segfault in json.dumps() while encoding highly-nested objects using the C accelerations. 2011-05-11 01:02:56 +03:00
Antoine Pitrou 3cade9942e Issue #8498: In socket.accept(), allow to specify 0 as a backlog value in
order to accept exactly one connection.  Patch by Daniel Evers.
2011-05-10 19:19:13 +02:00
Antoine Pitrou 1be815aac4 Issue #8498: In socket.accept(), allow to specify 0 as a backlog value in
order to accept exactly one connection.  Patch by Daniel Evers.
2011-05-10 19:16:29 +02:00
Victor Stinner 388196ed72 Issue #12011: signal.signal() and signal.siginterrupt() raise an OSError,
instead of a RuntimeError: OSError has an errno attribute.
2011-05-10 17:13:00 +02:00
Victor Stinner 00bc6ccb78 faulthandler: improve_sigabrt() on Visual Studio
Use _set_abort_behavior() + abort() instead of raise(SIGABRT) which may write
an error message and/or open a popup asking to report the fault.
2011-05-10 01:30:03 +02:00
Victor Stinner 17ca323e7c (Merge 3.1) Issue #12012: ssl.PROTOCOL_SSLv2 becomes optional
OpenSSL is now compiled with OPENSSL_NO_SSL2 defined (without the SSLv2
protocol) on Debian: fix the ssl module on Debian Testing and Debian Sid.

Optimize also ssl.get_protocol_name(): speed does matter!
2011-05-10 00:48:41 +02:00
Victor Stinner ee18b6f2fd Issue #12012: ssl.PROTOCOL_SSLv2 becomes optional
OpenSSL is now compiled with OPENSSL_NO_SSL2 defined (without the SSLv2
protocol) on Debian: fix the ssl module on Debian Testing and Debian Sid.

Optimize also ssl.get_protocol_name(): speed does matter!
2011-05-10 00:38:00 +02:00
Antoine Pitrou 2341f9ba00 Remove dead code from _multiprocessing 2011-05-09 20:55:03 +02:00
Antoine Pitrou 87cf220972 Issue #11743: Rewrite multiprocessing connection classes in pure Python. 2011-05-09 17:04:27 +02:00
Victor Stinner 86e104a6ab Issue #8407: Use an explicit cast for FreeBSD
pthread_t is a pointer, not an integer, on FreeBSD. It should fix the following
gcc warning:

passing argument 1 of ‘pthread_kill’ makes pointer from integer without a cast
2011-05-09 14:45:38 +02:00
Victor Stinner e0c9a7533c faulthandler: make quiet a gcc 4.6 warning (z was unused) 2011-05-09 14:44:26 +02:00
Victor Stinner 8f9f8d612a Issue #11888: Use system log2() when available
I expect the system libc to use more accurate functions than Python. The GNU
libc uses for example FYL2X and FYL2XP1 hardware instructions on Intel FPU.
2011-05-09 12:45:41 +02:00
Gerhard Haering 936d518dc8 #10811: Fix recursive usage of cursors. Instead of crashing, raise a ProgrammingError now. 2011-05-09 12:24:09 +02:00
Mark Dickinson 83b8c0be93 Grammatical fix for a comment for log2, to avoid referring to an *algorithm* as monotonic. 2011-05-09 08:40:20 +01:00
Mark Dickinson 23442584f4 Fix cut-and-paste typo in comment: log10 -> log2. 2011-05-09 08:05:00 +01:00
Victor Stinner fa0e3d52d6 Issue #11888: Add log2 function to math module. Patch written by Mark
Dickinson.
2011-05-09 01:01:09 +02:00
Victor Stinner 3de49192aa Issue #12012: ssl.PROTOCOL_SSLv2 becomes optional
OpenSSL is now compiled with OPENSSL_NO_SSL2 defined (without the SSLv2
protocol) on Debian: fix the ssl module on Debian Testing and Debian Sid.

Optimize also ssl.get_protocol_name(): speed does matter!
2011-05-09 00:42:58 +02:00
Victor Stinner d49b1f14de Issue #8407: The signal handler writes the signal number as a single byte
instead of a nul byte into the wakeup file descriptor. So it is possible to
wait more than one signal and know which signals were raised.
2011-05-08 02:03:15 +02:00
Victor Stinner b3e7219abf Issue #8407: Add pthread_kill(), sigpending() and sigwait() functions to the
signal module.
2011-05-08 01:46:11 +02:00
Ezio Melotti 9c18778695 #12017: merge with 3.2. 2011-05-07 18:29:14 +03:00
Ezio Melotti 06383ee090 #12017: merge with 3.1. 2011-05-07 18:15:34 +03:00
Ezio Melotti 362b95102f #12017: Fix segfault in json.loads() while decoding highly-nested objects using the C accelerations. 2011-05-07 17:58:09 +03:00
Victor Stinner 7bba62fd68 faulthandler: dump all threads by default
* Set the default value of all_threads arguments to True
 * Py_FatalError() dumps all threads, instead of only the current thread

Dump only the current thread is not reliable. In some cases, Python is unable
to retrieve the state of the current thread and so is unable to dump the
traceback. faulthandler keeps a reference to the interpreter and so is always
able to dump the traceback of all threads.
2011-05-07 12:43:00 +02:00
Victor Stinner c925617b54 faulthandler: save/restore errno in the two signal handlers 2011-05-07 12:20:11 +02:00
Ronald Oussoren 97c3eb4ed5 Closes Issue 11916: Add a number of MacOSX specific definitions to the errno module.
Patch by Pierre Carrier.
2011-05-07 09:59:03 +02:00
Victor Stinner 35b300c5fd Issue #8407: signal.pthread_sigmask() returns a set instead of a list
Update the doc. Refactor also related tests.
2011-05-04 13:20:35 +02:00
Victor Stinner d0e516db50 Issue #8407: pthread_sigmask() checks immediatly if signal handlers have been
called. The test checks that SIG_UNBLOCK calls immediatly the signal handler of
the pending SIGUSR1. Improve also the tests using an exception (division by
zero) instead of a flag (a function attribute).
2011-05-03 14:57:12 +02:00
Alexander Belopolsky 66746cb222 Removed unused variable 2011-05-02 13:44:20 -04:00
Alexander Belopolsky 89da349b7b Issue #11930: Remove year >= 1000 limitation from datetime.strftime.
Patch by Victor Stinner.
2011-05-02 13:14:24 -04:00
Alexander Belopolsky 09a98a99cd merge 2011-05-02 12:31:17 -04:00
Alexander Belopolsky 03163ac185 Issue #11930: Remove deprecated time.accept2dyear. 2011-05-02 12:20:52 -04:00
Victor Stinner 72c53b5dcc cleanup signalmodule.c: use PyModule_AddIntMacro() 2011-05-02 16:15:43 +02:00
Victor Stinner fadeeffe5b (Merge 3.2) Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X
to get around a mmap bug with sparse files. Patch written by Steffen Daode
Nurpmeso.
2011-05-02 01:14:55 +02:00
Victor Stinner 8108e96bc8 (Merge 3.1) Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X
to get around a mmap bug with sparse files. Patch written by Steffen Daode
Nurpmeso.
2011-05-02 01:11:33 +02:00
Victor Stinner a6cd0cf0f5 Issue #11277: mmap calls fcntl(fd, F_FULLFSYNC) on Mac OS X to get around a
mmap bug with sparse files. Patch written by Steffen Daode Nurpmeso.
2011-05-02 01:05:37 +02:00
Victor Stinner a929335961 Issue #8407, issue #11859: Add signal.pthread_sigmask() function to fetch
and/or change the signal mask of the calling thread.

Fix also tests of test_io using threads and an alarm: use pthread_sigmask() to
ensure that the SIGALRM signal is received by the main thread.

Original patch written by Jean-Paul Calderone.
2011-04-30 15:21:58 +02:00
Victor Stinner d5c355ccc7 Issue #11223: Replace threading._info() by sys.thread_info 2011-04-30 14:53:09 +02:00
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
Victor Stinner f048075079 Issue #11393: limit stack overflow test to 100 MB
Stop if the stack overflow doesn't occur after allocating 100 MB on the stack.
2011-03-31 11:34:08 +02:00
Victor Stinner 702624ecf7 Issue #11393: Fix the documentation (cancel_dump_traceback_later)
* dump_traceback_later() => dump_tracebacks_later()
 * cancel_dump_traceback_later() => cancel_dump_tracebacks_later()
2011-03-31 03:42:34 +02:00
Victor Stinner 024e37adcc Issue #11393: Add the new faulthandler module 2011-03-31 01:31:06 +02:00
Kristjan Valur Jonsson 8c5b748026 Merge 2011-03-30 11:55:52 +00:00
Kristjan Valur Jonsson d05595697d Merge 3.1 2011-03-30 11:54:13 +00:00
Kristjan Valur Jonsson 3c136e19b9 Merge 2011-03-30 11:39:24 +00:00
Kristjan Valur Jonsson 978da33c7a Merge 3.2 2011-03-30 11:32:06 +00:00
Kristjan Valur Jonsson fa3edbed25 Merge 3.1 2011-03-30 11:24:58 +00:00
Kristjan Valur Jonsson 35722a9376 Bugfix: Properly test for errors from PyLong_AsLong() in itertools.cycle.
ti can raise an exception even if PyLong_Check() has
succeeded.
2011-03-30 11:04:28 +00:00