Commit Graph

11560 Commits

Author SHA1 Message Date
Georg Brandl 6dc39987c9 Bug #1586773: extend hashlib docstring.
(backport from rev. 52532)
2006-10-29 18:01:12 +00:00
Georg Brandl f96b162b68 I thought I had already fixed this error in the test. 2006-10-29 15:22:43 +00:00
Georg Brandl c68d2cc3f2 Bug #1586613: fix zlib and bz2 codecs' incremental en/decoders.
(backport from rev. 52529)
2006-10-29 14:39:13 +00:00
Georg Brandl b8205a1188 Fix the new EncodedFile test to work with big endian platforms.
(backport from rev. 52527)
2006-10-29 09:32:19 +00:00
Georg Brandl 2527f7fee0 Patch #1583880: fix tarfile's problems with long names and posix/
GNU modes.
 (backport from rev. 52524)
2006-10-29 09:16:15 +00:00
Georg Brandl 0d3de7612c Bug #1357915: allow all sequence types for shell arguments in
subprocess.
 (backport from rev. 52522)
2006-10-29 09:05:08 +00:00
Georg Brandl 2a5a3027f2 Fix codecs.EncodedFile which did not use file_encoding in 2.5.0, and
fix all codecs file wrappers to work correctly with the "with"
statement (bug #1586513).
 (backport from rev. 52517)
2006-10-29 08:39:27 +00:00
Neal Norwitz 2f0940b6ca Backport 52504:
Fix bug #1565514, SystemError not raised on too many nested blocks.
It seems like this should be a different error than SystemError, but
I don't have any great ideas and SystemError was raised in 2.4 and earlier.
2006-10-28 21:38:43 +00:00
Thomas Heller a0a50feea8 WindowsError.str should display the windows error code,
not the posix error code; with test.
Fixes #1576174.

Backported from trunk, revision 52485.
2006-10-27 18:47:29 +00:00
Andrew M. Kuchling ff9e7abac8 [Patch #1574068 by Scott Dial] urllib and urllib2 were using
base64.encodestring() for encoding authentication data.
encodestring() can include newlines for very long input, which
produced broken HTTP headers.

2.4 backport candidate, probably.
2006-10-27 17:13:33 +00:00
Andrew M. Kuchling 7d1d540cc3 [Bug #1575506] The _singlefileMailbox class was using the wrong file object in its flush() method, causing an error 2006-10-27 16:57:44 +00:00
Andrew M. Kuchling 3d6a834e29 [Bug #1576241] Let functools.wraps work with built-in functions 2006-10-27 16:42:19 +00:00
Martin v. Löwis 62e58040c1 [Backport of r52452]
Patch #1549049: Rewrite type conversion in structmember.
Fixes #1545696 and #1566140.

The new warnings have been omitted in the backport.
2006-10-27 06:17:21 +00:00
Georg Brandl ee23f4bba7 Patch [ 1583506 ] tarfile.py: 100-char filenames are truncated
(backport from rev. 52431)
2006-10-24 16:54:23 +00:00
Martin v. Löwis 920fa6a102 Remove passwd.adjunct.byname from list of maps
for test_nis.
2006-10-22 13:46:23 +00:00
Thomas Heller dcbf64d34d ctypes callback functions only support 'fundamental' result types.
Check this and raise an error when something else is used - before
this change ctypes would hang or crash when such a callback was
called.  This is a partial fix for #1574584.

Backported from trunk.
2006-10-17 19:41:10 +00:00
Georg Brandl 58bf57fa04 Fix tarfile depending on buggy int('1\0', base) behavior.
(backport from rev. 52313)
2006-10-12 12:03:11 +00:00
Georg Brandl dd4c398c27 Bug #1545497: when given an explicit base, int() did ignore NULs
embedded in the string to convert.
 (backport from rev. 52305)
2006-10-12 11:28:04 +00:00
Georg Brandl 3c48709e3a Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode
arguments with the system default encoding just like the write()
method does, instead of converting it to a raw buffer.
 (backport from rev. 52301)
2006-10-12 09:47:17 +00:00
Georg Brandl fcf6696255 Bug #1550524: better heuristics to find correct class definition
in inspect.findsource().
 (backport from rev. 52299)
2006-10-12 09:20:36 +00:00
Georg Brandl f0db92a676 Bug #813342: Start the IDLE subprocess with -Qnew if the parent
is started with that option.
 (backport from rev. 52295)
2006-10-12 07:57:24 +00:00
Martin v. Löwis 463a42b5de Bug #1565150: Fix subsecond processing for os.utime on Windows. 2006-10-09 20:44:50 +00:00
Andrew M. Kuchling 0037300f15 [Bug #1545341] Let the 'classifiers' parameter be a tuple as well as a list. 2006-10-09 17:13:26 +00:00
Ronald Oussoren 115930d981 Backport of r52236 2006-10-08 17:52:37 +00:00
Ronald Oussoren beb82a3772 Backport of r52233 2006-10-08 17:50:26 +00:00
Hye-Shik Chang f4fe46d74b Backport from trunk r52223:
Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault
when encoding non-BMP unicode characters.  (Submitted by Ray Chason)
2006-10-08 14:01:45 +00:00
Georg Brandl a5fe3ef8d8 Fix #1569998: no break inside try statement (outside loop) allowed.
(backport from rev. 52129)
2006-10-08 07:12:23 +00:00
Georg Brandl 74284b9606 Patch #1542451: fix crash with continue in nested try/finally
(backport from rev. 51439)
2006-10-08 07:06:29 +00:00
Armin Rigo 4b63c21d6f Forward-port of r52136: a review of overflow-detecting code.
* unified the way intobject, longobject and mystrtoul handle
  values around -sys.maxint-1.

* in general, trying to entierely avoid overflows in any computation
  involving signed ints or longs is extremely involved.  Fixed a few
  simple cases where a compiler might be too clever (but that's all
  guesswork).

* more overflow checks against bad data in marshal.c.

* 2.5 specific: fixed a number of places that were still confusing int
  and Py_ssize_t.  Some of them could potentially have caused
  "real-world" breakage.

* list.pop(x): fixing overflow issues on x was messy.  I just reverted
  to PyArg_ParseTuple("n"), which does the right thing.  (An obscure
  test was trying to give a Decimal to list.pop()... doesn't make
  sense any more IMHO)

* trying to write a few tests...
2006-10-04 11:44:06 +00:00
Martin v. Löwis 10525ad313 Fix integer negation and absolute value to not rely
on undefined behaviour of the C compiler anymore.
2006-10-04 05:47:47 +00:00
Barry Warsaw a027bac30a decode_rfc2231(): As Christian Robottom Reis points out, it makes no sense to
test for parts > 3 when we use .split(..., 2).
2006-10-04 01:28:43 +00:00
Georg Brandl 1206a933cc Bug #1446043: correctly raise a LookupError if an encoding name given
to encodings.search_function() contains a dot.
 (backport from rev. 52075)
2006-09-30 11:22:35 +00:00
Georg Brandl 6d7c36332f Bug #1556784: allow format strings longer than 127 characters in
datetime's strftime function.
 (backport from rev. 52072)
2006-09-30 11:17:43 +00:00
Georg Brandl 7037745be7 Bug #1560617: in pyclbr, return full module name not only for classes,
but also for functions.
 (backport from rev. 52069)
2006-09-30 11:06:55 +00:00
Georg Brandl 9c9a9ab634 Bug #1566602: correct failure of posixpath unittest when $HOME ends
with a slash.
 (backport from rev. 52065)
2006-09-30 09:13:29 +00:00
Georg Brandl 506cc189a9 Bug #1566800: make sure that EnvironmentError can be called with any
number of arguments, as was the case in Python 2.4.
 (backport from rev. 52061)
2006-09-30 09:03:45 +00:00
Georg Brandl af4337a017 Patch #1567691: super() and new.instancemethod() now don't accept
keyword arguments any more (previously they accepted them, but didn't
use them).
 (backport from rev. 52058)
2006-09-30 08:43:50 +00:00
Georg Brandl bbcb2814f2 Bug #1565661: in webbrowser, split() the command for the default
GNOME browser in case it is a command with args.
 (backport from rev. 52056)
2006-09-30 07:32:00 +00:00
Georg Brandl c57221e158 Backport rev. 51972:
Bug #1557232: fix seg fault with def f((((x)))) and def f(((x),)).

These tests should be improved.  Hopefully this fixes variations when
flipping back and forth between fpdef and fplist.
2006-09-25 07:04:10 +00:00
Georg Brandl edd81b2402 Fix a bug in traceback.format_exception_only() that led to an error
being raised when print_exc() was called without an exception set.
In version 2.4, this printed "None", restored that behavior.
 (backport from rev. 51995)
2006-09-24 12:50:28 +00:00
Georg Brandl a6b9ce185e Fix a bug in the parser's future statement handling that led to "with"
not being recognized as a keyword after, e.g., this statement:
from __future__ import division, with_statement
 (backport from rev. 51993)
2006-09-24 12:35:40 +00:00
Georg Brandl 1f21578965 Fix webbrowser.BackgroundBrowser on Windows.
(backport from rev. 51991)
2006-09-24 10:36:08 +00:00
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
Anthony Baxter 2d8697f32c Preparing for 2.5 final.
(damn, it's nice to see the line
  #define PY_VERSION              "2.5"
in patchlevel.h)
2006-09-18 06:51:50 +00:00
Anthony Baxter 2d4183c5f6 preparing for 2.5c2 2006-09-11 15:30:13 +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
Neal Norwitz 5728c27c74 Backport rev 51820 from Thomas Heller
The cast function did not accept c_char_p or c_wchar_p instances
as first argument, and failed with a 'bad argument to internal function'
error message.
2006-09-11 04:02:43 +00:00
Neal Norwitz 71e2aa0cc5 Backport rev 51819 from Thomas Heller
Anonymous structure fields that have a bit-width specified did not work,
and they gave a strange error message from PyArg_ParseTuple:
   function takes exactly 2 arguments (3 given).
2006-09-11 04:01:57 +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 4dc095249e Fix missing import of the types module in logging.config.
(backport from rev. 51785)
2006-09-06 20:06:27 +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 8dc71f2161 This was found by Guido AFAIK on p3yk (sic) branch. 2006-09-05 02:00:21 +00:00
Neal Norwitz d3da7d394a Fix SF bug #1546288, crash in dict_equal 2006-09-05 01:54:06 +00:00
Neal Norwitz 8bd1c0d8ce Backport docos 2006-09-03 20:01:05 +00:00
Neal Norwitz 665a3ae0af Backport doco 2006-09-03 20:00:39 +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
Kurt B. Kaiser 7ae354846f File menu hotkeys: there were three 'p' assignments. Reassign the
'Save Copy As' and 'Print' hotkeys to 'y' and 't'.  Change the
Shell menu hotkey from 's' to 'l'.

M    Bindings.py
M    PyShell.py
M    NEWS.txt
2006-08-16 21:45:59 +00:00
Fredrik Lundh dc075b9ddd SF#1534630
ignore data that arrives before the opening start tag
2006-08-16 16:47:07 +00:00
Thomas Heller b4a0cf17c4 Remove the special casing of Py_None when converting the return value
of the Python part of a callback function to C.  If it cannot be
converted, call PyErr_WriteUnraisable with the exception we got.
Before, arbitrary data has been passed to the calling C code in this
case.

(I'm not really sure the NEWS entry is understandable, but I cannot
find better words)
2006-08-16 15:10:12 +00:00
Thomas Heller b0aa98fd4f The __repr__ method of a NULL py_object does no longer raise an
exception.  Remove a stray '?' character from the exception text
when the value is retrieved of such an object.

Includes tests.
2006-08-16 14:07:44 +00:00
Marc-André Lemburg 604c864f0f Revert to having static version numbers again. 2006-08-16 08:13:26 +00:00
Kurt B. Kaiser f137e1df2c Get quit() and exit() to work cleanly when not using subprocess. 2006-08-16 07:04:17 +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
Kurt B. Kaiser d112bc7958 Patch #1540892: site.py Quitter() class attempts to close sys.stdin
before raising SystemExit, allowing IDLE to honor quit() and exit().

M    Lib/site.py
M    Lib/idlelib/PyShell.py
M    Lib/idlelib/CREDITS.txt
M    Lib/idlelib/NEWS.txt
M    Misc/NEWS
2006-08-16 05:01:42 +00:00
Anthony Baxter b409666e8c preparing for 2.5c1 2006-08-16 03:42:26 +00:00
Kurt B. Kaiser 2a7ff297c5 The 'with' statement is now a Code Context block opener 2006-08-16 03:15:26 +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 6e482569c8 Update the docstring to use a version a little newer than 1999. This was
taken from a Debian patch.  Should we update the version for each release?
2006-08-15 04:59:30 +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 d76bd69712 Cookie.py shouldn't "bogusly" use string._idmap. 2006-08-14 22:01:24 +00:00
Georg Brandl 7a1af770b9 Patch #1536071: trace.py should now find the full module name of a
file correctly even on Windows.
2006-08-14 21:55:28 +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
Thomas Heller 867200483b Apply the patch #1532975 plus ideas from the patch #1533481.
ctypes instances no longer have the internal and undocumented
'_as_parameter_' attribute which was used to adapt them to foreign
function calls; this mechanism is replaced by a function pointer in
the type's stgdict.

In the 'from_param' class methods, try the _as_parameter_ attribute if
other conversions are not possible.

This makes the documented _as_parameter_ mechanism work as intended.

Change the ctypes version number to 1.0.1.
2006-08-14 11:17:48 +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