[Python-Dev] [Very Long 23kb] List of Patches to Go in 2.0.1

Moshe Zadka moshez@zadka.site.co.il
Wed, 28 Mar 2001 19:02:01 +0200


After labouring over the list of log messages for 2-3 days, I finally
have a tentative list of changes. I present it as a list of checkin
messages, complete with the versions. Sometimes I concatenated several
consecutive checkins into one -- "I fixed the bug", "oops, typo last
fix" and similar.

Please go over the list and see if there's anything you feel should
not go.
I'll write a short script that will dump patches files later today,
so I can start applying soon -- so please looking at it and see
I have not made any terrible mistakes.
Thanks in advance

Wholesale: Lib/tempfile.py (modulu __all__)
           Lib/sre.py
           Lib/sre_compile.py
           Lib/sre_constants.py
           Lib/sre_parse.py
           Modules/_sre.c          
----------------------------
Lib/locale.py, 1.15->1.16
setlocale(): In _locale-missing compatibility function, string
comparison should be done with != instead of "is not".
----------------------------
Lib/xml/dom/pulldom.py, 1.20->1.21

When creating an attribute node using createAttribute() or
createAttributeNS(), use the parallel setAttributeNode() or
setAttributeNodeNS() to add the node to the document -- do not assume
that setAttributeNode() will operate properly for both.
----------------------------
Python/pythonrun.c, 2.128->2.129
Fix memory leak with SyntaxError.  (The DECREF was originally hidden
inside a piece of code that was deemed reduntant; the DECREF was
unfortunately *not* redundant!)
----------------------------
Lib/quopri.py, 1.10->1.11
Strip \r as trailing whitespace as part of soft line endings.

Inspired by SF patch #408597 (Walter Dörwald): quopri, soft line
breaks and CRLF.  (I changed (" ", "\t", "\r") into " \t\r".)
----------------------------
Modules/bsddbmodule.c, 1.28->1.29
Don't raise MemoryError in keys() when the database is empty.

This fixes SF bug #410146 (python 2.1b shelve is broken).
----------------------------
Lib/fnmatch.py, 1.10->1.11

Donovan Baarda <abo@users.sourceforge.net>:
Patch to make "\" in a character group work properly.

This closes SF bug #409651.
----------------------------
Objects/complexobject.c, 2.34->2.35
SF bug [ #409448 ] Complex division is braindead
http://sourceforge.net/tracker/?func=detail&aid=409448&group_id=5470&atid=105470
Now less braindead.  Also added test_complex.py, which doesn't test much, but
fails without this patch.
----------------------------
Modules/cPickle.c, 2.54->2.55
SF bug [ #233200 ] cPickle does not use Py_BEGIN_ALLOW_THREADS.
http://sourceforge.net/tracker/?func=detail&aid=233200&group_id=5470&atid=105470
Wrapped the fread/fwrite calls in thread BEGIN_ALLOW/END_ALLOW brackets
Afraid I hit the "delete trailing whitespace key" too!  Only two "real" sections
of code changed here.
----------------------------
Lib/xml/sax/xmlreader.py, 1.13->1.14

Import the exceptions that this module can raise.
----------------------------
Lib/xmllib.py, 1.27->1.28
Moved clearing of "literal" flag.  The flag is set in setliteral which
can be called from a start tag handler.  When the corresponding end
tag is read the flag is cleared.  However, it didn't get cleared when
the start tag was for an empty element of the type <tag .../>.  This
modification fixes the problem.
----------------------------
Modules/pwdmodule.c, 1.24->1.25
Modules/grpmodule.c, 1.14->1.15

Make sure we close the group and password databases when we are done with
them; this closes SF bug #407504.
----------------------------
Python/errors.c, 2.61->2.62
Objects/intobject.c, 2.55->2.56
Modules/timemodule.c, 2.107->2.108
Use Py_CHARMASK for ctype macros. Fixes bug #232787.
----------------------------
Modules/termios.c, 2.17->2.18

Add more protection around the VSWTC/VSWTCH, CRTSCTS, and XTABS symbols;
these can be missing on some (all?) Irix and Tru64 versions.

Protect the CRTSCTS value with a cast; this can be a larger value on
Solaris/SPARC.

This should fix SF tracker items #405092, #405350, and #405355.
----------------------------
Modules/pyexpat.c, 2.42->2.43

Wrap some long lines, use only C89 /* */ comments, and add spaces around
some operators (style guide conformance).
----------------------------
Modules/termios.c, 2.15->2.16

Revised version of Jason Tishler's patch to make this compile on Cygwin,
which does not define all the constants.

This closes SF tracker patch #404924.
----------------------------
Modules/bsddbmodule.c, 1.27->1.28

Gustavo Niemeyer <niemeyer@conectiva.com>:
Fixed recno support (keys are integers rather than strings).
Work around DB bug that cause stdin to be closed by rnopen() when the
DB file needed to exist but did not (no longer segfaults).

This closes SF tracker patch #403445.

Also wrapped some long lines and added whitespace around operators -- FLD.
----------------------------
Lib/urllib.py, 1.117->1.118
Fixing bug #227562 by calling  URLopener.http_error_default when
an invalid 401 request is being handled.
----------------------------
Python/compile.c, 2.170->2.171
Shuffle premature decref; nuke unreachable code block.
Fixes the "debug-build -O test_builtin.py and no test_b2.pyo" crash just
discussed on Python-Dev.
----------------------------
Python/import.c, 2.161->2.162
The code in PyImport_Import() tried to save itself a bit of work and
save the __builtin__ module in a static variable.  But this doesn't
work across Py_Finalise()/Py_Initialize()!  It also doesn't work when
using multiple interpreter states created with PyInterpreterState_New().

So I'm ripping out this small optimization.

This was probably broken since PyImport_Import() was introduced in
1997!  We really need a better test suite for multiple interpreter
states and repeatedly initializing.

This fixes the problems Barry reported in Demo/embed/loop.c.
----------------------------
Modules/unicodedata.c, 2.9->2.11


renamed internal functions to avoid name clashes under OpenVMS
(fixes bug #132815)
----------------------------
Modules/pyexpat.c, 2.40->2.41

Remove the old version of my_StartElementHandler().  This was conditionally
compiled only for some versions of Expat, but was no longer needed as the
new implementation works for all versions.  Keeping it created multiple
definitions for Expat 1.2, which caused compilation to fail.
----------------------------
Lib/urllib.py, 1.116->1.117
provide simple recovery/escape from apparent redirect recursion.  If the
number of entries into http_error_302 exceeds the value set for the maxtries
attribute (which defaults to 10), the recursion is exited by calling
the http_error_500 method (or if that is not defined, http_error_default).
----------------------------
Modules/posixmodule.c, 2.183->2.184

Add a few more missing prototypes to the SunOS 4.1.4 section (no SF
bugreport, just an IRC one by Marion Delgado.) These prototypes are
necessary because the functions are tossed around, not just called.
----------------------------
Modules/mpzmodule.c, 2.35->2.36

Richard Fish <rfish@users.sourceforge.net>:
Fix the .binary() method of mpz objects for 64-bit systems.

[Also removed a lot of trailing whitespace elsewhere in the file. --FLD]

This closes SF patch #103547.
----------------------------
Python/pythonrun.c, 2.121->2.122
Ugly fix for SF bug 131239 (-x flag busted).
Bug was introduced by tricks played to make .pyc files executable
via cmdline arg.  Then again, -x worked via a trick to begin with.
If anyone can think of a portable way to test -x, be my guest!
----------------------------
Makefile.pre.in, 1.15->1.16
Specify directory permissions properly.  Closes SF patch #103717.
----------------------------
install-sh, 2.3->2.4
Update install-sh using version from automake 1.4.  Closes patch #103657
and #103717.
----------------------------
Modules/socketmodule.c, 1.135->1.136
Patch #103636: Allow writing strings containing null bytes to an SSL socket
----------------------------
Modules/mpzmodule.c, 2.34->2.35
Patch #103523, to make mpz module compile with Cygwin
----------------------------
Objects/floatobject.c, 2.78->2.79
SF patch 103543 from tg@freebsd.org:
PyFPE_END_PROTECT() was called on undefined var
----------------------------
Modules/posixmodule.c, 2.181->2.182
Fix Bug #125891 - os.popen2,3 and 4 leaked file objects on Windows.
----------------------------
Python/ceval.c, 2.224->2.225
SF bug #130532:  newest CVS won't build on AIX.
Removed illegal redefinition of REPR macro; kept the one with the
argument name that isn't too easy to confuse with zero <wink>.
----------------------------
Objects/classobject.c, 2.35->2.36
Rename dubiously named local variable 'cmpfunc' -- this is also a
typedef, and at least one compiler choked on this.

(SF patch #103457, by bquinlan)
----------------------------
Modules/_cursesmodule.c, 2.47->2.50
Patch #103485 from Donn Cave: patches to make the module compile on AIX and
    NetBSD
Rename 'lines' variable to 'nlines' to avoid conflict with a macro defined
    in term.h
2001/01/28 18:10:23 akuchling Modules/_cursesmodule.c
Bug #130117: add a prototype required to compile cleanly on IRIX
   (contributed by Paul Jackson)
----------------------------
Lib/statcache.py, 1.9->1.10
SF bug #130306:  statcache.py full of thread problems.
Fixed the thread races.  Function forget_dir was also utterly Unix-specific.
----------------------------
Python/structmember.c, 1.74->1.75
SF bug http://sourceforge.net/bugs/?func=detailbug&bug_id=130242&group_id=5470
SF patch http://sourceforge.net/patch/?func=detailpatch&patch_id=103453&group_id=5470
PyMember_Set of T_CHAR always raises exception.
Unfortunately, this is a use of a C API function that Python itself never makes, so
there's no .py test I can check in to verify this stays fixed.  But the fault in the
code is obvious, and Dave Cole's patch just as obviously fixes it.
----------------------------
Modules/arraymodule.c, 2.61->2.62
Correct one-line typo, reported by yole @ SF, bug 130077.
----------------------------
Python/compile.c, 2.150->2.151
Fix bug reported by Ka-Ping Yee: The compiler botched parsing function
parameters that contained both anonymous tuples and *arg or **arg. Ex:
def f(a, (b, c), *d): pass

Fix the symtable_params() to generate names in the right order for
co_varnames slot of code object.  Consider *arg and **arg before the
"complex" names introduced by anonymous tuples.
----------------------------
Modules/config.c.in, 1.72->1.73
_PyImport_Inittab: define the exceptions module's init function.
Fixes bug #121706.
----------------------------
Python/exceptions.c, 1.19->1.20
[Ed. -- only partial]
Leak pluggin', bug fixin' and better documentin'.  Specifically,

module__doc__: Document the Warning subclass heirarchy.

make_class(): Added a "goto finally" so that if populate_methods()
fails, the return status will be -1 (failure) instead of 0 (success).

fini_exceptions(): When decref'ing the static pointers to the
exception classes, clear out their dictionaries too.  This breaks a
cycle from class->dict->method->class and allows the classes with
unbound methods to be reclaimed.  This plugs a large memory leak in a
common Py_Initialize()/dosomething/Py_Finalize() loop.
----------------------------
Python/pythonrun.c, 2.118->2.119
Lib/atexit.py, 1.3->1.4
Bug #128475: mimetools.encode (sometimes) fails when called from a thread.
pythonrun.c:  In Py_Finalize, don't reset the initialized flag until after
the exit funcs have run.
atexit.py:  in _run_exitfuncs, mutate the list of pending calls in a
threadsafe way.  This wasn't a contributor to bug 128475, it just burned
my eyeballs when looking at that bug.
----------------------------
Modules/ucnhash.c, 1.6->1.7
gethash/cmpname both looked beyond the end of the character name.
This patch makes u"\N{x}" a bit less dependent on pure luck...
----------------------------
Lib/urllib.py, 1.112->1.113
Anonymous SF bug 129288: "The python 2.0 urllib has %%%x as a format
when quoting forbidden characters. There are scripts out there that
break with lower case, therefore I guess %%%X should be used."

I agree, so am fixing this.
----------------------------
Python/bltinmodule.c, 2.191->2.192
Fix for the bug in complex() just reported by Ping.
----------------------------
Modules/socketmodule.c, 1.130->1.131
Use openssl/*.h to include the OpenSSL header files
----------------------------
Lib/distutils/command/install.py, 1.55->1.56
Modified version of a patch from Jeremy Kloth, to make .get_outputs()
produce a list of unique filenames:
    "While attempting to build an RPM using distutils on Python 2.0,
    rpm complained about duplicate files.  The following patch fixed
    that problem.
----------------------------
Objects/unicodeobject.c, 2.72->2.73
Objects/stringobject.c, 2.96->2.97
(partial)
Added checks to prevent PyUnicode_Count() from dumping core
in case the parameters are out of bounds and fixes error handling
for .count(), .startswith() and .endswith() for the case of
mixed string/Unicode objects.

This patch adds Python style index semantics to PyUnicode_Count()
indices (including the special handling of negative indices).

The patch is an extended version of patch #103249 submitted
by Michael Hudson (mwh) on SF. It also includes new test cases.
----------------------------
Modules/posixmodule.c, 2.180->2.181
Plug memory leak.
----------------------------
Python/dynload_mac.c, 2.9->2.11
Use #if TARGET_API_MAC_CARBON to determine carbon/classic macos, not #ifdef.
Added a separate extension (.carbon.slb) for Carbon dynamic modules.
----------------------------
Modules/mmapmodule.c, 2.26->2.27
SF bug 128713:  type(mmap_object) blew up on Linux.
----------------------------
Python/sysmodule.c, 2.81->2.82
stdout is sometimes a macro; use "outf" instead.

Submitted by: Mark Favas <m.favas@per.dem.csiro.au>
----------------------------
Python/ceval.c, 2.215->2.216
Add missing Py_DECREF in fast_cfunction.  Partial fix for SF bug
#127699.
----------------------------
Modules/mmapmodule.c, 2.24->2.25
Windows mmap should (as the docs probably <wink> say) create a mapping
without a name when the optional tagname arg isn't specified.  Was
actually creating a mapping with an empty string as the name.
----------------------------
Lib/shlex.py, 1.10->1.11
Patch #102953: Fix bug #125452, where shlex.shlex hangs when it
    encounters a string with an unmatched quote, by adding a check for
    EOF in the 'quotes' state.
----------------------------
Modules/binascii.c, 2.27->2.28
Address a bug in the uuencode decoder, reported bu "donut" in SF bug
#127718: '@' and '`' seem to be confused.
----------------------------
Objects/fileobject.c, 2.102->2.103
Tsk, tsk, tsk.  Treat FreeBSD the same as the other BSDs when defining
a fallback for TELL64.  Fixes SF Bug #128119.
----------------------------
Modules/posixmodule.c, 2.179->2.180
Anonymous SF bug report #128053 point out that the #ifdef for
including "tmpfile" in the posix_methods[] array is wrong -- should be
HAVE_TMPFILE, not HAVE_TMPNAM.
----------------------------
Lib/urllib.py, 1.109->1.110
Fixed bug which caused HTTPS not to work at all with string URLs
----------------------------
Objects/floatobject.c, 2.76->2.77
Fix a silly bug in float_pow.  Sorry Tim.
----------------------------
Modules/fpectlmodule.c, 2.12->2.13
Patch #103012: Update fpectlmodule for current glibc;
    The _setfpucw() function/macro doesn't seem to exist any more;
    instead there's an _FPU_SETCW macro.
----------------------------
Objects/dictobject.c, 2.71->2.72
dict_update has two boundary conditions: a.update(a) and a.update({})
Added test for second one.
----------------------------
Objects/listobject.c
fix leak
----------------------------
Lib/getopt.py, 1.11->1.13
getopt used to sort the long option names, in an attempt to simplify
the logic.  That resulted in a bug.  My previous getopt checkin repaired
the bug but left the sorting.  The solution is significantly simpler if
we don't bother sorting at all, so this checkin gets rid of the sort and
the code that relied on it.
Fix for SF bug
https://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470
"getopt long option handling broken".  Tossed the excruciating logic in
long_has_args in favor of something obviously correct.
----------------------------
Lib/curses/ascii.py, 1.3->1.4
Make isspace(chr(32)) return true
----------------------------
Lib/distutils/command/install.py, 1.54->1.55
Add forgotten initialization.  Fixes bug #120994, "Traceback with
    DISTUTILS_DEBUG set"
----------------------------
Objects/unicodeobject.c, 2.68->2.69
Fix off-by-one error in split_substring().  Fixes SF bug #122162.
----------------------------
Modules/cPickle.c, 2.53->2.54
Lib/pickle.py, 1.40->1.41
Minimal fix for the complaints about pickling Unicode objects.  (SF
bugs #126161 and 123634).

The solution doesn't use the unicode-escape encoding; that has other
problems (it seems not 100% reversible).  Rather, it transforms the
input Unicode object slightly before encoding it using
raw-unicode-escape, so that the decoding will reconstruct the original
string: backslash and newline characters are translated into their
\uXXXX counterparts.

This is backwards incompatible for strings containing backslashes, but
for some of those strings, the pickling was already broken.

Note that SF bug #123634 complains specifically that cPickle fails to
unpickle the pickle for u'' (the empty Unicode string) correctly.
This was an off-by-one error in load_unicode().

XXX Ugliness: in order to do the modified raw-unicode-escape, I've
cut-and-pasted a copy of PyUnicode_EncodeRawUnicodeEscape() into this
file that also encodes '\\' and '\n'.  It might be nice to migrate
this into the Unicode implementation and give this encoding a new name
('half-raw-unicode-escape'? 'pickle-unicode-escape'?); that would help
pickle.py too.  But right now I can't be bothered with the necessary
infrastructural changes.
----------------------------
Modules/socketmodule.c, 1.129->1.130
Adapted from a patch by Barry Scott, SF patch #102875 and SF bug
#125981: closing sockets was not thread-safe.
----------------------------
Lib/xml/dom/__init__.py, 1.4->1.6

Typo caught by /F -- thanks!
DOMException.__init__():  Remember to pass self to Exception.__init__().
----------------------------
Lib/urllib.py, 1.108->1.09
(partial)
Get rid of string functions, except maketrans() (which is *not*
obsolete!).

Fix a bug in ftpwrapper.retrfile() where somehow ftplib.error_perm was
assumed to be a string.  (The fix applies str().)

Also break some long lines and change the output from test() slightly.
----------------------------
Modules/bsddbmodule.c, 1.25->1.26
[Patch #102827] Fix for PR#119558, avoiding core dumps by checking for
malloc() returning NULL
----------------------------
Lib/site.py, 1.21->1.22
The ".pth" code knew about the layout of Python trees on unix and
windows, but not on the mac. Fixed.
----------------------------
Modules/selectmodule.c, 1.83->1.84
SF bug 110843:  Low FD_SETSIZE limit on Win32 (PR#41).  Boosted to 512.
----------------------------
Modules/parsermodule.c, 2.58->2.59

validate_varargslist():  Fix two bugs in this function, one that affected
                         it when *args and/or **kw are used, and one when
                         they are not.

This closes bug #125375: "parser.tuple2ast() failure on valid parse tree".
----------------------------
Lib/httplib.py, 1.24->1.25
Hoepeful fix for SF bug #123924: Windows - using OpenSSL, problem with
socket in httplib.py.

The bug reports that on Windows, you must pass sock._sock to the
socket.ssl() call.  But on Unix, you must pass sock itself.  (sock is
a wrapper on Windows but not on Unix; the ssl() call wants the real
socket object, not the wrapper.)

So we see if sock has an _sock attribute and if so, extract it.

Unfortunately, the submitter of the bug didn't confirm that this patch
works, so I'll just have to believe it (can't test it myself since I
don't have OpenSSL on Windows set up, and that's a nontrivial thing I
believe).
----------------------------
Python/getargs.c, 2.50->2.51
vgetargskeywords(): Patch for memory leak identified in bug #119862.
----------------------------
Lib/ConfigParser.py, 1.23->1.24

remove_option():  Use the right variable name for the option name!

This closes bug #124324.
----------------------------
Lib/filecmp.py, 1.6->1.7
Call of _cmp had wrong number of paramereters.
Fixed definition of _cmp.
----------------------------
Python/compile.c, 2.143->2.144
Plug a memory leak in com_import_stmt(): the tuple created to hold the
"..." in "from M import ..." was never DECREFed.  Leak reported by
James Slaughter and nailed by Barry, who also provided an earlier
version of this patch.
----------------------------
Objects/stringobject.c, 2.92->2.93
SF patch #102548, fix for bug #121013, by mwh@users.sourceforge.net.

Fixes a typo that caused "".join(u"this is a test") to dump core.
----------------------------
Python/marshal.c, 1.57->1.58
Python/compile.c, 2.142->2.143
SF bug 119622:  compile errors due to redundant atof decls.  I don't understand
the bug report (for details, look at it), but agree there's no need for Python
to declare atof itself:  we #include stdlib.h, and ANSI C sez atof is declared
there already.
----------------------------
Lib/webbrowser.py, 1.4->1.5
Typo for Mac code, fixing SF bug 12195.
----------------------------
Objects/fileobject.c, 2.91->2.92
Added _HAVE_BSDI and __APPLE__ to the list of platforms that require a
hack for TELL64()...  Sounds like there's something else going on
really.  Does anybody have a clue I can buy?
----------------------------
Python/thread_cthread.h, 2.13->2.14
Fix syntax error.  Submitted by Bill Bumgarner.  Apparently this is
still in use, for Apple Mac OSX.
----------------------------
Modules/arraymodule.c, 2.58->2.59
Fix for SF bug 117402, crashes on str(array) and repr(array).  This was an
unfortunate consequence of somebody switching from PyArg_Parse to
PyArg_ParseTuple but without changing the argument from a NULL to a tuple.
----------------------------
Lib/smtplib.py, 1.29->1.30
SMTP.connect(): If the socket.connect() raises a socket.error, be sure
to call self.close() to reclaim some file descriptors, the reraise the
exception.  Closes SF patch #102185 and SF bug #119833.
----------------------------
Objects/rangeobject.c, 2.20->2.22

Fixed support for containment test when a negative step is used; this
*really* closes bug #121965.

Added three attributes to the xrange object: start, stop, and step.  These
are the same as for the slice objects.

In the containment test, get the boundary condition right.  ">" was used
where ">=" should have been.

This closes bug #121965.
----------------------------
configure.in, 1.177->1.178
Fix for SF bug #117606:
  - when compiling with GCC on Solaris, use "$(CC) -shared" instead
    of "$(CC) -G" to generate .so files
  - when compiling with GCC on any platform, add "-fPIC" to OPT
    (without this, "$(CC) -shared" dies horribly)
----------------------------
configure.in, 1.175->1.176

Make sure the Modules/ directory is created before writing Modules/Setup.
----------------------------
Modules/_cursesmodule.c, 2.39->2.40
Patch from Randall Hopper to fix PR #116172, "curses module fails to
build on SGI":
* Check for 'sgi' preprocessor symbol, not '__sgi__'
* Surround individual character macros with #ifdef's, instead of making them
  all rely on STRICT_SYSV_CURSES
----------------------------
Modules/_tkinter.c, 1.114->1.115
Do not release unallocated Tcl objects. Closes #117278 and  #117167.
----------------------------
Python/dynload_shlib.c, 2.6->2.7
Patch 102114, Bug 11725.  On OpenBSD (but apparently not on the other
BSDs) you need a leading underscore in the dlsym() lookup name.
----------------------------
Lib/UserString.py, 1.6->1.7
Fix two typos in __imul__.  Closes Bug #117745.
----------------------------
Lib/mailbox.py, 1.25->1.26

Maildir.__init__():  Make sure self.boxes is set.

This closes SourceForge bug #117490.
----------------------------

-- 
"I'll be ex-DPL soon anyway so I'm        |LUKE: Is Perl better than Python?
looking for someplace else to grab power."|YODA: No...no... no. Quicker,
   -- Wichert Akkerman (on debian-private)|      easier, more seductive.
For public key, finger moshez@debian.org  |http://www.{python,debian,gnu}.org