Guido van Rossum [Fri, 11 Oct 2002 20:37:58 +0000 (20:37 +0000)]
Backport 2.193:
PyObject_Init[Var] is almost always called from the PyObject_NEW[_VAR]
macros. The 'op' argument is then the result from PyObject_MALLOC,
and that can of course be NULL. In that case, PyObject_Init[Var]
would raise a SystemError with "NULL object passed to
PyObject_Init[Var]". But there's nothing the caller of the macro can
do about this. So PyObject_Init[Var] should call just PyErr_NoMemory.
Tim Peters [Fri, 11 Oct 2002 18:38:20 +0000 (18:38 +0000)]
SF bug 621507: python22.dll incorrect "File version".
The MS resource compiler can't do arithmetic. Fixed it by hand. Note
that the new PCbuild\field3.py was added to help with this, and injects
another manual step into the Python Windows release process.
Tim Peters [Fri, 11 Oct 2002 18:29:54 +0000 (18:29 +0000)]
Backporting a new file from 2.3 needed to worm around that MS's
resource compiler can't do correct arithmetic. The 3rd 16-bit int
in the "binary file version" we produce on Windows has been nonsense
as a result. I'll fix that next.
Guido van Rossum [Fri, 11 Oct 2002 00:47:20 +0000 (00:47 +0000)]
Backport stringobject.c 2.194 and unicodeobject.c 2.172:
Fix a nasty endcase reported by Armin Rigo in SF bug 618623:
'%2147483647d' % -123 segfaults. This was because an integer overflow
in a comparison caused the string resize to be skipped. After fixing
the overflow, this could call _PyString_Resize() with a negative size,
so I (1) test for that and raise MemoryError instead; (2) also added a
test for negative newsize to _PyString_Resize(), raising SystemError
as for all bad arguments.
An identical bug existed in unicodeobject.c, of course.
Guido van Rossum [Fri, 11 Oct 2002 00:22:22 +0000 (00:22 +0000)]
New in 2.2.2!
In inherit_slots(), get rid of the COPYSLOT(tp_dictoffset). Copying
the offset from a non-dominant base makes no sense: either the
non-dominant base has a nonzero tp_dictoffset, and then we should have
already copied it from the dominant base (at the very end of
inherit_special()), or the non-dominant base has no tp_dictoffset and
for some reason type_new() decided not to add one. The tp_dictoffset
from a non-dominant base is likely to conflict with the instance
layout of the dominant base, so copying the tp_dictoffset from the
non-dominant base would be a really bad idea in that case. This bug
can only be triggered by multiple inheritance from an extension class
that doesn't set tp_dictoffset and a new-style user-level class that
does have one. There are no such extension classes in the
distribution, but there are 3rd party ones. (Zope3 now has one,
that's how I found this. :-)
I've asked a few heavy users of new-style classes, extension classes
and metaclasses (David Abrahams and Kevin Jacobs), and neither of them
found any problems in their test suite after applying this fix, so I
assume it's safe.
Guido van Rossum [Fri, 11 Oct 2002 00:09:51 +0000 (00:09 +0000)]
Backport the relevant part of 2.192:
The string formatting code has a test to switch to Unicode when %s
sees a Unicode argument. Unfortunately this test was also executed
for %r, because %s and %r share almost all of their code. This meant
that, if u is a unicode object while repr(u) is an 8-bit string
containing ASCII characters, '%r' % u is a *unicode* string containing
only ASCII characters!
Barry Warsaw [Thu, 10 Oct 2002 00:59:16 +0000 (00:59 +0000)]
detect_modules(): Be more conservative about adding
runtime_library_dirs (i.e. -R flags) when building the _socket.so
module. Whitelist only the platforms we know need the flags, which
are only sunos (aka Solaris) platforms at the moment. Tested on
RH7.3, OSX 10.2, and Solaris 8.
Tim Peters [Tue, 8 Oct 2002 21:03:26 +0000 (21:03 +0000)]
The
list(xrange(sys.maxint / 4))
test. Changed 4 to 2.
The belief is that this test intended to trigger a bit of code in
listobject.c's NRESIZE macro that's looking for arithmetic overflow. As
written, it doesn't achieve that, though, and leaves it up to the platform
realloc() as to whether it wants to allocate 2 gigabytes. Some platforms
say "sure!", although they don't appear to mean it, and disaster ensues.
Changing 4 to 2 (just barely) manages to trigger the arithmetic overflow
test instead, leaving the platform realloc() out of it.
Fred Drake [Tue, 8 Oct 2002 19:49:36 +0000 (19:49 +0000)]
Fix some code that was added to the r22-maint branch to allow it to work with
arbitrary versions of Expat.
Not applicable to Python 2.3, which will incorporate an Expat that does not
need this crutch.
News for 2.2.2b1. I'm exhausted -- this was a multi-hour job of
poring over the logs. Quite likely I've forgotten some things,
introduced typos, and organized things less than ideally.
- Changed new-style class instantiation so that when C's __new__
method returns something that's not a C instance, its __init__ is
not called. [SF bug #537450]
XXX This is arguably a semantic change, but it's hard to imagine a
reason for wanting to depend on the old behavior. If problems with
this are reported within a week of the release of 2.2.2 beta 1, we may
revert this change.
Extend stripid() to handle strings ending in more than one '>'.
Add resolve() to handle looking up objects and names (fix SF bug 586931).
Add a nicer error message when given a filename that doesn't exist.
Barry Warsaw [Mon, 7 Oct 2002 17:05:28 +0000 (17:05 +0000)]
openfile(): Go back to opening the files in text mode. This undoes
the change in revision 1.11 (test_email.py) in response to SF bug
#609988. We now think that was the wrong fix and that WinZip was the
real culprit there.
This and the Parser.py patch will be forward ported into Python 2.3
and email 2.5.
Barry Warsaw [Mon, 7 Oct 2002 17:02:40 +0000 (17:02 +0000)]
_parsebody(): Use get_content_type() instead of the deprecated
get_type(). Also, one of the regular expressions is constant so might
as well make it a module global. And, when splitting up digests,
handle lineseps that are longer than 1 character in length
(e.g. \r\n).
Fred Drake [Mon, 7 Oct 2002 16:26:28 +0000 (16:26 +0000)]
Backport patches from trunk revisions 1.62, 1.63. Modified to be
easier to read for both HTML and typeset renderings. Relies on
../perl/python.perl revision 1.116.4.4.
Fred Drake [Mon, 7 Oct 2002 16:18:57 +0000 (16:18 +0000)]
Back-port part of 1.128 from the trunk:
\productioncont: Replace leading spaces with so that it's
possible to control the indentation of continuation lines.
In both spilldata() functions, pretend that the docstring for
non-callable objects is always None. This makes for less confusing
output and fixes the problem reported in SF patch #550290.
Backport 1.70 and 1.71 (which really go together):
1.70:
whichmodule() should skip dummy package entries in sys.modules.
This fixes the charming, but unhelpful error message for
>>> pickle.dumps(type.__new__)
Can't pickle <built-in method __new__ of type object at 0x812a440>: it's not the same object as datetime.math.__new__
1.71:
Fiddle comments and variable names in whichmodule().
A couple of fixes for the compiler package:
* always write the mtime to a .pyc in little endian format
* ensure class's docstrings get attached to the class, not the
enclosing scope!
Rather more fixes are needed for the trunk; these will be done in due
course.
Backport fdrake's
revision 1.88 of setup.py
revision 1.46 of Lib/distutils/sysconfig.py
When using a Python that has not been installed to build 3rd-party
modules, distutils does not understand that the build version of the
source tree is needed.
This patch fixes distutils.sysconfig to understand that the running
Python is part of the build tree and needs to use the appropriate
"shape" of the tree. This does not assume anything about the current
directory, so can be used to build 3rd-party modules using Python's
build tree as well.
This is useful since it allows us to use a non-installed debug-mode
Python with 3rd-party modules for testing. It as the side-effect that
set_python_build() is no longer needed (the hack which was added to
allow distutils to be used to build the "standard" extension modules).
Fix bug 439992 - [win32] KeyboardInterrupt Not Caught.
This gets us closer to consistent Ctrl+C behaviour on NT and Win9x.
NT now reliably generates KeyboardInterrupt exceptions for NT when a
file IO operation was aborted. Bugfix candidate
Aargh! The 2.3 version of this file requires "from test.test_support
import run_suite", but the 2.2.2 version requires "from test_support
import run_suite" ... :-(
SF #558432: Prevent Annoying ' ' from readline (Holker Krekel).
readline in all python versions is configured
to append a 'space' character for a successful
completion. But for almost all python expressions
'space' is not wanted (see coding conventions PEP 8).
For example if you have a function 'longfunction'
and you type 'longf<TAB>' you get 'longfunction '
as a completion. note the unwanted space at the
end.
The patch fixes this behaviour by setting readline's
append_character to '\0' which means don't append
anything. This doesn't work with readline < 2.1
(AFAIK nowadays readline2.2 is in good use).
An alternative approach would be to make the
append_character
accessable from python so that modules like
the rlcompleter.py can set it to '\0'.
[Ed.: I think expecting readline >= 2.2 is fine. If a completer wants
another character they can append that to the keyword in the list.]
Backport 1.12 and 1.13 and normalize whitespace (remove formfeeds):
SF #515021, print the refused list to the DEBUGSTREAM, so the parameter is used
Note: There is a TBD (aka FIXME) for how best to handle the refused addresses.
smtp_RCPT(): Removed a somewhat embarrassing debugging line, found by
Scot Stevenson. Could be a bug fix candidate, but probably doesn't
matter much unless a certain blue-nosed cat suddenly becomes corporeal
and starts emailing some stmp.py (sic) fronted mailer.
Patch #586999: Fix multiline string in sendmail example.
smptlib did not handle empty addresses.
The problem was that it expected rfc822.parseaddr() to return None
upon a parse failure. The actual, documented return value for a
parse failure is (None, None).
Closes SF bug 602029.
Call me anal, but there was a particular phrase that was speading to
comments everywhere that bugged me: /* Foo is inlined */ instead of
/* Inline Foo */. Somehow the "is inlined" phrase always confused me
for half a second (thinking, "No it isn't" until I added the missing
"here"). The new phrase is hopefully unambiguous.
Close SF bug 563740. complex() now finds __complex__() in new style classes.
Made conversion failure error messages consistent between types.
Added related unittests.