Guido van Rossum [Thu, 27 Dec 2001 16:27:28 +0000 (16:27 +0000)]
_reduce(): Avoid infinite recursion in the pickler when self.__class__
doesn't have the _HEAPTYPE flag set, e.g. for time.struct_time and
posix.stat_result.
This fixes the immediate symptoms of SF bug #496873 (cPickle /
time.struct_time loop), replacing the infinite loop with an exception.
Fred Drake [Wed, 26 Dec 2001 22:08:44 +0000 (22:08 +0000)]
Fix wrongly-named formal parameters in three places: begin_y was used twice
instead of begin_y and begin_x for derwin(), subpad(), and subwin().
Reported for derwin() by Eric Huss.
Added class annotations for the window methods so they would be properly
described in the index.
Fred Drake [Wed, 26 Dec 2001 20:06:40 +0000 (20:06 +0000)]
Added index entries similar to some recommended by Skip, and used the word
"interpolation" in the text, to make the string formatting material easier to
find.
This closes SF bug #487165.
Bugfix: this should be applied for Python 2.2.1.
Fred Drake [Wed, 26 Dec 2001 19:55:14 +0000 (19:55 +0000)]
Make this do the right thing with entries which start with the percent sign,
in response to Skip's comments in SF bug #487165.
Make use of string methods instead of string module functions in most places.
Add (and make the default) a way to collapse symbol entries into a single
"Symbols" section in the generated index. This is similar to what makeindex
does, but does not include entries beginning with an underscore.
Tim Peters [Tue, 25 Dec 2001 19:07:38 +0000 (19:07 +0000)]
SF bug #495548: troublesome #define in pyport.h
Removed the ancient "#define ANY void".
Bugfix candidate? Hard call. The bug report claims the existence of
this #define creates conflicts with other packages, which is easy to
believe. OTOH, some extension authors may still be relying on its
presence. I'm afraid you can't win on this one.
Tim Peters [Tue, 25 Dec 2001 18:49:11 +0000 (18:49 +0000)]
SF bug #496549 -Qnew and in-place division "/=".
eval_frame(): Under -Qnew, INPLACE_DIVIDE wasn't getting handed off to
INPLACE_TRUE_DIVIDE (like BINARY_DIVIDE was getting handed off to
BINARY_TRUE_DIVIDE).
Fred Drake [Sat, 22 Dec 2001 19:07:58 +0000 (19:07 +0000)]
Fix the erroneous availability annotation for s.makefile() from the last
checkin (my fault!).
Wrap some long lines and fix some markup inconsistencies.
Barry Warsaw [Fri, 21 Dec 2001 16:32:15 +0000 (16:32 +0000)]
PyOS_vsnprintf(): Change PyMem_Malloc() call to PyMem_MALLOC() macro,
(ditto for PyMem_Free() -> PyMem_FREE()) to fix and close SF bug
#495875 on systems that HAVE_SNPRINTF=0.
Anthony Baxter [Fri, 21 Dec 2001 05:13:37 +0000 (05:13 +0000)]
forward-patch from release21-maint branch:
Make dumbdbm merely "dumb", rather than "terminally broken". Without this
patch, it's almost impossible to use dumbdbm _without_ causing horrible
datalossage. With this patch, dumbdbm passes my own horrible torture test,
as well as the roundup test suite.
dumbdbm really could do with a smidgin of a rewrite or two, but that's not
suitable for the release21-maint branch.
Fred Drake [Thu, 20 Dec 2001 17:13:09 +0000 (17:13 +0000)]
Re-commit Ping's patch to the cgi and cgitb documentation, using the
right version this time. Thanks, Ping!
(This was from SF patch #494582, "\index -> \indexii" version.)
Barry Warsaw [Thu, 20 Dec 2001 16:37:27 +0000 (16:37 +0000)]
test_parseaddr_empty(): New test for assuring that
Utils.parseaddr('<>') -- i.e. on an empty address, returns the empty
string. Built on rfc822, this used to return None.
Guido van Rossum [Thu, 20 Dec 2001 15:54:48 +0000 (15:54 +0000)]
SF patch #495358 (Artur Zaprzala): rfc822.AddressList and "<>" address
rfc822.AddressList incorrectly handles empty address.
"<>" is converted to None and should be "".
AddressList.__str__() fails on None.
I got an email with such an address and my program
failed processing it.
Example:
>>> import rfc822
>>> rfc822.AddressList("<>").addresslist
[('', None)]
>>> str(rfc822.AddressList("<>"))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.1/rfc822.py", line 753, in __str__
return ", ".join(map(dump_address_pair,
self.addresslist))
TypeError: sequence item 0: expected string, None found
[His solution: in the internal routine AddrlistClass.getrouteaddr(),
initialize adlist to "".]
Tim Peters [Wed, 19 Dec 2001 19:05:01 +0000 (19:05 +0000)]
SF bug #495021: Crash calling os.stat with a trailing backslash
Patch from Mark Hammond, plus code rearrangement and comments from me.
posix_do_stat(): Windows-specific code could try to free() stack
memory in some cases when a path ending with a forward or backward slash
was passed to os.stat().
Guido van Rossum [Wed, 19 Dec 2001 16:56:54 +0000 (16:56 +0000)]
save(): Fix for SF bug #494904: Cannot pickle a class with a
metaclass, reported by Dan Parisien.
Objects that are instances of custom metaclasses, i.e. whose ob_type
is a subclass of PyType_Type, should be pickled the same as new-style
classes (objects whose ob_type is PyType_Type). This can't be done
through the existing dispatch switches, and the __reduce__ trick
doesn't work for these, since it finds the unbound __reduce__ for
instances of the class (inherited from PyBaseObject_Type). So check
explicitly using PyType_IsSubtype().
Guido van Rossum [Wed, 19 Dec 2001 16:55:02 +0000 (16:55 +0000)]
Pickler.save(): Fix for SF bug #494904: Cannot pickle a class with a
metaclass, reported by Dan Parisien.
Objects that are instances of custom metaclasses, i.e. whose class is
a subclass of 'type', should be pickled the same as new-style classes
(objects whose class is 'type'). This can't be done through a
dispatch table entry, and the __reduce__ trick doesn't work for these,
since it finds the unbound __reduce__ for instances of the class
(inherited from 'object'). So check explicitly using issubclass().
Jack Jansen [Wed, 19 Dec 2001 09:24:40 +0000 (09:24 +0000)]
When running regen for the plat directories we should use the BUILDEXT
extension, not the EXT one, as regen uses the python binary in the build
directory. Fixes #493959.
Tim Peters [Wed, 19 Dec 2001 04:41:35 +0000 (04:41 +0000)]
SF bug #494738: binascii_b2a_base64 overwrites memory.
binascii_b2a_base64(): We didn't allocate enough buffer space for very
short inputs (e.g., a 1-byte input can produce a 5-byte output, but we
only allocated 2 bytes). I expect that malloc overheads absorbed the
overrun in practice, but computing a correct upper bound is a very simple
change.
Tim Peters [Wed, 19 Dec 2001 04:11:07 +0000 (04:11 +0000)]
SF bug #494668: PUSH() should assert-fail on overflow.
eval_frame(): Added asserts to the top of the eval loop, to verify
that the eval stack pointer is in bounds, plus some comments.
Tim Peters [Tue, 18 Dec 2001 22:32:40 +0000 (22:32 +0000)]
TemporaryFileWrapper: cache the value of os.unlink for use by __del__,
to prevent mysterious errors at shutdown due to "os.unlink" turning into
"None.unlink".
Guido van Rossum [Tue, 18 Dec 2001 22:22:25 +0000 (22:22 +0000)]
Move the helper class _closedsocket *into* the _socketobject class.
This way, when a socket object is deleted after the socket module has
already been zapped by module shutdown, we don't get annoying warnings
about exceptions in __del__ methods.
Thomas Heller [Tue, 18 Dec 2001 20:13:40 +0000 (20:13 +0000)]
Second part of fix for bug [#483982] Python 2.2b2 bdist_wininst
crashes.
If no external zip-utility is found, the archive is created by the
zipfile module, which behaves different now than in 2.1: if the
zip-file is created in the root directory if the distribution, it will
contain an (empty) version of itself.
This triggered the above bug - so it's better to create the zip-file
far away in the TMP directory.
Guido van Rossum [Mon, 17 Dec 2001 17:14:22 +0000 (17:14 +0000)]
- PyType_Ready(): Initialize the ob_type field to &PyType_Type if it's
NULL, so that you can call PyType_Ready() to initialize a type that
is to be separately compiled with C on Windows.
inherit_special(): Add a long comment explaining that you have to set
tp_new if your base class is PyBaseObject_Type.
Barry Warsaw [Mon, 17 Dec 2001 15:40:24 +0000 (15:40 +0000)]
Get rid of the stupid backslash in front of the column zero open
paren. This was there to worm around a stupid XEmacs bug, but since I
can't tickle the bug in newer XEmacsen (just tried w/21.4.5) it's
possible the problem has been fixed. We shouldn't have to be working
around editor bugs anyway.
If it crops up again, I'll report it (again) to the XEmacs crowd.
Steve Purcell [Mon, 17 Dec 2001 10:13:17 +0000 (10:13 +0000)]
Synch with pyunit CVS:
- Adds Fred's patch 487662: "Better error message for assertEqual"
- Removed small portion of code unused after Guido's patch
490119: "Don't treat ^C as error"
Tim Peters [Mon, 17 Dec 2001 01:27:01 +0000 (01:27 +0000)]
David Abrahams tried to compile this as a separate DLL under MSVC, and
got a barrage of compile errors that didn't make sense to the C++ brain:
MSVC does not allow C (but does allow C++) initializers to contain
data addresses supplied by other DLLs. So changed the initializers here
to use dummy nulls, and changed module init to plug in the foreign
addresses at runtime (manually simulating what C++ does by magic). Tested
on Windows, and Guido tested on Linux (thanks!). BTW, the *point* is that
people are going to use this module as a template for writing their own
subtypes, and it's unusual for extension authors to build their extensions
into Python directly (separate DLLs are the norm on Windows); so it's
better if we give them a template that works <wink>.
Tim Peters [Sun, 16 Dec 2001 19:11:44 +0000 (19:11 +0000)]
_PyEval_SliceIndex(): Repaired the comments, and added XXX comments
about its dubious treatment of NULL (also opened a bug report on that,
but don't want to risk changing it this late in the 2.2 game).
Tim Peters [Sat, 15 Dec 2001 22:12:47 +0000 (22:12 +0000)]
SF patch 493739 2 Bugfixes for 2.2c1 (RISC OS specific), from
Dietmar Schwertberger.
Bugfix candidate.
"""
RISCOS/Modules/getpath_riscos.c:
Include trailing '\0' when using strncpy [copy
strlen(...)+1 characters].
Lib/plat-riscos/riscospath.py:
Use riscosmodule.expand for os.path.abspath.
[fixes problems with site.py where
abspath("<Python$Dir>") returned
join(os.getcwd(), "<Python$Dir>") as e.g.
"SCSI::SCSI4.$.<Python$Dir>" because "<Python$Dir>"
wasn't recognised as an absolute path.]
"""
Jack Jansen [Sat, 15 Dec 2001 00:23:35 +0000 (00:23 +0000)]
Finally CW7 allows me to replace the continually-in-need-of-updating exports files with one 6-line anti-export-file. Yeah! (Thanks Alex, for reminding me:-)