Victor Stinner [Fri, 1 Jul 2011 13:24:50 +0000 (15:24 +0200)]
Issue #12363: improve siginterrupt() tests
Backport commits 968b9ff9a059 and aff0a7b0cb12 from the default branch to 3.2
branch. Extract of the changelog messages:
"The previous tests used time.sleep() to synchronize two processes. If the host
was too slow, the test could fail.
The new tests only use one process, but they use a subprocess to:
- have only one thread
- have a timeout on the blocking read (select cannot be used in the test,
select always fail with EINTR, the kernel doesn't restart it)
- not touch signal handling of the parent process"
and
"Add a basic synchronization code between the child and the parent processes:
the child writes "ready" to stdout."
I replaced .communicate(timeout=3.0) by an explicit waiting loop using
Popen.poll().
Victor Stinner [Thu, 30 Jun 2011 16:10:14 +0000 (18:10 +0200)]
Issue #12451: The XInclude default loader of xml.etree now decodes files from
UTF-8 instead of the locale encoding if the encoding is not specified. It now
also opens XML files for the parser in binary mode instead of the text mode to
avoid encoding issues.
Victor Stinner [Thu, 30 Jun 2011 15:35:55 +0000 (17:35 +0200)]
Issue #12451: doctest.debug_script() doesn't create a temporary file anymore to
avoid encoding issues (it used the locale encoding, whereas UTF-8 should be).
Victor Stinner [Wed, 29 Jun 2011 11:00:54 +0000 (13:00 +0200)]
Issue #12400: regrtest -W doesn't rerun the tests twice anymore, but captures
the output and displays it on failure instead. regrtest -v doesn't print the
error twice anymore if there is only one error.
Ned Deily [Wed, 29 Jun 2011 02:44:24 +0000 (19:44 -0700)]
Issue #9516: Change distutils to no longer globally attempt to check and
set the MACOSX_DEPLOYMENT_TARGET env variable for the interpreter process
on OS X. This could cause failures in non-distutils subprocesses and was
unreliable since tests or user programs could modify the interpreter
environment after distutils set it. Instead, have distutils set the
the deployment target only in the environment of each build subprocess.
Continue to use the previous algorithm for deriving the deployment target
value:
if MACOSX_DEPLOYMENT_TARGET is not set in the interpreter's env:
use the interpreter build configure MACOSX_DEPLOYMENT_TARGET
elif the MACOSX_DEPLOYMENT_TARGET env value >= configure value:
use the env MACOSX_DEPLOYMENT_TARGET
else: # env value less than interpreter build configure value
raise exception
This allows building extensions that can only run on newer versions of
the OS than the version python was built for, for example with a python
built for 10.3 or later and an extension that needs to be built for 10.5.
Ned Deily [Tue, 28 Jun 2011 07:42:50 +0000 (00:42 -0700)]
Issue #12141: Install a copy of template C module file so that
test_build_ext of test_distutils is no longer silently skipped when
run outside of a build directory.
Ned Deily [Tue, 28 Jun 2011 07:00:28 +0000 (00:00 -0700)]
Issue #8746: Correct faulty configure checks so that os.chflags() and
os.lchflags() are once again built on systems that support these
functions (*BSD and OS X). Also add new stat file flags for OS X
(UF_HIDDEN and UF_COMPRESSED). Also add additional tests for
os.chflags() and os.lchflags(). (Tests by Garrett Cooper)
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).