Commit Graph

4204 Commits

Author SHA1 Message Date
Jack Diederich 187e64806f backport of r51950
* regression bug, count_next was coercing a Py_ssize_t to an unsigned Py_size_t
  which breaks negative counts
* added test for negative numbers
2006-09-21 18:32:11 +00:00
Brett Cannon c70e003f75 Backport of fix to allow exception instances to be sliced once again. 2006-09-21 18:12:15 +00:00
Neal Norwitz 48829ba61d As mentioned on python-dev, reverting patch #1504333 because it introduced
an infinite loop in rev 47154.

This patch also adds a test to prevent the regression.

Will backport to 2.4 and head later.
2006-09-11 04:05:18 +00:00
Brett Cannon 19d76c5aa8 Remove __unicode__ method so that ``unicode(BaseException)`` succeeds.
Fixes bug #1551432.
2006-09-09 07:18:44 +00:00
Nick Coghlan 62f19e4281 Backport inspect.py fix from rev 51803 2006-09-08 10:01:23 +00:00
Hye-Shik Chang 137ae0cf7c Backport from trunk r51737:
Fixed a few bugs on cjkcodecs:
- gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT correctly.
- iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312
  codepoints to conform the standard.
- iso2022_jp_3 and iso2022_jp_2004 codec can encode JIS X 0213:2
  codepoints now.
2006-09-07 12:50:38 +00:00
Gustavo Niemeyer d83e7994f2 No, the problem was actually because buildbot uses a StringIO in
place of sys.stdout while running tests. Removing one more test
to make buildbot happy.
2006-09-06 23:15:24 +00:00
Gustavo Niemeyer d1b1b8c882 Fixed bug #1531862: Do not close standard file descriptors in subprocess.
Let's try that once more. Buildbots were broken last time, but probably
because tests were sending data to stderr for testing it (sending to a
file doesn't touch the problem).

The fix is still the same, but tests were reduced (removing tests to
be able to fix something is weird, but oh well).
2006-09-06 22:44:51 +00:00
Georg Brandl ecab623e13 Bug #1542051: Exceptions now correctly call PyObject_GC_UnTrack.
Also make sure that every exception class has __module__ set to
'exceptions'.
 (backport)
2006-09-06 06:47:02 +00:00
Neal Norwitz f3ce2ab2f1 Revert 51759 because it broke all the buildbots 2006-09-06 03:58:59 +00:00
Gustavo Niemeyer 63d675ce82 Backporting fix for bug #1531862, committed in 51758, into 2.5,
making subprocess not close standard file descriptors.
2006-09-06 02:05:35 +00:00
Neal Norwitz 3b3aae013b Bug #1520864 (again): unpacking singleton tuples in list comprehensions and
generator expressions (x for x, in ... ) works again.

Sigh, I only fixed for loops the first time, not list comps and genexprs too.
I couldn't find any more unpacking cases where there is a similar bug lurking.
2006-09-05 03:56:01 +00:00
Neal Norwitz 541a48b262 Patch #1540470, for OpenBSD 4.0. Backport candidate for 2.[34]. 2006-09-05 02:54:42 +00:00
Neal Norwitz 7ae5f29465 Backport fix for SF bug #1550714, itertools.tee raises SystemError 2006-09-05 02:30:10 +00:00
Neal Norwitz 29a5fdb7ca Fix str.rpartition(sep) when sep is not found in str.
Partially from SF patch #1551339, but also taken from head.
2006-09-05 02:21:38 +00:00
Neal Norwitz d3da7d394a Fix SF bug #1546288, crash in dict_equal 2006-09-05 01:54:06 +00:00
Nick Coghlan c48daf5bc4 Backport of decimal module context management updates from rev 51694 to 2.5 release branch 2006-09-03 01:08:30 +00:00
Neal Norwitz 19c35bba5d - Patch #1541585: fix buffer overrun when performing repr() on
a unicode string in a build with wide unicode (UCS-4) support.

I will forward port to 2.6.  Can someone backport to 2.4?
2006-08-21 22:13:11 +00:00
Neal Norwitz 7443b80549 Backport 51432:
Fix bug #1543303, tarfile adds padding that breaks gunzip.
Patch # 1543897.  (remove the padding)
2006-08-21 18:43:51 +00:00
Georg Brandl db232dc86a Patch #1542948: fix urllib2 header casing issue. With new test.
(backport from rev. 51416)
2006-08-20 13:15:43 +00:00
Martin v. Löwis 2c3a256351 Bug #1541863: uuid.uuid1 failed to generate unique identifiers
on systems with low clock resolution.
2006-08-18 03:40:13 +00:00
Neil Schemenauer 4c6b0d5bec Fix a bug in the ``compiler`` package that caused invalid code to be
generated for generator expressions.
2006-08-16 23:38:05 +00:00
Fredrik Lundh dc075b9ddd SF#1534630
ignore data that arrives before the opening start tag
2006-08-16 16:47:07 +00:00
Ka-Ping Yee b1cb56ad17 Update code and tests to support the 'bytes_le' attribute (for
little-endian byte order on Windows), and to work around clocks
with low resolution yielding duplicate UUIDs.

Anthony Baxter has approved this change.
2006-08-16 07:02:50 +00:00
Neal Norwitz 271a8689e9 Subclasses of int/long are allowed to define an __index__. 2006-08-15 06:29:03 +00:00
Neal Norwitz b476fdf7c3 Fix the test for SocketServer so it should pass on cygwin and not fail
sporadically on other platforms.  This is really a band-aid that doesn't
fix the underlying issue in SocketServer.  It's not clear if it's worth
it to fix SocketServer, however, I opened a bug to track it:

	http://python.org/sf/1540386
2006-08-15 04:58:28 +00:00
Tim Peters c02c1c8a12 Whitespace normalization. 2006-08-15 00:25:04 +00:00
Georg Brandl 85fec59104 Add an additional test: BZ2File write methods should raise IOError
when file is read-only.
2006-08-14 21:45:32 +00:00
Georg Brandl 3335a7ad63 Patch #1535500: fix segfault in BZ2File.writelines and make sure it
raises the correct exceptions.
2006-08-14 21:42:55 +00:00
Georg Brandl 2463f8f831 Make tabnanny recognize IndentationErrors raised by tokenize.
Add a test to test_inspect to make sure indented source
is recognized correctly. (fixes #1224621)
2006-08-14 21:34:08 +00:00
Marc-André Lemburg 040f76b79c Slightly revised version of patch #1538956:
Replace UnicodeDecodeErrors raised during == and !=
compares of Unicode and other objects with a new
UnicodeWarning.

All other comparisons continue to raise exceptions.
Exceptions other than UnicodeDecodeErrors are also left
untouched.
2006-08-14 10:55:19 +00:00
Neal Norwitz 56423e5762 Fix segfault when doing string formatting on subclasses of long if
__oct__, __hex__ don't return a string.

Klocwork 308
2006-08-13 18:11:08 +00:00
Neal Norwitz 1872b1c01f Fix a couple of bugs exposed by the new __index__ code. The 64-bit buildbots
were failing due to inappropriate clipping of numbers larger than 2**31
with new-style classes. (typeobject.c)  In reviewing the code for classic
classes, there were 2 problems.  Any negative value return could be returned.
Always return -1 if there was an error.  Also make the checks similar
with the new-style classes.  I believe this is correct for 32 and 64 bit
boxes, including Windows64.

Add a test of classic classes too.
2006-08-12 18:44:06 +00:00
Neal Norwitz 8a87f5d37e Patch #1538606, Patch to fix __index__() clipping.
I modified this patch some by fixing style, some error checking, and adding
XXX comments.  This patch requires review and some changes are to be expected.
I'm checking in now to get the greatest possible review and establish a
baseline for moving forward.  I don't want this to hold up release if possible.
2006-08-12 17:03:09 +00:00
Georg Brandl f3e304297e Repair logging test spew caused by rev. 51206. 2006-08-12 08:32:02 +00:00
Tim Peters 953c1897d2 Ah, fudge. One of the prints here actually "shouldn't be"
protected by "if verbose:", which caused the test to fail on
all non-Windows boxes.

Note that I deliberately didn't convert this to unittest yet,
because I expect it would be even harder to debug this on Tru64
after conversion.
2006-08-12 05:17:41 +00:00
Tim Peters 1742f3331f test_signal: Signal handling on the Tru64 buildbot
appears to be utterly insane.  Plug some theoretical
insecurities in the test script:

- Verify that the SIGALRM handler was actually installed.

- Don't call alarm() before the handler is installed.

- Move everything that can fail inside the try/finally,
  so the test cleans up after itself more often.

- Try sending all the expected signals in
  force_test_exit(), not just SIGALRM.  Since that was
  fixed to actually send SIGALRM (instead of invisibly
  dying with an AttributeError), we've seen that sending
  SIGALRM alone does not stop this from hanging.

- Move the "kill the child" business into the finally
  clause, so the child doesn't survive test failure
  to send SIGALRM to other tests later (there are also
  baffling SIGALRM-related failures in test_socket).

- Cancel the alarm in the finally clause -- if the
  test dies early, we again don't want SIGALRM showing
  up to confuse a later test.

Alas, this still relies on timing luck wrt the spawned
script that sends the test signals, but it's hard to see
how waiting for seconds can so often be so unlucky.

test_threadedsignals:  curiously, this test never fails
on Tru64, but doesn't normally signal SIGALRM.  Anyway,
fixed an obvious (but probably inconsequential) logic
error.
2006-08-12 04:42:47 +00:00
Neal Norwitz 421c1319ad Whoops, how did that get in there. :-) Revert all the parts of 51227 that were not supposed to go it. Only Modules/_ctypes/cfields.c was supposed to be changed 2006-08-12 02:12:30 +00:00
Neal Norwitz 6b4953fd3d Check returned pointer is valid.
Klocwork #233
2006-08-12 02:06:34 +00:00
Neal Norwitz 003c9e2952 Fix the failures on cygwin (2006-08-10 fixed the actual locking issue).
The first hunk changes the colon to an ! like other Windows variants.
We need to always wait on the child so the lock gets released and
no other tests fail.  This is the try/finally in the second hunk.
2006-08-11 06:09:41 +00:00
Tim Peters 8b8c59cf1d force_test_exit(): This has been completely ineffective
at stopping test_signal from hanging forever on the Tru64
buildbot.  That could be because there's no such thing as
signal.SIGALARM.  Changed to the idiotic (but standard)
signal.SIGALRM instead, and added some more debug output.
2006-08-11 03:49:10 +00:00
Tim Peters 08574770c5 test_PyThreadState_SetAsyncExc(): This is failing on some
64-bit boxes.  I have no idea what the ctypes docs mean
by "integers", and blind-guessing here that it intended to
mean the signed C "int" type, in which case perhaps I can
repair this by feeding the thread id argument to type
ctypes.c_long().

Also made the worker thread daemonic, so it doesn't hang
Python shutdown if the test continues to fail.
2006-08-11 00:49:01 +00:00
Tim Peters b7ad1eb2c6 Whitespace normalization broke test_cgi, because a line
of quoted test data relied on preserving a single trailing
blank.  Changed the string from raw to regular, and forced
in the trailing blank via an explicit \x20 escape.
2006-08-10 23:22:13 +00:00
Tim Peters 0d9ca9fa47 Whitespace normalization. 2006-08-10 22:48:45 +00:00
Tim Peters 4643c2fda1 Followup to bug #1069160.
PyThreadState_SetAsyncExc():  internal correctness changes wrt
refcount safety and deadlock avoidance.  Also added a basic test
case (relying on ctypes) and repaired the docs.
2006-08-10 22:45:34 +00:00
Guido van Rossum 9568b738ec Chris McDonough's patch to defend against certain DoS attacks on FieldStorage.
SF bug #1112549.
2006-08-10 17:41:07 +00:00
Tim Peters b2dd1a3906 test_copytree_simple(): This was leaving behind two new temp
directories each time it ran, at least on Windows.

Several changes:  explicitly closed all files; wrapped long
lines; stopped suppressing errors when removing a file or
directory fails (removing /shouldn't/ fail!); and changed
what appeared to be incorrect usage of os.removedirs() (that
doesn't remove empty directories at and /under/ the given
path, instead it must be given an empty leaf directory and
then deletes empty directories moving /up/ the path -- could
be that the conceptually simpler shutil.rmtree() was really
actually intended here).
2006-08-10 03:01:26 +00:00
Armin Rigo 97ff04789d Concatenation on a long string breaks (SF #1526585). 2006-08-09 15:37:26 +00:00
Armin Rigo 51fc8c456e Fix and test for an infinite C recursion. 2006-08-09 14:55:26 +00:00
Martin v. Löwis ab2f8f7bd5 __hash__ may now return long int; the final hash
value is obtained by invoking hash on the long int.
Fixes #1536021.
2006-08-09 07:57:39 +00:00