Mark Dickinson [Wed, 16 Sep 2009 22:10:56 +0000 (22:10 +0000)]
Issue #6713: Improve performance of str(n) and repr(n) for integers n
(up to 3.1 times faster in tests), by special-casing base 10 in
_PyLong_Format. (Backport of r74851 from py3k.)
Mark Dickinson [Wed, 16 Sep 2009 20:26:31 +0000 (20:26 +0000)]
Remove outdated include; this include was breaking OS X builds using
non-Apple gcc4.3 and gcc4.4 (because CoreFoundation/CoreFoundation.h
won't compile under non-Apple gcc).
Thomas Wouters [Wed, 16 Sep 2009 19:55:54 +0000 (19:55 +0000)]
Fix issue #1590864, multiple threads and fork() can cause deadlocks, by
acquiring the import lock around fork() calls. This prevents other threads
from having that lock while the fork happens, and is the recommended way of
dealing with such issues. There are two other locks we care about, the GIL
and the Thread Local Storage lock. The GIL is obviously held when calling
Python functions like os.fork(), and the TLS lock is explicitly reallocated
instead, while also deleting now-orphaned TLS data.
This only fixes calls to os.fork(), not extension modules or embedding
programs calling C's fork() directly. Solving that requires a new set of API
functions, and possibly a rewrite of the Python/thread_*.c mess. Add a
warning explaining the problem to the documentation in the mean time.
This also changes behaviour a little on AIX. Before, AIX (but only AIX) was
getting the import lock reallocated, seemingly to avoid this very same
problem. This is not the right approach, because the import lock is a
re-entrant one, and reallocating would do the wrong thing when forking while
holding the import lock.
Will backport to 2.6, minus the tiny AIX behaviour change.
Michael Foord [Sun, 13 Sep 2009 19:07:03 +0000 (19:07 +0000)]
Test discovery in unittest will only attempt to import modules that are importable; i.e. their names are valid Python identifiers. If an import fails during discovery this will be recorded as an error and test discovery will continue. Issue 6568.
Lars Gustäbel [Sat, 12 Sep 2009 10:28:15 +0000 (10:28 +0000)]
Issue #6856: Add a filter keyword argument to TarFile.add().
The filter argument must be a function that takes a TarInfo
object argument, changes it and returns it again. If the
function returns None the TarInfo object will be excluded
from the archive.
The exclude argument is deprecated from now on, because it
does something similar but is not as flexible.
Mark Dickinson [Mon, 7 Sep 2009 18:04:58 +0000 (18:04 +0000)]
#Issue 6795: Fix infinite recursion in long(Decimal('nan')); change int(Decimal('nan')) to raise ValueError instead of either returning NaN or raising InvalidContext.
test_platform fails on OS X Snow Leopard because the UNIX command to get the
canonical version, sw_vers, leaves off trailing zeros in the version number
(e.g. 10.6 instead of 10.6.0). Test now compensates by tacking on extra zeros
for the test comparison.
Sorry, sorry! Ignore my previous two commits. I mixed up the version
of python with which I tried running the crashers. They don't crash
the current HEAD.
#6750: TextIOWrapped could duplicate output when several threads write to it.
this affect text files opened with io.open(), and the print() function of py3k
Lars Gustäbel [Fri, 28 Aug 2009 19:23:44 +0000 (19:23 +0000)]
Issue #6054: Do not normalize stored pathnames.
No longer use tarfile.normpath() on pathnames. Store pathnames
unchanged, i.e. do not remove "./", "../" and "//" occurrences.
However, still convert absolute to relative paths.
Issue 6654
Allow the XML-RPC server to use the HTTP request path when dispatching. Added a MultiPathXMLRPCServer class that uses the feature, plus unit tests.
issue 6275
Add an "exc_value" attribute to the _AssertRaisesContext context manager in the unittest package. This allows further tests on the exception that was raised after the context manager exits.