Tim Peters [Thu, 29 May 2003 18:50:45 +0000 (18:50 +0000)]
Give the Windows socket wrapper function default values for its 'family'
and 'type' arguments. This improves x-platform compatibility (e.g., on
Unix systems socket() already supported these default arguments).
No need to do anything here for 2.3 -- it already fixed this glitch in a
different way.
Barry Warsaw [Thu, 29 May 2003 15:13:18 +0000 (15:13 +0000)]
Backport patch 2.206:
----------------------------
revision 2.206
date: 2003/02/11 16:25:43; author: gvanrossum; state: Exp; lines: +9 -0
Add basic arg sanity checking to wrap_descr_get(). This is called
when Python code calls a descriptor's __get__ method. It should
translate None to NULL in both argument positions, and insist that at
least one of the argument positions is not NULL after this
transformation.
----------------------------
which fixes SF bug # 736892, forcing function to act like an unbound
method dumps core.
Barry Warsaw [Wed, 28 May 2003 23:03:30 +0000 (23:03 +0000)]
The backport gets Fred's seal of approval:
SF 742860: WeakKeyDictionary __delitem__ uses iterkeys
Someone review this, please! Final releases are getting close, Fred
(the weakref guy) won't be around until Tuesday, and the pre-patch
code can indeed raise spurious RuntimeErrors in the presence of
threads or mutating comparison functions.
See the bug report for my confusions: I can't see any reason for why
__delitem__ iterated over the keys. The new one-liner implementation
is much faster, can't raise RuntimeError, and should be better-behaved
in all respects wrt threads.
New tests test_weak_keyed_bad_delitem and
test_weak_keyed_cascading_deletes fail before this patch.
Jeremy Hylton [Thu, 22 May 2003 18:11:20 +0000 (18:11 +0000)]
Backport fix for SF bug 692776.
Add a tp_new slot to function objects that handles the case of a
function requiring a closure. Put the function type in the new
module, rather than having a function new.function(). Add tests.
Barry Warsaw [Thu, 22 May 2003 17:36:54 +0000 (17:36 +0000)]
Link the dbm module against gdbm if it exists and if no earlier
library match was found. This fixes dbm on RedHat 9 and doesn't
appear (so far <wink>) to have any regressions on other *nixes.
Tim Peters [Wed, 21 May 2003 20:43:10 +0000 (20:43 +0000)]
PyType_Ready(): Complain if the type is a base type, and gc'able, and
tp_free is NULL or PyObject_Del at the end. Because it's a base type
it must call tp_free in its dealloc function, and because it's gc'able
it must not call PyObject_Del.
inherit_slots(): Don't inherit tp_free unless the type and its base
agree about whether they're gc'able. If the type is gc'able and the
base is not, and the base uses the default PyObject_Del for its
tp_free, give the type PyObject_GC_Del for its tp_free (the appropriate
default for a gc'able type).
cPickle.c: The Pickler and Unpickler types claim to be base classes
and gc'able, but their dealloc functions didn't call tp_free.
Repaired that. Also call PyType_Ready() on these typeobjects, so
that the correct (PyObject_GC_Del) default memory-freeing function
gets plugged into these types' tp_free slots.
Martin v. Löwis [Tue, 20 May 2003 06:16:55 +0000 (06:16 +0000)]
SF patch #497420 (Eduardo Pérez): ftplib: ftp anonymous password
Instead of sending the real user and host, use "anonymous@" (i.e. no
host name at all!) as the default anonymous FTP password. This avoids
privacy violations.
Tim Peters [Wed, 30 Apr 2003 19:24:59 +0000 (19:24 +0000)]
file_truncate(): Backported 2.3 code so that file.truncate(n) works on
Windows when n is too big to fit in a 32-bit int. This was a hole in
2.2's large file support on Windows, and turns out it's a bad hole at
least for ZODB.
SF bug #729096: getopt online documentation example improvement
A newbie found it difficult to translate the exampe into a
case that used only short options or long options but not both.
He tried to shorten the tuple search but forgot the trailing comma,
The appropriate pattern is an equality check.
Revised the example to point him in the right direction.
Barry Warsaw [Sun, 27 Apr 2003 04:00:01 +0000 (04:00 +0000)]
detect_modules(): On Redhat 9, building the ssl stuff eventually
includes krb5.h. Copy the krb5_h stanza from Python 2.3's setup.py
which seems to fix the problem.
Tim Peters [Wed, 23 Apr 2003 20:14:12 +0000 (20:14 +0000)]
fsync(): Implemented for Windows, via calling MS _commit. This counts
as "a bug" because there's no other way in core Python to ensure that
bytes written are actually on disk. At least ZODB wants this guarantee,
for robustness against crashes.
Backport:
Fix SF bug #697220, string.strip implementation/doc mismatch
Attempt to make all the various string/unicode *strip methods the same.
* Doc - add doc for when functions were added
* UserString
* string/unicode object methods
* string module functions
'chars' is used for the last parameter everywhere.
Backport:
PyErr_NormalizeException(): in the type==NULL test, we should simply
return. Setting an exception can mess with the exception state, and
continuing is definitely wrong (since type is dereferenced later on).
Some code that calls this seems to be prepared for a NULL exception
type, so let's be safe rather than sorry and simply assume there's
nothing to normalize in this case.
Backport from trunk:
property_traverse() should also traverse into prop_doc -- there's no
typecheck that guarantees it's a string, and BTW string subclasses
could hide references.
Tim Peters [Tue, 8 Apr 2003 19:13:14 +0000 (19:13 +0000)]
More backporting of gc-vs-__del__ fixes. It should be fixed for instances
of classic classes now. Alas, new-style classes are still a problem, and
didn't need to be fixed in 2.3 (they were already immune in 2.3 due to the
new-in-2.3 tp_del slot).
Tim Peters [Tue, 8 Apr 2003 19:02:34 +0000 (19:02 +0000)]
Added private API function _PyInstance_Lookup(). This is part of
backporting fixes so that garbage collection doesn't have to trigger
execution of arbitrary Python code just to figure out whether
an object has a __del__ method.
Barry Warsaw [Fri, 4 Apr 2003 02:46:38 +0000 (02:46 +0000)]
Backporting:
revision 1.27
date: 2003/03/30 20:46:47; author: bwarsaw; state: Exp; lines: +3 -3
__unicode__(): Fix the logic for calculating whether to add a
separating space or not between encoded chunks. Closes SF bug
#710498.