Commit Graph

2029 Commits

Author SHA1 Message Date
Raymond Hettinger 5b44cbe6d8 Fix zero-length corner case for iterating over a mutating deque. 2007-01-08 18:05:53 +00:00
Neal Norwitz 7770f9f6d2 Backport:
Prevent crash on shutdown which can occur if we are finalizing
and the module dict has been cleared already and some object
raises a warning (like in a __del__).
2007-01-05 05:28:50 +00:00
Gregory P. Smith 1a050f5f52 support linking the _bsddb extension module against BerkeleyDB 4.5
[backport of r53252]
2007-01-05 02:09:06 +00:00
Martin v. Löwis bea1c70144 Bug #1566280: Explicitly invoke threading._shutdown from Py_Main,
to avoid relying on atexit.
2007-01-04 21:06:57 +00:00
Raymond Hettinger ca516d21ab Fix stability of heapq's nlargest() and nsmallest(). 2007-01-04 17:53:16 +00:00
Raymond Hettinger 9cdf70399f For sets with cyclical reprs, emit '...' instead of recursing. 2006-12-29 18:49:13 +00:00
Lars Gustäbel f9a2c63c79 Patch #1504073: Fix tarfile.open() for mode "r" with a fileobj argument.
Backport from rev. 53161.
2006-12-27 10:36:58 +00:00
Lars Gustäbel 12e087a1b1 Patch #1262036: Prevent TarFiles from being added to themselves under
certain conditions.

(backport from rev. 53155)

Moved message from my previous change to the right place in
Misc/NEWS.
2006-12-23 18:13:57 +00:00
Lars Gustäbel aedb92e59c Patch #1230446: tarfile.py: fix ExFileObject so that read() and tell()
work correctly together with readline().

(backport from rev. 53153)
2006-12-23 16:51:47 +00:00
Andrew M. Kuchling 60775f29de [Patch #827559 from Chris Gonnerman] Make SimpleHTTPServer redirect when a directory URL is missing the trailing slash; this lets relative links work. 2006-12-22 19:08:41 +00:00
Andrew M. Kuchling bbad84b41a [Bug #737202; fix from Titus Brown] Make CGIHTTPServer work for scripts in sub-directories 2006-12-22 13:28:43 +00:00
Raymond Hettinger 5425a67331 Bug #1590891: random.randrange don't return correct value for big number 2006-12-20 07:43:59 +00:00
Andrew M. Kuchling fcb7513fc9 Add NEWS item 2006-12-19 15:13:44 +00:00
Andrew M. Kuchling e6acc8718c Add forgotten NEWS item for previous commit 2006-12-18 20:27:30 +00:00
Matthias Klose f877b25008 - Fix the build of the library reference in info format. 2006-12-09 12:13:02 +00:00
Georg Brandl 2bcf0154d5 Patch #1608267: fix a race condition in os.makedirs() is the directory
to be created is already there.
 (backport from rev. 52972)
2006-12-09 09:10:18 +00:00
Raymond Hettinger 775ebe29a5 Backport fixes to set objects:
rev 52964 sf 1576657 KeyError unpacks tuple arguments
rev 52963 sf 1456209 obscure resizing vulnerability
rev 52962 redundant calls to PyObject_Hash()
2006-12-08 18:12:24 +00:00
Georg Brandl 25f58f6b5a Patch #1610437: fix a tarfile bug with long filename headers.
(backport from rev. 52938)
2006-12-06 22:21:23 +00:00
Matthias Klose fa713e18f6 - Fix build failure on kfreebsd and on the hurd. 2006-12-03 17:13:54 +00:00
Martin v. Löwis 95b744cea9 Patch #1544279: Improve thread-safety of the socket module by moving
the sock_addr_t storage out of the socket object.
2006-12-03 11:24:00 +00:00
Thomas Heller 84a90cade5 Fix #1563807: _ctypes built on AIX fails with ld ffi error.
The contents of ffi_darwin.c must be compiled unless __APPLE__ is
defined and __ppc__ is not.

Backport from trunk.
2006-11-28 20:43:11 +00:00
Martin v. Löwis 9147f7ed8b Disable _XOPEN_SOURCE on NetBSD 1.x. 2006-11-25 15:39:28 +00:00
Thomas Heller 558e56d599 Fix bug #1598620: A ctypes structure cannot contain itself.
Backport from trunk.
2006-11-24 19:00:39 +00:00
Martin v. Löwis 2396f4c3b1 Conditionalize definition of _CRT_SECURE_NO_DEPRECATE
and _CRT_NONSTDC_NO_DEPRECATE.
2006-11-21 18:21:34 +00:00
Neal Norwitz 5890a6a8a6 Backport of 52811:
Bug #1599782: Fix segfault on bsddb.db.DB().type().

The problem is that _DB_get_type() can't be called without the GIL
because it calls a bunch of PyErr_* APIs when an error occurs.
There were no other cases in this file that it was called without the GIL.
Removing the BEGIN/END THREAD around _DB_get_type() made everything work.
2006-11-21 05:29:34 +00:00
Martin v. Löwis 0e64202fd7 Patch #1472877: Fix Tix subwidget name resolution. 2006-11-18 18:42:22 +00:00
Martin v. Löwis e350c840b3 Patch #1594554: Always close a tkSimpleDialog on ok(), even
if an exception occurs.
2006-11-18 18:05:57 +00:00
Martin v. Löwis ce9212f018 Patch #1538878: Don't make tkSimpleDialog dialogs transient if
the parent window is withdrawn. This mirrors what dialog.tcl
does.
2006-11-18 18:00:34 +00:00
Andrew M. Kuchling 830358af09 Remove locking of individual message files in MH.pack().
[Backport of rev52776 from the trunk.]
2006-11-17 16:16:28 +00:00
Georg Brandl dd3bffb679 Bug #1588217: don't parse "= " as a soft line break in binascii's
a2b_qp() function, instead leave it in the string as quopri.decode()
does.
 (backport from rev. 52765)
2006-11-16 17:08:48 +00:00
Martin v. Löwis 962e4317bc Patch #1360200: Use unmangled_version RPM spec field to deal with
file name mangling.
2006-11-12 18:56:18 +00:00
Martin v. Löwis 867ef13436 Patch #1359217: Ignore 2xx response before 150 response. 2006-11-12 18:48:30 +00:00
Andrew M. Kuchling 7ea928c452 [Patch #1514543] mailbox (Maildir): avoid losing messages on name clash
Two changes:

Where possible, use link()/remove() to move files into a directory; this
makes it easier to avoid overwriting an existing file.

Use _create_carefully() to create files in tmp/, which uses O_EXCL.
2006-11-10 13:15:58 +00:00
Andrew M. Kuchling bb876b9c69 [Patch #1514544 by David Watson] use fsync() to ensure data is really on disk 2006-11-10 13:08:03 +00:00
Andrew M. Kuchling d52a0b8583 [Bug #1569790] mailbox.Maildir.get_folder() loses factory information
Both the Maildir and MH classes had this bug; the patch fixes both classes
and adds a test.
2006-11-09 13:33:53 +00:00
Martin v. Löwis 3f63454e22 Patch #838546: Make terminal become controlling in pty.fork(). 2006-11-09 11:06:30 +00:00
Martin v. Löwis a1e3422205 Correctly forward exception in instance_contains().
Fixes #1591996. Patch contributed by Neal Norwitz.
2006-11-08 06:46:49 +00:00
Neal Norwitz a3ce6aa8b7 Backport 52621:
Bug #1588287: fix invalid assertion for `1,2` in debug builds.
2006-11-04 19:32:54 +00:00
Martin v. Löwis 56602a14e6 Patch #1060577: Extract list of RPM files from spec file in
bdist_rpm
2006-11-04 18:14:22 +00:00
Georg Brandl 5e9f94ac7a Bug #1576657: when setting a KeyError for a tuple key, make sure that
the tuple isn't used as the "exception arguments tuple".
 (backport from rev. 52535)
2006-10-29 18:31:45 +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 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 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
Georg Brandl a35f8e0538 Patch #1552024: add decorator support to unparse.py demo script.
(backport from rev. 52488)
2006-10-27 20:39:47 +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
Andrew M. Kuchling 5f95870868 [Bug #1542016] Report PCALL_POP value. This makes the return value of sys.callstats() match its docstring.
Backport candidate.  Though it's an API change, this is a pretty obscure
portion of the API.
2006-10-27 13:29:41 +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
Martin v. Löwis 920fa6a102 Remove passwd.adjunct.byname from list of maps
for test_nis.
2006-10-22 13:46:23 +00:00
Martin v. Löwis 63a9b8b067 - Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that
ctypes isn't considered as requiring executable stacks.
2006-10-22 10:55:25 +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
Martin v. Löwis ca362b6937 Forward-port r52358:
- Bug #1578513: Cross compilation was broken by a change to configure.
Repair so that it's back to how it was in 2.4.3.
2006-10-17 18:59:06 +00:00
Martin v. Löwis 2c7aa634cb Bug #1567666: Emulate GetFileAttributesExA for Win95. 2006-10-15 09:44:02 +00:00
Martin v. Löwis 6abebb2836 Patch #1576954: Update VC6 build directory; remove redundant
files in VC7.1 pythoncore.vcproj.
2006-10-15 07:55:42 +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 8984370c06 Bug #1565919: document set types in the Language Reference.
(backport from rev. 52297)
2006-10-12 08:22:57 +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
Georg Brandl 7444eda3d6 Patch #1572724: fix typo ('=' instead of '==') in _msi.c.
(backport from rev. 52251)
2006-10-09 19:03:12 +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
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
Andrew M. Kuchling d79524a4cc [Backport to 2-5maint of r52147 | andrew.kuchling ; the buildbots seem OK
with this change.]

Cause a PyObject_Malloc() failure to trigger a MemoryError, and then
add 'if (PyErr_Occurred())' checks to various places so that NULL is
returned properly.
2006-10-05 17:26:33 +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
Martin v. Löwis da70fd1599 Fix test for uintptr_t. Fixes #1568842. 2006-10-02 14:56:15 +00:00
Georg Brandl 0988904df8 Bug #1546052: clarify that PyString_FromString(AndSize) copies the
string pointed to by its parameter.
 (backport from rev. 52078)
2006-09-30 12:03:02 +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 ad4e11e16d Bug #1566663: remove obsolete example from datetime docs.
(backport from rev. 52063)
2006-09-30 09:06:49 +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
Gregory P. Smith 6fed7937c6 fix: DB.stat flags and txn keyword arguments were backwards. 2006-09-30 06:05:07 +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 934c90de0d Backport rev. 51971:
Fix %zd string formatting on Mac OS X so it prints negative numbers.

In addition to testing positive numbers, verify negative numbers work in configure.
In order to avoid compiler warnings on OS X 10.4, also change the order of the check
for the format character to use (PY_FORMAT_SIZE_T) in the sprintf format
for Py_ssize_t.  This patch changes PY_FORMAT_SIZE_T from "" to "l" if it wasn't
defined at configure time.  Need to verify the buildbot results.
2006-09-25 06:58:00 +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 6cc16bec17 added itertools.count(-n) fix 2006-09-21 20:38:39 +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 72345f2a0b remove 2.5 final section from NEWS.txt until after rc2 (reduced confusion) 2006-09-11 15:32:50 +00:00
Anthony Baxter 2d4183c5f6 preparing for 2.5c2 2006-09-11 15:30:13 +00:00
Neal Norwitz 0bcafac29e Building with HP's cc on HP-UX turned up a couple of problems.
_PyGILState_NoteThreadState was declared as static inconsistently.
Make it static as it's not necessary outside of this module.

Some tests failed because errno was reset to 0. (I think the tests
that failed were at least: test_fcntl and test_mailbox).
Ensure that errno doesn't change after a call to Py_END_ALLOW_THREADS.
This only affected debug builds.

This needs to be ported to HEAD.  I'll try to remember to do that tomorrow.
(Anyone, feel free to port it.)
2006-09-11 08:51:17 +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 2e488fdebf Add NEWS entries for ctypes backports. 2006-09-11 04:03:07 +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 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
Marc-André Lemburg 8a230b50a1 Backport bug fix for SF bug report #1546372. 2006-09-06 20:38:50 +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