Victor Stinner [Thu, 23 Jun 2011 09:57:56 +0000 (11:57 +0200)]
Issue #11223: skip test_lock_acquire_interruption() on FreeBSD6
Locks are implemented using a mutex and a condition variable of the pthread
library on FreeBSD6. POSIX condition variables cannot be interrupted by signals
(see pthread_cond_wait manual page).
Victor Stinner [Wed, 22 Jun 2011 19:28:43 +0000 (21:28 +0200)]
Issue #12383: fix test_empty_env() of subprocess on Mac OS X
Mac OS X adds __CF_USER_TEXT_ENCODING variable to an empty environment. Fix
also the test on the Py_ENABLE_SHARED config varible: test that the variable is
present, don't check it's value.
R David Murray [Sat, 18 Jun 2011 16:57:28 +0000 (12:57 -0400)]
#11584: make Header and make_header handle binary unknown-8bit input
Analogous to the decode_header fix, this fix makes Header.append and
make_header correctly handle the unknown-8bit charset introduced by email5.1,
when the input to them is binary strings. Previous to this fix the
make_header(decode_header(x)) == x invariant was broken in the face of the
unknown-8bit charset.
R David Murray [Fri, 17 Jun 2011 16:54:56 +0000 (12:54 -0400)]
#11767: use context manager to close file in __getitem__ to prevent FD leak
All of the other methods in mailbox that create message objects take care to
close the file descriptors they use, so it seems to make sense to have
__getitem__ do so as well.
Victor Stinner [Fri, 17 Jun 2011 12:01:18 +0000 (14:01 +0200)]
Issue #12133: fix a ResourceWarning in urllib.request
AbstractHTTPHandler.do_open() of urllib.request closes the HTTP connection if
its getresponse() method fails with a socket error. Patch written by Ezio
Melotti.
Victor Stinner [Fri, 17 Jun 2011 10:31:49 +0000 (12:31 +0200)]
Issue #12310: finalize the old process after _run_after_forkers()
multiprocessing: Process._bootstrap() keeps a reference to the old process to
delay its finalization until after _run_after_forkers() as been executed. This
change should fix a crash on Mac OS X Tiger when a lock is released after a
fork.
Patch written by Charles-François Nataliv and Antoine Pitrou.
Brian Curtin [Tue, 14 Jun 2011 14:52:50 +0000 (09:52 -0500)]
Correct completely broken os.stat behavior on Windows XP.
After 1a3e8db28d49, Windows XP could not os.stat at all due to raising
immediately when GetFinalPathNameByHandle wasn't available (pre-Vista).
The proper behavior in that situation is to just not attempt a traversal
rather than outright rejecting.
This change additionally handles a failed malloc by setting the error code
and returning false.
Brian Curtin [Mon, 13 Jun 2011 20:16:04 +0000 (15:16 -0500)]
Fix #12084. os.stat on Windows wasn't working properly with relative symlinks.
Use of DeviceIoControl to obtain the symlink path via the reparse tag was
removed. The code now uses GetFinalPathNameByHandle in the case of a
symbolic link and works properly given the added test which creates a symbolic
link and calls os.stat on it from multiple locations.
Victor Stinner also noticed an issue with os.lstat following the os.stat
code path when being passed bytes. The posix_lstat function was adjusted to
properly hook up win32_lstat instead of the previous STAT macro (win32_stat).
Victor Stinner [Fri, 10 Jun 2011 14:32:54 +0000 (16:32 +0200)]
Issue #10801: Fix test_unicode_filenames() of test_zipfile
Just try to open files from the ZIP for reading, don't extract them to avoid
UnicodeEncodeError if the filename is not encodable to the filesystem encoding
(e.g. ASCII locale encoding).
Rather than wrapping the C _isdir function in a Python function,
just import the C _isdir function directly. Additionally, add in the
docstring which was left out.
Brian Curtin [Wed, 8 Jun 2011 23:17:18 +0000 (18:17 -0500)]
Fix #11583. Changed os.path.isdir to use GetFileAttributes instead of os.stat.
By changing to the Windows GetFileAttributes API in nt._isdir we can figure
out if the path is a directory without opening the file via os.stat. This has
the minor benefit of speeding up os.path.isdir by at least 2x for regular
files and 10-15x improvements were seen on symbolic links (which opened the
file multiple times during os.stat). Since os.path.isdir is used in
several places on interpreter startup, we get a minor speedup in startup time.
Éric Araujo [Wed, 8 Jun 2011 03:29:39 +0000 (05:29 +0200)]
Fix a few misuses of :option: I missed in r86521.
Extract of the commit message:
Fix usage of :option: in the docs (#9312).
:option: is used to create a link to an option of python, not to mark
up any instance of any arbitrary command-line option. These were
changed to ````.
Éric Araujo [Sat, 4 Jun 2011 16:42:38 +0000 (18:42 +0200)]
Improve glossary entry for ABCs.
- Rename reST target name for collections ABCs to avoid collisions
- Add link to importlib ABCs (collections, numbers and io ABCs were already
linked)
- Link to glossary entry from numbers module doc (other modules already do it)
Victor Stinner [Fri, 3 Jun 2011 21:44:39 +0000 (23:44 +0200)]
Issue #12016: Add test_errorhandle() to TestBase_Mapping of
test_multibytecodec_support. Improve also error message of the
test_errorhandle() of TestBase.