patch #617312, both on the trunk and the 22-maint branch.
Also added a test case, and ported the test_trace I wrote for HEAD
to 2.2.2 (with all those horrible extra 'line' events ;-).
A possibility to deadlock (on the hidden import lock) was created here
in 2.3, seemingly when tempfile.py started to call functions in
random.py. The cure is "the usual": don't spawn threads as a side
effect of importing, when the spawned threads themselves do imports
(directly or indirectly), and the code that spawned the threads is
waiting for the threads to finish (they can't finish, because they're
waiting for the import lock the spawner still holds). Worming around
this is why the "test_main" mechanism was introduced in regrest, so
it's a straightforward fix.
NOT a bugfix candidate; the problem was introduced in 2.3.
module used in the Zope TAL implementation. The bug was already fixed
in the Python standard library, but the regression test would be good
to keep around.
Because ob_size is a 32-bit int but sys.maxint is LONG_MAX which is a
64-bit value, there's no way to make this test succeed on a 64-bit
platform. So just skip it when sys.maxint isn't 0x7fffffff.
Backport candidate.
exception occurred so it should only be closed in the else clause.
Without this change we can an UnboundLocalError on Linux:
Traceback (most recent call last):
File "Lib/test/test_mmap.py", line 304, in ?
test_both()
File "Lib/test/test_mmap.py", line 208, in test_both
m.close()
UnboundLocalError: local variable 'm' referenced before assignment
with a size larger than the underlying file worked on Windows. It
does <wink>. However, merely creating an mmap that way has the side
effect of growing the file on disk to match the specified size. A
*later* test assumed that the file on disk was still exactly as it was
before the new "size too big" test was added, but that's no longer true.
So added a hack at the end of the "size too big" test to truncate the
disk file back to its original size on Windows.
Unicode strings (with arbitrary length) are allowed
as entries in the unicode.translate mapping.
Add a test case for multicharacter replacements.
(Multicharacter replacements were enabled by the
PEP 293 patch)
to fix it. (It fails when the day of the month is a 1-digit number,
because %c produces space+digit there, while strptime seems to expect
zero+digit somehow.)
of PyString_DecodeEscape(). This prevents a call to
_PyString_Resize() for the empty string, which would
result in a PyErr_BadInternalCall(), because the
empty string has more than one reference.
This closes SF bug http://www.python.org/sf/603937
Use a slightly different strategy to determine when not to call the line
trace function. This removes the need for the RETURN_NONE opcode, so
that's gone again. Update docs and comments to match.
Thanks to Neal and Armin!
Also add a test suite. This should have come with the original patch...
localtime, which in -0400 is 12 noon GMT. The bug boiled down to
broken conversion of 12 PM to hour 12 for the '%I %p' format string.
Added a test for this specific condition: Strptime12AMPMTests. Fix to
_strptime.py coming momentarily.
the tokenize module by test_tokenize.py. The FutureWarnings only
appeared during installation, and I've figured out a way to suppress
those in a different way.
sure these are the best fixes.
- Test maxint-1 against the negative octal constant -020000000000
- Comment out the tests for oct -1 and hex -1, since 037777777777 and
0xffffffff raise FutureWarnings now and in Python 2.4 those
constants will produce positive values, not negative values. So the
existing test seems to test something that won't be true in 2.4.
underlying dictionaries, there were no reasonable use cases (lexicographic
sorting of a list of sets is somewhat esoteric). Frees the operators
for other uses (such as strict subset and superset comparisons).
Updated documentation and test suite accordingly.
the inplace operators. The strategy is to have the operator overloading
code do the work and then to define equivalent method calls which rely on
the operators. The changes facilitate proper application of TypeError
and NonImplementedErrors.
Added corresponding tests to the test suite to make sure both the operator
and method call versions get exercised.
Add missing tests for difference_update().
wrong thing for a unicode subclass when there were zero string
replacements. The example given in the SF bug report was only one way
to trigger this; replacing a string of length >= 2 that's not found is
another. The code would actually write outside allocated memory if
replacement string was longer than the search string.
(I wonder how many more of these are lurking? The unicode code base
is full of wonders.)
Bugfix candidate; this same bug is present in 2.2.1.
base class (WrapperTestCase) instead, and call it repeatedly in the
methods that used to have a loop-over-subcases. Much simpler.
Rename perennial temp variable 't' to 'text'.
<peter@engcorp.com> based on a test script that's been kicking around my
home directory for a couple of months now and only saw the light of day
because I included it when I sent textwrap.py to python-dev for review.
Also, don't call gettempdir() in the default expression for the 'dir'
argument to various functions; use 'dir=None' for the default and
insert 'if dir is None: dir = gettemptir()' in the bodies. That way
the work done by gettempdir is postponed until needed.
[ 587993 ] SET_LINENO killer
Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab.
Many sundry changes to document and adapt to this change.
binary=True
to
text=False
by BDFL Pronouncement. All other changes follow from this. The change
to the docs is ready to go, but blocked by another JackMacLock in the
doc directory.
do bizarre things to get a temp file, I changed it to use mkstemp instead
of NamedTemporaryFile. This tried to leave the file open while passing
its name to execfile(). On Win2K (but not Win9X), though, a file created
with O_TEMPORARY cannot be opened again, so the test failed with a
permission error when execfile tried to open it. Closer to the truth:
a file created with O_TEMPORARY can be opened again, but only if the
file is also created with SHARE_DELETE access via the Win32 CreateFile()
function. There's no way to get at that from MS's version of libc, though
(we'd have to ditch the "std" C file functions in favor of Win32 API
calls).
Close the bug report again -- this time for Cygwin due to a newlib bug.
See the following for the details:
http://sources.redhat.com/ml/newlib/2002/msg00369.html
Note that this commit is only a documentation (i.e., comment) change.
test was written. So boosted the number of "digits" this generates, and
also beefed up the "* / divmod" test to tickle numbers big enough to
trigger the Karatsuba algorithm. It takes about 2 seconds now on my box.
rewrite, by Zack Weinberg). This replaces most code in tempfile.py
(please review!!!) and adds extensive unit tests for it.
This will cause some warnings in the test suite; I'll check those in
soon, and also the docs.
least on OS/2 (see note on SF patch 555085 by A I MacIntyre) but
looks like the test *could* fail on any other platform too -- there's
no guarantee that recv() reads all data.
prints function and module names, which is more informative now that
we repeat some tests in slightly modified subclasses.
Add a test for read() until EOF.
Add test suites for line-buffered (bufsize==1) and a small custom
buffer size (bufsize==2).
Restructure testUnbufferedRead() somewhat to avoid a potentially
infinite loop.
and this broke a Zope "pipelining" test which read multiple responses
from the same connection (this attaches a new file object to the
socket for each response). Added a test for this too.
(I want to do some code cleanup too, but I thought I'd first fix
the problem with as little code as possible, and add a unit test
for this case. So that's what this checkin is about.)
on Windows. The test_sequence() ERROR is easily repaired if we're
willing to add an os.unlink() line to mhlib's updateline(). The
test_listfolders FAIL I gave up on -- I don't remember enough about Unix
link esoterica to recall why a link count of 2 is something a well-
written program should be keenly interested in <wink>.