Georg Brandl [Fri, 31 Mar 2006 20:00:15 +0000 (20:00 +0000)]
bug #1461855: make os.fdopen() add the O_APPEND flag if using "a" mode.
glibc, for example, does this already on its own, but it seems that
the solaris libc doesn't. This leads to Python code being able to over-
write file contents even though having specified "a" mode.
(backport from rev. 43501)
Hye-Shik Chang [Tue, 28 Mar 2006 08:27:27 +0000 (08:27 +0000)]
Ubuntu bug #29289: Fixed a bug that the gb18030 codec raises
RuntimeError on encoding surrogate pair area on UCS4 build.
This is a partial backport of r43320. (Approved by Anthony Baxter)
Tim Peters [Tue, 28 Mar 2006 07:09:33 +0000 (07:09 +0000)]
Merge rev 43181 from the trunk.
Try to repair at least one segfault on the Mac buildbot,
as diagnosed by Nick Coghlan.
test_capi.py: A test module should never spawn a thread as
a side effect of being imported. Because this one did, the
segfault one of its thread tests caused didn't occur until
a few tests after test_regrtest.py thought test_capi was
finished. Repair that. Also join() the thread spawned
at the end, so that test_capi is truly finished when
regrtest reports that it's done.
_testcapimodule.c test_thread_state(): this spawns a
couple of non-threading.py threads, passing them a PyObject*
argument, but did nothing to ensure that those threads
finished before returning. As a result, the PyObject*
_could_ (although this was unlikely) get decref'ed out of
existence before the threads got around to using it.
Added explicit synchronization (via a Python mutex) so
that test_thread_state can reliably wait for its spawned
threads to finish.
Neal Norwitz [Tue, 28 Mar 2006 06:05:21 +0000 (06:05 +0000)]
Fix the refleak from test_unicode.
Backport 42973 (lots of whitespace changes intermixed):
- Reindent a confusingly indented piece of code (no intended code changes
there)
- Add missing DECREFs of inner-scope 'temp' variable
- Add various missing DECREFs by changing 'return NULL' into 'goto onError'
- Avoid double DECREF when last _PyUnicode_Resize() fails
Coverity found one of the missing DECREFs, but oddly enough not the others.
Martin v. Löwis [Mon, 27 Mar 2006 21:38:32 +0000 (21:38 +0000)]
Backport of r41530 (neal.norwitz, 2005-11-24):
Move registration of the codec search function to the module scope
so it is only executed once. Otherwise the same search function is
repeated added to the codec search path when regrtest is run with -R
and leaks are reported.
Thomas Wouters [Mon, 27 Mar 2006 12:50:42 +0000 (12:50 +0000)]
Backport Ka-Ping Yee's trunk checkin r41400:
Fix SF bug #417833 (pydoc HTTP reload failure) by removing from
sys.modules all submodules of a the given module/package path
when trying to reload a module.
Neal Norwitz [Sun, 26 Mar 2006 04:10:42 +0000 (04:10 +0000)]
Backport:
Handle sys.getfilesystemencoding() returning None.
ascii seems like the safest bet, it should exist. I wonder if utf-8
would be a better choice? This should get test_fileinput passing on OpenBSD.
Tim Peters [Mon, 20 Mar 2006 06:06:07 +0000 (06:06 +0000)]
The new fetch_data_files.py downloads all the input data files
used by encoding tests. Fiddled the Windows buildbot helper
scripts to invoke this if needed. Note that this isn't needed
on the trunk (the encoding tests download input files automatically
in 2.5).
Tim Peters [Mon, 20 Mar 2006 02:12:05 +0000 (02:12 +0000)]
Merge revs 42842, 42844, and part of a whitespace normalization
patch from the trunk.
This stops test_socket_ssl from dying with:
TypeError: 'NoneType' object is not callable
in urlparsre.py's urljoin() when the tests are run in this order:
test_???
test_importhooks
test_socket_ssl
"test_???" can be various things, but must be there. For
example, test_urllibnet "works" to provoke the failure.
Alas, nobody actually understands _why_ test_socket_ssl fails
then, or why this hack makes the problem go away.
Amazingly, the tests just happened to run in the right order on
the 2.4 branch on two Windows buildbot slaves today, causing them
both to fail their most recent test runs before this patch.
Tim Peters [Sat, 18 Mar 2006 02:47:38 +0000 (02:47 +0000)]
Merge rev 43091 from the trunk.
"""
Try to find a host that responds slower from python.org so this test
does not fail on macteagle (G4 OSX.4 in buildbot)
"""
Since testConnectTimeout() frequently fails in the same way in 2.4
branch, and this patch seems to have fixed it on the trunk, it
should fix it on the 2.4 branch too.
Tim Peters [Thu, 16 Mar 2006 18:52:17 +0000 (18:52 +0000)]
Merge rev 43079 from the trunk. This should allow test_winsound to pass
on a box without a sound card.
Update test_winsound to check for a configured sound card (using a VBScript
helper written by Roger Upole and Mark Hammond) and adjust the expected
PlaySoundTest case results accordingly.
Neal Norwitz [Tue, 14 Mar 2006 06:10:22 +0000 (06:10 +0000)]
Backport 43022:
Fix and test (manually w/xx module) passing NULLs to PyObject_Str() and
PyObject_Unicode(). This problem was originally reported from Coverity
and addresses mail on python-dev "checkin r43015".
This inlines the conversion of the string to unicode and cleans
up/simplifies some code at the end of the PyObject_Unicode().
We really need a complete C API test module for all public APIs
and passing good and bad parameter values.
Tim Peters [Mon, 13 Mar 2006 05:53:04 +0000 (05:53 +0000)]
Merge rev 42963 from the trunk.
When the new -w option (yay! great idea) reruns a
failed test, first display the name of the test (else
it's not always clear from the output which test is
getting run).
Tim Peters [Mon, 13 Mar 2006 04:50:34 +0000 (04:50 +0000)]
Merge rev 41859 from the trunk.
test_main(): Restore the original root logger level after running
the tests. This stops the confusing/annoying:
No handlers could be found for logger "cookielib"
message we got whenever some test running after test_logging
happened to use cookielib.py (when not using regrtest's -r,
this happened during test_urllib2; when using -r, it varied).
Tim Peters [Mon, 13 Mar 2006 04:17:40 +0000 (04:17 +0000)]
Merge rev 42984 from trunk.
Adding the /useenv means that one's PATH actually gets through. This is
important for the _ssl.vproj build. It calls build_ssl.py which tries to
find a Perl to use. Without "/useenv" Visual Studio is getting a PATH
from somewhere else (presumably from its internal environment
configuration). The result is that build_ssl.py fallsback to its
"well-known" locations for a Perl install.
Tim Peters [Sun, 12 Mar 2006 07:05:34 +0000 (07:05 +0000)]
Add a do-nothing "clean" operation to the _ssl project,
so the buildbot's "clean" step doesn't fail due to
_ssl whining that it can't spawn an empty string.
Tim Peters [Sat, 11 Mar 2006 04:55:45 +0000 (04:55 +0000)]
Merge rev 42904 from the trunk.
_hotshot hotshot_profiler(): If write_header() returned
an error code, this let `self` leak. This is a disaster
on Windows, since `self` already points to a newly-opened
file object, and it was impossible for Python code to
close the thing since the only reference to it was in a
blob of leaked C memory.
test_hotshot test_bad_sys_path(): This new test provoked
the C bug above. This test passed, but left an open
"@test" file behind, which caused a massive cascade of
bogus test failures in later, unrelated tests on Windows.
Changed the test code to remove the @test file it leaves
behind, which relies on the change above to close that
file first.
Brett Cannon [Mon, 27 Feb 2006 23:15:56 +0000 (23:15 +0000)]
Return value off PyErr_Warn() for raising string exceptions was not being
checked. Problem when 'warnings' was set to "error" and thus would re-raise a
new exception.
PyThreadState_Delete(): if the auto-GIL-state machinery knows about
the thread state, forget it (since the thread state is being deleted,
continuing to remember it can't help, but can hurt if another thread
happens to get created with the same thread id).