From birkenfeld at users.sourceforge.net Thu Sep 1 00:08:56 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 1 Sep 2005 00:08:56 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib HTMLParser.py,1.15,1.16 Message-ID: <20050831220856.1B0521E4164@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32301/Lib Modified Files: HTMLParser.py Log Message: bug [ 761452 ] HTMLParser chokes on my.yahoo.com output Index: HTMLParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/HTMLParser.py,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- HTMLParser.py 8 Sep 2004 22:58:36 -0000 1.15 +++ HTMLParser.py 31 Aug 2005 22:08:45 -0000 1.16 @@ -36,7 +36,7 @@ (?:'[^']*' # LITA-enclosed value |\"[^\"]*\" # LIT-enclosed value |[^'\">\s]+ # bare value - ) + )? )? ) )* From birkenfeld at users.sourceforge.net Thu Sep 1 00:09:12 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 1 Sep 2005 00:09:12 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib HTMLParser.py,1.15,1.15.2.1 Message-ID: <20050831220912.E83F51E400F@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32632/Lib Modified Files: Tag: release24-maint HTMLParser.py Log Message: backport bug [ 761452 ] HTMLParser chokes on my.yahoo.com output Index: HTMLParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/HTMLParser.py,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -d -r1.15 -r1.15.2.1 --- HTMLParser.py 8 Sep 2004 22:58:36 -0000 1.15 +++ HTMLParser.py 31 Aug 2005 22:09:02 -0000 1.15.2.1 @@ -36,7 +36,7 @@ (?:'[^']*' # LITA-enclosed value |\"[^\"]*\" # LIT-enclosed value |[^'\">\s]+ # bare value - ) + )? )? ) )* From birkenfeld at users.sourceforge.net Thu Sep 1 00:21:28 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 1 Sep 2005 00:21:28 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python bltinmodule.c, 2.323, 2.324 Message-ID: <20050831222128.2A3D41E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12346/Python Modified Files: bltinmodule.c Log Message: Whitespace normalization. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.323 retrieving revision 2.324 diff -u -d -r2.323 -r2.324 --- bltinmodule.c 21 Aug 2005 11:03:58 -0000 2.323 +++ bltinmodule.c 31 Aug 2005 22:21:15 -0000 2.324 @@ -529,7 +529,7 @@ return NULL; } if (globals != Py_None && !PyDict_Check(globals)) { - PyErr_SetString(PyExc_TypeError, PyMapping_Check(globals) ? + PyErr_SetString(PyExc_TypeError, PyMapping_Check(globals) ? "globals must be a real dict; try eval(expr, {}, mapping)" : "globals must be a dict"); return NULL; @@ -1198,11 +1198,11 @@ if (kwds != NULL && PyDict_Check(kwds) && PyDict_Size(kwds)) { keyfunc = PyDict_GetItemString(kwds, "key"); if (PyDict_Size(kwds)!=1 || keyfunc == NULL) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument", name); return NULL; } - } + } it = PyObject_GetIter(v); if (it == NULL) @@ -1916,7 +1916,7 @@ Py_DECREF(newlist); return NULL; } - + newargs = PyTuple_GetSlice(args, 1, 4); if (newargs == NULL) { Py_DECREF(newlist); @@ -2548,21 +2548,21 @@ if (ok) { int reslen; if (!PyUnicode_Check(item)) { - PyErr_SetString(PyExc_TypeError, + PyErr_SetString(PyExc_TypeError, "can't filter unicode to unicode:" " __getitem__ returned different type"); Py_DECREF(item); goto Fail_1; } reslen = PyUnicode_GET_SIZE(item); - if (reslen == 1) + if (reslen == 1) PyUnicode_AS_UNICODE(result)[j++] = PyUnicode_AS_UNICODE(item)[0]; else { /* do we need more space? */ int need = j + reslen + len - i - 1; if (need > outlen) { - /* overallocate, + /* overallocate, to avoid reallocations */ if (need < 2 * outlen) need = 2 * outlen; From birkenfeld at users.sourceforge.net Thu Sep 1 00:48:55 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 1 Sep 2005 00:48:55 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib shutil.py,1.36,1.37 Message-ID: <20050831224855.EF7421E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32748/Lib Modified Files: shutil.py Log Message: patch [ 1242454 ] shutil.copytree() quits too soon after an error. Index: shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shutil.py,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- shutil.py 23 Jan 2005 12:20:15 -0000 1.36 +++ shutil.py 31 Aug 2005 22:48:45 -0000 1.37 @@ -124,6 +124,10 @@ # XXX What about devices, sockets etc.? except (IOError, os.error), why: errors.append((srcname, dstname, why)) + # catch the Error from the recursive copytree so that we can + # continue with other files + except Error, err: + errors.extend(err.args[0]) copystat(src, dst) if errors: raise Error, errors From birkenfeld at users.sourceforge.net Thu Sep 1 00:48:59 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 1 Sep 2005 00:48:59 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib shutil.py,1.34,1.34.2.1 Message-ID: <20050831224859.8FFCC1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv321/Lib Modified Files: Tag: release24-maint shutil.py Log Message: patch [ 1242454 ] shutil.copytree() quits too soon after an error. Index: shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shutil.py,v retrieving revision 1.34 retrieving revision 1.34.2.1 diff -u -d -r1.34 -r1.34.2.1 --- shutil.py 31 Oct 2004 12:05:31 -0000 1.34 +++ shutil.py 31 Aug 2005 22:48:48 -0000 1.34.2.1 @@ -124,6 +124,10 @@ # XXX What about devices, sockets etc.? except (IOError, os.error), why: errors.append((srcname, dstname, why)) + # catch the Error from the recursive copytree so that we can + # continue with other files + except Error, err: + errors.extend(err.args[0]) if errors: raise Error, errors From nascheme at users.sourceforge.net Thu Sep 1 01:02:17 2005 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Thu, 1 Sep 2005 01:02:17 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Objects stringobject.c, 2.231, 2.232 Message-ID: <20050831230217.7E2D91E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10493/Objects Modified Files: stringobject.c Log Message: Fix bug in last checkin (2.231). To match previous behavior, unicode subclasses should be substituted as-is and not have tp_str called on them. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.231 retrieving revision 2.232 diff -u -d -r2.231 -r2.232 --- stringobject.c 12 Aug 2005 17:34:57 -0000 2.231 +++ stringobject.c 31 Aug 2005 23:02:05 -0000 2.232 @@ -4078,6 +4078,11 @@ break; case 's': #ifdef Py_USING_UNICODE + if (PyUnicode_Check(v)) { + fmt = fmt_start; + argidx = argidx_start; + goto unicode; + } temp = _PyObject_Str(v); if (temp != NULL && PyUnicode_Check(temp)) { Py_DECREF(temp); From nnorwitz at users.sourceforge.net Thu Sep 1 02:39:13 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 1 Sep 2005 02:39:13 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/idlelib PyShell.py, 1.98, 1.99 Message-ID: <20050901003913.C19C11E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19931/Lib/idlelib Modified Files: PyShell.py Log Message: Remove unused import Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v retrieving revision 1.98 retrieving revision 1.99 diff -u -d -r1.98 -r1.99 --- PyShell.py 21 Jun 2005 02:42:17 -0000 1.98 +++ PyShell.py 1 Sep 2005 00:39:02 -0000 1.99 @@ -11,7 +11,6 @@ import threading import traceback import types -import exceptions import linecache from code import InteractiveInterpreter From nnorwitz at users.sourceforge.net Thu Sep 1 02:45:39 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 1 Sep 2005 02:45:39 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib asyncore.py, 1.61, 1.62 shutil.py, 1.37, 1.38 Message-ID: <20050901004539.1D7591E4028@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25272/Lib Modified Files: asyncore.py shutil.py Log Message: No need to import exceptions, they are builtins Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- asyncore.py 1 Sep 2004 14:04:51 -0000 1.61 +++ asyncore.py 1 Sep 2005 00:45:28 -0000 1.62 @@ -46,7 +46,6 @@ sophisticated high-performance network servers and clients a snap. """ -import exceptions import select import socket import sys @@ -61,7 +60,7 @@ except NameError: socket_map = {} -class ExitNow(exceptions.Exception): +class ExitNow(Exception): pass def read(obj): Index: shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shutil.py,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- shutil.py 31 Aug 2005 22:48:45 -0000 1.37 +++ shutil.py 1 Sep 2005 00:45:28 -0000 1.38 @@ -7,13 +7,12 @@ import os import sys import stat -import exceptions from os.path import abspath __all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2", "copytree","move","rmtree","Error"] -class Error(exceptions.EnvironmentError): +class Error(EnvironmentError): pass def copyfileobj(fsrc, fdst, length=16*1024): From nnorwitz at users.sourceforge.net Thu Sep 1 02:45:39 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 1 Sep 2005 02:45:39 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/encodings __init__.py, 1.20, 1.21 Message-ID: <20050901004539.43BC41E402A@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/encodings In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25272/Lib/encodings Modified Files: __init__.py Log Message: No need to import exceptions, they are builtins Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/__init__.py,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- __init__.py 20 Jan 2004 09:40:14 -0000 1.20 +++ __init__.py 1 Sep 2005 00:45:28 -0000 1.21 @@ -27,7 +27,7 @@ """#" -import codecs, exceptions, types, aliases +import codecs, types, aliases _cache = {} _unknown = '--unknown--' @@ -40,8 +40,7 @@ ' ') _aliases = aliases.aliases -class CodecRegistryError(exceptions.LookupError, - exceptions.SystemError): +class CodecRegistryError(LookupError, SystemError): pass def normalize_encoding(encoding): From birkenfeld at users.sourceforge.net Thu Sep 1 08:25:46 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 1 Sep 2005 08:25:46 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib HTMLParser.py,1.16,1.17 Message-ID: <20050901062546.15FBE1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10974/Lib Modified Files: HTMLParser.py Log Message: Reverting previous checkin. This breaks too much of HTMLParser to be applied without thought. Anyway, such malformed HTML is better handled by something like BeautifulSoup. Index: HTMLParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/HTMLParser.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- HTMLParser.py 31 Aug 2005 22:08:45 -0000 1.16 +++ HTMLParser.py 1 Sep 2005 06:25:34 -0000 1.17 @@ -36,7 +36,7 @@ (?:'[^']*' # LITA-enclosed value |\"[^\"]*\" # LIT-enclosed value |[^'\">\s]+ # bare value - )? + ) )? ) )* From birkenfeld at users.sourceforge.net Thu Sep 1 08:26:14 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 1 Sep 2005 08:26:14 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib HTMLParser.py, 1.15.2.1, 1.15.2.2 Message-ID: <20050901062614.17D6F1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11450/Lib Modified Files: Tag: release24-maint HTMLParser.py Log Message: Reverting previous checkin. This breaks too much of HTMLParser to be applied without thought. Anyway, such malformed HTML is better handled by something like BeautifulSoup. CVS: ---------------------------------------------------------------------- CVS: Enter Log. Lines beginning with `CVS:' are removed automatically CVS: CVS: Committing in . CVS: CVS: Modified Files: CVS: Lib/HTMLParser.py CVS: ---------------------------------------------------------------------- Index: HTMLParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/HTMLParser.py,v retrieving revision 1.15.2.1 retrieving revision 1.15.2.2 diff -u -d -r1.15.2.1 -r1.15.2.2 --- HTMLParser.py 31 Aug 2005 22:09:02 -0000 1.15.2.1 +++ HTMLParser.py 1 Sep 2005 06:26:03 -0000 1.15.2.2 @@ -36,7 +36,7 @@ (?:'[^']*' # LITA-enclosed value |\"[^\"]*\" # LIT-enclosed value |[^'\">\s]+ # bare value - )? + ) )? ) )* From doerwalter at users.sourceforge.net Thu Sep 1 13:57:04 2005 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 1 Sep 2005 13:57:04 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib codecs.py,1.47,1.48 Message-ID: <20050901115704.2F3111E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27925/Lib Modified Files: codecs.py Log Message: SF bug #1235646: codecs.StreamRecoder.next() now reencodes the data it reads from the input stream, so that the output is a byte string in the correct encoding instead of a unicode string. Index: codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- codecs.py 24 Aug 2005 07:38:12 -0000 1.47 +++ codecs.py 1 Sep 2005 11:56:53 -0000 1.48 @@ -556,7 +556,9 @@ def next(self): """ Return the next decoded line from the input stream.""" - return self.reader.next() + data = self.reader.next() + data, bytesencoded = self.encode(data, self.errors) + return data def __iter__(self): return self From doerwalter at users.sourceforge.net Thu Sep 1 13:57:07 2005 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 1 Sep 2005 13:57:07 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1358,1.1359 Message-ID: <20050901115707.EA2F41E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27925/Misc Modified Files: NEWS Log Message: SF bug #1235646: codecs.StreamRecoder.next() now reencodes the data it reads from the input stream, so that the output is a byte string in the correct encoding instead of a unicode string. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1358 retrieving revision 1.1359 diff -u -d -r1.1358 -r1.1359 --- NEWS 30 Aug 2005 10:23:13 -0000 1.1358 +++ NEWS 1 Sep 2005 11:56:53 -0000 1.1359 @@ -439,6 +439,9 @@ about illegal code points. The codec now supports PEP 293 style error handlers. +- Bug #1235646: ^^codecs.StreamRecoder.next()^^ now reencodes the data it reads + from the input stream, so that the output is a byte string in the correct + encoding instead of a unicode string. Build ----- From doerwalter at users.sourceforge.net Thu Sep 1 14:03:26 2005 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 1 Sep 2005 14:03:26 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.92, 1.1193.2.93 Message-ID: <20050901120326.0B4251E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32536/Misc Modified Files: Tag: release24-maint NEWS Log Message: Backport checkin: SF bug #1235646: codecs.StreamRecoder.next() now reencodes the data it reads from the input stream, so that the output is a byte string in the correct encoding instead of a unicode string. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.92 retrieving revision 1.1193.2.93 diff -u -d -r1.1193.2.92 -r1.1193.2.93 --- NEWS 30 Aug 2005 10:46:06 -0000 1.1193.2.92 +++ NEWS 1 Sep 2005 12:03:14 -0000 1.1193.2.93 @@ -141,6 +141,9 @@ about illegal code points. The codec now supports PEP 293 style error handlers. +- Bug #1235646: ``codecs.StreamRecoder.next()`` now reencodes the data it reads + from the input stream, so that the output is a byte string in the correct + encoding instead of a unicode string. Build ----- From doerwalter at users.sourceforge.net Thu Sep 1 14:03:26 2005 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 1 Sep 2005 14:03:26 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib codecs.py, 1.35.2.9, 1.35.2.10 Message-ID: <20050901120326.0BAB21E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32536/Lib Modified Files: Tag: release24-maint codecs.py Log Message: Backport checkin: SF bug #1235646: codecs.StreamRecoder.next() now reencodes the data it reads from the input stream, so that the output is a byte string in the correct encoding instead of a unicode string. Index: codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v retrieving revision 1.35.2.9 retrieving revision 1.35.2.10 diff -u -d -r1.35.2.9 -r1.35.2.10 --- codecs.py 24 Aug 2005 07:38:36 -0000 1.35.2.9 +++ codecs.py 1 Sep 2005 12:03:14 -0000 1.35.2.10 @@ -556,7 +556,9 @@ def next(self): """ Return the next decoded line from the input stream.""" - return self.reader.next() + data = self.reader.next() + data, bytesencoded = self.encode(data, self.errors) + return data def __iter__(self): return self From doerwalter at users.sourceforge.net Thu Sep 1 14:04:39 2005 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 1 Sep 2005 14:04:39 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1359,1.1360 Message-ID: <20050901120439.DAF241E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1232/Misc Modified Files: NEWS Log Message: Fix rest markup and typos. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1359 retrieving revision 1.1360 diff -u -d -r1.1359 -r1.1360 --- NEWS 1 Sep 2005 11:56:53 -0000 1.1359 +++ NEWS 1 Sep 2005 12:04:29 -0000 1.1360 @@ -64,7 +64,7 @@ proper magic slot for type conversions when subclassed. Previously the magic slot was ignored during conversion. Semantics now match the way subclasses of str always behaved. int/long/float, conversion of an instance - to the base class has been moved the prroper nb_* magic slot and out of + to the base class has been moved to the proper nb_* magic slot and out of PyNumber_*(). Thanks Walter Dörwald. @@ -439,7 +439,7 @@ about illegal code points. The codec now supports PEP 293 style error handlers. -- Bug #1235646: ^^codecs.StreamRecoder.next()^^ now reencodes the data it reads +- Bug #1235646: ``codecs.StreamRecoder.next()`` now reencodes the data it reads from the input stream, so that the output is a byte string in the correct encoding instead of a unicode string. From akuchling at users.sourceforge.net Thu Sep 1 16:08:51 2005 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 1 Sep 2005 16:08:51 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib libzlib.tex,1.32,1.33 Message-ID: <20050901140851.082081E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30482 Modified Files: libzlib.tex Log Message: Remove statement about meaning of constants; arguably it's incorrect Index: libzlib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libzlib.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- libzlib.tex 31 Aug 2005 16:52:40 -0000 1.32 +++ libzlib.tex 1 Sep 2005 14:08:38 -0000 1.33 @@ -115,8 +115,7 @@ compressed output is returned. \var{mode} can be selected from the constants \constant{Z_SYNC_FLUSH}, \constant{Z_FULL_FLUSH}, or \constant{Z_FINISH}, defaulting to \constant{Z_FINISH}. \constant{Z_SYNC_FLUSH} and -\constant{Z_FULL_FLUSH} allow compressing further strings of data and -are used to allow partial error recovery on decompression, while +\constant{Z_FULL_FLUSH} allow compressing further strings of data, while \constant{Z_FINISH} finishes the compressed stream and prevents compressing any more data. After calling \method{flush()} with \var{mode} set to \constant{Z_FINISH}, the From vsajip at users.sourceforge.net Fri Sep 2 13:20:46 2005 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Fri, 2 Sep 2005 13:20:46 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/logging __init__.py, 1.27, 1.28 Message-ID: <20050902112046.54B971E4019@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21191 Modified Files: __init__.py Log Message: Changed _srcfile determination to support py2exe. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/__init__.py,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- __init__.py 31 Mar 2005 20:16:55 -0000 1.27 +++ __init__.py 2 Sep 2005 11:20:33 -0000 1.28 @@ -52,7 +52,9 @@ # _srcfile is used when walking the stack to check when we've got the first # caller stack frame. # -if string.lower(__file__[-4:]) in ['.pyc', '.pyo']: +if hasattr(sys, 'frozen'): #support for py2exe + _srcfile = "logging%s__init__%s" % (os.sep, __file__[-4:]) +elif string.lower(__file__[-4:]) in ['.pyc', '.pyo']: _srcfile = __file__[:-4] + '.py' else: _srcfile = __file__ From pje at users.sourceforge.net Sat Sep 3 05:21:06 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 3 Sep 2005 05:21:06 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command bdist_egg.py, 1.30, 1.31 Message-ID: <20050903032106.121CC1E4003@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32206/setuptools/command Modified Files: bdist_egg.py Log Message: Work around a problem with SuSE Linux's patched install_lib command, by figuring out the extension paths without its help. :( Index: bdist_egg.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/bdist_egg.py,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- bdist_egg.py 23 Aug 2005 13:24:42 -0000 1.30 +++ bdist_egg.py 3 Sep 2005 03:20:54 -0000 1.31 @@ -173,9 +173,8 @@ old_root = instcmd.root; instcmd.root = None cmd = self.call_command('install_lib', warn_dir=0) instcmd.root = old_root - ext_outputs = cmd._mutate_outputs( - self.distribution.has_ext_modules(), 'build_ext', 'build_lib', '' - ) + + ext_outputs = self.get_ext_outputs() self.stubs = [] to_compile = [] for (p,ext_name) in enumerate(ext_outputs): @@ -187,6 +186,7 @@ write_stub(os.path.basename(ext_name), pyfile) to_compile.append(pyfile) ext_outputs[p] = ext_name.replace(os.sep,'/') + to_compile.extend(self.make_init_files()) if to_compile: cmd.byte_compile(to_compile) @@ -285,6 +285,47 @@ return init_files + def get_ext_outputs(self): + """Get a list of relative paths to C extensions in the output distro""" + + if not self.distribution.has_ext_modules(): + return [] + + build_cmd = self.get_finalized_command('build_ext') + prefix_len = len(build_cmd.build_lib) + len(os.sep) + + outputs = [] + for filename in build_cmd.get_outputs(): + outputs.append(filename[prefix_len:]) + + return outputs + + + + + + + + + + + + + + + + + + + + + + + + + + + def walk_egg(egg_dir): """Walk an unpacked egg's contents, skipping the metadata directory""" walker = os.walk(egg_dir) From pje at users.sourceforge.net Sat Sep 3 06:04:15 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 3 Sep 2005 06:04:15 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command easy_install.py, 1.25, 1.26 Message-ID: <20050903040415.1EDDA1E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5150/setuptools/command Modified Files: easy_install.py Log Message: Fix typo in symlink handling code. Index: easy_install.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/easy_install.py,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- easy_install.py 23 Aug 2005 13:34:52 -0000 1.25 +++ easy_install.py 3 Sep 2005 04:04:03 -0000 1.26 @@ -849,7 +849,7 @@ # Ensure that setuptools itself never becomes unavailable! # XXX should this check for latest version? filename = os.path.join(self.install_dir,'setuptools.pth') - if os.path.islink(filename): unlink(filename) + if os.path.islink(filename): os.unlink(filename) f = open(filename, 'wt') f.write(dist.location+'\n') f.close() From pje at users.sourceforge.net Sat Sep 3 06:37:29 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 3 Sep 2005 06:37:29 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command easy_install.py, 1.26, 1.27 Message-ID: <20050903043729.A28D01E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9807/setuptools/command Modified Files: easy_install.py Log Message: Make sure that script target directory exists. Ordinarily it should, but some bdist_* targets install to a pseudo-root where stuff might not exist. Index: easy_install.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/easy_install.py,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- easy_install.py 3 Sep 2005 04:04:03 -0000 1.26 +++ easy_install.py 3 Sep 2005 04:37:18 -0000 1.27 @@ -481,6 +481,7 @@ ) % locals() if not self.dry_run: + ensure_directory(target) f = open(target,"w") f.write(script_text) f.close() @@ -489,7 +490,6 @@ except (AttributeError, os.error): pass - def install_eggs(self, spec, dist_filename, tmpdir): # .egg dirs or files are already built, so just return them if dist_filename.lower().endswith('.egg'): From pje at users.sourceforge.net Sat Sep 3 06:50:16 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 3 Sep 2005 06:50:16 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command easy_install.py, 1.27, 1.28 Message-ID: <20050903045016.284751E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11565/setuptools/command Modified Files: easy_install.py Log Message: Ensure wrapper scripts are included in output file record; this is especially important for RPMs with scripts. Index: easy_install.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/easy_install.py,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- easy_install.py 3 Sep 2005 04:37:18 -0000 1.27 +++ easy_install.py 3 Sep 2005 04:50:05 -0000 1.28 @@ -479,7 +479,7 @@ "import pkg_resources\n" "pkg_resources.run_script(%(spec)r, %(script_name)r)\n" ) % locals() - + self.add_output(target) if not self.dry_run: ensure_directory(target) f = open(target,"w") From pje at users.sourceforge.net Sat Sep 3 06:51:38 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 3 Sep 2005 06:51:38 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command bdist_rpm.py, 1.1, 1.2 install.py, 1.5, 1.6 Message-ID: <20050903045138.5BD871E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11938/setuptools/command Modified Files: bdist_rpm.py install.py Log Message: Added support for old-style RPMs (i.e. non-egg RPMs) Index: bdist_rpm.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/bdist_rpm.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- bdist_rpm.py 21 Aug 2005 23:33:39 -0000 1.1 +++ bdist_rpm.py 3 Sep 2005 04:51:27 -0000 1.2 @@ -1,11 +1,33 @@ # This is just a kludge so that bdist_rpm doesn't guess wrong about the -# distribution name and version, if the egg_info command is going to alter them +# distribution name and version, if the egg_info command is going to alter +# them, and another kludge to allow you to build old-style non-egg RPMs from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm class bdist_rpm(_bdist_rpm): + user_options = _bdist_rpm.user_options + [ + ('no-egg', None, "Don't install as an egg (may break the package!)") + ] + + boolean_options = _bdist_rpm.boolean_options + ['no-egg'] + + def initialize_options(self): + _bdist_rpm.initialize_options(self) + self.no_egg = None + def run(self): self.run_command('egg_info') # ensure distro name is up-to-date _bdist_rpm.run(self) + def _make_spec_file(self): + spec = _bdist_rpm._make_spec_file(self) + if not self.no_egg: + return spec + + # Hack the spec file so that we install old-style + return [ + line.replace( + "setup.py install ","setup.py install --old-and-unmanageable " + ) for line in spec + ] Index: install.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/install.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- install.py 22 Aug 2005 13:40:10 -0000 1.5 +++ install.py 3 Sep 2005 04:51:27 -0000 1.6 @@ -4,6 +4,16 @@ class install(_install): """Use easy_install to install the package, w/dependencies""" + user_options = _install.user_options + [ + ('old-and-unmanageable', None, "Try not to use this!"), + ] + + boolean_options = _install.boolean_options + ['old-and-unmanageable'] + + def initialize_options(self): + _install.initialize_options(self) + self.old_and_unmanageable = None + def handle_extra_path(self): # We always ignore extra_path, because we always install eggs # (you can always use install_* commands directly if needed) @@ -11,23 +21,24 @@ self.extra_dirs = '' def run(self): - calling_module = sys._getframe(1).f_globals.get('__name__','') - if calling_module != 'distutils.dist': - # We're not being run from the command line, so use old-style - # behavior. This is a bit kludgy, because a command might use - # dist.run_command() to run 'install', but bdist_dumb and - # bdist_wininst both call run directly at the moment. - # When this is part of the distutils, the old install behavior - # should probably be requested with a flag, or a different method. + if (self.old_and_unmanageable or + sys._getframe(1).f_globals.get('__name__','') != 'distutils.dist' + ): + # Either we were asked for the old behavior, or we're not being + # run from the command line. This is a bit kludgy, because a + # command might use dist.run_command() to run 'install', but + # bdist_dumb and bdist_wininst both call run() directly right now. return _install.run(self) from setuptools.command.easy_install import easy_install + cmd = easy_install( self.distribution, args="x", ignore_conflicts_at_my_risk=1, root=self.root ) cmd.ensure_finalized() # finalize before bdist_egg munges install cmd + self.run_command('bdist_egg') args = [self.distribution.get_command_obj('bdist_egg').egg_output] @@ -39,3 +50,33 @@ cmd.run() setuptools.bootstrap_install_from = None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From pje at users.sourceforge.net Sat Sep 3 06:53:21 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 3 Sep 2005 06:53:21 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools setuptools.txt, 1.34, 1.35 Message-ID: <20050903045321.568EA1E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12188 Modified Files: setuptools.txt Log Message: Add release note about bdist_rpm --no-egg option Index: setuptools.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.txt,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- setuptools.txt 23 Aug 2005 13:24:40 -0000 1.34 +++ setuptools.txt 3 Sep 2005 04:53:10 -0000 1.35 @@ -1777,6 +1777,9 @@ ---------------------------- 0.6a1 + * Added support for building "old-style" RPMs that don't install an egg for + the target package, using a ``--no-egg`` option. + * The ``build_ext`` command now works better when using the ``--inplace`` option and multiple Python versions. It now makes sure that all extensions match the current Python version, even if newer copies were built for a From pje at users.sourceforge.net Sat Sep 3 07:01:23 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 3 Sep 2005 07:01:23 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools ez_setup.py, 1.25, 1.26 setup.cfg, 1.2, 1.3 Message-ID: <20050903050123.410711E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13407 Modified Files: ez_setup.py setup.cfg Log Message: Release 0.6a1c2. Index: ez_setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/ez_setup.py,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- ez_setup.py 22 Aug 2005 03:50:19 -0000 1.25 +++ ez_setup.py 3 Sep 2005 05:01:12 -0000 1.26 @@ -13,12 +13,14 @@ This file can also be run as a script to install or upgrade setuptools. """ -DEFAULT_VERSION = "0.6a1" +DEFAULT_VERSION = "0.6a1c2" DEFAULT_URL = "http://www.python.org/packages/source/s/setuptools/" md5_data = { 'setuptools-0.5a13-py2.3.egg': '85edcf0ef39bab66e130d3f38f578c86', 'setuptools-0.5a13-py2.4.egg': 'ede4be600e3890e06d4ee5e0148e092a', + 'setuptools-0.6a1c2-py2.3.egg': '92291ca957044306d96a7b8589c01d87', + 'setuptools-0.6a1c2-py2.4.egg': '5ae6405341eddb5baf93cd6ab178efb1', } import sys, os Index: setup.cfg =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setup.cfg,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- setup.cfg 18 Jul 2005 02:06:15 -0000 1.2 +++ setup.cfg 3 Sep 2005 05:01:12 -0000 1.3 @@ -1,3 +1,6 @@ +[egg_info] +tag-build=c2 + [aliases] binary = bdist_egg upload --show-response develop = develop From nnorwitz at users.sourceforge.net Sat Sep 3 07:48:50 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 3 Sep 2005 07:48:50 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep-0284.txt,1.4,1.5 Message-ID: <20050903054850.45EAA1E4004@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19207 Modified Files: pep-0284.txt Log Message: Fix typo Index: pep-0284.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0284.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pep-0284.txt 4 Jul 2005 06:40:53 -0000 1.4 +++ pep-0284.txt 3 Sep 2005 05:48:39 -0000 1.5 @@ -36,7 +36,7 @@ the premise that the range() format needed fixing, "The whole point (15 years ago) of range() was to *avoid* needing syntax to specify a loop over numbers. I think it's worked out well and there's nothing - that needs to be fixed (except range() needs to become an interator, + that needs to be fixed (except range() needs to become an iterator, which it will in Python 3.0)." Rationale From birkenfeld at users.sourceforge.net Sat Sep 3 09:27:37 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sat, 3 Sep 2005 09:27:37 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.65,1.66 Message-ID: <20050903072737.3EF501E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2874/Doc/api Modified Files: concrete.tex Log Message: - Correct PyBool_FromLong's return type and its description. - Unify function description mode ("Return X" vs "Returns X") Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- concrete.tex 17 Aug 2005 12:23:45 -0000 1.65 +++ concrete.tex 3 Sep 2005 07:27:26 -0000 1.66 @@ -36,20 +36,20 @@ \end{cvardesc} \begin{cfuncdesc}{int}{PyType_Check}{PyObject *o} - Returns true if the object \var{o} is a type object, including - instances of types derived from the standard type object. Returns + Return true if the object \var{o} is a type object, including + instances of types derived from the standard type object. Return false in all other cases. \end{cfuncdesc} \begin{cfuncdesc}{int}{PyType_CheckExact}{PyObject *o} [...1472 lines suppressed...] + for missing keys. Raise a \exception{TypeError} if the \var{key} is unhashable. Unlike the Python \method{discard()} method, this function does not automatically convert unhashable sets into temporary frozensets. - Raises \exception{PyExc_SystemError} if \var{set} is an not an instance + Raise \exception{PyExc_SystemError} if \var{set} is an not an instance of \class{set} or its subtype. \end{cfuncdesc} \begin{cfuncdesc}{PyObject*}{PySet_Pop}{PyObject *set} - Returns a new reference to an arbitrary object in the \var{set}, - and removes the object from the \var{set}. Returns \NULL{} on - failure. Raises \exception{KeyError} if the set is empty. - Raises a \exception{SystemError} if \var{set} is an not an instance + Return a new reference to an arbitrary object in the \var{set}, + and removes the object from the \var{set}. Return \NULL{} on + failure. Raise \exception{KeyError} if the set is empty. + Raise a \exception{SystemError} if \var{set} is an not an instance of \class{set} or its subtype. \end{cfuncdesc} From birkenfeld at users.sourceforge.net Sat Sep 3 09:27:48 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sat, 3 Sep 2005 09:27:48 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex, 1.58.2.2, 1.58.2.3 Message-ID: <20050903072748.497CE1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2951/Doc/api Modified Files: Tag: release24-maint concrete.tex Log Message: - Correct PyBool_FromLong's return type and its description. - Unify function description mode ("Return X" vs "Returns X") CVS: ---------------------------------------------------------------------- CVS: Enter Log. Lines beginning with `CVS:' are removed automatically CVS: CVS: Committing in . CVS: CVS: Modified Files: CVS: Doc/api/concrete.tex CVS: ---------------------------------------------------------------------- Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.58.2.2 retrieving revision 1.58.2.3 diff -u -d -r1.58.2.2 -r1.58.2.3 --- concrete.tex 17 Feb 2005 05:16:19 -0000 1.58.2.2 +++ concrete.tex 3 Sep 2005 07:27:37 -0000 1.58.2.3 @@ -36,20 +36,20 @@ \end{cvardesc} \begin{cfuncdesc}{int}{PyType_Check}{PyObject *o} - Returns true if the object \var{o} is a type object, including - instances of types derived from the standard type object. Returns + Return true if the object \var{o} is a type object, including + instances of types derived from the standard type object. Return false in all other cases. \end{cfuncdesc} \begin{cfuncdesc}{int}{PyType_CheckExact}{PyObject *o} [...1362 lines suppressed...] \end{cfuncdesc} @@ -2470,7 +2470,7 @@ \var{stop}, and \var{step} parameters are used as the values of the slice object attributes of the same names. Any of the values may be \NULL{}, in which case the \code{None} will be used for the - corresponding attribute. Returns \NULL{} if the new object could + corresponding attribute. Return \NULL{} if the new object could not be allocated. \end{cfuncdesc} @@ -2558,7 +2558,7 @@ \end{cfuncdesc} \begin{cfuncdesc}{PyObject*}{PyWeakref_GetObject}{PyObject *ref} - Returns the referenced object from a weak reference, \var{ref}. If + Return the referenced object from a weak reference, \var{ref}. If the referent is no longer live, returns \code{None}. \versionadded{2.2} \end{cfuncdesc} From birkenfeld at users.sourceforge.net Sat Sep 3 09:49:59 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sat, 3 Sep 2005 09:49:59 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules bz2module.c, 1.23.2.2, 1.23.2.3 Message-ID: <20050903074959.E8C6E1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6193/Modules Modified Files: Tag: release24-maint bz2module.c Log Message: bug [ 1274069 ] bz2module.c compiler warning Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.23.2.2 retrieving revision 1.23.2.3 diff -u -d -r1.23.2.2 -r1.23.2.3 --- bz2module.c 25 Aug 2005 13:10:58 -0000 1.23.2.2 +++ bz2module.c 3 Sep 2005 07:49:48 -0000 1.23.2.3 @@ -110,8 +110,8 @@ BZFILE *fp; int mode; - long pos; - long size; + Py_off_t pos; + Py_off_t size; #ifdef WITH_THREAD PyThread_type_lock lock; #endif @@ -982,7 +982,7 @@ char *buffer = small_buffer; size_t buffersize = SMALLCHUNK; int bytesread = 0; - int readsize; + size_t readsize; int chunksize; int bzerror; int rewind = 0; @@ -1089,10 +1089,13 @@ /* Before getting here, offset must be set to the number of bytes * to walk forward. */ for (;;) { - if ((size_t)offset-bytesread > buffersize) + if (offset-bytesread > buffersize) readsize = buffersize; else - readsize = offset-bytesread; + /* offset might be wider that readsize, but the result + * of the subtraction is bound by buffersize (see the + * condition above). buffersize is 8192. */ + readsize = (size_t)(offset-bytesread); Py_BEGIN_ALLOW_THREADS chunksize = Util_UnivNewlineRead(&bzerror, self->fp, buffer, readsize, self); @@ -1137,7 +1140,11 @@ goto cleanup; } +#if !defined(HAVE_LARGEFILE_SUPPORT) ret = PyInt_FromLong(self->pos); +#else + ret = PyLong_FromLongLong(self->pos); +#endif cleanup: return ret; From birkenfeld at users.sourceforge.net Sat Sep 3 09:50:03 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sat, 3 Sep 2005 09:50:03 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.25,1.26 Message-ID: <20050903075003.8CBFD1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6167/Modules Modified Files: bz2module.c Log Message: bug [ 1274069 ] bz2module.c compiler warning Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- bz2module.c 21 Aug 2005 14:16:03 -0000 1.25 +++ bz2module.c 3 Sep 2005 07:49:53 -0000 1.26 @@ -110,8 +110,8 @@ BZFILE *fp; int mode; - long pos; - long size; + Py_off_t pos; + Py_off_t size; #ifdef WITH_THREAD PyThread_type_lock lock; #endif @@ -982,7 +982,7 @@ char *buffer = small_buffer; size_t buffersize = SMALLCHUNK; int bytesread = 0; - int readsize; + size_t readsize; int chunksize; int bzerror; int rewind = 0; @@ -1089,10 +1089,13 @@ /* Before getting here, offset must be set to the number of bytes * to walk forward. */ for (;;) { - if ((size_t)offset-bytesread > buffersize) + if (offset-bytesread > buffersize) readsize = buffersize; else - readsize = offset-bytesread; + /* offset might be wider that readsize, but the result + * of the subtraction is bound by buffersize (see the + * condition above). buffersize is 8192. */ + readsize = (size_t)(offset-bytesread); Py_BEGIN_ALLOW_THREADS chunksize = Util_UnivNewlineRead(&bzerror, self->fp, buffer, readsize, self); @@ -1137,7 +1140,11 @@ goto cleanup; } +#if !defined(HAVE_LARGEFILE_SUPPORT) ret = PyInt_FromLong(self->pos); +#else + ret = PyLong_FromLongLong(self->pos); +#endif cleanup: return ret; From doko at users.sourceforge.net Sun Sep 4 18:20:42 2005 From: doko at users.sourceforge.net (doko@users.sourceforge.net) Date: Sun, 4 Sep 2005 18:20:42 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/texinputs howto.cls, 1.15, 1.15.4.1 manual.cls, 1.19, 1.19.4.1 Message-ID: <20050904162042.0F1721E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4155/Doc/texinputs Modified Files: Tag: release24-maint howto.cls manual.cls Log Message: use a test for PDF support that is more portable across teTeX major versions (closes SF bug #1238210) Index: howto.cls =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/howto.cls,v retrieving revision 1.15 retrieving revision 1.15.4.1 diff -u -d -r1.15 -r1.15.4.1 --- howto.cls 31 Mar 2004 08:08:34 -0000 1.15 +++ howto.cls 4 Sep 2005 16:20:30 -0000 1.15.4.1 @@ -50,7 +50,8 @@ % \renewcommand{\maketitle}{ \py at doHorizontalRule - \@ifundefined{pdfinfo}{}{{ + \ifpdf + \begingroup % This \def is required to deal with multi-line authors; it % changes \\ to ', ' (comma-space), making it pass muster for % generating document info in the PDF file. @@ -59,7 +60,8 @@ /Author (\@author) /Title (\@title) } - }} + \endgroup + \fi \begin{flushright} {\rm\Huge\py at HeaderFamily \@title} \par {\em\large\py at HeaderFamily \py at release\releaseinfo} \par Index: manual.cls =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/manual.cls,v retrieving revision 1.19 retrieving revision 1.19.4.1 diff -u -d -r1.19 -r1.19.4.1 --- manual.cls 31 Mar 2004 08:08:34 -0000 1.19 +++ manual.cls 4 Sep 2005 16:20:30 -0000 1.19.4.1 @@ -64,7 +64,8 @@ \let\footnotesize\small \let\footnoterule\relax \py at doHorizontalRule% - \@ifundefined{pdfinfo}{}{{ + \ifpdf + \begingroup % This \def is required to deal with multi-line authors; it % changes \\ to ', ' (comma-space), making it pass muster for % generating document info in the PDF file. @@ -73,7 +74,8 @@ /Author (\@author) /Title (\@title) } - }} + \endgroup + \fi \begin{flushright}% {\rm\Huge\py at HeaderFamily \@title \par}% {\em\LARGE\py at HeaderFamily \py at release\releaseinfo \par} From birkenfeld at users.sourceforge.net Sun Sep 4 20:30:31 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sun, 4 Sep 2005 20:30:31 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.128,1.129 Message-ID: <20050904183031.0F3D01E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29768/Doc/ref Modified Files: ref3.tex Log Message: Clarify what is meant with "whole numbers". Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.128 retrieving revision 1.129 diff -u -d -r1.128 -r1.129 --- ref3.tex 26 Aug 2005 12:56:22 -0000 1.128 +++ ref3.tex 4 Sep 2005 18:30:19 -0000 1.129 @@ -165,7 +165,8 @@ \begin{description} \item[Integers] -These represent elements from the mathematical set of whole numbers. +These represent elements from the mathematical set of whole numbers +(positive and negative ones). \obindex{integer} There are three types of integers: From birkenfeld at users.sourceforge.net Sun Sep 4 20:30:55 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sun, 4 Sep 2005 20:30:55 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex, 1.121.2.7, 1.121.2.8 Message-ID: <20050904183055.783781E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30144/Doc/ref Modified Files: Tag: release24-maint ref3.tex Log Message: Clarify what is meant with "whole numbers". Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.121.2.7 retrieving revision 1.121.2.8 diff -u -d -r1.121.2.7 -r1.121.2.8 --- ref3.tex 26 Aug 2005 12:56:17 -0000 1.121.2.7 +++ ref3.tex 4 Sep 2005 18:30:44 -0000 1.121.2.8 @@ -165,7 +165,8 @@ \begin{description} \item[Integers] -These represent elements from the mathematical set of whole numbers. +These represent elements from the mathematical set of whole numbers +(positive and negative ones). \obindex{integer} There are three types of integers: From nnorwitz at users.sourceforge.net Mon Sep 5 18:17:00 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 5 Sep 2005 18:17:00 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc gdbinit,1.10,1.11 Message-ID: <20050905161700.62E781E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25467/Misc Modified Files: gdbinit Log Message: break sets a breakpoint rather than stopping the loop. It *appears* a flag is necessary instead. This was tested in gdb 6.0. Backport candidate Index: gdbinit =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/gdbinit,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- gdbinit 13 Aug 2005 00:28:41 -0000 1.10 +++ gdbinit 5 Sep 2005 16:16:49 -0000 1.11 @@ -46,18 +46,19 @@ # A rewrite of the Python interpreter's line number calculator in GDB's # command language define lineno + set $__continue = 1 set $__co = f->f_code set $__lasti = f->f_lasti set $__sz = ((PyStringObject *)$__co->co_lnotab)->ob_size/2 set $__p = (unsigned char *)((PyStringObject *)$__co->co_lnotab)->ob_sval set $__li = $__co->co_firstlineno set $__ad = 0 - while ($__sz-1 >= 0) + while ($__sz-1 >= 0 && $__continue) set $__sz = $__sz - 1 set $__ad = $__ad + *$__p set $__p = $__p + 1 if ($__ad > $__lasti) - break + set $__continue = 0 end set $__li = $__li + *$__p set $__p = $__p + 1 From Accounts.Department at skyfi.com Mon Sep 5 17:15:16 2005 From: Accounts.Department at skyfi.com (Sky Bank) Date: Mon, 05 Sep 2005 11:15:16 -0400 Subject: [Python-checkins] Account Information Update Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20050905/356082f3/attachment.html From fdrake at users.sourceforge.net Wed Sep 7 06:58:00 2005 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 7 Sep 2005 06:58:00 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.129,1.130 Message-ID: <20050907045800.AEBDB1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5128/ref Modified Files: ref3.tex Log Message: - fix typo report by email, only 1.5 years late - fix several consistency nits relating to \method{...()} Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.129 retrieving revision 1.130 diff -u -d -r1.129 -r1.130 --- ref3.tex 4 Sep 2005 18:30:19 -0000 1.129 +++ ref3.tex 7 Sep 2005 04:57:56 -0000 1.130 @@ -326,7 +326,7 @@ \function{ord()}\bifuncindex{ord} convert between code units and nonnegative integers representing the Unicode ordinals as defined in the Unicode Standard 3.0. Conversion from and to other encodings are -possible through the Unicode method \method{encode} and the built-in +possible through the Unicode method \method{encode()} and the built-in function \function{unicode()}.\bifuncindex{unicode} \obindex{unicode} \index{character} @@ -1208,8 +1208,8 @@ There are no implied relationships among the comparison operators. The truth of \code{\var{x}==\var{y}} does not imply that \code{\var{x}!=\var{y}} -is false. Accordingly, when defining \method{__eq__}, one should also -define \method{__ne__} so that the operators will behave as expected. +is false. Accordingly, when defining \method{__eq__()}, one should also +define \method{__ne__()} so that the operators will behave as expected. There are no reflected (swapped-argument) versions of these methods (to be used when the left argument does not support the operation but @@ -1338,7 +1338,7 @@ \begin{methoddesc}[object]{__getattribute__}{self, name} Called unconditionally to implement attribute accesses for instances -of the class. If the class also defines \method{__getattr__}, the latter +of the class. If the class also defines \method{__getattr__()}, the latter will not be called unless \method{__getattribute__()} either calls it explicitly or raises an \exception{AttributeError}. This method should return the (computed) attribute @@ -1905,7 +1905,7 @@ \var{x}\code{+=}\var{y}, where \var{x} is an instance of a class that has an \method{__iadd__()} method, \code{\var{x}.__iadd__(\var{y})} is called. If \var{x} is an instance of a class that does not define a -\method{__iadd()} method, \code{\var{x}.__add__(\var{y})} and +\method{__iadd__()} method, \code{\var{x}.__add__(\var{y})} and \code{\var{y}.__radd__(\var{x})} are considered, as with the evaluation of \var{x}\code{+}\var{y}. \end{methoddesc} @@ -1988,10 +1988,10 @@ Below, \method{__op__()} and \method{__rop__()} are used to signify the generic method names corresponding to an operator; -\method{__iop__} is used for the corresponding in-place operator. For +\method{__iop__()} is used for the corresponding in-place operator. For example, for the operator `\code{+}', \method{__add__()} and \method{__radd__()} are used for the left and right variant of the -binary operator, and \method{__iadd__} for the in-place variant. +binary operator, and \method{__iadd__()} for the in-place variant. \item From fdrake at users.sourceforge.net Wed Sep 7 07:00:00 2005 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 7 Sep 2005 07:00:00 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex, 1.121.2.8, 1.121.2.9 Message-ID: <20050907050000.D7DDB1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5312/ref Modified Files: Tag: release24-maint ref3.tex Log Message: - fix typo report by email, only 1.5 years late - fix several consistency nits relating to \method{...()} (backport of trunk revision 1.130) Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.121.2.8 retrieving revision 1.121.2.9 diff -u -d -r1.121.2.8 -r1.121.2.9 --- ref3.tex 4 Sep 2005 18:30:44 -0000 1.121.2.8 +++ ref3.tex 7 Sep 2005 04:59:57 -0000 1.121.2.9 @@ -326,7 +326,7 @@ \function{ord()}\bifuncindex{ord} convert between code units and nonnegative integers representing the Unicode ordinals as defined in the Unicode Standard 3.0. Conversion from and to other encodings are -possible through the Unicode method \method{encode} and the built-in +possible through the Unicode method \method{encode()} and the built-in function \function{unicode()}.\bifuncindex{unicode} \obindex{unicode} \index{character} @@ -1208,8 +1208,8 @@ There are no implied relationships among the comparison operators. The truth of \code{\var{x}==\var{y}} does not imply that \code{\var{x}!=\var{y}} -is false. Accordingly, when defining \method{__eq__}, one should also -define \method{__ne__} so that the operators will behave as expected. +is false. Accordingly, when defining \method{__eq__()}, one should also +define \method{__ne__()} so that the operators will behave as expected. There are no reflected (swapped-argument) versions of these methods (to be used when the left argument does not support the operation but @@ -1338,7 +1338,7 @@ \begin{methoddesc}[object]{__getattribute__}{self, name} Called unconditionally to implement attribute accesses for instances -of the class. If the class also defines \method{__getattr__}, the latter +of the class. If the class also defines \method{__getattr__()}, the latter will not be called unless \method{__getattribute__()} either calls it explicitly or raises an \exception{AttributeError}. This method should return the (computed) attribute @@ -1905,7 +1905,7 @@ \var{x}\code{+=}\var{y}, where \var{x} is an instance of a class that has an \method{__iadd__()} method, \code{\var{x}.__iadd__(\var{y})} is called. If \var{x} is an instance of a class that does not define a -\method{__iadd()} method, \code{\var{x}.__add__(\var{y})} and +\method{__iadd__()} method, \code{\var{x}.__add__(\var{y})} and \code{\var{y}.__radd__(\var{x})} are considered, as with the evaluation of \var{x}\code{+}\var{y}. \end{methoddesc} @@ -1988,10 +1988,10 @@ Below, \method{__op__()} and \method{__rop__()} are used to signify the generic method names corresponding to an operator; -\method{__iop__} is used for the corresponding in-place operator. For +\method{__iop__()} is used for the corresponding in-place operator. For example, for the operator `\code{+}', \method{__add__()} and \method{__radd__()} are used for the left and right variant of the -binary operator, and \method{__iadd__} for the in-place variant. +binary operator, and \method{__iadd__()} for the in-place variant. \item From fdrake at users.sourceforge.net Wed Sep 7 07:17:10 2005 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 7 Sep 2005 07:17:10 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/ref ref6.tex,1.76,1.77 Message-ID: <20050907051710.C27031E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7313/ref Modified Files: ref6.tex Log Message: note that the return and yield statements cannot be used at the top level in exec statements; people coming from certain other languages seem to be confused by this on a regular basis Index: ref6.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref6.tex,v retrieving revision 1.76 retrieving revision 1.77 diff -u -d -r1.76 -r1.77 --- ref6.tex 28 Apr 2005 07:18:47 -0000 1.76 +++ ref6.tex 7 Sep 2005 05:17:07 -0000 1.77 @@ -873,7 +873,12 @@ a code object. If it is a string, the string is parsed as a suite of Python statements which is then executed (unless a syntax error occurs). If it is an open file, the file is parsed until \EOF{} and -executed. If it is a code object, it is simply executed. +executed. If it is a code object, it is simply executed. In all +cases, the code that's executed is expected to be be valid as file +input (see section~\ref{file-input}, ``File input''). Be aware that +the \keyword{return} and \keyword{yield} statements may not be used +outside of function definitions even within the context of code passed +to the \keyword{exec} statement. In all cases, if the optional parts are omitted, the code is executed in the current scope. If only the first expression after \keyword{in} From fdrake at users.sourceforge.net Wed Sep 7 07:18:09 2005 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 7 Sep 2005 07:18:09 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/ref ref6.tex, 1.73.2.3, 1.73.2.4 Message-ID: <20050907051809.6E2681E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7497/ref Modified Files: Tag: release24-maint ref6.tex Log Message: note that the return and yield statements cannot be used at the top level in exec statements; people coming from certain other languages seem to be confused by this on a regular basis (backported from trunk revision 1.77) Index: ref6.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref6.tex,v retrieving revision 1.73.2.3 retrieving revision 1.73.2.4 diff -u -d -r1.73.2.3 -r1.73.2.4 --- ref6.tex 28 Apr 2005 07:19:39 -0000 1.73.2.3 +++ ref6.tex 7 Sep 2005 05:18:06 -0000 1.73.2.4 @@ -873,7 +873,12 @@ a code object. If it is a string, the string is parsed as a suite of Python statements which is then executed (unless a syntax error occurs). If it is an open file, the file is parsed until \EOF{} and -executed. If it is a code object, it is simply executed. +executed. If it is a code object, it is simply executed. In all +cases, the code that's executed is expected to be be valid as file +input (see section~\ref{file-input}, ``File input''). Be aware that +the \keyword{return} and \keyword{yield} statements may not be used +outside of function definitions even within the context of code passed +to the \keyword{exec} statement. In all cases, if the optional parts are omitted, the code is executed in the current scope. If only the first expression after \keyword{in} From perky at users.sourceforge.net Wed Sep 7 09:40:08 2005 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed, 7 Sep 2005 09:40:08 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib telnetlib.py,1.24,1.25 Message-ID: <20050907074008.F06B41E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30905 Modified Files: telnetlib.py Log Message: Quote docstring with r"" to keep '\r\n' in example code. Index: telnetlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/telnetlib.py,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- telnetlib.py 12 Feb 2004 17:35:07 -0000 1.24 +++ telnetlib.py 7 Sep 2005 07:40:05 -0000 1.25 @@ -1,4 +1,4 @@ -"""TELNET client class. +r"""TELNET client class. Based on RFC 854: TELNET Protocol Specification, by J. Postel and J. Reynolds From bcannon at users.sourceforge.net Thu Sep 8 02:26:23 2005 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu, 8 Sep 2005 02:26:23 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep-3000.txt,1.19,1.20 Message-ID: <20050908002623.AA3981E4002@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1483 Modified Files: pep-3000.txt Log Message: Change reference for removing 'print' as a statement. Thanks Bill Janssen for digging up the link. Index: pep-3000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-3000.txt,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- pep-3000.txt 27 Aug 2005 18:27:33 -0000 1.19 +++ pep-3000.txt 8 Sep 2005 00:26:20 -0000 1.20 @@ -49,8 +49,7 @@ * Support only new-style classes; classic classes will be gone [1]_ * Return iterators instead of lists where appropriate for atomic type methods (e.g. ``dict.keys()``, ``dict.values()``, ``dict.items()``, etc.) -* Replace ``print`` by a function: ``write(x,y,z)``, - ``writeln(x,y,z)`` [2]_ +* Replace ``print`` by a function [16]_ * Do something so you can catch multiple exceptions using ``except E1, E2, E3:``. Maybe use ``except E1, E2, E3 as err:`` if you want the error variable? [3]_ @@ -169,6 +168,9 @@ .. [15] python-dev email (Remove str.find in 3.0?) http://mail.python.org/pipermail/python-dev/2005-August/055705.html +.. [16] python-dev email (Replacement for print in Python 3.0) + http://mail.python.org/pipermail/python-dev/2005-September/056154.html + Copyright ========= From vsajip at users.sourceforge.net Thu Sep 8 20:14:19 2005 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Thu, 8 Sep 2005 20:14:19 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/logging __init__.py, 1.28, 1.29 Message-ID: <20050908181419.5CE231E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30247 Modified Files: __init__.py Log Message: Added _handlerList to allow shutdown to flush and close handlers in reverse order of creation (see SF# 1282539) Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/__init__.py,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- __init__.py 2 Sep 2005 11:20:33 -0000 1.28 +++ __init__.py 8 Sep 2005 18:14:16 -0000 1.29 @@ -544,6 +544,7 @@ #--------------------------------------------------------------------------- _handlers = {} #repository of handlers (for flushing when shutdown called) +_handlerList = [] # added to allow handlers to be removed in reverse of order initialized class Handler(Filterer): """ @@ -566,6 +567,7 @@ _acquireLock() try: #unlikely to raise an exception, but you never know... _handlers[self] = 1 + _handlerList.insert(0, self) finally: _releaseLock() self.createLock() @@ -668,6 +670,7 @@ _acquireLock() try: #unlikely to raise an exception, but you never know... del _handlers[self] + _handlerList.remove(self) finally: _releaseLock() @@ -1307,7 +1310,7 @@ Should be called at application exit. """ - for h in _handlers.keys(): + for h in _handlerList[:]: # was _handlers.keys(): #errors might occur, for example, if files are locked #we just ignore them try: From rhettinger at users.sourceforge.net Sat Sep 10 00:27:17 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 10 Sep 2005 00:27:17 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.168,1.169 Message-ID: <20050909222717.868D41E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21536 Modified Files: urllib.py Log Message: SF #1285086: urllib.quote is too slow Simplify and speed-up quote() function. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.168 retrieving revision 1.169 diff -u -d -r1.168 -r1.169 --- urllib.py 26 Aug 2005 08:51:34 -0000 1.168 +++ urllib.py 9 Sep 2005 22:27:13 -0000 1.169 @@ -1076,22 +1076,7 @@ always_safe = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' '0123456789' '_.-') - -_fast_safe_test = always_safe + '/' -_fast_safe = None - -def _fast_quote(s): - global _fast_safe - if _fast_safe is None: - _fast_safe = {} - for c in _fast_safe_test: - _fast_safe[c] = c - res = list(s) - for i in range(len(res)): - c = res[i] - if not c in _fast_safe: - res[i] = '%%%02X' % ord(c) - return ''.join(res) +_safemaps = {} def quote(s, safe = '/'): """quote('abc def') -> 'abc%20def' @@ -1114,14 +1099,17 @@ called on a path where the existing slash characters are used as reserved characters. """ - safe = always_safe + safe - if _fast_safe_test == safe: - return _fast_quote(s) - res = list(s) - for i in range(len(res)): - c = res[i] - if c not in safe: - res[i] = '%%%02X' % ord(c) + cachekey = (safe, always_safe) + try: + safe_map = _safemaps[cachekey] + except KeyError: + safe += always_safe + safe_map = {} + for i in range(256): + c = chr(i) + safe_map[c] = (c in safe) and c or ('%%%02X' % i) + _safemaps[cachekey] = safe_map + res = map(safe_map.__getitem__, s) return ''.join(res) def quote_plus(s, safe = ''): From rhettinger at users.sourceforge.net Sat Sep 10 04:27:44 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 10 Sep 2005 04:27:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.169,1.170 Message-ID: <20050910022744.A46E21E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3622 Modified Files: urllib.py Log Message: Simplify and speed-up quote_plus(). Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.169 retrieving revision 1.170 diff -u -d -r1.169 -r1.170 --- urllib.py 9 Sep 2005 22:27:13 -0000 1.169 +++ urllib.py 10 Sep 2005 02:27:41 -0000 1.170 @@ -1115,12 +1115,9 @@ def quote_plus(s, safe = ''): """Quote the query fragment of a URL; replacing ' ' with '+'""" if ' ' in s: - l = s.split(' ') - for i in range(len(l)): - l[i] = quote(l[i], safe) - return '+'.join(l) - else: - return quote(s, safe) + s = s.replace(' ', '+') + safe += '+' + return quote(s, safe) def urlencode(query,doseq=0): """Encode a sequence of two-element tuples or dictionary into a URL query string. From rhettinger at users.sourceforge.net Sat Sep 10 08:49:07 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 10 Sep 2005 08:49:07 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.170,1.171 Message-ID: <20050910064907.865781E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5027 Modified Files: urllib.py Log Message: Simplify and speed-up unquote(). Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.170 retrieving revision 1.171 diff -u -d -r1.170 -r1.171 --- urllib.py 10 Sep 2005 02:27:41 -0000 1.170 +++ urllib.py 10 Sep 2005 06:49:04 -0000 1.171 @@ -1049,23 +1049,18 @@ return selector[1], selector[2:] return None, selector +_hextochr = dict(('%02x' % i, chr(i)) for i in range(256)) +_hextochr.update(('%02X' % i, chr(i)) for i in range(256)) + def unquote(s): """unquote('abc%20def') -> 'abc def'.""" - mychr = chr - myatoi = int - list = s.split('%') - res = [list[0]] - myappend = res.append - del list[0] - for item in list: - if item[1:2]: - try: - myappend(mychr(myatoi(item[:2], 16)) - + item[2:]) - except ValueError: - myappend('%' + item) - else: - myappend('%' + item) + res = s.split('%') + for i in xrange(1, len(res)): + item = res[i] + try: + res[i] = _hextochr[item[:2]] + item[2:] + except KeyError: + res[i] = '%' + item return "".join(res) def unquote_plus(s): From rhettinger at users.sourceforge.net Sat Sep 10 16:30:12 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 10 Sep 2005 16:30:12 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.171,1.172 Message-ID: <20050910143012.E3AE21E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16867 Modified Files: urllib.py Log Message: Revert 1.170. Add tests. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.171 retrieving revision 1.172 diff -u -d -r1.171 -r1.172 --- urllib.py 10 Sep 2005 06:49:04 -0000 1.171 +++ urllib.py 10 Sep 2005 14:30:09 -0000 1.172 @@ -1110,9 +1110,12 @@ def quote_plus(s, safe = ''): """Quote the query fragment of a URL; replacing ' ' with '+'""" if ' ' in s: - s = s.replace(' ', '+') - safe += '+' - return quote(s, safe) + l = s.split(' ') + for i in range(len(l)): + l[i] = quote(l[i], safe) + return '+'.join(l) + else: + return quote(s, safe) def urlencode(query,doseq=0): """Encode a sequence of two-element tuples or dictionary into a URL query string. From rhettinger at users.sourceforge.net Sat Sep 10 16:30:12 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 10 Sep 2005 16:30:12 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_urllib.py, 1.17, 1.18 Message-ID: <20050910143012.F16931E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16867/test Modified Files: test_urllib.py Log Message: Revert 1.170. Add tests. Index: test_urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib.py,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- test_urllib.py 26 Aug 2005 08:51:34 -0000 1.17 +++ test_urllib.py 10 Sep 2005 14:30:09 -0000 1.18 @@ -353,6 +353,12 @@ self.assertEqual(expect, result, "using quote_plus(): %s != %s" % (expect, result)) + def test_quoting_plus(self): + self.assertEqual(urllib.quote_plus('alpha+beta gamma'), + 'alpha%2Bbeta+gamma') + self.assertEqual(urllib.quote_plus('alpha+beta gamma', '+'), + 'alpha+beta+gamma') + class UnquotingTests(unittest.TestCase): """Tests for unquote() and unquote_plus() From rhettinger at users.sourceforge.net Sat Sep 10 20:17:57 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 10 Sep 2005 20:17:57 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.172,1.173 Message-ID: <20050910181757.7DDDF1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26841 Modified Files: urllib.py Log Message: Corrected version of 1.170 Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.172 retrieving revision 1.173 diff -u -d -r1.172 -r1.173 --- urllib.py 10 Sep 2005 14:30:09 -0000 1.172 +++ urllib.py 10 Sep 2005 18:17:54 -0000 1.173 @@ -1110,12 +1110,9 @@ def quote_plus(s, safe = ''): """Quote the query fragment of a URL; replacing ' ' with '+'""" if ' ' in s: - l = s.split(' ') - for i in range(len(l)): - l[i] = quote(l[i], safe) - return '+'.join(l) - else: - return quote(s, safe) + s = quote(s, safe + ' ') + return s.replace(' ', '+') + return quote(s, safe) def urlencode(query,doseq=0): """Encode a sequence of two-element tuples or dictionary into a URL query string. From rhettinger at users.sourceforge.net Sun Sep 11 18:34:09 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 11 Sep 2005 18:34:09 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib tarfile.py,1.32,1.33 Message-ID: <20050911163409.F329F1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30179 Modified Files: tarfile.py Log Message: Minor cleanup. Index: tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tarfile.py,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- tarfile.py 27 Aug 2005 10:07:56 -0000 1.32 +++ tarfile.py 11 Sep 2005 16:34:05 -0000 1.33 @@ -2012,8 +2012,7 @@ raise ValueError, "unknown compression constant" if mode[0:1] == "r": members = self.tarfile.getmembers() - for i in xrange(len(members)): - m = members[i] + for m in members: m.filename = m.name m.file_size = m.size m.date_time = time.gmtime(m.mtime)[:6] From rhettinger at users.sourceforge.net Sun Sep 11 20:21:56 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 11 Sep 2005 20:21:56 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib libdecimal.tex, 1.29, 1.30 Message-ID: <20050911182156.3417F1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16988 Modified Files: libdecimal.tex Log Message: Add FAQ entry regarding non-expoential representation. Index: libdecimal.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdecimal.tex,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- libdecimal.tex 22 Aug 2005 19:35:17 -0000 1.29 +++ libdecimal.tex 11 Sep 2005 18:21:52 -0000 1.30 @@ -32,7 +32,7 @@ For this reason, decimal would be preferred in accounting applications which have strict equality invariants. -\item The decimal module incorporates notion of significant places so that +\item The decimal module incorporates a notion of significant places so that \samp{1.30 + 1.20} is \constant{2.50}. The trailing zero is kept to indicate significance. This is the customary presentation for monetary applications. For multiplication, the ``schoolbook'' approach uses all the figures in the @@ -1141,7 +1141,7 @@ \end{verbatim} -Q. In a fixed-point application to two decimal places, some inputs +Q. In a fixed-point application with two decimal places, some inputs have many places and need to be rounded. Others are not supposed to have excess digits and need to be validated. What methods should be used? @@ -1189,6 +1189,15 @@ \end{verbatim} +Q. Some decimal values always print with exponential notation. Is there +a way to get a non-exponential representation? + +A. For some values, exponential notation is the only way to express +the number of significant places in the coefficient. For example, +expressing \constant{5.0E+3} as \constant{5000} keeps the value +constant but cannot show the original's two-place significance. + + Q. Is there a way to convert a regular float to a \class{Decimal}? A. Yes, all binary floating point numbers can be exactly expressed as a From rhettinger at users.sourceforge.net Sun Sep 11 20:29:49 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 11 Sep 2005 20:29:49 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib libdecimal.tex, 1.24.2.4, 1.24.2.5 Message-ID: <20050911182949.645071E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18600 Modified Files: Tag: release24-maint libdecimal.tex Log Message: Add FAQ entry regarding non-expoential representation. Index: libdecimal.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdecimal.tex,v retrieving revision 1.24.2.4 retrieving revision 1.24.2.5 diff -u -d -r1.24.2.4 -r1.24.2.5 --- libdecimal.tex 22 Aug 2005 19:35:24 -0000 1.24.2.4 +++ libdecimal.tex 11 Sep 2005 18:29:46 -0000 1.24.2.5 @@ -32,7 +32,7 @@ For this reason, decimal would be preferred in accounting applications which have strict equality invariants. -\item The decimal module incorporates notion of significant places so that +\item The decimal module incorporates a notion of significant places so that \samp{1.30 + 1.20} is \constant{2.50}. The trailing zero is kept to indicate significance. This is the customary presentation for monetary applications. For multiplication, the ``schoolbook'' approach uses all the figures in the @@ -1141,7 +1141,7 @@ \end{verbatim} -Q. In a fixed-point application to two decimal places, some inputs +Q. In a fixed-point application with two decimal places, some inputs have many places and need to be rounded. Others are not supposed to have excess digits and need to be validated. What methods should be used? @@ -1189,6 +1189,15 @@ \end{verbatim} +Q. Some decimal values always print with exponential notation. Is there +a way to get a non-exponential representation? + +A. For some values, exponential notation is the only way to express +the number of significant places in the coefficient. For example, +expressing \constant{5.0E+3} as \constant{5000} keeps the value +constant but cannot show the original's two-place significance. + + Q. Is there a way to convert a regular float to a \class{Decimal}? A. Yes, all binary floating point numbers can be exactly expressed as a From akuchling at users.sourceforge.net Mon Sep 12 14:44:00 2005 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 12 Sep 2005 14:44:00 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.279,1.280 Message-ID: <20050912124400.E97F01E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18082 Modified Files: tut.tex Log Message: Update link Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.279 retrieving revision 1.280 diff -u -d -r1.279 -r1.280 --- tut.tex 23 Aug 2005 18:26:00 -0000 1.279 +++ tut.tex 12 Sep 2005 12:43:57 -0000 1.280 @@ -5302,7 +5302,7 @@ announcing new modules. Before posting, be sure to check the list of \ulink{Frequently Asked Questions}{http://www.python.org/doc/faq/} (also called the FAQ), or look for it in the \file{Misc/} directory of the Python source distribution. Mailing -list archives are available at \url{http://www.python.org/pipermail/}. +list archives are available at \url{http://mail.python.org/pipermail/}. The FAQ answers many of the questions that come up again and again, and may already contain the solution for your problem. From akuchling at users.sourceforge.net Mon Sep 12 14:44:23 2005 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 12 Sep 2005 14:44:23 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.280,1.281 Message-ID: <20050912124423.DFB621E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18173 Modified Files: tut.tex Log Message: Update link Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.280 retrieving revision 1.281 diff -u -d -r1.280 -r1.281 --- tut.tex 12 Sep 2005 12:43:57 -0000 1.280 +++ tut.tex 12 Sep 2005 12:44:20 -0000 1.281 @@ -5282,10 +5282,8 @@ code, documentation, and pointers to Python-related pages around the Web. This Web site is mirrored in various places around the world, such as Europe, Japan, and Australia; a mirror may be faster -than the main site, depending on your geographical location. A more -informal site is \url{http://starship.python.net/}, which contains a -bunch of Python-related personal home pages; many people have -downloadable software there. Many more user-created Python modules +than the main site, depending on your geographical location. +Many more user-created Python modules can be found in the \ulink{Python Package Index}{http://www.python.org/pypi} (PyPI). From akuchling at users.sourceforge.net Mon Sep 12 14:45:41 2005 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 12 Sep 2005 14:45:41 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.281,1.282 Message-ID: <20050912124541.7D2AF1E4177@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18418 Modified Files: tut.tex Log Message: Shorten run-on sentence Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.281 retrieving revision 1.282 diff -u -d -r1.281 -r1.282 --- tut.tex 12 Sep 2005 12:44:20 -0000 1.281 +++ tut.tex 12 Sep 2005 12:45:37 -0000 1.282 @@ -5272,7 +5272,7 @@ which gives complete (though terse) reference material about types, functions, and modules that can save you a lot of time when writing Python programs. The standard Python distribution includes a -\emph{lot} of code in both C and Python; there are modules to read +\emph{lot} of additional code. There are modules to read \UNIX{} mailboxes, retrieve documents via HTTP, generate random numbers, parse command-line options, write CGI programs, compress data, and a lot more; skimming through the Library Reference will give From birkenfeld at users.sourceforge.net Mon Sep 12 14:49:41 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Mon, 12 Sep 2005 14:49:41 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.130,1.131 Message-ID: <20050912124941.5BAEF1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19101/Doc/ref Modified Files: ref3.tex Log Message: Better wording for integer ref entry. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.130 retrieving revision 1.131 diff -u -d -r1.130 -r1.131 --- ref3.tex 7 Sep 2005 04:57:56 -0000 1.130 +++ ref3.tex 12 Sep 2005 12:49:38 -0000 1.131 @@ -165,8 +165,8 @@ \begin{description} \item[Integers] -These represent elements from the mathematical set of whole numbers -(positive and negative ones). +These represent elements from the mathematical set of integers +(positive and negative). \obindex{integer} There are three types of integers: From birkenfeld at users.sourceforge.net Mon Sep 12 14:56:50 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Mon, 12 Sep 2005 14:56:50 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex, 1.121.2.9, 1.121.2.10 Message-ID: <20050912125650.730181E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20158/Doc/ref Modified Files: Tag: release24-maint ref3.tex Log Message: Better wording for integer ref entry (from HEAD 1.131). Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.121.2.9 retrieving revision 1.121.2.10 diff -u -d -r1.121.2.9 -r1.121.2.10 --- ref3.tex 7 Sep 2005 04:59:57 -0000 1.121.2.9 +++ ref3.tex 12 Sep 2005 12:56:47 -0000 1.121.2.10 @@ -165,8 +165,8 @@ \begin{description} \item[Integers] -These represent elements from the mathematical set of whole numbers -(positive and negative ones). +These represent elements from the mathematical set of integers +(positive and negative). \obindex{integer} There are three types of integers: From rhettinger at users.sourceforge.net Tue Sep 13 00:50:40 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 13 Sep 2005 00:50:40 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib sre.py,1.51,1.52 Message-ID: <20050912225040.9FFE91E4006@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7880 Modified Files: sre.py Log Message: Speed-up escape() Index: sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre.py,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- sre.py 24 Sep 2004 03:41:05 -0000 1.51 +++ sre.py 12 Sep 2005 22:50:37 -0000 1.52 @@ -188,12 +188,18 @@ "Compile a template pattern, returning a pattern object" return _compile(pattern, flags|T) +_alphanum = {} +for c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890': + _alphanum[c] = 1 +del c + def escape(pattern): "Escape all non-alphanumeric characters in pattern." s = list(pattern) + alphanum = _alphanum for i in range(len(pattern)): c = pattern[i] - if not ("a" <= c <= "z" or "A" <= c <= "Z" or "0" <= c <= "9"): + if c not in alphanum: if c == "\000": s[i] = "\\000" else: From akuchling at users.sourceforge.net Tue Sep 13 21:56:12 2005 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 Sep 2005 21:56:12 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.282,1.283 Message-ID: <20050913195612.416C81E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20220 Modified Files: tut.tex Log Message: Add more links to the 'What Next?' section; rewrite to be briefer Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.282 retrieving revision 1.283 diff -u -d -r1.282 -r1.283 --- tut.tex 12 Sep 2005 12:45:37 -0000 1.282 +++ tut.tex 13 Sep 2005 19:56:06 -0000 1.283 @@ -5265,27 +5265,61 @@ Reading this tutorial has probably reinforced your interest in using Python --- you should be eager to apply Python to solving your -real-world problems. Now what should you do? +real-world problems. Where should you go to learn more? -You should read, or at least page through, the -\citetitle[../lib/lib.html]{Python Library Reference}, -which gives complete (though terse) reference material about types, -functions, and modules that can save you a lot of time when writing -Python programs. The standard Python distribution includes a -\emph{lot} of additional code. There are modules to read -\UNIX{} mailboxes, retrieve documents via HTTP, generate random -numbers, parse command-line options, write CGI programs, compress -data, and a lot more; skimming through the Library Reference will give -you an idea of what's available. +This tutorial is part of Python's documentation set. +Some other documents in the set are: -The major Python Web site is \url{http://www.python.org/}; it contains +\begin{itemize} + +\item \citetitle[../lib/lib.html]{Python Library Reference}: + +You should browse through this manual, which gives complete (though +terse) reference material about types, functions, and the modules in +the standard library. The standard Python distribution includes a +\emph{lot} of additional code. There are modules to read \UNIX{} +mailboxes, retrieve documents via HTTP, generate random numbers, parse +command-line options, write CGI programs, compress data, and many other tasks. +Skimming through the Library Reference will give you an idea of +what's available. + +\item \citetitle[../inst/inst.html]{Installing Python Modules} +explains how to install external modules written by other Python +users. + +\item \citetitle[../ref/ref.html]{Language Reference}: A detailed +explanation of Python's syntax and semantics. It's heavy reading, +but is useful as a + +\end{itemize} + +More Python resources: + +\begin{itemize} + +\item \url{http://www.python.org}: The major Python Web site. It contains code, documentation, and pointers to Python-related pages around the Web. This Web site is mirrored in various places around the world, such as Europe, Japan, and Australia; a mirror may be faster than the main site, depending on your geographical location. -Many more user-created Python modules -can be found in the \ulink{Python Package -Index}{http://www.python.org/pypi} (PyPI). + +\item \url{http://docs.python.org}: Fast access to Python's +documentation. + +\item \url{http://cheeseshop.python.org}: +The Python Package Index, nicknamed the Cheese Shop, +is an index of user-created Python modules that are available for +download. Once you begin releasing code, you can register it +here so that others can find it. + +\item \url{http://aspn.activestate.com/ASPN/Python/Cookbook/}: The +Python Cookbook is a sizable collection of code examples, larger +modules, and useful scripts. Particularly notable contributions are +collected in a book also titled \citetitle{Python Cookbook} (O'Reilly +\& Associates, ISBN 0-596-00797-3.) + +\end{itemize} + For Python-related questions and problem reports, you can post to the newsgroup \newsgroup{comp.lang.python}, or send them to the mailing From pje at users.sourceforge.net Wed Sep 14 05:28:13 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Wed, 14 Sep 2005 05:28:13 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools package_index.py, 1.19, 1.20 Message-ID: <20050914032813.79B641E4002@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25736/setuptools Modified Files: package_index.py Log Message: Correctly handle URL fragments in --find-links. Index: package_index.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/package_index.py,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- package_index.py 22 Aug 2005 01:13:14 -0000 1.19 +++ package_index.py 14 Sep 2005 03:28:10 -0000 1.20 @@ -44,6 +44,7 @@ scheme, server, path, parameters, query, fragment = urlparse.urlparse(url) base = urllib2.unquote(path.split('/')[-1]) + if '#' in base: base, fragment = base.split('#',1) dists = distros_for_location(url, base, metadata) if fragment and not dists: match = EGG_FRAGMENT.match(fragment) @@ -79,7 +80,6 @@ return [] # no extension matched - def distros_for_filename(filename, metadata=None): """Yield possible egg or source distribution objects based on a filename""" return distros_for_location( From pje at users.sourceforge.net Wed Sep 14 05:33:53 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Wed, 14 Sep 2005 05:33:53 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools ez_setup.py, 1.26, 1.27 pkg_resources.txt, 1.13, 1.14 setup.cfg, 1.3, 1.4 Message-ID: <20050914033353.5EE3D1E4002@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26623 Modified Files: ez_setup.py pkg_resources.txt setup.cfg Log Message: 0.6a1 release of setuptools. Index: ez_setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/ez_setup.py,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- ez_setup.py 3 Sep 2005 05:01:12 -0000 1.26 +++ ez_setup.py 14 Sep 2005 03:33:49 -0000 1.27 @@ -13,12 +13,16 @@ This file can also be run as a script to install or upgrade setuptools. """ -DEFAULT_VERSION = "0.6a1c2" +DEFAULT_VERSION = "0.6a1" DEFAULT_URL = "http://www.python.org/packages/source/s/setuptools/" md5_data = { 'setuptools-0.5a13-py2.3.egg': '85edcf0ef39bab66e130d3f38f578c86', 'setuptools-0.5a13-py2.4.egg': 'ede4be600e3890e06d4ee5e0148e092a', + 'setuptools-0.6a1-py2.3.egg': 'ee819a13b924d9696b0d6ca6d1c5833d', + 'setuptools-0.6a1-py2.4.egg': '8256b5f1cd9e348ea6877b5ddd56257d', + 'setuptools-0.6a1c1-py2.3.egg': '1eaf2ca9fb2417977d5b5042dc50e1f4', + 'setuptools-0.6a1c1-py2.4.egg': '5baad71652b3047756ba1dcbf721b1ee', 'setuptools-0.6a1c2-py2.3.egg': '92291ca957044306d96a7b8589c01d87', 'setuptools-0.6a1c2-py2.4.egg': '5ae6405341eddb5baf93cd6ab178efb1', } Index: pkg_resources.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- pkg_resources.txt 22 Aug 2005 03:40:20 -0000 1.13 +++ pkg_resources.txt 14 Sep 2005 03:33:49 -0000 1.14 @@ -18,16 +18,82 @@ Overview -------- -This section isn't written yet. For now, please check out the extensive `API -Reference`_ below. +Eggs are a distribution format for Python modules, similar in concept to Java's +"jars" or Ruby's "gems". They differ from previous Python distribution formats +in that they are importable (i.e. they can be added to ``sys.path``), and they +are *discoverable*, meaning that they carry metadata that unambiguously +identifies their contents and dependencies, and thus can be *automatically* +found and added to ``sys.path`` in response to simple requests of the form, +"get me everything I need to use docutils' PDF support". +The ``pkg_resources`` module provides runtime facilities for finding, +introspecting, activating and using eggs and other "pluggable" distribution +formats. Because these are new concepts in Python (and not that well- +established in other languages either), it helps to have a few special terms +for talking about eggs and how they can be used: ------------------ -Developer's Guide ------------------ +project + A library, framework, script, plugin, application, or collection of data + or other resources, or some combination thereof. Projects are assumed to + have "relatively unique" names, e.g. names registered with PyPI. -This section isn't written yet. Currently planned topics include:: +release + A snapshot of a project at a particular point in time, denoted by a version + identifier. + +distribution + A file or files that represent a particular release. + +importable distribution + A file or directory that, if placed on ``sys.path``, allows Python to + import any modules contained within it. + +pluggable distribution + An importable distribution whose filename unambiguously identifies its + release (i.e. project and version), and whose contents unamabiguously + specify what releases of other projects will satisfy its runtime + requirements. +extra + An "extra" is an optional feature of a release, that may impose additional + runtime requirements. For example, if docutils PDF support required a + PDF support library to be present, docutils could define its PDF support as + an "extra", and list what other project releases need to be available in + order to provide it. + +environment + A collection of distributions potentially available for importing, but not + necessarily active. More than one distribution (i.e. release version) for + a given project may be present in an environment. + +working set + A collection of distributions actually available for importing, as on + ``sys.path``. At most one distribution (release version) of a given + project may be present in a working set, as otherwise there would be + ambiguity as to what to import. + +eggs + Eggs are pluggable distributions in one of the three formats currently + supported by ``pkg_resources``. There are built eggs, development eggs, + and egg links. Built eggs are directories or zipfiles whose name ends + with ``.egg`` and follows the egg naming conventions, and contain an + ``EGG-INFO`` subdirectory (zipped or otherwise). Development eggs are + normal directories of Python code with one or more ``ProjectName.egg-info`` + subdirectories. And egg links are ``*.egg-link`` files that contain the + name of a built or development egg, to support symbolic linking on + platforms that do not have native symbolic links. + +(For more information about these terms and concepts, see also this +`architectural overview`_ of ``pkg_resources`` and Python Eggs in general.) + +.. _architectural overview: http://mail.python.org/pipermail/distutils-sig/2005-June/004652.html + + +.. ----------------- +.. Developer's Guide +.. ----------------- + +.. This section isn't written yet. Currently planned topics include Accessing Resources Finding and Activating Package Distributions get_provider() @@ -43,8 +109,7 @@ Metadata access Extended Discovery and Installation Supporting Custom PEP 302 Implementations - -For now, please check out the extensive `API Reference`_ below. +.. For now, please check out the extensive `API Reference`_ below. ------------- Index: setup.cfg =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setup.cfg,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- setup.cfg 3 Sep 2005 05:01:12 -0000 1.3 +++ setup.cfg 14 Sep 2005 03:33:49 -0000 1.4 @@ -1,6 +1,3 @@ -[egg_info] -tag-build=c2 - [aliases] binary = bdist_egg upload --show-response develop = develop From birkenfeld at users.sourceforge.net Wed Sep 14 08:56:23 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 08:56:23 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python import.c,2.242,2.243 Message-ID: <20050914065623.C11EC1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24343/Python Modified Files: import.c Log Message: Patch #1290454: Fix reload() error message when parent module is not in sys.modules. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.242 retrieving revision 2.243 diff -u -d -r2.242 -r2.243 --- import.c 3 Jun 2005 14:41:54 -0000 2.242 +++ import.c 14 Sep 2005 06:56:20 -0000 2.243 @@ -2288,13 +2288,14 @@ if (parentname == NULL) return NULL; parent = PyDict_GetItem(modules, parentname); - Py_DECREF(parentname); if (parent == NULL) { PyErr_Format(PyExc_ImportError, "reload(): parent %.200s not in sys.modules", - name); + PyString_AS_STRING(parentname)); + Py_DECREF(parentname); return NULL; } + Py_DECREF(parentname); subname++; path = PyObject_GetAttrString(parent, "__path__"); if (path == NULL) From birkenfeld at users.sourceforge.net Wed Sep 14 08:56:55 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 08:56:55 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python import.c,2.240,2.240.2.1 Message-ID: <20050914065655.1B4861E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24522/Python Modified Files: Tag: release24-maint import.c Log Message: Backport of patch #1290454: Fix reload() error message when parent is not in sys.modules. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.240 retrieving revision 2.240.2.1 diff -u -d -r2.240 -r2.240.2.1 --- import.c 7 Oct 2004 06:46:25 -0000 2.240 +++ import.c 14 Sep 2005 06:56:51 -0000 2.240.2.1 @@ -2298,13 +2298,14 @@ if (parentname == NULL) return NULL; parent = PyDict_GetItem(modules, parentname); - Py_DECREF(parentname); if (parent == NULL) { PyErr_Format(PyExc_ImportError, "reload(): parent %.200s not in sys.modules", - name); + PyString_AS_STRING(parentname)); + Py_DECREF(parentname); return NULL; } + Py_DECREF(parentname); subname++; path = PyObject_GetAttrString(parent, "__path__"); if (path == NULL) From niemeyer at users.sourceforge.net Wed Sep 14 10:54:42 2005 From: niemeyer at users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Wed, 14 Sep 2005 10:54:42 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1360,1.1361 Message-ID: <20050914085442.ABE5B1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21345/Misc Modified Files: NEWS Log Message: Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than considering it exactly like a '*'. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1360 retrieving revision 1.1361 diff -u -d -r1.1360 -r1.1361 --- NEWS 1 Sep 2005 12:04:29 -0000 1.1360 +++ NEWS 14 Sep 2005 08:54:39 -0000 1.1361 @@ -443,6 +443,10 @@ from the input stream, so that the output is a byte string in the correct encoding instead of a unicode string. +- Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than + considering it exactly like a '*'. + + Build ----- From niemeyer at users.sourceforge.net Wed Sep 14 10:54:42 2005 From: niemeyer at users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Wed, 14 Sep 2005 10:54:42 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_re.py,1.55,1.56 Message-ID: <20050914085442.B5EAA1E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21345/Lib/test Modified Files: test_re.py Log Message: Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than considering it exactly like a '*'. Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- test_re.py 3 Jun 2005 13:55:58 -0000 1.55 +++ test_re.py 14 Sep 2005 08:54:39 -0000 1.56 @@ -297,6 +297,9 @@ self.assertNotEqual(re.match("^x{1,4}?$", "xxx"), None) self.assertNotEqual(re.match("^x{3,4}?$", "xxx"), None) + self.assertEqual(re.match("^x{}$", "xxx"), None) + self.assertNotEqual(re.match("^x{}$", "x{}"), None) + def test_getattr(self): self.assertEqual(re.match("(a)", "a").pos, 0) self.assertEqual(re.match("(a)", "a").endpos, 1) From niemeyer at users.sourceforge.net Wed Sep 14 10:54:42 2005 From: niemeyer at users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Wed, 14 Sep 2005 10:54:42 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib sre_parse.py,1.64,1.65 Message-ID: <20050914085442.B8C231E4009@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21345/Lib Modified Files: sre_parse.py Log Message: Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than considering it exactly like a '*'. Index: sre_parse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_parse.py,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- sre_parse.py 28 Feb 2005 19:27:52 -0000 1.64 +++ sre_parse.py 14 Sep 2005 08:54:39 -0000 1.65 @@ -485,6 +485,9 @@ elif this == "+": min, max = 1, MAXREPEAT elif this == "{": + if source.next == "}": + subpatternappend((LITERAL, ord(this))) + continue here = source.tell() min, max = 0, MAXREPEAT lo = hi = "" From pje at users.sourceforge.net Wed Sep 14 18:41:27 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Wed, 14 Sep 2005 18:41:27 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools EasyInstall.txt, 1.58, 1.59 ez_setup.py, 1.27, 1.28 Message-ID: <20050914164127.597A91E40D0@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2672 Modified Files: EasyInstall.txt ez_setup.py Log Message: Update cheeseshop URL, fix typo. Index: EasyInstall.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/EasyInstall.txt,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- EasyInstall.txt 23 Aug 2005 13:45:50 -0000 1.58 +++ EasyInstall.txt 14 Sep 2005 16:41:23 -0000 1.59 @@ -788,7 +788,7 @@ * If you manually delete the current version of a package, the next run of EasyInstall against the target directory will now remove the stray entry - from the ``easy-install.pth``file. + from the ``easy-install.pth`` file. * EasyInstall now recognizes URLs with a ``#egg=project_name`` fragment ID as pointing to the named project's source checkout. Such URLs have a lower Index: ez_setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/ez_setup.py,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- ez_setup.py 14 Sep 2005 03:33:49 -0000 1.27 +++ ez_setup.py 14 Sep 2005 16:41:23 -0000 1.28 @@ -14,7 +14,7 @@ This file can also be run as a script to install or upgrade setuptools. """ DEFAULT_VERSION = "0.6a1" -DEFAULT_URL = "http://www.python.org/packages/source/s/setuptools/" +DEFAULT_URL = "http://cheeseshop.python.org/packages/source/s/setuptools/" md5_data = { 'setuptools-0.5a13-py2.3.egg': '85edcf0ef39bab66e130d3f38f578c86', From pje at users.sourceforge.net Wed Sep 14 18:45:11 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Wed, 14 Sep 2005 18:45:11 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools ez_setup.py, 1.28, 1.29 Message-ID: <20050914164511.164591E4003@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3547 Modified Files: ez_setup.py Log Message: Fix another typo Index: ez_setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/ez_setup.py,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- ez_setup.py 14 Sep 2005 16:41:23 -0000 1.28 +++ ez_setup.py 14 Sep 2005 16:45:07 -0000 1.29 @@ -69,7 +69,7 @@ ) sys.exit(2) except ImportError: - egg = download_setuptools(version, download_base, to_dir, dl_delay) + egg = download_setuptools(version, download_base, to_dir, download_delay) sys.path.insert(0, egg) import setuptools; setuptools.bootstrap_install_from = egg From montanaro at users.sourceforge.net Wed Sep 14 18:52:39 2005 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 14 Sep 2005 18:52:39 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib liblogging.tex, 1.33.2.3, 1.33.2.4 Message-ID: <20050914165239.0E5F71E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5034 Modified Files: Tag: release24-maint liblogging.tex Log Message: backport notes about basicConfig() changes to 2.4 branch Index: liblogging.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblogging.tex,v retrieving revision 1.33.2.3 retrieving revision 1.33.2.4 diff -u -d -r1.33.2.3 -r1.33.2.4 --- liblogging.tex 18 Aug 2005 21:53:19 -0000 1.33.2.3 +++ liblogging.tex 14 Sep 2005 16:52:35 -0000 1.33.2.4 @@ -258,13 +258,32 @@ it as a \class{LogRecord} instance at the receiving end. \end{funcdesc} -\begin{funcdesc}{basicConfig}{} +\begin{funcdesc}{basicConfig}{\optional{**kwargs}} Does basic configuration for the logging system by creating a \class{StreamHandler} with a default \class{Formatter} and adding it to the root logger. The functions \function{debug()}, \function{info()}, \function{warning()}, \function{error()} and \function{critical()} will call \function{basicConfig()} automatically if no handlers are defined for the root logger. + +\versionchanged[Formerly, \function{basicConfig} did not take any keyword +arguments]{2.4} + +The following keyword arguments are supported. + +\begin{tableii}{l|l}{code}{Format}{Description} +\lineii{filename}{Specifies that a FileHandler be created, using the +specified filename, rather than a StreamHandler.} +\lineii{filemode}{Specifies the mode to open the file, if filename is +specified (if filemode is unspecified, it defaults to 'a').} +\lineii{format}{Use the specified format string for the handler.} +\lineii{datefmt}{Use the specified date/time format.} +\lineii{level}{Set the root logger level to the specified level.} +\lineii{stream}{Use the specified stream to initialize the StreamHandler. +Note that this argument is incompatible with 'filename' - if both +are present, 'stream' is ignored.} +\end{tableii} + \end{funcdesc} \begin{funcdesc}{shutdown}{} @@ -415,6 +434,9 @@ \subsection{Basic example \label{minimal-example}} +\versionchanged[formerly \function{basicConfig} did not take any keyword +arguments]{2.4} + The \module{logging} package provides a lot of flexibility, and its configuration can appear daunting. This section demonstrates that simple use of the logging package is possible. From birkenfeld at users.sourceforge.net Wed Sep 14 19:24:44 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 19:24:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.118.2.1, 1.118.2.2 Message-ID: <20050914172444.4A82C1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14205/Doc/whatsnew Modified Files: Tag: release24-maint whatsnew24.tex Log Message: comma nit Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.118.2.1 retrieving revision 1.118.2.2 diff -u -d -r1.118.2.1 -r1.118.2.2 --- whatsnew24.tex 1 Jan 2005 00:34:56 -0000 1.118.2.1 +++ whatsnew24.tex 14 Sep 2005 17:24:41 -0000 1.118.2.2 @@ -1036,7 +1036,7 @@ \item The inner loops for list and tuple slicing were optimized and now run about one-third faster. The inner loops - for dictionaries were also optimized , resulting in performance boosts for + for dictionaries were also optimized, resulting in performance boosts for \method{keys()}, \method{values()}, \method{items()}, \method{iterkeys()}, \method{itervalues()}, and \method{iteritems()}. (Contributed by Raymond Hettinger.) From birkenfeld at users.sourceforge.net Wed Sep 14 19:25:06 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 19:25:06 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.129, 1.130 Message-ID: <20050914172506.337941E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14284/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: comma nit Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.129 retrieving revision 1.130 diff -u -d -r1.129 -r1.130 --- whatsnew24.tex 9 Jun 2005 15:57:32 -0000 1.129 +++ whatsnew24.tex 14 Sep 2005 17:25:02 -0000 1.130 @@ -1041,7 +1041,7 @@ \item The inner loops for list and tuple slicing were optimized and now run about one-third faster. The inner loops - for dictionaries were also optimized , resulting in performance boosts for + for dictionaries were also optimized, resulting in performance boosts for \method{keys()}, \method{values()}, \method{items()}, \method{iterkeys()}, \method{itervalues()}, and \method{iteritems()}. (Contributed by Raymond Hettinger.) From gvanrossum at users.sourceforge.net Wed Sep 14 19:49:57 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 19:49:57 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1361,1.1362 Message-ID: <20050914174957.D4AF61E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18898/Misc Modified Files: NEWS Log Message: - Changes donated by Elemental Security to make it work on HP-UX 11 on Itanium2 with HP's 64-bit compiler (SF patch #1225212). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1361 retrieving revision 1.1362 diff -u -d -r1.1361 -r1.1362 --- NEWS 14 Sep 2005 08:54:39 -0000 1.1361 +++ NEWS 14 Sep 2005 17:49:54 -0000 1.1362 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Changes donated by Elemental Security to make it work on HP-UX 11 on + Itanium2 with HP's 64-bit compiler (SF patch #1225212). + - Disallow keyword arguments for type constructors that don't use them (fixes bug #1119418). From gvanrossum at users.sourceforge.net Wed Sep 14 19:49:57 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 19:49:57 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Include pyport.h,2.70,2.71 Message-ID: <20050914174957.DDDA01E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18898/Include Modified Files: pyport.h Log Message: - Changes donated by Elemental Security to make it work on HP-UX 11 on Itanium2 with HP's 64-bit compiler (SF patch #1225212). Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.70 retrieving revision 2.71 diff -u -d -r2.70 -r2.71 --- pyport.h 23 Sep 2004 19:11:21 -0000 2.70 +++ pyport.h 14 Sep 2005 17:49:54 -0000 2.71 @@ -297,7 +297,7 @@ * This isn't reliable. See Py_OVERFLOWED comments. * X is evaluated more than once. */ -#if defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64)) #define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM; #else #define _Py_SET_EDOM_FOR_NAN(X) ; From gvanrossum at users.sourceforge.net Wed Sep 14 19:49:58 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 19:49:58 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python thread.c,2.54,2.55 Message-ID: <20050914174958.0EB491E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18898/Python Modified Files: thread.c Log Message: - Changes donated by Elemental Security to make it work on HP-UX 11 on Itanium2 with HP's 64-bit compiler (SF patch #1225212). Index: thread.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread.c,v retrieving revision 2.54 retrieving revision 2.55 diff -u -d -r2.54 -r2.55 --- thread.c 10 Oct 2004 01:58:44 -0000 2.54 +++ thread.c 14 Sep 2005 17:49:54 -0000 2.55 @@ -45,6 +45,20 @@ #define SUN_LWP #endif +/* Check if we're running on HP-UX and _SC_THREADS is defined. If so, then + enough of the Posix threads package is implimented to support python + threads. + + This is valid for HP-UX 11.23 running on an ia64 system. If needed, add + a check of __ia64 to verify that we're running on a ia64 system instead + of a pa-risc system. +*/ +#ifdef __hpux +#ifdef _SC_THREADS +#define _POSIX_THREADS +#endif +#endif + #endif /* _POSIX_THREADS */ From gvanrossum at users.sourceforge.net Wed Sep 14 19:49:58 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 19:49:58 +0200 (CEST) Subject: [Python-checkins] python/dist/src README,1.189,1.190 Message-ID: <20050914174958.A13471E4003@bag.python.org> Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18898 Modified Files: README Log Message: - Changes donated by Elemental Security to make it work on HP-UX 11 on Itanium2 with HP's 64-bit compiler (SF patch #1225212). Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.189 retrieving revision 1.190 diff -u -d -r1.189 -r1.190 --- README 16 Jun 2005 15:51:20 -0000 1.189 +++ README 14 Sep 2005 17:49:54 -0000 1.190 @@ -368,7 +368,25 @@ compiler, some experience has shown that the compiler's optimiser produces a completely broken version of python (see http://www.python.org/sf/814976). To work around this, - edit the Makefile and remove -O from the OPT line. + edit the Makefile and remove -O from the OPT line. (This is + old information; with the latest compiler this problem does + not occur.) + + To build a 64-bit executable on an Itanium 2 system using HP's + compiler, use these environment variables: + + CC=cc + CXX=aCC + BASECFLAGS="+DD64" + LDFLAGS="+DD64 -lxnet" + + and call configure as: + + ./configure --without-gcc + + then *unset* the environment variables again before running + make. (At least one of these flags causes the build to fail + if it remains set.) HP PA-RISC 2.0: A recent bug report (http://www.python.org/sf/546117) suggests that the C compiler in this 64-bit system has bugs From gvanrossum at users.sourceforge.net Wed Sep 14 19:54:42 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 19:54:42 +0200 (CEST) Subject: [Python-checkins] python/dist/src README,1.184.2.3,1.184.2.4 Message-ID: <20050914175442.653721E4003@bag.python.org> Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20005 Modified Files: Tag: release24-maint README Log Message: (backport from HEAD) - Changes donated by Elemental Security to make it work on HP-UX 11 on Itanium2 with HP's 64-bit compiler (SF patch #1225212). Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.184.2.3 retrieving revision 1.184.2.4 diff -u -d -r1.184.2.3 -r1.184.2.4 --- README 25 Jan 2005 12:43:57 -0000 1.184.2.3 +++ README 14 Sep 2005 17:54:39 -0000 1.184.2.4 @@ -374,11 +374,29 @@ using HP/UX 11 and later - threading seems to work "out of the box". -HP-UX ia64: When building on the ia64 (Itanium) platform using HP's - compiler, some experience has shown that the compiler's - optimiser produces a completely broken version of python - (see http://www.python.org/sf/814976). To work around this, - edit the Makefile and remove -O from the OPT line. +HP-UX ia64: When building on the ia64 (Itanium) platform using HP's + compiler, some experience has shown that the compiler's + optimiser produces a completely broken version of python + (see http://www.python.org/sf/814976). To work around this, + edit the Makefile and remove -O from the OPT line. (This is + old information; with the latest compiler this problem does + not occur.) + + To build a 64-bit executable on an Itanium 2 system using HP's + compiler, use these environment variables: + + CC=cc + CXX=aCC + BASECFLAGS="+DD64" + LDFLAGS="+DD64 -lxnet" + + and call configure as: + + ./configure --without-gcc + + then *unset* the environment variables again before running + make. (At least one of these flags causes the build to fail + if it remains set.) HP PA-RISC 2.0: A recent bug report (http://www.python.org/sf/546117) suggests that the C compiler in this 64-bit system has bugs From gvanrossum at users.sourceforge.net Wed Sep 14 19:54:42 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 19:54:42 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Include pyport.h,2.70,2.70.2.1 Message-ID: <20050914175442.71CEE1E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20005/Include Modified Files: Tag: release24-maint pyport.h Log Message: (backport from HEAD) - Changes donated by Elemental Security to make it work on HP-UX 11 on Itanium2 with HP's 64-bit compiler (SF patch #1225212). Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.70 retrieving revision 2.70.2.1 diff -u -d -r2.70 -r2.70.2.1 --- pyport.h 23 Sep 2004 19:11:21 -0000 2.70 +++ pyport.h 14 Sep 2005 17:54:39 -0000 2.70.2.1 @@ -297,7 +297,7 @@ * This isn't reliable. See Py_OVERFLOWED comments. * X is evaluated more than once. */ -#if defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64)) #define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM; #else #define _Py_SET_EDOM_FOR_NAN(X) ; From gvanrossum at users.sourceforge.net Wed Sep 14 19:54:42 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 19:54:42 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.93, 1.1193.2.94 Message-ID: <20050914175442.A308E1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20005/Misc Modified Files: Tag: release24-maint NEWS Log Message: (backport from HEAD) - Changes donated by Elemental Security to make it work on HP-UX 11 on Itanium2 with HP's 64-bit compiler (SF patch #1225212). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.93 retrieving revision 1.1193.2.94 diff -u -d -r1.1193.2.93 -r1.1193.2.94 --- NEWS 1 Sep 2005 12:03:14 -0000 1.1193.2.93 +++ NEWS 14 Sep 2005 17:54:39 -0000 1.1193.2.94 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Changes donated by Elemental Security to make it work on HP-UX 11 on + Itanium2 with HP's 64-bit compiler (SF patch #1225212). + - Disallow keyword arguments for type constructors that don't use them (fixes bug #1119418). From gvanrossum at users.sourceforge.net Wed Sep 14 19:54:42 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 19:54:42 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python thread.c,2.54,2.54.2.1 Message-ID: <20050914175442.AE6511E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20005/Python Modified Files: Tag: release24-maint thread.c Log Message: (backport from HEAD) - Changes donated by Elemental Security to make it work on HP-UX 11 on Itanium2 with HP's 64-bit compiler (SF patch #1225212). Index: thread.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread.c,v retrieving revision 2.54 retrieving revision 2.54.2.1 diff -u -d -r2.54 -r2.54.2.1 --- thread.c 10 Oct 2004 01:58:44 -0000 2.54 +++ thread.c 14 Sep 2005 17:54:39 -0000 2.54.2.1 @@ -45,6 +45,20 @@ #define SUN_LWP #endif +/* Check if we're running on HP-UX and _SC_THREADS is defined. If so, then + enough of the Posix threads package is implimented to support python + threads. + + This is valid for HP-UX 11.23 running on an ia64 system. If needed, add + a check of __ia64 to verify that we're running on a ia64 system instead + of a pa-risc system. +*/ +#ifdef __hpux +#ifdef _SC_THREADS +#define _POSIX_THREADS +#endif +#endif + #endif /* _POSIX_THREADS */ From gvanrossum at users.sourceforge.net Wed Sep 14 20:09:44 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 20:09:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Include import.h,2.30,2.31 Message-ID: <20050914180944.444161E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23292/Include Modified Files: import.h Log Message: - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). Index: import.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/import.h,v retrieving revision 2.30 retrieving revision 2.31 diff -u -d -r2.30 -r2.31 --- import.h 7 Oct 2004 06:46:23 -0000 2.30 +++ import.h 14 Sep 2005 18:09:41 -0000 2.31 @@ -24,6 +24,7 @@ PyAPI_FUNC(struct filedescr *) _PyImport_FindModule( const char *, PyObject *, char *, size_t, FILE **, PyObject **); PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *); +PyAPI_FUNC(void) _PyImport_ReInitLock(void); PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *); PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *); From gvanrossum at users.sourceforge.net Wed Sep 14 20:09:44 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 20:09:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py, 1.171, 1.172 test_ioctl.py, 1.2, 1.3 Message-ID: <20050914180944.848421E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23292/Lib/test Modified Files: regrtest.py test_ioctl.py Log Message: - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.171 retrieving revision 1.172 diff -u -d -r1.171 -r1.172 --- regrtest.py 21 Aug 2005 18:46:01 -0000 1.171 +++ regrtest.py 14 Sep 2005 18:09:41 -0000 1.172 @@ -1070,6 +1070,34 @@ test_winreg test_winsound """, + 'aix5': + """ + test_aepack + test_al + test_applesingle + test_bsddb + test_bsddb185 + test_bsddb3 + test_bz2 + test_cd + test_cl + test_dl + test_gdbm + test_gl + test_gzip + test_imgfile + test_linuxaudiodev + test_macfs + test_macostools + test_nis + test_ossaudiodev + test_sunaudiodev + test_tcl + test_winreg + test_winsound + test_zipimport + test_zlib + """, } _expectations['freebsd5'] = _expectations['freebsd4'] _expectations['freebsd6'] = _expectations['freebsd4'] Index: test_ioctl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ioctl.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- test_ioctl.py 20 Mar 2003 04:33:16 -0000 1.2 +++ test_ioctl.py 14 Sep 2005 18:09:41 -0000 1.3 @@ -1,5 +1,5 @@ import unittest -from test_support import TestSkipped, run_unittest +from test.test_support import TestSkipped, run_unittest import os, struct try: import fcntl, termios @@ -16,19 +16,23 @@ class IoctlTests(unittest.TestCase): def test_ioctl(self): - pgrp = os.getpgrp() + # If this process has been put into the background, TIOCGPGRP returns + # the session ID instead of the process group id. + ids = (os.getpgrp(), os.getsid(0)) tty = open("/dev/tty", "r") r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ") - self.assertEquals(pgrp, struct.unpack("i", r)[0]) + rpgrp = struct.unpack("i", r)[0] + self.assert_(rpgrp in ids, "%s not in %s" % (rpgrp, ids)) def test_ioctl_mutate(self): import array buf = array.array('i', [0]) - pgrp = os.getpgrp() + ids = (os.getpgrp(), os.getsid(0)) tty = open("/dev/tty", "r") r = fcntl.ioctl(tty, termios.TIOCGPGRP, buf, 1) + rpgrp = buf[0] self.assertEquals(r, 0) - self.assertEquals(pgrp, buf[0]) + self.assert_(rpgrp in ids, "%s not in %s" % (rpgrp, ids)) def test_main(): run_unittest(IoctlTests) From gvanrossum at users.sourceforge.net Wed Sep 14 20:09:45 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 20:09:45 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python import.c,2.243,2.244 Message-ID: <20050914180945.0C6531E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23292/Python Modified Files: import.c Log Message: - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.243 retrieving revision 2.244 diff -u -d -r2.243 -r2.244 --- import.c 14 Sep 2005 06:56:20 -0000 2.243 +++ import.c 14 Sep 2005 18:09:42 -0000 2.244 @@ -260,6 +260,18 @@ return 1; } +/* This function is called from PyOS_AfterFork to ensure that newly + created child processes do not share locks with the parent. */ + +void +_PyImport_ReInitLock(void) +{ +#ifdef _AIX + if (import_lock != NULL) + import_lock = PyThread_allocate_lock(); +#endif +} + #else #define lock_import() From gvanrossum at users.sourceforge.net Wed Sep 14 20:09:45 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 20:09:45 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules grpmodule.c, 2.22, 2.23 makexp_aix, 2.2, 2.3 pwdmodule.c, 1.39, 1.40 signalmodule.c, 2.76, 2.77 socketmodule.c, 1.312, 1.313 socketmodule.h, 1.12, 1.13 Message-ID: <20050914180945.6628B1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23292/Modules Modified Files: grpmodule.c makexp_aix pwdmodule.c signalmodule.c socketmodule.c socketmodule.h Log Message: - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). Index: grpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/grpmodule.c,v retrieving revision 2.22 retrieving revision 2.23 diff -u -d -r2.22 -r2.23 --- grpmodule.c 20 Jan 2004 21:06:00 -0000 2.22 +++ grpmodule.c 14 Sep 2005 18:09:41 -0000 2.23 @@ -85,9 +85,9 @@ static PyObject * grp_getgrgid(PyObject *self, PyObject *args) { - int gid; + unsigned int gid; struct group *p; - if (!PyArg_ParseTuple(args, "i:getgrgid", &gid)) + if (!PyArg_ParseTuple(args, "I:getgrgid", &gid)) return NULL; if ((p = getgrgid(gid)) == NULL) { PyErr_Format(PyExc_KeyError, "getgrgid(): gid not found: %d", gid); Index: makexp_aix =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/makexp_aix,v retrieving revision 2.2 retrieving revision 2.3 diff -u -d -r2.2 -r2.3 --- makexp_aix 9 Apr 1998 21:46:02 -0000 2.2 +++ makexp_aix 14 Sep 2005 18:09:41 -0000 2.3 @@ -70,6 +70,12 @@ # left with just the symbol name. # 7. Eliminate all entries containing two colons, like Class::method # -/usr/ccs/bin/nm -Bex $inputFiles \ + +# Use -X32_64 if it appears to be implemented in this version of 'nm'. +NM=/usr/ccs/bin/nm +xopt=-X32_64 +$NM -e $xopt $1 >/dev/null 2>&1 || xopt="" + +$NM -Bex $xopt $inputFiles \ | sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' -e '/::/d' \ | sort | uniq >> $expFileName Index: pwdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pwdmodule.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- pwdmodule.c 20 Jan 2004 21:07:23 -0000 1.39 +++ pwdmodule.c 14 Sep 2005 18:09:41 -0000 1.40 @@ -102,9 +102,9 @@ static PyObject * pwd_getpwuid(PyObject *self, PyObject *args) { - int uid; + unsigned int uid; struct passwd *p; - if (!PyArg_ParseTuple(args, "i:getpwuid", &uid)) + if (!PyArg_ParseTuple(args, "I:getpwuid", &uid)) return NULL; if ((p = getpwuid(uid)) == NULL) { PyErr_Format(PyExc_KeyError, Index: signalmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/signalmodule.c,v retrieving revision 2.76 retrieving revision 2.77 diff -u -d -r2.76 -r2.77 --- signalmodule.c 13 Oct 2004 14:48:50 -0000 2.76 +++ signalmodule.c 14 Sep 2005 18:09:41 -0000 2.77 @@ -669,5 +669,6 @@ PyEval_ReInitThreads(); main_thread = PyThread_get_thread_ident(); main_pid = getpid(); + _PyImport_ReInitLock(); #endif } Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.312 retrieving revision 1.313 diff -u -d -r1.312 -r1.313 --- socketmodule.c 26 Aug 2005 08:34:00 -0000 1.312 +++ socketmodule.c 14 Sep 2005 18:09:41 -0000 1.313 @@ -1344,7 +1344,7 @@ static PyObject * sock_accept(PySocketSockObject *s) { - char addrbuf[256]; + sock_addr_t addrbuf; SOCKET_T newfd; socklen_t addrlen; PyObject *sock = NULL; @@ -1354,7 +1354,7 @@ if (!getsockaddrlen(s, &addrlen)) return NULL; - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); #ifdef MS_WINDOWS newfd = INVALID_SOCKET; @@ -1365,7 +1365,7 @@ Py_BEGIN_ALLOW_THREADS timeout = internal_select(s, 0); if (!timeout) - newfd = accept(s->sock_fd, (struct sockaddr *) addrbuf, + newfd = accept(s->sock_fd, (struct sockaddr *) &addrbuf, &addrlen); Py_END_ALLOW_THREADS @@ -1392,7 +1392,7 @@ SOCKETCLOSE(newfd); goto finally; } - addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, + addr = makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto); if (addr == NULL) goto finally; @@ -1865,19 +1865,19 @@ static PyObject * sock_getsockname(PySocketSockObject *s) { - char addrbuf[256]; + sock_addr_t addrbuf; int res; socklen_t addrlen; if (!getsockaddrlen(s, &addrlen)) return NULL; - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); Py_BEGIN_ALLOW_THREADS - res = getsockname(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); + res = getsockname(s->sock_fd, (struct sockaddr *) &addrbuf, &addrlen); Py_END_ALLOW_THREADS if (res < 0) return s->errorhandler(); - return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen, + return makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto); } @@ -1894,19 +1894,19 @@ static PyObject * sock_getpeername(PySocketSockObject *s) { - char addrbuf[256]; + sock_addr_t addrbuf; int res; socklen_t addrlen; if (!getsockaddrlen(s, &addrlen)) return NULL; - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); Py_BEGIN_ALLOW_THREADS - res = getpeername(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); + res = getpeername(s->sock_fd, (struct sockaddr *) &addrbuf, &addrlen); Py_END_ALLOW_THREADS if (res < 0) return s->errorhandler(); - return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen, + return makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto); } @@ -2115,7 +2115,7 @@ static PyObject * sock_recvfrom(PySocketSockObject *s, PyObject *args) { - char addrbuf[256]; + sock_addr_t addrbuf; PyObject *buf = NULL; PyObject *addr = NULL; PyObject *ret = NULL; @@ -2132,18 +2132,18 @@ return NULL; Py_BEGIN_ALLOW_THREADS - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); timeout = internal_select(s, 0); if (!timeout) n = recvfrom(s->sock_fd, PyString_AS_STRING(buf), len, flags, #ifndef MS_WINDOWS #if defined(PYOS_OS2) && !defined(PYCC_GCC) - (struct sockaddr *)addrbuf, &addrlen + (struct sockaddr *) &addrbuf, &addrlen #else - (void *)addrbuf, &addrlen + (void *) &addrbuf, &addrlen #endif #else - (struct sockaddr *)addrbuf, &addrlen + (struct sockaddr *) &addrbuf, &addrlen #endif ); Py_END_ALLOW_THREADS @@ -2161,7 +2161,7 @@ if (n != len && _PyString_Resize(&buf, n) < 0) return NULL; - if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, + if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto))) goto finally; @@ -2589,11 +2589,7 @@ socket_gethostbyname(PyObject *self, PyObject *args) { char *name; -#ifdef ENABLE_IPV6 - struct sockaddr_storage addrbuf; -#else - struct sockaddr_in addrbuf; -#endif + sock_addr_t addrbuf; if (!PyArg_ParseTuple(args, "s:gethostbyname", &name)) return NULL; Index: socketmodule.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- socketmodule.h 23 Mar 2004 23:16:54 -0000 1.12 +++ socketmodule.h 14 Sep 2005 18:09:42 -0000 1.13 @@ -72,6 +72,26 @@ # define SIZEOF_SOCKET_T SIZEOF_INT #endif +/* Socket address */ +typedef union sock_addr { + struct sockaddr_in in; +#ifdef AF_UNIX + struct sockaddr_un un; +#endif +#ifdef ENABLE_IPV6 + struct sockaddr_in6 in6; + struct sockaddr_storage storage; +#endif +#ifdef HAVE_BLUETOOTH_BLUETOOTH_H + struct sockaddr_l2 bt_l2; + struct sockaddr_rc bt_rc; + struct sockaddr_sco bt_sco; +#endif +#ifdef HAVE_NETPACKET_PACKET_H + struct sockaddr_ll ll; +#endif +} sock_addr_t; + /* The object holding a socket. It holds some extra information, like the address family, which is used to decode socket address arguments properly. */ @@ -82,24 +102,7 @@ int sock_family; /* Address family, e.g., AF_INET */ int sock_type; /* Socket type, e.g., SOCK_STREAM */ int sock_proto; /* Protocol type, usually 0 */ - union sock_addr { - struct sockaddr_in in; -#ifdef AF_UNIX - struct sockaddr_un un; -#endif -#ifdef ENABLE_IPV6 - struct sockaddr_in6 in6; - struct sockaddr_storage storage; -#endif -#ifdef HAVE_BLUETOOTH_BLUETOOTH_H - struct sockaddr_l2 bt_l2; - struct sockaddr_rc bt_rc; - struct sockaddr_sco bt_sco; -#endif -#ifdef HAVE_NETPACKET_PACKET_H - struct sockaddr_ll ll; -#endif - } sock_addr; + sock_addr_t sock_addr; /* Socket address */ PyObject *(*errorhandler)(void); /* Error handler; checks errno, returns NULL and sets a Python exception */ From gvanrossum at users.sourceforge.net Wed Sep 14 20:09:47 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 20:09:47 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1362,1.1363 Message-ID: <20050914180947.E03891E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23292/Misc Modified Files: NEWS Log Message: - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1362 retrieving revision 1.1363 diff -u -d -r1.1362 -r1.1363 --- NEWS 14 Sep 2005 17:49:54 -0000 1.1362 +++ NEWS 14 Sep 2005 18:09:41 -0000 1.1363 @@ -12,6 +12,10 @@ Core and builtins ----------------- +- Changes donated by Elemental Security to make it work on AIX 5.3 + with IBM's 64-bit compiler (SF patch #1284289). This also closes SF + bug #105470: test_pwd fails on 64bit system (Opteron). + - Changes donated by Elemental Security to make it work on HP-UX 11 on Itanium2 with HP's 64-bit compiler (SF patch #1225212). From gvanrossum at users.sourceforge.net Wed Sep 14 20:15:06 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 20:15:06 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Include import.h,2.30,2.30.2.1 Message-ID: <20050914181506.206DF1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24791/Include Modified Files: Tag: release24-maint import.h Log Message: - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). Index: import.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/import.h,v retrieving revision 2.30 retrieving revision 2.30.2.1 diff -u -d -r2.30 -r2.30.2.1 --- import.h 7 Oct 2004 06:46:23 -0000 2.30 +++ import.h 14 Sep 2005 18:15:02 -0000 2.30.2.1 @@ -24,6 +24,7 @@ PyAPI_FUNC(struct filedescr *) _PyImport_FindModule( const char *, PyObject *, char *, size_t, FILE **, PyObject **); PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *); +PyAPI_FUNC(void) _PyImport_ReInitLock(void); PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *); PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *); From gvanrossum at users.sourceforge.net Wed Sep 14 20:15:06 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 20:15:06 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py, 1.165.2.2, 1.165.2.3 test_ioctl.py, 1.2, 1.2.18.1 Message-ID: <20050914181506.486751E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24791/Lib/test Modified Files: Tag: release24-maint regrtest.py test_ioctl.py Log Message: - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.165.2.2 retrieving revision 1.165.2.3 diff -u -d -r1.165.2.2 -r1.165.2.3 --- regrtest.py 3 Jun 2005 14:10:49 -0000 1.165.2.2 +++ regrtest.py 14 Sep 2005 18:15:02 -0000 1.165.2.3 @@ -1066,6 +1066,34 @@ test_winreg test_winsound """, + 'aix5': + """ + test_aepack + test_al + test_applesingle + test_bsddb + test_bsddb185 + test_bsddb3 + test_bz2 + test_cd + test_cl + test_dl + test_gdbm + test_gl + test_gzip + test_imgfile + test_linuxaudiodev + test_macfs + test_macostools + test_nis + test_ossaudiodev + test_sunaudiodev + test_tcl + test_winreg + test_winsound + test_zipimport + test_zlib + """, } _expectations['freebsd5'] = _expectations['freebsd4'] _expectations['freebsd6'] = _expectations['freebsd4'] Index: test_ioctl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ioctl.py,v retrieving revision 1.2 retrieving revision 1.2.18.1 diff -u -d -r1.2 -r1.2.18.1 --- test_ioctl.py 20 Mar 2003 04:33:16 -0000 1.2 +++ test_ioctl.py 14 Sep 2005 18:15:02 -0000 1.2.18.1 @@ -1,5 +1,5 @@ import unittest -from test_support import TestSkipped, run_unittest +from test.test_support import TestSkipped, run_unittest import os, struct try: import fcntl, termios @@ -16,19 +16,23 @@ class IoctlTests(unittest.TestCase): def test_ioctl(self): - pgrp = os.getpgrp() + # If this process has been put into the background, TIOCGPGRP returns + # the session ID instead of the process group id. + ids = (os.getpgrp(), os.getsid(0)) tty = open("/dev/tty", "r") r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ") - self.assertEquals(pgrp, struct.unpack("i", r)[0]) + rpgrp = struct.unpack("i", r)[0] + self.assert_(rpgrp in ids, "%s not in %s" % (rpgrp, ids)) def test_ioctl_mutate(self): import array buf = array.array('i', [0]) - pgrp = os.getpgrp() + ids = (os.getpgrp(), os.getsid(0)) tty = open("/dev/tty", "r") r = fcntl.ioctl(tty, termios.TIOCGPGRP, buf, 1) + rpgrp = buf[0] self.assertEquals(r, 0) - self.assertEquals(pgrp, buf[0]) + self.assert_(rpgrp in ids, "%s not in %s" % (rpgrp, ids)) def test_main(): run_unittest(IoctlTests) From gvanrossum at users.sourceforge.net Wed Sep 14 20:15:06 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 20:15:06 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python import.c, 2.240.2.1, 2.240.2.2 Message-ID: <20050914181506.AFEEC1E4009@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24791/Python Modified Files: Tag: release24-maint import.c Log Message: - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.240.2.1 retrieving revision 2.240.2.2 diff -u -d -r2.240.2.1 -r2.240.2.2 --- import.c 14 Sep 2005 06:56:51 -0000 2.240.2.1 +++ import.c 14 Sep 2005 18:15:03 -0000 2.240.2.2 @@ -259,6 +259,18 @@ return 1; } +/* This function is called from PyOS_AfterFork to ensure that newly + created child processes do not share locks with the parent. */ + +void +_PyImport_ReInitLock(void) +{ +#ifdef _AIX + if (import_lock != NULL) + import_lock = PyThread_allocate_lock(); +#endif +} + #else #define lock_import() From gvanrossum at users.sourceforge.net Wed Sep 14 20:15:06 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 20:15:06 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.94, 1.1193.2.95 Message-ID: <20050914181506.EAADC1E400E@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24791/Misc Modified Files: Tag: release24-maint NEWS Log Message: - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.94 retrieving revision 1.1193.2.95 diff -u -d -r1.1193.2.94 -r1.1193.2.95 --- NEWS 14 Sep 2005 17:54:39 -0000 1.1193.2.94 +++ NEWS 14 Sep 2005 18:15:03 -0000 1.1193.2.95 @@ -12,6 +12,10 @@ Core and builtins ----------------- +- Changes donated by Elemental Security to make it work on AIX 5.3 + with IBM's 64-bit compiler (SF patch #1284289). This also closes SF + bug #105470: test_pwd fails on 64bit system (Opteron). + - Changes donated by Elemental Security to make it work on HP-UX 11 on Itanium2 with HP's 64-bit compiler (SF patch #1225212). From gvanrossum at users.sourceforge.net Wed Sep 14 20:15:07 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Sep 2005 20:15:07 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules grpmodule.c, 2.22, 2.22.4.1 makexp_aix, 2.2, 2.2.50.1 pwdmodule.c, 1.39, 1.39.4.1 signalmodule.c, 2.76, 2.76.2.1 socketmodule.c, 1.311.2.1, 1.311.2.2 socketmodule.h, 1.12, 1.12.4.1 Message-ID: <20050914181507.8ACA11E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24791/Modules Modified Files: Tag: release24-maint grpmodule.c makexp_aix pwdmodule.c signalmodule.c socketmodule.c socketmodule.h Log Message: - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). Index: grpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/grpmodule.c,v retrieving revision 2.22 retrieving revision 2.22.4.1 diff -u -d -r2.22 -r2.22.4.1 --- grpmodule.c 20 Jan 2004 21:06:00 -0000 2.22 +++ grpmodule.c 14 Sep 2005 18:15:03 -0000 2.22.4.1 @@ -85,9 +85,9 @@ static PyObject * grp_getgrgid(PyObject *self, PyObject *args) { - int gid; + unsigned int gid; struct group *p; - if (!PyArg_ParseTuple(args, "i:getgrgid", &gid)) + if (!PyArg_ParseTuple(args, "I:getgrgid", &gid)) return NULL; if ((p = getgrgid(gid)) == NULL) { PyErr_Format(PyExc_KeyError, "getgrgid(): gid not found: %d", gid); Index: makexp_aix =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/makexp_aix,v retrieving revision 2.2 retrieving revision 2.2.50.1 diff -u -d -r2.2 -r2.2.50.1 --- makexp_aix 9 Apr 1998 21:46:02 -0000 2.2 +++ makexp_aix 14 Sep 2005 18:15:03 -0000 2.2.50.1 @@ -70,6 +70,12 @@ # left with just the symbol name. # 7. Eliminate all entries containing two colons, like Class::method # -/usr/ccs/bin/nm -Bex $inputFiles \ + +# Use -X32_64 if it appears to be implemented in this version of 'nm'. +NM=/usr/ccs/bin/nm +xopt=-X32_64 +$NM -e $xopt $1 >/dev/null 2>&1 || xopt="" + +$NM -Bex $xopt $inputFiles \ | sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' -e '/::/d' \ | sort | uniq >> $expFileName Index: pwdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pwdmodule.c,v retrieving revision 1.39 retrieving revision 1.39.4.1 diff -u -d -r1.39 -r1.39.4.1 --- pwdmodule.c 20 Jan 2004 21:07:23 -0000 1.39 +++ pwdmodule.c 14 Sep 2005 18:15:03 -0000 1.39.4.1 @@ -102,9 +102,9 @@ static PyObject * pwd_getpwuid(PyObject *self, PyObject *args) { - int uid; + unsigned int uid; struct passwd *p; - if (!PyArg_ParseTuple(args, "i:getpwuid", &uid)) + if (!PyArg_ParseTuple(args, "I:getpwuid", &uid)) return NULL; if ((p = getpwuid(uid)) == NULL) { PyErr_Format(PyExc_KeyError, Index: signalmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/signalmodule.c,v retrieving revision 2.76 retrieving revision 2.76.2.1 diff -u -d -r2.76 -r2.76.2.1 --- signalmodule.c 13 Oct 2004 14:48:50 -0000 2.76 +++ signalmodule.c 14 Sep 2005 18:15:03 -0000 2.76.2.1 @@ -669,5 +669,6 @@ PyEval_ReInitThreads(); main_thread = PyThread_get_thread_ident(); main_pid = getpid(); + _PyImport_ReInitLock(); #endif } Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.311.2.1 retrieving revision 1.311.2.2 diff -u -d -r1.311.2.1 -r1.311.2.2 --- socketmodule.c 26 Aug 2005 08:33:28 -0000 1.311.2.1 +++ socketmodule.c 14 Sep 2005 18:15:03 -0000 1.311.2.2 @@ -1344,7 +1344,7 @@ static PyObject * sock_accept(PySocketSockObject *s) { - char addrbuf[256]; + sock_addr_t addrbuf; SOCKET_T newfd; socklen_t addrlen; PyObject *sock = NULL; @@ -1354,7 +1354,7 @@ if (!getsockaddrlen(s, &addrlen)) return NULL; - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); #ifdef MS_WINDOWS newfd = INVALID_SOCKET; @@ -1365,7 +1365,7 @@ Py_BEGIN_ALLOW_THREADS timeout = internal_select(s, 0); if (!timeout) - newfd = accept(s->sock_fd, (struct sockaddr *) addrbuf, + newfd = accept(s->sock_fd, (struct sockaddr *) &addrbuf, &addrlen); Py_END_ALLOW_THREADS @@ -1392,7 +1392,7 @@ SOCKETCLOSE(newfd); goto finally; } - addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, + addr = makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto); if (addr == NULL) goto finally; @@ -1865,19 +1865,19 @@ static PyObject * sock_getsockname(PySocketSockObject *s) { - char addrbuf[256]; + sock_addr_t addrbuf; int res; socklen_t addrlen; if (!getsockaddrlen(s, &addrlen)) return NULL; - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); Py_BEGIN_ALLOW_THREADS - res = getsockname(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); + res = getsockname(s->sock_fd, (struct sockaddr *) &addrbuf, &addrlen); Py_END_ALLOW_THREADS if (res < 0) return s->errorhandler(); - return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen, + return makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto); } @@ -1894,19 +1894,19 @@ static PyObject * sock_getpeername(PySocketSockObject *s) { - char addrbuf[256]; + sock_addr_t addrbuf; int res; socklen_t addrlen; if (!getsockaddrlen(s, &addrlen)) return NULL; - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); Py_BEGIN_ALLOW_THREADS - res = getpeername(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); + res = getpeername(s->sock_fd, (struct sockaddr *) &addrbuf, &addrlen); Py_END_ALLOW_THREADS if (res < 0) return s->errorhandler(); - return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen, + return makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto); } @@ -2115,7 +2115,7 @@ static PyObject * sock_recvfrom(PySocketSockObject *s, PyObject *args) { - char addrbuf[256]; + sock_addr_t addrbuf; PyObject *buf = NULL; PyObject *addr = NULL; PyObject *ret = NULL; @@ -2132,18 +2132,18 @@ return NULL; Py_BEGIN_ALLOW_THREADS - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); timeout = internal_select(s, 0); if (!timeout) n = recvfrom(s->sock_fd, PyString_AS_STRING(buf), len, flags, #ifndef MS_WINDOWS #if defined(PYOS_OS2) && !defined(PYCC_GCC) - (struct sockaddr *)addrbuf, &addrlen + (struct sockaddr *) &addrbuf, &addrlen #else - (void *)addrbuf, &addrlen + (void *) &addrbuf, &addrlen #endif #else - (struct sockaddr *)addrbuf, &addrlen + (struct sockaddr *) &addrbuf, &addrlen #endif ); Py_END_ALLOW_THREADS @@ -2161,7 +2161,7 @@ if (n != len && _PyString_Resize(&buf, n) < 0) return NULL; - if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, + if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto))) goto finally; @@ -2589,11 +2589,7 @@ socket_gethostbyname(PyObject *self, PyObject *args) { char *name; -#ifdef ENABLE_IPV6 - struct sockaddr_storage addrbuf; -#else - struct sockaddr_in addrbuf; -#endif + sock_addr_t addrbuf; if (!PyArg_ParseTuple(args, "s:gethostbyname", &name)) return NULL; Index: socketmodule.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.h,v retrieving revision 1.12 retrieving revision 1.12.4.1 diff -u -d -r1.12 -r1.12.4.1 --- socketmodule.h 23 Mar 2004 23:16:54 -0000 1.12 +++ socketmodule.h 14 Sep 2005 18:15:03 -0000 1.12.4.1 @@ -72,6 +72,26 @@ # define SIZEOF_SOCKET_T SIZEOF_INT #endif +/* Socket address */ +typedef union sock_addr { + struct sockaddr_in in; +#ifdef AF_UNIX + struct sockaddr_un un; +#endif +#ifdef ENABLE_IPV6 + struct sockaddr_in6 in6; + struct sockaddr_storage storage; +#endif +#ifdef HAVE_BLUETOOTH_BLUETOOTH_H + struct sockaddr_l2 bt_l2; + struct sockaddr_rc bt_rc; + struct sockaddr_sco bt_sco; +#endif +#ifdef HAVE_NETPACKET_PACKET_H + struct sockaddr_ll ll; +#endif +} sock_addr_t; + /* The object holding a socket. It holds some extra information, like the address family, which is used to decode socket address arguments properly. */ @@ -82,24 +102,7 @@ int sock_family; /* Address family, e.g., AF_INET */ int sock_type; /* Socket type, e.g., SOCK_STREAM */ int sock_proto; /* Protocol type, usually 0 */ - union sock_addr { - struct sockaddr_in in; -#ifdef AF_UNIX - struct sockaddr_un un; -#endif -#ifdef ENABLE_IPV6 - struct sockaddr_in6 in6; - struct sockaddr_storage storage; -#endif -#ifdef HAVE_BLUETOOTH_BLUETOOTH_H - struct sockaddr_l2 bt_l2; - struct sockaddr_rc bt_rc; - struct sockaddr_sco bt_sco; -#endif -#ifdef HAVE_NETPACKET_PACKET_H - struct sockaddr_ll ll; -#endif - } sock_addr; + sock_addr_t sock_addr; /* Socket address */ PyObject *(*errorhandler)(void); /* Error handler; checks errno, returns NULL and sets a Python exception */ From nnorwitz at gmail.com Wed Sep 14 21:01:09 2005 From: nnorwitz at gmail.com (Neal Norwitz) Date: Wed, 14 Sep 2005 12:01:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py, 1.171, 1.172 test_ioctl.py, 1.2, 1.3 In-Reply-To: <20050914180944.848421E4003@bag.python.org> References: <20050914180944.848421E4003@bag.python.org> Message-ID: > Index: test_ioctl.py > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ioctl.py,v > retrieving revision 1.2 > retrieving revision 1.3 > diff -u -d -r1.2 -r1.3 > --- test_ioctl.py 20 Mar 2003 04:33:16 -0000 1.2 > +++ test_ioctl.py 14 Sep 2005 18:09:41 -0000 1.3 > @@ -16,19 +16,23 @@ > > class IoctlTests(unittest.TestCase): > def test_ioctl(self): > - pgrp = os.getpgrp() > + # If this process has been put into the background, TIOCGPGRP returns > + # the session ID instead of the process group id. > + ids = (os.getpgrp(), os.getsid(0)) > tty = open("/dev/tty", "r") > r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ") > - self.assertEquals(pgrp, struct.unpack("i", r)[0]) > + rpgrp = struct.unpack("i", r)[0] > + self.assert_(rpgrp in ids, "%s not in %s" % (rpgrp, ids)) With the change to use unsigned ints in pwd and grp modules, should the struct.unpack() use "I" (capital i) instead of "i"? n From birkenfeld at users.sourceforge.net Wed Sep 14 21:29:57 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 21:29:57 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python getargs.c,2.106,2.107 Message-ID: <20050914192957.504AE1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12451/Python Modified Files: getargs.c Log Message: Complete format code support in getargs.c::skipitem(), which is called when evaluating keyword arguments. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.106 retrieving revision 2.107 diff -u -d -r2.106 -r2.107 --- getargs.c 26 Aug 2005 06:42:30 -0000 2.106 +++ getargs.c 14 Sep 2005 19:29:53 -0000 2.107 @@ -453,7 +453,9 @@ or a string with a message describing the failure. The message is formatted as "must be , not ". When failing, an exception may or may not have been raised. - Don't call if a tuple is expected. + Don't call if a tuple is expected. + + When you add new format codes, please don't forget poor skipitem() below. */ static char * @@ -1406,83 +1408,52 @@ char c = *format++; switch (c) { - + + /* simple codes + * The individual types (second arg of va_arg) are irrelevant */ + case 'b': /* byte -- very short int */ case 'B': /* byte as bitfield */ - { - (void) va_arg(*p_va, char *); - break; - } - case 'h': /* short int */ - { - (void) va_arg(*p_va, short *); - break; - } - case 'H': /* short int as bitfield */ - { - (void) va_arg(*p_va, unsigned short *); - break; - } - case 'i': /* int */ - { - (void) va_arg(*p_va, int *); - break; - } - + case 'I': /* int sized bitfield */ case 'l': /* long int */ - { - (void) va_arg(*p_va, long *); - break; - } - + case 'k': /* long int sized bitfield */ #ifdef HAVE_LONG_LONG - case 'L': /* PY_LONG_LONG int */ - { - (void) va_arg(*p_va, PY_LONG_LONG *); - break; - } + case 'L': /* PY_LONG_LONG */ + case 'K': /* PY_LONG_LONG sized bitfield */ #endif - case 'f': /* float */ - { - (void) va_arg(*p_va, float *); - break; - } - case 'd': /* double */ - { - (void) va_arg(*p_va, double *); - break; - } - #ifndef WITHOUT_COMPLEX case 'D': /* complex double */ - { - (void) va_arg(*p_va, Py_complex *); - break; - } -#endif /* WITHOUT_COMPLEX */ - +#endif case 'c': /* char */ { - (void) va_arg(*p_va, char *); + (void) va_arg(*p_va, void *); break; } - case 's': /* string */ + /* string codes */ + + case 'e': /* string with encoding */ { - (void) va_arg(*p_va, char **); - if (*format == '#') { - (void) va_arg(*p_va, int *); - format++; - } - break; + (void) va_arg(*p_va, const char *); + if (!(*format == 's' || *format == 't')) + /* after 'e', only 's' and 't' is allowed */ + goto err; + format++; + /* explicit fallthrough to string cases */ } - case 'z': /* string */ + case 's': /* string */ + case 'z': /* string or None */ +#ifdef Py_USING_UNICODE + case 'u': /* unicode string */ +#endif + case 't': /* buffer, read-only */ + case 'w': /* buffer, read-write */ { (void) va_arg(*p_va, char **); if (*format == '#') { @@ -1491,8 +1462,13 @@ } break; } - + + /* object codes */ + case 'S': /* string object */ +#ifdef Py_USING_UNICODE + case 'U': /* unicode string object */ +#endif { (void) va_arg(*p_va, PyObject **); break; @@ -1528,9 +1504,13 @@ } default: +err: return "impossible"; } + + /* The "(...)" format code for tuples is not handled here because + * it is not allowed with keyword args. */ *p_format = format; return NULL; From birkenfeld at users.sourceforge.net Wed Sep 14 21:30:14 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 21:30:14 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python getargs.c, 2.102.2.3, 2.102.2.4 Message-ID: <20050914193014.C86A91E4009@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12778/Python Modified Files: Tag: release24-maint getargs.c Log Message: Complete format code support in getargs.c::skipitem(), which is called when evaluating keyword arguments. CVS: ---------------------------------------------------------------------- CVS: Enter Log. Lines beginning with `CVS:' are removed automatically CVS: CVS: Committing in . CVS: CVS: Modified Files: CVS: Python/getargs.c CVS: ---------------------------------------------------------------------- Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.102.2.3 retrieving revision 2.102.2.4 diff -u -d -r2.102.2.3 -r2.102.2.4 --- getargs.c 26 Aug 2005 06:43:16 -0000 2.102.2.3 +++ getargs.c 14 Sep 2005 19:30:11 -0000 2.102.2.4 @@ -453,7 +453,9 @@ or a string with a message describing the failure. The message is formatted as "must be , not ". When failing, an exception may or may not have been raised. - Don't call if a tuple is expected. + Don't call if a tuple is expected. + + When you add new format codes, please don't forget poor skipitem() below. */ static char * @@ -1405,83 +1407,52 @@ char c = *format++; switch (c) { - + + /* simple codes + * The individual types (second arg of va_arg) are irrelevant */ + case 'b': /* byte -- very short int */ case 'B': /* byte as bitfield */ - { - (void) va_arg(*p_va, char *); - break; - } - case 'h': /* short int */ - { - (void) va_arg(*p_va, short *); - break; - } - case 'H': /* short int as bitfield */ - { - (void) va_arg(*p_va, unsigned short *); - break; - } - case 'i': /* int */ - { - (void) va_arg(*p_va, int *); - break; - } - + case 'I': /* int sized bitfield */ case 'l': /* long int */ - { - (void) va_arg(*p_va, long *); - break; - } - + case 'k': /* long int sized bitfield */ #ifdef HAVE_LONG_LONG - case 'L': /* PY_LONG_LONG int */ - { - (void) va_arg(*p_va, PY_LONG_LONG *); - break; - } + case 'L': /* PY_LONG_LONG */ + case 'K': /* PY_LONG_LONG sized bitfield */ #endif - case 'f': /* float */ - { - (void) va_arg(*p_va, float *); - break; - } - case 'd': /* double */ - { - (void) va_arg(*p_va, double *); - break; - } - #ifndef WITHOUT_COMPLEX case 'D': /* complex double */ - { - (void) va_arg(*p_va, Py_complex *); - break; - } -#endif /* WITHOUT_COMPLEX */ - +#endif case 'c': /* char */ { - (void) va_arg(*p_va, char *); + (void) va_arg(*p_va, void *); break; } - case 's': /* string */ + /* string codes */ + + case 'e': /* string with encoding */ { - (void) va_arg(*p_va, char **); - if (*format == '#') { - (void) va_arg(*p_va, int *); - format++; - } - break; + (void) va_arg(*p_va, const char *); + if (!(*format == 's' || *format == 't')) + /* after 'e', only 's' and 't' is allowed */ + goto err; + format++; + /* explicit fallthrough to string cases */ } - case 'z': /* string */ + case 's': /* string */ + case 'z': /* string or None */ +#ifdef Py_USING_UNICODE + case 'u': /* unicode string */ +#endif + case 't': /* buffer, read-only */ + case 'w': /* buffer, read-write */ { (void) va_arg(*p_va, char **); if (*format == '#') { @@ -1490,8 +1461,13 @@ } break; } - + + /* object codes */ + case 'S': /* string object */ +#ifdef Py_USING_UNICODE + case 'U': /* unicode string object */ +#endif { (void) va_arg(*p_va, PyObject **); break; @@ -1527,9 +1503,13 @@ } default: +err: return "impossible"; } + + /* The "(...)" format code for tuples is not handled here because + * it is not allowed with keyword args. */ *p_format = format; return NULL; From birkenfeld at users.sourceforge.net Wed Sep 14 21:38:32 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 21:38:32 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1363,1.1364 Message-ID: <20050914193832.CB6701E4009@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14371/Misc Modified Files: NEWS Log Message: Complete format code support in getargs.c::skipitem(), which is called when evaluating keyword arguments. CVS: ---------------------------------------------------------------------- CVS: Enter Log. Lines beginning with `CVS:' are removed automatically CVS: CVS: Committing in . CVS: CVS: Modified Files: CVS: Python/getargs.c CVS: ---------------------------------------------------------------------- Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1363 retrieving revision 1.1364 diff -u -d -r1.1363 -r1.1364 --- NEWS 14 Sep 2005 18:09:41 -0000 1.1363 +++ NEWS 14 Sep 2005 19:38:29 -0000 1.1364 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- SF bug #893549: parsing keyword arguments was broken with a few format + codes. + - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). From birkenfeld at users.sourceforge.net Wed Sep 14 21:38:37 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 21:38:37 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.95, 1.1193.2.96 Message-ID: <20050914193837.7516C1E4009@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14374/Misc Modified Files: Tag: release24-maint NEWS Log Message: Complete format code support in getargs.c::skipitem(), which is called when evaluating keyword arguments. CVS: ---------------------------------------------------------------------- CVS: Enter Log. Lines beginning with `CVS:' are removed automatically CVS: CVS: Committing in . CVS: CVS: Modified Files: CVS: Python/getargs.c CVS: ---------------------------------------------------------------------- Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.95 retrieving revision 1.1193.2.96 diff -u -d -r1.1193.2.95 -r1.1193.2.96 --- NEWS 14 Sep 2005 18:15:03 -0000 1.1193.2.95 +++ NEWS 14 Sep 2005 19:38:34 -0000 1.1193.2.96 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- SF bug #893549: parsing keyword arguments was broken with a few format + codes. + - Changes donated by Elemental Security to make it work on AIX 5.3 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron). From birkenfeld at users.sourceforge.net Wed Sep 14 22:42:03 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 22:42:03 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1364,1.1365 Message-ID: <20050914204203.8ED4B1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28409/Misc Modified Files: NEWS Log Message: bug [ 1274828 ] splitunc not documented Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1364 retrieving revision 1.1365 diff -u -d -r1.1364 -r1.1365 --- NEWS 14 Sep 2005 19:38:29 -0000 1.1364 +++ NEWS 14 Sep 2005 20:42:00 -0000 1.1365 @@ -512,6 +512,8 @@ Documentation ------------- +- Bug #1274828: Document os.path.splitunc(). + - Bug #1190204: Clarify which directories are searched by site.py. - Bug #1193849: Clarify os.path.expanduser() documentation. From birkenfeld at users.sourceforge.net Wed Sep 14 22:42:03 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 22:42:03 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib libposixpath.tex, 1.42, 1.43 Message-ID: <20050914204203.977D11E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28409/Doc/lib Modified Files: libposixpath.tex Log Message: bug [ 1274828 ] splitunc not documented Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- libposixpath.tex 24 Aug 2005 07:26:55 -0000 1.42 +++ libposixpath.tex 14 Sep 2005 20:42:00 -0000 1.43 @@ -234,6 +234,15 @@ at most one period. \end{funcdesc} +\begin{funcdesc}{splitunc}{path} +Split the pathname \var{path} into a pair \code{(\var{unc}, \var{rest})} +so that \var{unc} is the UNC mount point (such as \code{r'\e\e host\e mount'}), +if present, and \var{rest} the rest of the path (such as +\code{r'\e path\e file.ext'}). For paths containing drive letters, \var{unc} +will always be the empty string. +Availability: Windows. +\end{funcdesc} + \begin{funcdesc}{walk}{path, visit, arg} Calls the function \var{visit} with arguments \code{(\var{arg}, \var{dirname}, \var{names})} for each directory in the From birkenfeld at users.sourceforge.net Wed Sep 14 22:42:07 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 22:42:07 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.96, 1.1193.2.97 Message-ID: <20050914204207.A9E3A1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28425/Misc Modified Files: Tag: release24-maint NEWS Log Message: backport bug [ 1274828 ] splitunc not documented Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.96 retrieving revision 1.1193.2.97 diff -u -d -r1.1193.2.96 -r1.1193.2.97 --- NEWS 14 Sep 2005 19:38:34 -0000 1.1193.2.96 +++ NEWS 14 Sep 2005 20:42:04 -0000 1.1193.2.97 @@ -170,6 +170,8 @@ Documentation ------------- +- Bug #1274828: Document os.path.splitunc(). + - Bug #1190204: Clarify which directories are searched by site.py. - Bug #1193849: Clarify os.path.expanduser() documentation. From birkenfeld at users.sourceforge.net Wed Sep 14 22:42:07 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 22:42:07 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib libposixpath.tex, 1.40.2.2, 1.40.2.3 Message-ID: <20050914204207.BF0FC1E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28425/Doc/lib Modified Files: Tag: release24-maint libposixpath.tex Log Message: backport bug [ 1274828 ] splitunc not documented Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.40.2.2 retrieving revision 1.40.2.3 diff -u -d -r1.40.2.2 -r1.40.2.3 --- libposixpath.tex 24 Aug 2005 07:27:00 -0000 1.40.2.2 +++ libposixpath.tex 14 Sep 2005 20:42:04 -0000 1.40.2.3 @@ -234,6 +234,15 @@ at most one period. \end{funcdesc} +\begin{funcdesc}{splitunc}{path} +Split the pathname \var{path} into a pair \code{(\var{unc}, \var{rest})} +so that \var{unc} is the UNC mount point (such as \code{r'\e\e host\e mount'}), +if present, and \var{rest} the rest of the path (such as +\code{r'\e path\e file.ext'}). For paths containing drive letters, \var{unc} +will always be the empty string. +Availability: Windows. +\end{funcdesc} + \begin{funcdesc}{walk}{path, visit, arg} Calls the function \var{visit} with arguments \code{(\var{arg}, \var{dirname}, \var{names})} for each directory in the From birkenfeld at users.sourceforge.net Wed Sep 14 22:51:44 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 22:51:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.329.2.3, 2.329.2.4 Message-ID: <20050914205144.070391E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29927/Modules Modified Files: Tag: release24-maint posixmodule.c Log Message: bug [ 1007046 ] os.startfile() doesn't accept Unicode filenames Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.329.2.3 retrieving revision 2.329.2.4 diff -u -d -r2.329.2.3 -r2.329.2.4 --- posixmodule.c 13 Mar 2005 22:18:26 -0000 2.329.2.3 +++ posixmodule.c 14 Sep 2005 20:51:40 -0000 2.329.2.4 @@ -7182,7 +7182,8 @@ { char *filepath; HINSTANCE rc; - if (!PyArg_ParseTuple(args, "s:startfile", &filepath)) + if (!PyArg_ParseTuple(args, "et:startfile", + Py_FileSystemDefaultEncoding, &filepath)) return NULL; Py_BEGIN_ALLOW_THREADS rc = ShellExecute((HWND)0, NULL, filepath, NULL, NULL, SW_SHOWNORMAL); From birkenfeld at users.sourceforge.net Wed Sep 14 22:51:44 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 22:51:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.339, 2.340 Message-ID: <20050914205144.287A71E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29916/Modules Modified Files: posixmodule.c Log Message: bug [ 1007046 ] os.startfile() doesn't accept Unicode filenames Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.339 retrieving revision 2.340 diff -u -d -r2.339 -r2.340 --- posixmodule.c 14 Aug 2005 21:42:34 -0000 2.339 +++ posixmodule.c 14 Sep 2005 20:51:40 -0000 2.340 @@ -7248,7 +7248,8 @@ { char *filepath; HINSTANCE rc; - if (!PyArg_ParseTuple(args, "s:startfile", &filepath)) + if (!PyArg_ParseTuple(args, "et:startfile", + Py_FileSystemDefaultEncoding, &filepath)) return NULL; Py_BEGIN_ALLOW_THREADS rc = ShellExecute((HWND)0, NULL, filepath, NULL, NULL, SW_SHOWNORMAL); From birkenfeld at users.sourceforge.net Wed Sep 14 22:53:35 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 22:53:35 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1365,1.1366 Message-ID: <20050914205335.642831E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30428/Misc Modified Files: NEWS Log Message: Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1365 retrieving revision 1.1366 diff -u -d -r1.1365 -r1.1366 --- NEWS 14 Sep 2005 20:42:00 -0000 1.1365 +++ NEWS 14 Sep 2005 20:53:32 -0000 1.1366 @@ -143,6 +143,9 @@ Extension Modules ----------------- +- Bug #1007046: os.startfile() did not accept unicode strings encoded in + the file system encoding. + - Patch #756021: Special-case socket.inet_aton('255.255.255.255') for platforms that don't have inet_aton(). From birkenfeld at users.sourceforge.net Wed Sep 14 22:53:42 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 14 Sep 2005 22:53:42 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.97, 1.1193.2.98 Message-ID: <20050914205342.B0AA01E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30461/Misc Modified Files: Tag: release24-maint NEWS Log Message: Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.97 retrieving revision 1.1193.2.98 diff -u -d -r1.1193.2.97 -r1.1193.2.98 --- NEWS 14 Sep 2005 20:42:04 -0000 1.1193.2.97 +++ NEWS 14 Sep 2005 20:53:38 -0000 1.1193.2.98 @@ -65,6 +65,9 @@ Extension Modules ----------------- +- Bug #1007046: os.startfile() did not accept unicode strings encoded in + the file system encoding. + - Patch #756021: Special-case socket.inet_aton('255.255.255.255') for platforms that don't have inet_aton(). From guido at python.org Thu Sep 15 01:53:59 2005 From: guido at python.org (Guido van Rossum) Date: Wed, 14 Sep 2005 16:53:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py, 1.171, 1.172 test_ioctl.py, 1.2, 1.3 In-Reply-To: References: <20050914180944.848421E4003@bag.python.org> Message-ID: On 9/14/05, Neal Norwitz wrote: > > Index: test_ioctl.py > > =================================================================== > > RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ioctl.py,v > > retrieving revision 1.2 > > retrieving revision 1.3 > > diff -u -d -r1.2 -r1.3 > > --- test_ioctl.py 20 Mar 2003 04:33:16 -0000 1.2 > > +++ test_ioctl.py 14 Sep 2005 18:09:41 -0000 1.3 > > @@ -16,19 +16,23 @@ > > > > class IoctlTests(unittest.TestCase): > > def test_ioctl(self): > > - pgrp = os.getpgrp() > > + # If this process has been put into the background, TIOCGPGRP returns > > + # the session ID instead of the process group id. > > + ids = (os.getpgrp(), os.getsid(0)) > > tty = open("/dev/tty", "r") > > r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ") > > - self.assertEquals(pgrp, struct.unpack("i", r)[0]) > > + rpgrp = struct.unpack("i", r)[0] > > + self.assert_(rpgrp in ids, "%s not in %s" % (rpgrp, ids)) > > With the change to use unsigned ints in pwd and grp modules, should > the struct.unpack() use "I" (capital i) instead of "i"? I asked the author of the patch (Monte Davidoff, who occasionally comes to baypiggies meetings :-) and his response is: """ No. The change to the pwd and grp modules and the change to test_ioctl are unrelated. Unfortunately, the term "group" is overloaded, which leads to confusion. The pwd and grp modules read the password database and the group database, which are attributes of a UNIX user. The test_ioctl test case is calling the TIOCGPGRP ioctl, which returns the process group id, which is an attribute of the process. This has type pid_t, which is signed. I hope this clarifies the situation. I am glad to hear that it is checked in! Monte """ -- --Guido van Rossum (home page: http://www.python.org/~guido/) From bkm563 at socal.rr.com Thu Sep 15 02:51:27 2005 From: bkm563 at socal.rr.com (Brian McGee) Date: Wed, 14 Sep 2005 17:51:27 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liblogging.tex, 1.12.8.4, Message-ID: <000001c5b98f$9ac96940$96be4a42@mcgees4a0so3ot> Brian McGee -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20050914/7806419a/attachment.htm From bcannon at users.sourceforge.net Thu Sep 15 04:34:59 2005 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu, 15 Sep 2005 04:34:59 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py, 1.29, 1.30 Message-ID: <20050915023459.687461E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4715/Lib/test Modified Files: test_strptime.py Log Message: Clear out the regex cache when the TimeRE cache is invalidated by a locale change. Fixes bug #1290505. Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- test_strptime.py 28 Oct 2004 04:49:21 -0000 1.29 +++ test_strptime.py 15 Sep 2005 02:34:56 -0000 1.30 @@ -462,10 +462,12 @@ # Make sure cache is recreated when current locale does not match what # cached object was created with. _strptime.strptime("10", "%d") + _strptime.strptime("2005", "%Y") _strptime._TimeRE_cache.locale_time.lang = "Ni" original_time_re = id(_strptime._TimeRE_cache) _strptime.strptime("10", "%d") self.failIfEqual(original_time_re, id(_strptime._TimeRE_cache)) + self.failUnlessEqual(len(_strptime._regex_cache), 1) def test_regex_cleanup(self): # Make sure cached regexes are discarded when cache becomes "full". From bcannon at users.sourceforge.net Thu Sep 15 04:34:59 2005 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu, 15 Sep 2005 04:34:59 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.40,1.41 Message-ID: <20050915023459.871A51E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4715/Lib Modified Files: _strptime.py Log Message: Clear out the regex cache when the TimeRE cache is invalidated by a locale change. Fixes bug #1290505. Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- _strptime.py 29 Aug 2005 18:25:55 -0000 1.40 +++ _strptime.py 15 Sep 2005 02:34:56 -0000 1.41 @@ -275,13 +275,14 @@ def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): """Return a time struct based on the input string and the format string.""" - global _TimeRE_cache + global _TimeRE_cache, _regex_cache _cache_lock.acquire() try: time_re = _TimeRE_cache locale_time = time_re.locale_time if _getlang() != locale_time.lang: _TimeRE_cache = TimeRE() + _regex_cache = {} if len(_regex_cache) > _CACHE_MAX_SIZE: _regex_cache.clear() format_regex = _regex_cache.get(format) From bcannon at users.sourceforge.net Thu Sep 15 04:34:59 2005 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu, 15 Sep 2005 04:34:59 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1366,1.1367 Message-ID: <20050915023459.95C731E4009@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4715/Misc Modified Files: NEWS Log Message: Clear out the regex cache when the TimeRE cache is invalidated by a locale change. Fixes bug #1290505. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1366 retrieving revision 1.1367 diff -u -d -r1.1366 -r1.1367 --- NEWS 14 Sep 2005 20:53:32 -0000 1.1366 +++ NEWS 15 Sep 2005 02:34:56 -0000 1.1367 @@ -217,6 +217,8 @@ Library ------- +- Bug #1290505: Fix clearing the regex cache for time.strptime(). + - Bug #1167128: Fix size of a symlink in a tarfile to be 0. - Patch #810023: Fix off-by-one bug in urllib.urlretrieve reporthook From bcannon at users.sourceforge.net Thu Sep 15 04:42:08 2005 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu, 15 Sep 2005 04:42:08 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib _strptime.py, 1.38.2.2, 1.38.2.3 Message-ID: <20050915024208.25B0D1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6239/Lib Modified Files: Tag: release24-maint _strptime.py Log Message: Clear the regex cache when the locale changes. Backport of fix for bug #1290505. Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.38.2.2 retrieving revision 1.38.2.3 diff -u -d -r1.38.2.2 -r1.38.2.3 --- _strptime.py 29 Aug 2005 18:26:48 -0000 1.38.2.2 +++ _strptime.py 15 Sep 2005 02:42:05 -0000 1.38.2.3 @@ -272,13 +272,14 @@ def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): """Return a time struct based on the input string and the format string.""" - global _TimeRE_cache + global _TimeRE_cache, _regex_cache _cache_lock.acquire() try: time_re = _TimeRE_cache locale_time = time_re.locale_time if _getlang() != locale_time.lang: _TimeRE_cache = TimeRE() + _regex_cache = {} if len(_regex_cache) > _CACHE_MAX_SIZE: _regex_cache.clear() format_regex = _regex_cache.get(format) From bcannon at users.sourceforge.net Thu Sep 15 04:42:08 2005 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu, 15 Sep 2005 04:42:08 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py, 1.29, 1.29.2.1 Message-ID: <20050915024208.2774C1E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6239/Lib/test Modified Files: Tag: release24-maint test_strptime.py Log Message: Clear the regex cache when the locale changes. Backport of fix for bug #1290505. Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.29 retrieving revision 1.29.2.1 diff -u -d -r1.29 -r1.29.2.1 --- test_strptime.py 28 Oct 2004 04:49:21 -0000 1.29 +++ test_strptime.py 15 Sep 2005 02:42:05 -0000 1.29.2.1 @@ -462,10 +462,12 @@ # Make sure cache is recreated when current locale does not match what # cached object was created with. _strptime.strptime("10", "%d") + _strptime.strptime("2005", "%Y") _strptime._TimeRE_cache.locale_time.lang = "Ni" original_time_re = id(_strptime._TimeRE_cache) _strptime.strptime("10", "%d") self.failIfEqual(original_time_re, id(_strptime._TimeRE_cache)) + self.failUnlessEqual(len(_strptime._regex_cache), 1) def test_regex_cleanup(self): # Make sure cached regexes are discarded when cache becomes "full". From bcannon at users.sourceforge.net Thu Sep 15 04:42:08 2005 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu, 15 Sep 2005 04:42:08 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.98, 1.1193.2.99 Message-ID: <20050915024208.42F791E4009@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6239/Misc Modified Files: Tag: release24-maint NEWS Log Message: Clear the regex cache when the locale changes. Backport of fix for bug #1290505. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.98 retrieving revision 1.1193.2.99 diff -u -d -r1.1193.2.98 -r1.1193.2.99 --- NEWS 14 Sep 2005 20:53:38 -0000 1.1193.2.98 +++ NEWS 15 Sep 2005 02:42:05 -0000 1.1193.2.99 @@ -92,6 +92,9 @@ Library ------- +- Bug #1290505: time.strptime() was not invalidating its regex cache when the + locale changed. + - Fix a misuse of str.find() in detection of use of %U or %W in datetime format. From rhettinger at users.sourceforge.net Thu Sep 15 07:09:33 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 15 Sep 2005 07:09:33 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib textwrap.py, 1.35.4.1, 1.35.4.2 Message-ID: <20050915050933.B49171E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29738 Modified Files: Tag: release24-maint textwrap.py Log Message: Backport SF #1209527. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.35.4.1 retrieving revision 1.35.4.2 diff -u -d -r1.35.4.1 -r1.35.4.2 --- textwrap.py 5 Mar 2005 02:38:32 -0000 1.35.4.1 +++ textwrap.py 15 Sep 2005 05:09:30 -0000 1.35.4.2 @@ -161,7 +161,7 @@ else: i += 1 - def _handle_long_word(self, chunks, cur_line, cur_len, width): + def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width): """_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int) @@ -174,14 +174,14 @@ # If we're allowed to break long words, then do so: put as much # of the next chunk onto the current line as will fit. if self.break_long_words: - cur_line.append(chunks[0][0:space_left]) - chunks[0] = chunks[0][space_left:] + cur_line.append(reversed_chunks[-1][:space_left]) + reversed_chunks[-1] = reversed_chunks[-1][space_left:] # Otherwise, we have to preserve the long word intact. Only add # it to the current line if there's nothing already there -- # that minimizes how much we violate the width constraint. elif not cur_line: - cur_line.append(chunks.pop(0)) + cur_line.append(reversed_chunks.pop()) # If we're not allowed to break long words, and there's already # text on the current line, do nothing. Next time through the @@ -206,6 +206,10 @@ if self.width <= 0: raise ValueError("invalid width %r (must be > 0)" % self.width) + # Arrange in reverse order so items can be efficiently popped + # from a stack of chucks. + chunks.reverse() + while chunks: # Start the list of chunks that will make up the current line. @@ -224,15 +228,15 @@ # First chunk on line is whitespace -- drop it, unless this # is the very beginning of the text (ie. no lines started yet). - if chunks[0].strip() == '' and lines: - del chunks[0] + if chunks[-1].strip() == '' and lines: + del chunks[-1] while chunks: - l = len(chunks[0]) + l = len(chunks[-1]) # Can at least squeeze this chunk onto the current line. if cur_len + l <= width: - cur_line.append(chunks.pop(0)) + cur_line.append(chunks.pop()) cur_len += l # Nope, this line is full. @@ -241,7 +245,7 @@ # The current line is full, and the next chunk is too big to # fit on *any* line (not just this one). - if chunks and len(chunks[0]) > width: + if chunks and len(chunks[-1]) > width: self._handle_long_word(chunks, cur_line, cur_len, width) # If the last chunk on this line is all whitespace, drop it. From rhettinger at users.sourceforge.net Thu Sep 15 07:28:28 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 15 Sep 2005 07:28:28 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib urllib.py, 1.165.2.1, 1.165.2.2 Message-ID: <20050915052828.A4FD81E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31892 Modified Files: Tag: release24-maint urllib.py Log Message: Sync-up with patches to the head. Includes SF 1016880: urllib.urlretrieve silently truncates downloads and the performance fix-ups. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.165.2.1 retrieving revision 1.165.2.2 diff -u -d -r1.165.2.1 -r1.165.2.2 --- urllib.py 26 Aug 2005 08:51:39 -0000 1.165.2.1 +++ urllib.py 15 Sep 2005 05:28:25 -0000 1.165.2.2 @@ -86,6 +86,11 @@ if _urlopener: _urlopener.cleanup() +# exception raised when downloaded size does not match content-length +class ContentTooShortError(IOError): + def __init__(self, message, content): + IOError.__init__(self, message) + self.content = content ftpcache = {} class URLopener: @@ -228,6 +233,7 @@ self.tempcache[url] = result bs = 1024*8 size = -1 + read = 0 blocknum = 0 if reporthook: if "content-length" in headers: @@ -237,6 +243,7 @@ block = fp.read(bs) if block == "": break + read += len(block) tfp.write(block) blocknum += 1 if reporthook: @@ -245,6 +252,12 @@ tfp.close() del fp del tfp + + # raise exception if actual size does not match content-length header + if size >= 0 and read < size: + raise ContentTooShortError("retrieval incomplete: got only %i out " + "of %i bytes" % (read, size), result) + return result # Each method named open_ knows how to open that type of URL @@ -409,7 +422,11 @@ def open_local_file(self, url): """Use local file.""" - import mimetypes, mimetools, email.Utils, StringIO + import mimetypes, mimetools, email.Utils + try: + from cStringIO import StringIO + except ImportError: + from StringIO import StringIO host, file = splithost(url) localname = url2pathname(file) try: @@ -419,7 +436,7 @@ size = stats.st_size modified = email.Utils.formatdate(stats.st_mtime, usegmt=True) mtype = mimetypes.guess_type(url)[0] - headers = mimetools.Message(StringIO.StringIO( + headers = mimetools.Message(StringIO( 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' % (mtype or 'text/plain', size, modified))) if not host: @@ -440,7 +457,11 @@ def open_ftp(self, url): """Use FTP protocol.""" - import mimetypes, mimetools, StringIO + import mimetypes, mimetools + try: + from cStringIO import StringIO + except ImportError: + from StringIO import StringIO host, path = splithost(url) if not host: raise IOError, ('ftp error', 'no host given') host, port = splitport(host) @@ -489,7 +510,7 @@ headers += "Content-Type: %s\n" % mtype if retrlen is not None and retrlen >= 0: headers += "Content-Length: %d\n" % retrlen - headers = mimetools.Message(StringIO.StringIO(headers)) + headers = mimetools.Message(StringIO(headers)) return addinfourl(fp, headers, "ftp:" + url) except ftperrors(), msg: raise IOError, ('ftp error', msg), sys.exc_info()[2] @@ -503,7 +524,11 @@ # mediatype := [ type "/" subtype ] *( ";" parameter ) # data := *urlchar # parameter := attribute "=" value - import StringIO, mimetools + import mimetools + try: + from cStringIO import StringIO + except ImportError: + from StringIO import StringIO try: [type, data] = url.split(',', 1) except ValueError: @@ -529,7 +554,7 @@ msg.append('') msg.append(data) msg = '\n'.join(msg) - f = StringIO.StringIO(msg) + f = StringIO(msg) headers = mimetools.Message(f, 0) f.fileno = None # needed for addinfourl return addinfourl(f, headers, url) @@ -696,8 +721,11 @@ global _noheaders if _noheaders is None: import mimetools - import StringIO - _noheaders = mimetools.Message(StringIO.StringIO(), 0) + try: + from cStringIO import StringIO + except ImportError: + from StringIO import StringIO + _noheaders = mimetools.Message(StringIO(), 0) _noheaders.fp.close() # Recycle file descriptor return _noheaders @@ -1021,23 +1049,18 @@ return selector[1], selector[2:] return None, selector +_hextochr = dict(('%02x' % i, chr(i)) for i in range(256)) +_hextochr.update(('%02X' % i, chr(i)) for i in range(256)) + def unquote(s): """unquote('abc%20def') -> 'abc def'.""" - mychr = chr - myatoi = int - list = s.split('%') - res = [list[0]] - myappend = res.append - del list[0] - for item in list: - if item[1:2]: - try: - myappend(mychr(myatoi(item[:2], 16)) - + item[2:]) - except ValueError: - myappend('%' + item) - else: - myappend('%' + item) + res = s.split('%') + for i in xrange(1, len(res)): + item = res[i] + try: + res[i] = _hextochr[item[:2]] + item[2:] + except KeyError: + res[i] = '%' + item return "".join(res) def unquote_plus(s): @@ -1048,22 +1071,7 @@ always_safe = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' '0123456789' '_.-') - -_fast_safe_test = always_safe + '/' -_fast_safe = None - -def _fast_quote(s): - global _fast_safe - if _fast_safe is None: - _fast_safe = {} - for c in _fast_safe_test: - _fast_safe[c] = c - res = list(s) - for i in range(len(res)): - c = res[i] - if not c in _fast_safe: - res[i] = '%%%02X' % ord(c) - return ''.join(res) +_safemaps = {} def quote(s, safe = '/'): """quote('abc def') -> 'abc%20def' @@ -1086,25 +1094,25 @@ called on a path where the existing slash characters are used as reserved characters. """ - safe = always_safe + safe - if _fast_safe_test == safe: - return _fast_quote(s) - res = list(s) - for i in range(len(res)): - c = res[i] - if c not in safe: - res[i] = '%%%02X' % ord(c) + cachekey = (safe, always_safe) + try: + safe_map = _safemaps[cachekey] + except KeyError: + safe += always_safe + safe_map = {} + for i in range(256): + c = chr(i) + safe_map[c] = (c in safe) and c or ('%%%02X' % i) + _safemaps[cachekey] = safe_map + res = map(safe_map.__getitem__, s) return ''.join(res) def quote_plus(s, safe = ''): """Quote the query fragment of a URL; replacing ' ' with '+'""" if ' ' in s: - l = s.split(' ') - for i in range(len(l)): - l[i] = quote(l[i], safe) - return '+'.join(l) - else: - return quote(s, safe) + s = quote(s, safe + ' ') + return s.replace(' ', '+') + return quote(s, safe) def urlencode(query,doseq=0): """Encode a sequence of two-element tuples or dictionary into a URL query string. From birkenfeld at users.sourceforge.net Thu Sep 15 09:29:41 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 15 Sep 2005 09:29:41 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib webbrowser.py,1.37,1.37.4.1 Message-ID: <20050915072941.96FED1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19747/Lib Modified Files: Tag: release24-maint webbrowser.py Log Message: Fix bug #687747 and patch #1077979 in webbrowser.py. Index: webbrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v retrieving revision 1.37 retrieving revision 1.37.4.1 diff -u -d -r1.37 -r1.37.4.1 --- webbrowser.py 10 Jul 2004 22:07:02 -0000 1.37 +++ webbrowser.py 15 Sep 2005 07:29:38 -0000 1.37.4.1 @@ -127,7 +127,7 @@ def open(self, url, new=0, autoraise=1): if new: - self._remote("openURL(%s, new-window)"%url, autoraise) + self._remote("openURL(%s,new-window)"%url, autoraise) else: self._remote("openURL(%s)" % url, autoraise) @@ -355,7 +355,7 @@ if "BROWSER" in os.environ: # It's the user's responsibility to register handlers for any unknown # browser referenced by this value, before calling open(). - _tryorder = os.environ["BROWSER"].split(os.pathsep) + _tryorder[0:0] = os.environ["BROWSER"].split(os.pathsep) for cmd in _tryorder: if not cmd.lower() in _browsers: From birkenfeld at users.sourceforge.net Thu Sep 15 12:46:16 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 15 Sep 2005 12:46:16 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python bltinmodule.c, 2.324, 2.325 Message-ID: <20050915104616.E36341E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28578/Python Modified Files: bltinmodule.c Log Message: bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.324 retrieving revision 2.325 diff -u -d -r2.324 -r2.325 --- bltinmodule.c 31 Aug 2005 22:21:15 -0000 2.324 +++ bltinmodule.c 15 Sep 2005 10:46:13 -0000 2.325 @@ -542,6 +542,13 @@ else if (locals == Py_None) locals = globals; + if (globals == NULL || locals == NULL) { + PyErr_SetString(PyExc_TypeError, + "eval must be given globals and locals " + "when called without a frame"); + return NULL; + } + if (PyDict_GetItemString(globals, "__builtins__") == NULL) { if (PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins()) != 0) From birkenfeld at users.sourceforge.net Thu Sep 15 12:46:21 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 15 Sep 2005 12:46:21 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python bltinmodule.c, 2.318.2.2, 2.318.2.3 Message-ID: <20050915104621.3606E1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28585/Python Modified Files: Tag: release24-maint bltinmodule.c Log Message: backport bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.318.2.2 retrieving revision 2.318.2.3 diff -u -d -r2.318.2.2 -r2.318.2.3 --- bltinmodule.c 21 Aug 2005 11:09:58 -0000 2.318.2.2 +++ bltinmodule.c 15 Sep 2005 10:46:18 -0000 2.318.2.3 @@ -479,6 +479,13 @@ else if (locals == Py_None) locals = globals; + if (globals == NULL || locals == NULL) { + PyErr_SetString(PyExc_TypeError, + "eval must be given globals and locals " + "when called without a frame"); + return NULL; + } + if (PyDict_GetItemString(globals, "__builtins__") == NULL) { if (PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins()) != 0) From birkenfeld at users.sourceforge.net Thu Sep 15 13:16:27 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 15 Sep 2005 13:16:27 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/api utilities.tex, 1.20.2.2, 1.20.2.3 Message-ID: <20050915111627.3DB211E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5110/Doc/api Modified Files: Tag: release24-maint utilities.tex Log Message: fix typo Index: utilities.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/utilities.tex,v retrieving revision 1.20.2.2 retrieving revision 1.20.2.3 diff -u -d -r1.20.2.2 -r1.20.2.3 --- utilities.tex 17 Jul 2005 20:05:26 -0000 1.20.2.2 +++ utilities.tex 15 Sep 2005 11:16:23 -0000 1.20.2.3 @@ -34,7 +34,7 @@ Return true when the interpreter runs out of stack space. This is a reliable check, but is only available when \constant{USE_STACKCHECK} is defined (currently on Windows using the Microsoft Visual \Cpp{} - compiler). \constant{USE_CHECKSTACK} will be + compiler). \constant{USE_STACKCHECK} will be defined automatically; you should never change the definition in your own code. \end{cfuncdesc} From birkenfeld at users.sourceforge.net Thu Sep 15 13:16:30 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 15 Sep 2005 13:16:30 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/api utilities.tex,1.22,1.23 Message-ID: <20050915111630.F00321E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5147/Doc/api Modified Files: utilities.tex Log Message: fix typo Index: utilities.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/utilities.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- utilities.tex 17 Jul 2005 20:05:25 -0000 1.22 +++ utilities.tex 15 Sep 2005 11:16:28 -0000 1.23 @@ -34,7 +34,7 @@ Return true when the interpreter runs out of stack space. This is a reliable check, but is only available when \constant{USE_STACKCHECK} is defined (currently on Windows using the Microsoft Visual \Cpp{} - compiler). \constant{USE_CHECKSTACK} will be + compiler). \constant{USE_STACKCHECK} will be defined automatically; you should never change the definition in your own code. \end{cfuncdesc} From birkenfeld at users.sourceforge.net Thu Sep 15 15:00:30 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 15 Sep 2005 15:00:30 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python sysmodule.c, 2.126.2.2, 2.126.2.3 Message-ID: <20050915130030.62C661E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27745/Python Modified Files: Tag: release24-maint sysmodule.c Log Message: backport patch [ 1119423 ] python -c readlink()s and stat()s '-c' Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.126.2.2 retrieving revision 2.126.2.3 diff -u -d -r2.126.2.2 -r2.126.2.3 --- sysmodule.c 27 Jan 2005 18:58:30 -0000 2.126.2.2 +++ sysmodule.c 15 Sep 2005 13:00:25 -0000 2.126.2.3 @@ -1188,7 +1188,7 @@ char link[MAXPATHLEN+1]; char argv0copy[2*MAXPATHLEN+1]; int nr = 0; - if (argc > 0 && argv0 != NULL) + if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) nr = readlink(argv0, link, MAXPATHLEN); if (nr > 0) { /* It's a symlink */ @@ -1213,7 +1213,7 @@ } #endif /* HAVE_READLINK */ #if SEP == '\\' /* Special case for MS filename syntax */ - if (argc > 0 && argv0 != NULL) { + if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) { char *q; #ifdef MS_WINDOWS char *ptemp; @@ -1236,7 +1236,7 @@ } } #else /* All other filename syntaxes */ - if (argc > 0 && argv0 != NULL) { + if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) { #if defined(HAVE_REALPATH) if (realpath(argv0, fullpath)) { argv0 = fullpath; From birkenfeld at users.sourceforge.net Thu Sep 15 15:00:38 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 15 Sep 2005 15:00:38 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python sysmodule.c,2.128,2.129 Message-ID: <20050915130038.11B8D1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27881/Python Modified Files: sysmodule.c Log Message: patch [ 1119423 ] python -c readlink()s and stat()s '-c' Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.128 retrieving revision 2.129 diff -u -d -r2.128 -r2.129 --- sysmodule.c 27 Jan 2005 18:56:16 -0000 2.128 +++ sysmodule.c 15 Sep 2005 13:00:34 -0000 2.129 @@ -1188,7 +1188,7 @@ char link[MAXPATHLEN+1]; char argv0copy[2*MAXPATHLEN+1]; int nr = 0; - if (argc > 0 && argv0 != NULL) + if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) nr = readlink(argv0, link, MAXPATHLEN); if (nr > 0) { /* It's a symlink */ @@ -1213,7 +1213,7 @@ } #endif /* HAVE_READLINK */ #if SEP == '\\' /* Special case for MS filename syntax */ - if (argc > 0 && argv0 != NULL) { + if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) { char *q; #ifdef MS_WINDOWS char *ptemp; @@ -1236,7 +1236,7 @@ } } #else /* All other filename syntaxes */ - if (argc > 0 && argv0 != NULL) { + if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) { #if defined(HAVE_REALPATH) if (realpath(argv0, fullpath)) { argv0 = fullpath; From birkenfeld at users.sourceforge.net Thu Sep 15 18:02:14 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 15 Sep 2005 18:02:14 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex, 1.27.2.4, 1.27.2.5 Message-ID: <20050915160214.759871E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5477/Doc/lib Modified Files: Tag: release24-maint tkinter.tex Log Message: backport patch [ 1277677 ] tkinter hello world example bug Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.27.2.4 retrieving revision 1.27.2.5 diff -u -d -r1.27.2.4 -r1.27.2.5 --- tkinter.tex 29 Jan 2005 19:54:45 -0000 1.27.2.4 +++ tkinter.tex 15 Sep 2005 16:02:09 -0000 1.27.2.5 @@ -258,8 +258,10 @@ self.pack() self.createWidgets() -app = Application() +root = Tk() +app = Application(master=root) app.mainloop() +root.destroy() \end{verbatim} From birkenfeld at users.sourceforge.net Thu Sep 15 18:02:16 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 15 Sep 2005 18:02:16 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.31,1.32 Message-ID: <20050915160216.731EA1E400A@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5462/Doc/lib Modified Files: tkinter.tex Log Message: patch [ 1277677 ] tkinter hello world example bug Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- tkinter.tex 29 Jan 2005 19:49:34 -0000 1.31 +++ tkinter.tex 15 Sep 2005 16:02:13 -0000 1.32 @@ -258,8 +258,10 @@ self.pack() self.createWidgets() -app = Application() +root = Tk() +app = Application(master=root) app.mainloop() +root.destroy() \end{verbatim} From rhettinger at users.sourceforge.net Thu Sep 15 19:22:02 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 15 Sep 2005 19:22:02 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib textwrap.py, 1.35.4.2, 1.35.4.3 Message-ID: <20050915172202.E31721E403B@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27719 Modified Files: Tag: release24-maint textwrap.py Log Message: Removed assignment to an unused variable. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.35.4.2 retrieving revision 1.35.4.3 diff -u -d -r1.35.4.2 -r1.35.4.3 --- textwrap.py 15 Sep 2005 05:09:30 -0000 1.35.4.2 +++ textwrap.py 15 Sep 2005 17:21:59 -0000 1.35.4.3 @@ -272,7 +272,6 @@ converted to space. """ text = self._munge_whitespace(text) - indent = self.initial_indent chunks = self._split(text) if self.fix_sentence_endings: self._fix_sentence_endings(chunks) From rhettinger at users.sourceforge.net Thu Sep 15 19:40:31 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 15 Sep 2005 19:40:31 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib decimal.py, 1.31.2.5, 1.31.2.6 Message-ID: <20050915174031.76FAF1E406E@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31585 Modified Files: Tag: release24-maint decimal.py Log Message: Sync-up with minor changes to the head. Index: decimal.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/decimal.py,v retrieving revision 1.31.2.5 retrieving revision 1.31.2.6 diff -u -d -r1.31.2.5 -r1.31.2.6 --- decimal.py 22 Aug 2005 19:35:24 -0000 1.31.2.5 +++ decimal.py 15 Sep 2005 17:40:28 -0000 1.31.2.6 @@ -515,7 +515,7 @@ if isinstance(value, (list,tuple)): if len(value) != 3: raise ValueError, 'Invalid arguments' - if value[0] not in [0,1]: + if value[0] not in (0,1): raise ValueError, 'Invalid sign' for digit in value[1]: if not isinstance(digit, (int,long)) or digit < 0: @@ -760,18 +760,19 @@ Captures all of the information in the underlying representation. """ - if self._isnan(): - minus = '-'*self._sign - if self._int == (0,): - info = '' - else: - info = ''.join(map(str, self._int)) - if self._isnan() == 2: - return minus + 'sNaN' + info - return minus + 'NaN' + info - if self._isinfinity(): - minus = '-'*self._sign - return minus + 'Infinity' + if self._is_special: + if self._isnan(): + minus = '-'*self._sign + if self._int == (0,): + info = '' + else: + info = ''.join(map(str, self._int)) + if self._isnan() == 2: + return minus + 'sNaN' + info + return minus + 'NaN' + info + if self._isinfinity(): + minus = '-'*self._sign + return minus + 'Infinity' if context is None: context = getcontext() @@ -1446,7 +1447,7 @@ return float(str(self)) def __int__(self): - """Converts self to a int, truncating if necessary.""" + """Converts self to an int, truncating if necessary.""" if self._is_special: if self._isnan(): context = getcontext() From barry at python.org Thu Sep 15 19:52:03 2005 From: barry at python.org (Barry Warsaw) Date: Thu, 15 Sep 2005 13:52:03 -0400 Subject: [Python-checkins] [Fwd: python-checkins reply-to] Message-ID: <1126806723.21457.17.camel@geddy.wooz.org> FYI for those not on python-dev... -------------- next part -------------- An embedded message was scrubbed... From: Barry Warsaw Subject: python-checkins reply-to Date: Thu, 15 Sep 2005 13:05:38 -0400 Size: 1374 Url: http://mail.python.org/pipermail/python-checkins/attachments/20050915/03adeb70/attachment-0001.mht -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 307 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/python-checkins/attachments/20050915/03adeb70/attachment-0001.pgp From rhettinger at users.sourceforge.net Thu Sep 15 20:07:15 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 15 Sep 2005 20:07:15 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib random.py,1.69,1.69.2.1 Message-ID: <20050915180715.3A0A01E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4852 Modified Files: Tag: release24-maint random.py Log Message: Sync-up with head except for 1.72 which is Py2.5 specific. Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.69 retrieving revision 1.69.2.1 diff -u -d -r1.69 -r1.69.2.1 --- random.py 27 Sep 2004 15:29:03 -0000 1.69 +++ random.py 15 Sep 2005 18:07:11 -0000 1.69.2.1 @@ -43,7 +43,6 @@ from types import MethodType as _MethodType, BuiltinMethodType as _BuiltinMethodType from math import log as _log, exp as _exp, pi as _pi, e as _e from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin -from math import floor as _floor from os import urandom as _urandom from binascii import hexlify as _hexlify @@ -346,7 +345,7 @@ # Math Software, 3, (1977), pp257-260. random = self.random - while True: + while 1: u1 = random() u2 = 1.0 - random() z = NV_MAGICCONST*(u1-0.5)/u2 @@ -416,7 +415,7 @@ b = (a - _sqrt(2.0 * a))/(2.0 * kappa) r = (1.0 + b * b)/(2.0 * b) - while True: + while 1: u1 = random() z = _cos(_pi * u1) @@ -425,7 +424,7 @@ u2 = random() - if not (u2 >= c * (2.0 - c) and u2 > c * _exp(1.0 - c)): + if u2 < c * (2.0 - c) or u2 <= c * _exp(1.0 - c): break u3 = random() @@ -463,7 +462,7 @@ bbb = alpha - LOG4 ccc = alpha + ainv - while True: + while 1: u1 = random() if not 1e-7 < u1 < .9999999: continue @@ -486,18 +485,19 @@ # Uses ALGORITHM GS of Statistical Computing - Kennedy & Gentle - while True: + while 1: u = random() b = (_e + alpha)/_e p = b*u if p <= 1.0: - x = pow(p, 1.0/alpha) + x = p ** (1.0/alpha) else: - # p > 1 x = -_log((b-p)/alpha) u1 = random() - if not (((p <= 1.0) and (u1 > _exp(-x))) or - ((p > 1) and (u1 > pow(x, alpha - 1.0)))): + if p > 1.0: + if u1 <= x ** (alpha - 1.0): + break + elif u1 <= _exp(-x): break return x * beta From bcannon at users.sourceforge.net Fri Sep 16 04:43:39 2005 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri, 16 Sep 2005 04:43:39 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules getpath.c,1.50,1.51 Message-ID: <20050916024339.4C3581E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21321/Modules Modified Files: getpath.c Log Message: Change type on variable to silence gcc 4 warning. Call signature was found at http://darwinsource.opendarwin.org/10.4.2/dyld-43.1/src/dyldAPIs.cpp . Index: getpath.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/getpath.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- getpath.c 8 Aug 2004 01:00:47 -0000 1.50 +++ getpath.c 16 Sep 2005 02:43:35 -0000 1.51 @@ -381,7 +381,7 @@ NSModule pythonModule; #endif #ifdef __APPLE__ - unsigned long nsexeclength = MAXPATHLEN; + uint32_t nsexeclength = MAXPATHLEN; #endif /* If there is no slash in the argv0 path, then we have to From birkenfeld at users.sourceforge.net Fri Sep 16 08:42:30 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Fri, 16 Sep 2005 08:42:30 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Objects complexobject.c, 2.73, 2.74 Message-ID: <20050916064230.39D481E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25840/Objects Modified Files: complexobject.c Log Message: patch [ 1118729 ] Error in representation of complex numbers(again) Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.73 retrieving revision 2.74 diff -u -d -r2.73 -r2.74 --- complexobject.c 19 Dec 2004 20:45:20 -0000 2.73 +++ complexobject.c 16 Sep 2005 06:42:26 -0000 2.74 @@ -279,15 +279,12 @@ strncat(buf, "j", bufsz); } else { char re[64], im[64]; - char *fmt; + /* Format imaginary part with sign, real part without */ PyOS_snprintf(format, 32, "%%.%ig", precision); PyOS_ascii_formatd(re, 64, format, v->cval.real); + PyOS_snprintf(format, 32, "%%+.%ig", precision); PyOS_ascii_formatd(im, 64, format, v->cval.imag); - if (v->cval.imag < 0.) - fmt = "(%s%sj)"; - else - fmt = "(%s+%sj)"; - PyOS_snprintf(buf, bufsz, fmt, re, im); + PyOS_snprintf(buf, bufsz, "(%s%sj)", re, im); } } From birkenfeld at users.sourceforge.net Fri Sep 16 08:42:36 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Fri, 16 Sep 2005 08:42:36 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Objects complexobject.c, 2.72.2.1, 2.72.2.2 Message-ID: <20050916064236.267BD1E4009@bag.python.org> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25841/Objects Modified Files: Tag: release24-maint complexobject.c Log Message: backport patch [ 1118729 ] Error in representation of complex numbers(again) Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.72.2.1 retrieving revision 2.72.2.2 diff -u -d -r2.72.2.1 -r2.72.2.2 --- complexobject.c 19 Dec 2004 20:47:25 -0000 2.72.2.1 +++ complexobject.c 16 Sep 2005 06:42:32 -0000 2.72.2.2 @@ -279,15 +279,12 @@ strncat(buf, "j", bufsz); } else { char re[64], im[64]; - char *fmt; + /* Format imaginary part with sign, real part without */ PyOS_snprintf(format, 32, "%%.%ig", precision); PyOS_ascii_formatd(re, 64, format, v->cval.real); + PyOS_snprintf(format, 32, "%%+.%ig", precision); PyOS_ascii_formatd(im, 64, format, v->cval.imag); - if (v->cval.imag < 0.) - fmt = "(%s%sj)"; - else - fmt = "(%s+%sj)"; - PyOS_snprintf(buf, bufsz, fmt, re, im); + PyOS_snprintf(buf, bufsz, "(%s%sj)", re, im); } } From rhettinger at users.sourceforge.net Fri Sep 16 09:14:24 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 16 Sep 2005 09:14:24 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_set.py,1.22,1.23 Message-ID: <20050916071424.871711E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv303/Lib/test Modified Files: test_set.py Log Message: No longer ignore exceptions raised by comparisons during key lookup. Inspired by Armin Rigo's suggestion to do the same with dictionaries. Index: test_set.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_set.py,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- test_set.py 16 Aug 2005 10:44:15 -0000 1.22 +++ test_set.py 16 Sep 2005 07:14:21 -0000 1.23 @@ -15,6 +15,12 @@ raise PassThru yield 1 +class BadCmp: + def __hash__(self): + return 1 + def __cmp__(self, other): + raise RuntimeError + class TestJointOps(unittest.TestCase): # Tests common to both set and frozenset @@ -227,6 +233,17 @@ f.add(s) f.discard(s) + def test_badcmp(self): + s = self.thetype([BadCmp()]) + # Detect comparison errors during insertion and lookup + self.assertRaises(RuntimeError, self.thetype, [BadCmp(), BadCmp()]) + self.assertRaises(RuntimeError, s.__contains__, BadCmp()) + # Detect errors during mutating operations + if hasattr(s, 'add'): + self.assertRaises(RuntimeError, s.add, BadCmp()) + self.assertRaises(RuntimeError, s.discard, BadCmp()) + self.assertRaises(RuntimeError, s.remove, BadCmp()) + class TestSet(TestJointOps): thetype = set From rhettinger at users.sourceforge.net Fri Sep 16 09:14:25 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 16 Sep 2005 09:14:25 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.56,1.57 Message-ID: <20050916071425.13BF81E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv303/Objects Modified Files: setobject.c Log Message: No longer ignore exceptions raised by comparisons during key lookup. Inspired by Armin Rigo's suggestion to do the same with dictionaries. Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- setobject.c 26 Aug 2005 06:42:30 -0000 1.56 +++ setobject.c 16 Sep 2005 07:14:21 -0000 1.57 @@ -44,11 +44,8 @@ All arithmetic on hash should ignore overflow. -The lookup function always succeeds and nevers return NULL. This simplifies -and speeds client functions which do won't have to test for and handle -errors. To meet that requirement, any errors generated by a user defined -__cmp__() function are simply cleared and ignored. -Previously outstanding exceptions are maintained. +Unlike the dictionary implementation, the lookkey functions can return +NULL if the rich comparison returns an error. */ static setentry * @@ -60,10 +57,7 @@ register unsigned int mask = so->mask; setentry *table = so->table; register setentry *entry; - register int restore_error; - register int checked_error; register int cmp; - PyObject *err_type, *err_value, *err_tb; PyObject *startkey; i = hash & mask; @@ -71,31 +65,23 @@ if (entry->key == NULL || entry->key == key) return entry; - restore_error = checked_error = 0; if (entry->key == dummy) freeslot = entry; else { if (entry->hash == hash) { - /* error can't have been checked yet */ - checked_error = 1; - if (_PyErr_OCCURRED()) { - restore_error = 1; - PyErr_Fetch(&err_type, &err_value, &err_tb); - } startkey = entry->key; cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); if (cmp < 0) - PyErr_Clear(); + return NULL; if (table == so->table && entry->key == startkey) { if (cmp > 0) - goto Done; + return entry; } else { /* The compare did major nasty stuff to the * set: start over. */ - entry = set_lookkey(so, key, hash); - goto Done; + return set_lookkey(so, key, hash); } } freeslot = NULL; @@ -114,18 +100,10 @@ if (entry->key == key) break; if (entry->hash == hash && entry->key != dummy) { - if (!checked_error) { - checked_error = 1; - if (_PyErr_OCCURRED()) { - restore_error = 1; - PyErr_Fetch(&err_type, &err_value, - &err_tb); - } - } startkey = entry->key; cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); if (cmp < 0) - PyErr_Clear(); + return NULL; if (table == so->table && entry->key == startkey) { if (cmp > 0) break; @@ -134,29 +112,19 @@ /* The compare did major nasty stuff to the * set: start over. */ - entry = set_lookkey(so, key, hash); - break; + return set_lookkey(so, key, hash); } } else if (entry->key == dummy && freeslot == NULL) freeslot = entry; } - -Done: - if (restore_error) - PyErr_Restore(err_type, err_value, err_tb); return entry; } /* * Hacked up version of set_lookkey which can assume keys are always strings; - * this assumption allows testing for errors during PyObject_Compare() to - * be dropped; string-string comparisons never raise exceptions. This also - * means we don't need to go through PyObject_Compare(); we can always use - * _PyString_Eq directly. - * - * This is valuable because the general-case error handling in set_lookkey() is - * expensive, and sets with pure-string keys may be very common. + * This means we can always use _PyString_Eq directly and not have to check to + * see if the comparison altered the table. */ static setentry * set_lookkey_string(PySetObject *so, PyObject *key, register long hash) @@ -210,7 +178,7 @@ Used both by the internal resize routine and by the public insert routine. Eats a reference to key. */ -static void +static int set_insert_key(register PySetObject *so, PyObject *key, long hash) { register setentry *entry; @@ -218,6 +186,8 @@ assert(so->lookup != NULL); entry = so->lookup(so, key, hash); + if (entry == NULL) + return -1; if (entry->key == NULL) { /* UNUSED */ so->fill++; @@ -234,6 +204,7 @@ /* ACTIVE */ Py_DECREF(key); } + return 0; } /* @@ -317,7 +288,11 @@ } else { /* ACTIVE */ --i; - set_insert_key(so, entry->key, entry->hash); + if(set_insert_key(so, entry->key, entry->hash) == -1) { + if (is_oldtable_malloced) + PyMem_DEL(oldtable); + return -1; + } } } @@ -336,7 +311,8 @@ assert(so->fill <= so->mask); /* at least one empty slot */ n_used = so->used; Py_INCREF(entry->key); - set_insert_key(so, entry->key, entry->hash); + if (set_insert_key(so, entry->key, entry->hash) == -1) + return -1; if (!(so->used > n_used && so->fill*3 >= (so->mask+1)*2)) return 0; return set_table_resize(so, so->used>50000 ? so->used*2 : so->used*4); @@ -357,7 +333,10 @@ assert(so->fill <= so->mask); /* at least one empty slot */ n_used = so->used; Py_INCREF(key); - set_insert_key(so, key, hash); + if (set_insert_key(so, key, hash) == -1) { + Py_DECREF(key); + return -1; + } if (!(so->used > n_used && so->fill*3 >= (so->mask+1)*2)) return 0; return set_table_resize(so, so->used>50000 ? so->used*2 : so->used*4); @@ -372,6 +351,8 @@ PyObject *old_key; entry = (so->lookup)(so, oldentry->key, oldentry->hash); + if (entry == NULL) + return -1; if (entry->key == NULL || entry->key == dummy) return DISCARD_NOTFOUND; old_key = entry->key; @@ -397,6 +378,8 @@ return -1; } entry = (so->lookup)(so, key, hash); + if (entry == NULL) + return -1; if (entry->key == NULL || entry->key == dummy) return DISCARD_NOTFOUND; old_key = entry->key; @@ -601,7 +584,10 @@ if (entry->key != NULL && entry->key != dummy) { Py_INCREF(entry->key); - set_insert_key(so, entry->key, entry->hash); + if (set_insert_key(so, entry->key, entry->hash) == -1) { + Py_DECREF(entry->key); + return -1; + } } } return 0; @@ -611,6 +597,7 @@ set_contains_key(PySetObject *so, PyObject *key) { long hash; + setentry *entry; if (!PyString_CheckExact(key) || (hash = ((PyStringObject *) key)->ob_shash) == -1) { @@ -618,7 +605,10 @@ if (hash == -1) return -1; } - key = (so->lookup)(so, key, hash)->key; + entry = (so->lookup)(so, key, hash); + if (entry == NULL) + return -1; + key = entry->key; return key != NULL && key != dummy; } @@ -626,8 +616,12 @@ set_contains_entry(PySetObject *so, setentry *entry) { PyObject *key; + setentry *lu_entry; - key = (so->lookup)(so, entry->key, entry->hash)->key; + lu_entry = (so->lookup)(so, entry->key, entry->hash); + if (lu_entry == NULL) + return -1; + key = lu_entry->key; return key != NULL && key != dummy; } @@ -2096,4 +2090,6 @@ Py_RETURN_TRUE; } +#undef assertRaises + #endif From vsajip at users.sourceforge.net Fri Sep 16 12:33:44 2005 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Fri, 16 Sep 2005 12:33:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/logging __init__.py, 1.29, 1.30 Message-ID: <20050916103344.0F8901E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6686 Modified Files: __init__.py Log Message: Added lock acquisition around handler removal from logger Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/__init__.py,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- __init__.py 8 Sep 2005 18:14:16 -0000 1.29 +++ __init__.py 16 Sep 2005 10:33:40 -0000 1.30 @@ -1090,7 +1090,11 @@ """ if hdlr in self.handlers: #hdlr.close() - self.handlers.remove(hdlr) + hdlr.acquire() + try: + self.handlers.remove(hdlr) + finally: + hdlr.release() def callHandlers(self, record): """ From vsajip at users.sourceforge.net Fri Sep 16 12:44:44 2005 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Fri, 16 Sep 2005 12:44:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/logging __init__.py, 1.24.2.1, 1.24.2.2 Message-ID: <20050916104444.0F3581E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8350 Modified Files: Tag: release24-maint __init__.py Log Message: Misc. backported changes Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/__init__.py,v retrieving revision 1.24.2.1 retrieving revision 1.24.2.2 diff -u -d -r1.24.2.1 -r1.24.2.2 --- __init__.py 31 Mar 2005 20:10:38 -0000 1.24.2.1 +++ __init__.py 16 Sep 2005 10:44:40 -0000 1.24.2.2 @@ -52,7 +52,9 @@ # _srcfile is used when walking the stack to check when we've got the first # caller stack frame. # -if string.lower(__file__[-4:]) in ['.pyc', '.pyo']: +if hasattr(sys, 'frozen'): #support for py2exe + _srcfile = "logging%s__init__%s" % (os.sep, __file__[-4:]) +elif string.lower(__file__[-4:]) in ['.pyc', '.pyo']: _srcfile = __file__[:-4] + '.py' else: _srcfile = __file__ @@ -542,6 +544,7 @@ #--------------------------------------------------------------------------- _handlers = {} #repository of handlers (for flushing when shutdown called) +_handlerList = [] # added to allow handlers to be removed in reverse of order initialized class Handler(Filterer): """ @@ -564,6 +567,7 @@ _acquireLock() try: #unlikely to raise an exception, but you never know... _handlers[self] = 1 + _handlerList.insert(0, self) finally: _releaseLock() self.createLock() @@ -666,6 +670,7 @@ _acquireLock() try: #unlikely to raise an exception, but you never know... del _handlers[self] + _handlerList.remove(self) finally: _releaseLock() @@ -1085,7 +1090,11 @@ """ if hdlr in self.handlers: #hdlr.close() - self.handlers.remove(hdlr) + hdlr.acquire() + try: + self.handlers.remove(hdlr) + finally: + hdlr.release() def callHandlers(self, record): """ @@ -1305,7 +1314,7 @@ Should be called at application exit. """ - for h in _handlers.keys(): + for h in _handlerList[:]: # was _handlers.keys(): #errors might occur, for example, if files are locked #we just ignore them try: From vsajip at users.sourceforge.net Fri Sep 16 12:45:50 2005 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Fri, 16 Sep 2005 12:45:50 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/logging config.py, 1.10.2.1, 1.10.2.2 Message-ID: <20050916104550.126161E4180@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8467 Modified Files: Tag: release24-maint config.py Log Message: Misc. backported changes Index: config.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/config.py,v retrieving revision 1.10.2.1 retrieving revision 1.10.2.2 diff -u -d -r1.10.2.1 -r1.10.2.2 --- config.py 31 Mar 2005 20:11:45 -0000 1.10.2.1 +++ config.py 16 Sep 2005 10:45:46 -0000 1.10.2.2 @@ -225,9 +225,9 @@ """ Handle a request. - Each request is expected to be a 4-byte length, - followed by the config file. Uses fileConfig() to do the - grunt work. + Each request is expected to be a 4-byte length, packed using + struct.pack(">L", n), followed by the config file. + Uses fileConfig() to do the grunt work. """ import tempfile try: From vsajip at users.sourceforge.net Fri Sep 16 12:56:00 2005 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Fri, 16 Sep 2005 12:56:00 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib liblogging.tex, 1.33.2.4, 1.33.2.5 Message-ID: <20050916105600.AB39F1E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10071 Modified Files: Tag: release24-maint liblogging.tex Log Message: Misc. backported changes Index: liblogging.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblogging.tex,v retrieving revision 1.33.2.4 retrieving revision 1.33.2.5 diff -u -d -r1.33.2.4 -r1.33.2.5 --- liblogging.tex 14 Sep 2005 16:52:35 -0000 1.33.2.4 +++ liblogging.tex 16 Sep 2005 10:55:57 -0000 1.33.2.5 @@ -1418,7 +1418,10 @@ will be sent as a file suitable for processing by \function{fileConfig()}. Returns a \class{Thread} instance on which you can call \method{start()} to start the server, and which you can \method{join()} when appropriate. -To stop the server, call \function{stopListening()}. +To stop the server, call \function{stopListening()}. To send a configuration +to the socket, read in the configuration file and send it to the socket +as a string of bytes preceded by a four-byte length packed in binary using +struct.\code{pack(">L", n)}. \end{funcdesc} \begin{funcdesc}{stopListening}{} From pje at users.sourceforge.net Sat Sep 17 02:18:41 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 17 Sep 2005 02:18:41 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools ez_setup.py, 1.29, 1.30 Message-ID: <20050917001841.835DE1E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30533 Modified Files: ez_setup.py Log Message: Fixed cheeseshop URL. Index: ez_setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/ez_setup.py,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- ez_setup.py 14 Sep 2005 16:45:07 -0000 1.29 +++ ez_setup.py 17 Sep 2005 00:18:37 -0000 1.30 @@ -13,8 +13,9 @@ This file can also be run as a script to install or upgrade setuptools. """ +import sys DEFAULT_VERSION = "0.6a1" -DEFAULT_URL = "http://cheeseshop.python.org/packages/source/s/setuptools/" +DEFAULT_URL = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3] md5_data = { 'setuptools-0.5a13-py2.3.egg': '85edcf0ef39bab66e130d3f38f578c86', From pje at users.sourceforge.net Sat Sep 17 03:13:05 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 17 Sep 2005 03:13:05 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools.egg-info entry_points.txt, 1.6, 1.7 Message-ID: <20050917011305.6C9531E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.egg-info In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8383/setuptools.egg-info Modified Files: entry_points.txt Log Message: Added support to solve the infamous "we want .py on Windows, no extension elsewhere" problem, while also bypassing the need for PATHEXT on Windows, and in fact the need to even write script files at all, for any platform. Instead, you define "entry points" in your setup script, in this case the names of the scripts you want (without extensions) and the functions that should be imported and run to implement the scripts. Setuptools will then generate platform-appropriate script files at install time, including an .exe wrapper when installing on Windows. Index: entry_points.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.egg-info/entry_points.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- entry_points.txt 22 Aug 2005 03:14:58 -0000 1.6 +++ entry_points.txt 17 Sep 2005 01:13:02 -0000 1.7 @@ -16,11 +16,15 @@ entry_points.txt = setuptools.command.egg_info:write_entries depends.txt = setuptools.command.egg_info:warn_depends_obsolete +[console_scripts] +easy_install = setuptools.command.easy_install:main + [distutils.commands] bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm rotate = setuptools.command.rotate:rotate develop = setuptools.command.develop:develop setopt = setuptools.command.setopt:setopt +build_py = setuptools.command.build_py:build_py saveopts = setuptools.command.saveopts:saveopts egg_info = setuptools.command.egg_info:egg_info upload = setuptools.command.upload:upload From pje at users.sourceforge.net Sat Sep 17 03:13:05 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 17 Sep 2005 03:13:05 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools launcher.exe, NONE, 1.1 Message-ID: <20050917011305.86ED11E4008@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8383/setuptools Added Files: launcher.exe Log Message: Added support to solve the infamous "we want .py on Windows, no extension elsewhere" problem, while also bypassing the need for PATHEXT on Windows, and in fact the need to even write script files at all, for any platform. Instead, you define "entry points" in your setup script, in this case the names of the scripts you want (without extensions) and the functions that should be imported and run to implement the scripts. Setuptools will then generate platform-appropriate script files at install time, including an .exe wrapper when installing on Windows. --- NEW FILE: launcher.exe --- (This appears to be a binary file; contents omitted.) From pje at users.sourceforge.net Sat Sep 17 03:13:05 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 17 Sep 2005 03:13:05 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command develop.py, 1.5, 1.6 easy_install.py, 1.28, 1.29 Message-ID: <20050917011305.B7C1A1E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8383/setuptools/command Modified Files: develop.py easy_install.py Log Message: Added support to solve the infamous "we want .py on Windows, no extension elsewhere" problem, while also bypassing the need for PATHEXT on Windows, and in fact the need to even write script files at all, for any platform. Instead, you define "entry points" in your setup script, in this case the names of the scripts you want (without extensions) and the functions that should be imported and run to implement the scripts. Setuptools will then generate platform-appropriate script files at install time, including an .exe wrapper when installing on Windows. Index: develop.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/develop.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- develop.py 18 Jul 2005 01:39:45 -0000 1.5 +++ develop.py 17 Sep 2005 01:13:02 -0000 1.6 @@ -101,6 +101,11 @@ return easy_install.install_egg_scripts(self,dist) # create wrapper scripts in the script dir, pointing to dist.scripts + + # new-style... + self.install_console_scripts(dist) + + # ...and old-style for script_name in self.distribution.scripts or []: script_path = os.path.abspath(convert_path(script_name)) script_name = os.path.basename(script_path) @@ -116,8 +121,3 @@ - - - - - Index: easy_install.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/easy_install.py,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- easy_install.py 3 Sep 2005 04:50:05 -0000 1.28 +++ easy_install.py 17 Sep 2005 01:13:02 -0000 1.29 @@ -244,6 +244,19 @@ + def install_egg_scripts(self, dist): + """Write all the scripts for `dist`, unless scripts are excluded""" + + self.install_console_scripts(dist) + if self.exclude_scripts or not dist.metadata_isdir('scripts'): + return + + for script_name in dist.metadata_listdir('scripts'): + self.install_script( + dist, script_name, + dist.get_metadata('scripts/'+script_name).replace('\r','\n') + ) + def add_output(self, path): if os.path.isdir(path): for base, dirs, files in os.walk(path): @@ -272,19 +285,6 @@ - - - - - - - - - - - - - def easy_install(self, spec, deps=False): tmpdir = tempfile.mkdtemp(prefix="easy_install-") download = None @@ -408,16 +408,6 @@ ) - def install_egg_scripts(self, dist): - if self.exclude_scripts or not dist.metadata_isdir('scripts'): - return - - for script_name in dist.metadata_listdir('scripts'): - self.install_script( - dist, script_name, - dist.get_metadata('scripts/'+script_name).replace('\r','\n') - ) - def should_unzip(self, dist): if self.zip_ok is not None: return not self.zip_ok @@ -449,23 +439,63 @@ ensure_directory(dst); shutil.move(setup_base, dst) return dst + + + + + + + + + + + def install_console_scripts(self, dist): + """Write new-style console scripts, unless excluded""" + + if self.exclude_scripts: + return + + spec = str(dist.as_requirement()) + group = 'console_scripts' + + for name,ep in dist.get_entry_map(group).items(): + + script_text = get_script_header("") + ( + "# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r\n" + "import sys\n" + "from pkg_resources import load_entry_point\n" + "\n" + "sys.exit(\n" + " load_entry_point(%(spec)r, %(group)r, %(name)r)()\n" + ")\n" + ) % locals() + + if sys.platform=='win32': + # On Windows, add a .py extension and an .exe launcher + self.write_script(name+'.py', script_text) + self.write_script( + name+'.exe', resource_string('setuptools','launcher.exe'), + 'b' # write in binary mode + ) + else: + # On other platforms, we assume the right thing to do is to + # write the stub with no extension. + self.write_script(name, script_text) + + + + + + + + + def install_script(self, dist, script_name, script_text, dev_path=None): - log.info("Installing %s script to %s", script_name,self.script_dir) - target = os.path.join(self.script_dir, script_name) - first, rest = script_text.split('\n',1) - from distutils.command.build_scripts import first_line_re - match = first_line_re.match(first) - options = '' - if match: - options = match.group(1) or '' - if options: - options = ' '+options + """Generate a legacy script wrapper and install it""" spec = str(dist.as_requirement()) - executable = os.path.normpath(sys.executable) if dev_path: - script_text = ( - "#!%(executable)s%(options)s\n" + script_text = get_script_header(script_text) + ( "# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r\n" "from pkg_resources import require; require(%(spec)r)\n" "del require\n" @@ -473,23 +503,34 @@ "execfile(__file__)\n" ) % locals() else: - script_text = ( - "#!%(executable)s%(options)s\n" + script_text = get_script_header(script_text) + ( + "#!python\n" "# EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r\n" "import pkg_resources\n" "pkg_resources.run_script(%(spec)r, %(script_name)r)\n" ) % locals() + + self.write_script(script_name, script_text) + + + def write_script(self, script_name, contents, mode="t"): + """Write an executable file to the scripts directory""" + log.info("Installing %s script to %s", script_name, self.script_dir) + + target = os.path.join(self.script_dir, script_name) self.add_output(target) + if not self.dry_run: ensure_directory(target) - f = open(target,"w") - f.write(script_text) + f = open(target,"w"+mode) + f.write(contents) f.close() try: os.chmod(target,0755) except (AttributeError, os.error): pass + def install_eggs(self, spec, dist_filename, tmpdir): # .egg dirs or files are already built, so just return them if dist_filename.lower().endswith('.egg'): @@ -1118,26 +1159,26 @@ Environment.remove(self,dist) -def main(argv, **kw): - from setuptools import setup - setup(script_args = ['-q','easy_install', '-v']+argv, **kw) - - - - - - - - - - - - - - - +def get_script_header(script_text): + """Create a #! line, getting options (if any) from script_text""" + from distutils.command.build_scripts import first_line_re + first, rest = (script_text+'\n').split('\n',1) + match = first_line_re.match(first) + options = '' + if match: + script_text = rest + options = match.group(1) or '' + if options: + options = ' '+options + executable = os.path.normpath(sys.executable) + return "#!%(executable)s%(options)s\n" % locals() +def main(argv=None, **kw): + from setuptools import setup + if argv is None: + argv = sys.argv[1:] + setup(script_args = ['-q','easy_install', '-v']+argv, **kw) From pje at users.sourceforge.net Sat Sep 17 03:13:05 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 17 Sep 2005 03:13:05 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools launcher.c, NONE, 1.1 EasyInstall.txt, 1.59, 1.60 easy_install.py, 1.26, 1.27 setup.py, 1.37, 1.38 setuptools.txt, 1.35, 1.36 Message-ID: <20050917011305.C76501E4008@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8383 Modified Files: EasyInstall.txt easy_install.py setup.py setuptools.txt Added Files: launcher.c Log Message: Added support to solve the infamous "we want .py on Windows, no extension elsewhere" problem, while also bypassing the need for PATHEXT on Windows, and in fact the need to even write script files at all, for any platform. Instead, you define "entry points" in your setup script, in this case the names of the scripts you want (without extensions) and the functions that should be imported and run to implement the scripts. Setuptools will then generate platform-appropriate script files at install time, including an .exe wrapper when installing on Windows. --- NEW FILE: launcher.c --- /* Setuptools Script Launcher for Windows This is a stub executable for Windows that functions somewhat like Effbot's "exemaker", in that it runs a script with the same name but a .py extension, using information from a #! line. It differs in that it spawns the actual Python executable, rather than attempting to hook into the Python DLL. This means that the script will run with sys.executable set to the Python executable, where exemaker ends up with sys.executable pointing to itself. (Which means it won't work if you try to run another Python process using sys.executable.) To build/rebuild with mingw32, do this in the setuptools project directory: gcc -mno-cygwin -O -s -o setuptools/launcher.exe launcher.c It links to msvcrt.dll, but this shouldn't be a problem since it doesn't actually run Python in the same process. Note that using 'exec' instead of 'spawn' doesn't work, because on Windows this leads to the Python executable running in the *background*, attached to the same console window, meaning you get a command prompt back *before* Python even finishes starting. So, we have to use spawnv() and wait for Python to exit before continuing. :( */ #include #include #include #include #include "windows.h" int fail(char *format, char *data) { /* Print error message to stderr and return 1 */ fprintf(stderr, format, data); return 1; } int main(int argc, char **argv) { char python[256]; /* python executable's filename*/ char script[256]; /* the script's filename */ HINSTANCE hPython; /* DLL handle for python executable */ int scriptf; /* file descriptor for script file */ char **newargs; /* argument array for exec */ char *ptr, *end; /* working pointers for string manipulation */ /* compute script name from our .exe name*/ GetModuleFileName(NULL, script, sizeof(script)); end = script + strlen(script); while( end>script && *end != '.') *end-- = '\0'; strcat(script, "py"); /* figure out the target python executable */ scriptf = open(script, O_RDONLY); if (scriptf == -1) { return fail("Cannot open %s\n", script); } end = python + read(scriptf, python, sizeof(python)); close(scriptf); ptr = python-1; while(++ptr < end && *ptr && *ptr!='\n' && *ptr!='\r') { if (*ptr=='/') *ptr='\\'; /* convert slashes to avoid LoadLibrary crashes... */ } *ptr = '\0'; while (ptr>python && isspace(*ptr)) *ptr-- = '\0'; /* strip trailing sp */ if (strncmp(python, "#!", 2)) { /* default to python.exe if no #! header */ strcpy(python, "#!python.exe"); } /* At this point, the python buffer contains "#!pythonfilename" */ /* Using spawnv() can fail strangely if you e.g. find the Cygwin Python, so we'll make sure Windows can find and load it */ hPython = LoadLibraryEx(python+2, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (!hPython) { return fail("Cannot find Python executable %s\n", python+2); } /* And we'll use the absolute filename for spawnv */ GetModuleFileName(hPython, python, sizeof(python)); /* printf("Python executable: %s\n", python); */ /* Argument array needs to be argc+1 for args, plus 1 for null sentinel */ newargs = (char **)calloc(argc+2, sizeof(char *)); newargs[0] = python; newargs[1] = script; memcpy(newargs+2, argv+1, (argc-1)*sizeof(char *)); newargs[argc+1] = NULL; /* printf("args 0: %s\nargs 1: %s\n", newargs[0], newargs[1]); */ return spawnv(P_WAIT, newargs[0], (const char * const *)(newargs)); } Index: EasyInstall.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/EasyInstall.txt,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- EasyInstall.txt 14 Sep 2005 16:41:23 -0000 1.59 +++ EasyInstall.txt 17 Sep 2005 01:13:01 -0000 1.60 @@ -46,12 +46,8 @@ setuptools being present; if so, you must be sure to delete it entirely, along with the old ``pkg_resources`` module if it's present on ``sys.path``. -An ``easy_install.py`` script will be installed in the normal location for -Python scripts on your platform. In the examples below, you'll need to replace -references to ``easy_install`` with the correct invocation to run -``easy_install.py`` on your system. If you have Python 2.4 or better, you can -also use ``python -m easy_install``, which will have the same effect, but which -may be easier for you to type. +An ``easy_install`` script will be installed in the normal location for +Python scripts on your platform. (Note: the ``ez_setup.py`` script accepts the same `Command-Line Options`_ and `Configuration Files`_ as ``easy_install`` itself, so you can use them to @@ -61,6 +57,28 @@ it afterwards.) +Windows Installation +~~~~~~~~~~~~~~~~~~~~ + +On Windows, an ``easy_install.exe`` launcher will also be installed, so that +you can just type ``easy_install`` as long as it's on your ``PATH``. If typing +``easy_install`` at the command prompt doesn't work, check to make sure your +``PATH`` includes the appropriate ``C:\\Python2X\\Scripts`` directory. On +most current versions of Windows, you can change the ``PATH`` by right-clicking +"My Computer", choosing "Properties" and selecting the "Advanced" tab, then +clicking the "Environment Variables" button. ``PATH`` will be in the "System +Variables" section, and you will probably need to reboot for the change to take +effect. Be sure to add a ``;`` after the last item on ``PATH`` before adding +the scripts directory to it. + +Note that instead of changing your ``PATH`` to include the Python scripts +directory, you can also retarget the installtion location for scripts so they +go on a directory that's already on the ``PATH``. For more information see the +sections below on `Command-Line Options`_ and `Configuration Files`_. You +can pass command line options (such as ``--script-dir``) to ``ez_setup.py`` to +control where ``easy_install.exe`` will be installed. + + Downloading and Installing a Package ------------------------------------ @@ -758,6 +776,15 @@ in Exemaker. So, don't use Exemaker to wrap ``easy_install.py``, or at any rate don't expect it to work with all packages. +0.6a2 + * EasyInstall can now install "console_scripts" defined by packages that use + ``setuptools`` and define appropriate entry points. On Windows, console + scripts get an ``.exe`` wrapper so you can just type their name. On other + platforms, the scripts are installed without a file extension. + + * Using ``python -m easy_install`` is now DEPRECATED, since an + ``easy_install`` wrapper is now available on all platforms. + 0.6a1 * EasyInstall now does MD5 validation of downloads from PyPI, or from any link that has an "#md5=..." trailer with a 32-digit lowercase hex md5 digest. Index: easy_install.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/easy_install.py,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- easy_install.py 6 Jul 2005 02:10:47 -0000 1.26 +++ easy_install.py 17 Sep 2005 01:13:02 -0000 1.27 @@ -15,5 +15,8 @@ from setuptools.command.easy_install import * if __name__ == '__main__': + print >>sys.stderr, "NOTE: python -m easy_install is deprecated." + print >>sys.stderr, "Please use the 'easy_install' command instead." + print >>sys.stderr main(sys.argv[1:]) Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setup.py,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- setup.py 22 Aug 2005 03:50:19 -0000 1.37 +++ setup.py 17 Sep 2005 01:13:02 -0000 1.38 @@ -34,12 +34,12 @@ keywords = "CPAN PyPI distutils eggs package management", url = "http://peak.telecommunity.com/DevCenter/setuptools", test_suite = 'setuptools.tests.test_suite', - packages = find_packages(), + package_data = {'setuptools': ['launcher.exe']}, py_modules = ['pkg_resources', 'easy_install'], - scripts = ['easy_install.py'], + - zip_safe = False, # We want 'python -m easy_install' to work :( + zip_safe = False, # We want 'python -m easy_install' to work, for now :( entry_points = { "distutils.commands" : [ "%(cmd)s = setuptools.command.%(cmd)s:%(cmd)s" % locals() @@ -63,9 +63,9 @@ "top_level.txt = setuptools.command.egg_info:write_toplevel_names", "depends.txt = setuptools.command.egg_info:warn_depends_obsolete", ], + "console_scripts": + ["easy_install = setuptools.command.easy_install:main"], }, - # uncomment for testing - # setup_requires = ['setuptools>=0.6a0'], classifiers = [f.strip() for f in """ Development Status :: 3 - Alpha @@ -78,5 +78,46 @@ Topic :: System :: Archiving :: Packaging Topic :: System :: Systems Administration Topic :: Utilities""".splitlines() if f.strip()] + + + # uncomment for testing + # setup_requires = ['setuptools>=0.6a0'], ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: setuptools.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.txt,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- setuptools.txt 3 Sep 2005 04:53:10 -0000 1.35 +++ setuptools.txt 17 Sep 2005 01:13:02 -0000 1.36 @@ -199,7 +199,8 @@ defining the entry points. Entry points are used to support dynamic discovery of services or plugins provided by a project. See `Dynamic Discovery of Services and Plugins`_ for details and examples of the format - of this argument. + of this argument. In addition, this keyword is used to support `Automatic + Script Creation`_. ``extras_require`` A dictionary mapping names of "extras" (optional features of your project) @@ -295,6 +296,49 @@ top-level packages or subpackages. +Automatic Script Creation +========================= + +Packaging and installing scripts can be a bit awkward with the distutils. For +one thing, there's no easy way to have a script's filename match local +conventions on both Windows and POSIX platforms. For another, you often have +to create a separate file just for the "main" script, when your actual "main" +is a function in a module somewhere. And even in Python 2.4, using the ``-m`` +option only works for actual ``.py`` files that aren't installed in a package. + +``setuptools`` fixes all of these problems by automatically generating scripts +for you with the correct extension, and on Windows it will even create an +``.exe`` file so that users don't have to change their ``PATHEXT`` settings. +The way to use this feature is to define "entry points" in your setup script +that indicate what function the generated script should import and run. For +example, to create two scripts called ``foo`` and ``bar``, you might do +something like this:: + + setup( + # other arguments here... + entry_points = { + 'console_scripts': [ + 'foo = my_package.some_module:main_func', + 'bar = other_module:some_func', + ] + } + ) + +When this project is installed on non-Windows platforms (using "setup.py +install", "setup.py develop", or by using EasyInstall), a pair of ``foo`` and +``bar`` scripts will be installed that import ``main_func`` and ``some_func`` +from the specified modules. The functions you specify are called with no +arguments, and their return value is passed to ``sys.exit()``, so you can +return an errorlevel or message to print to stderr. + +You may define as many "console script" entry points as you like, and each one +can optionally specify "extras" that it depends on, and that will be added to +``sys.path`` when the script is run. For more information on "extras", see +section below on `Declaring Extras`_. For more information on "entry points" +in general, see the section below on `Dynamic Discovery of Services and +Plugins`_. + + Declaring Dependencies ====================== @@ -350,6 +394,9 @@ using ``setup.py develop``.) +.. _Declaring Extras: + + Declaring "Extras" (optional features with their own dependencies) ------------------------------------------------------------------ @@ -372,7 +419,33 @@ } ) -And that project B needs project A, *with* PDF support:: +As you can see, the ``extras_require`` argument takes a dictionary mapping +names of "extra" features, to strings or lists of strings describing those +features' requirements. These requirements will *not* be automatically +installed unless another package depends on them (directly or indirectly) by +including the desired "extras" in square brackets after the associated project +name. (Or if the extras were listed in a requirement spec on the EasyInstall +command line.) + +Extras can be used by a project's `entry points`_ to specify dynamic +dependencies. For example, if Project A includes a "rst2pdf" script, it might +declare it like this, so that the "PDF" requirements are only resolved if the +"rst2pdf" script is run:: + + setup( + name="Project-A", + ... + entry_points = { + 'console_scripts': + ['rst2pdf = project_a.tools.pdfgen [PDF]'], + ['rst2html = project_a.tools.htmlgen'], + # more script entry points ... + } + ) + +Projects can also use another project's extras when specifying dependencies. +For example, if project B needs "project A" with PDF support installed, it +might declare the dependency like this:: setup( name="Project-B", @@ -389,19 +462,11 @@ ReportLab in order to provide PDF support, Project B's setup information does not need to change, but the right packages will still be installed if needed. -As you can see, the ``extras_require`` argument takes a dictionary mapping -names of "extra" features, to strings or lists of strings describing those -features' requirements. These requirements will *not* be automatically -installed unless another package depends on them (directly or indirectly) by -including the desired "extras" in square brackets after the associated project -name. (Or if the extras were listed in a requirement spec on the EasyInstall -command line.) - Note, by the way, that if a project ends up not needing any other packages to support a feature, it should keep an empty requirements list for that feature in its ``extras_require`` argument, so that packages depending on that feature don't break (due to an invalid feature name). For example, if Project A above -builds in PDF support and no longer needs ReportLab, it should change its +builds in PDF support and no longer needs ReportLab, it could change its setup to this:: setup( @@ -417,7 +482,6 @@ specifier. - Including Data Files ==================== @@ -576,6 +640,8 @@ ====================================== +.. _Entry Points: + Dynamic Discovery of Services and Plugins ----------------------------------------- @@ -1776,6 +1842,12 @@ Release Notes/Change History ---------------------------- +0.6a2 + * Added ``console_scripts`` entry point group to allow installing scripts + without the need to create separate script files. On Windows, console + scripts get an ``.exe`` wrapper so you can just type their name. On other + platforms, the scripts are written without a file extension. + 0.6a1 * Added support for building "old-style" RPMs that don't install an egg for the target package, using a ``--no-egg`` option. From birkenfeld at users.sourceforge.net Sat Sep 17 09:51:12 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sat, 17 Sep 2005 09:51:12 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_complex.py, 1.15, 1.15.2.1 Message-ID: <20050917075112.1AE291E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4056/Lib/test Modified Files: Tag: release24-maint test_complex.py Log Message: Test case for latest complexobject fix. Index: test_complex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_complex.py,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -d -r1.15 -r1.15.2.1 --- test_complex.py 22 Aug 2004 21:09:14 -0000 1.15 +++ test_complex.py 17 Sep 2005 07:51:08 -0000 1.15.2.1 @@ -288,6 +288,8 @@ self.assertEqual(repr(1+6j), '(1+6j)') self.assertEqual(repr(1-6j), '(1-6j)') + self.assertNotEqual(repr(-(1+0j)), '(-1+-0j)') + def test_neg(self): self.assertEqual(-(1+6j), -1-6j) From birkenfeld at users.sourceforge.net Sat Sep 17 09:51:19 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sat, 17 Sep 2005 09:51:19 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_complex.py, 1.16, 1.17 Message-ID: <20050917075119.33D5C1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4057/Lib/test Modified Files: test_complex.py Log Message: Test case for latest complexobject fix. Index: test_complex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_complex.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- test_complex.py 26 Apr 2005 03:45:26 -0000 1.16 +++ test_complex.py 17 Sep 2005 07:51:15 -0000 1.17 @@ -310,6 +310,8 @@ self.assertEqual(repr(1+6j), '(1+6j)') self.assertEqual(repr(1-6j), '(1-6j)') + self.assertNotEqual(repr(-(1+0j)), '(-1+-0j)') + def test_neg(self): self.assertEqual(-(1+6j), -1-6j) From pje at users.sourceforge.net Sun Sep 18 06:02:41 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sun, 18 Sep 2005 06:02:41 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools __init__.py, 1.23, 1.24 Message-ID: <20050918040241.F3E681E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10372/setuptools Modified Files: __init__.py Log Message: setuptools 0.6a2 release Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/__init__.py,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- __init__.py 22 Aug 2005 03:50:19 -0000 1.23 +++ __init__.py 18 Sep 2005 04:02:38 -0000 1.24 @@ -7,7 +7,7 @@ from distutils.util import convert_path import os.path -__version__ = '0.6a1' +__version__ = '0.6a2' __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' From pje at users.sourceforge.net Sun Sep 18 06:02:42 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sun, 18 Sep 2005 06:02:42 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools.egg-info entry_points.txt, 1.7, 1.8 Message-ID: <20050918040242.0B01B1E4006@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.egg-info In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10372/setuptools.egg-info Modified Files: entry_points.txt Log Message: setuptools 0.6a2 release Index: entry_points.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.egg-info/entry_points.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- entry_points.txt 17 Sep 2005 01:13:02 -0000 1.7 +++ entry_points.txt 18 Sep 2005 04:02:38 -0000 1.8 @@ -24,7 +24,6 @@ rotate = setuptools.command.rotate:rotate develop = setuptools.command.develop:develop setopt = setuptools.command.setopt:setopt -build_py = setuptools.command.build_py:build_py saveopts = setuptools.command.saveopts:saveopts egg_info = setuptools.command.egg_info:egg_info upload = setuptools.command.upload:upload From pje at users.sourceforge.net Sun Sep 18 06:02:42 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sun, 18 Sep 2005 06:02:42 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools ez_setup.py, 1.30, 1.31 setup.py, 1.38, 1.39 setuptools.txt, 1.36, 1.37 Message-ID: <20050918040242.3BAAC1E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10372 Modified Files: ez_setup.py setup.py setuptools.txt Log Message: setuptools 0.6a2 release Index: ez_setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/ez_setup.py,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- ez_setup.py 17 Sep 2005 00:18:37 -0000 1.30 +++ ez_setup.py 18 Sep 2005 04:02:38 -0000 1.31 @@ -14,7 +14,7 @@ This file can also be run as a script to install or upgrade setuptools. """ import sys -DEFAULT_VERSION = "0.6a1" +DEFAULT_VERSION = "0.6a2" DEFAULT_URL = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3] md5_data = { @@ -22,10 +22,8 @@ 'setuptools-0.5a13-py2.4.egg': 'ede4be600e3890e06d4ee5e0148e092a', 'setuptools-0.6a1-py2.3.egg': 'ee819a13b924d9696b0d6ca6d1c5833d', 'setuptools-0.6a1-py2.4.egg': '8256b5f1cd9e348ea6877b5ddd56257d', - 'setuptools-0.6a1c1-py2.3.egg': '1eaf2ca9fb2417977d5b5042dc50e1f4', - 'setuptools-0.6a1c1-py2.4.egg': '5baad71652b3047756ba1dcbf721b1ee', - 'setuptools-0.6a1c2-py2.3.egg': '92291ca957044306d96a7b8589c01d87', - 'setuptools-0.6a1c2-py2.4.egg': '5ae6405341eddb5baf93cd6ab178efb1', + 'setuptools-0.6a2-py2.3.egg': 'b98da449da411267c37a738f0ab625ba', + 'setuptools-0.6a2-py2.4.egg': 'be5b88bc30aed63fdefd2683be135c3b', } import sys, os @@ -43,9 +41,6 @@ return data - - - def use_setuptools( version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, download_delay=15 @@ -187,7 +182,7 @@ import inspect srcfile = inspect.getsourcefile(sys.modules[__name__]) - f = open(srcfile); src = f.read(); f.close() + f = open(srcfile, 'rb'); src = f.read(); f.close() match = re.search("\nmd5_data = {\n([^}]+)}", src) if not match: Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setup.py,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- setup.py 17 Sep 2005 01:13:02 -0000 1.38 +++ setup.py 18 Sep 2005 04:02:38 -0000 1.39 @@ -15,7 +15,7 @@ f.close() return ''.join(lines) -VERSION = "0.6a1" +VERSION = "0.6a2" from setuptools import setup, find_packages import sys Index: setuptools.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.txt,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- setuptools.txt 17 Sep 2005 01:13:02 -0000 1.36 +++ setuptools.txt 18 Sep 2005 04:02:38 -0000 1.37 @@ -39,6 +39,9 @@ without needing to create a ``MANIFEST.in`` file, and without having to force regeneration of the ``MANIFEST`` file when your source tree changes. +* Automatically generate wrapper scripts or Windows (console) .exe files for + any number of "main" functions in your project. + * Transparent Pyrex support, so that your setup.py can list ``.pyx`` files and still work even when the end-user doesn't have Pyrex installed (as long as you include the Pyrex-generated C in your source distribution) From loewis at users.sourceforge.net Sun Sep 18 10:17:59 2005 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 Sep 2005 10:17:59 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1367,1.1368 Message-ID: <20050918081759.B93791E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14856/Misc Modified Files: NEWS Log Message: Patch #1213831: Fix typo in unicodedata._getcode. Will backport to Python 2.4. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1367 retrieving revision 1.1368 diff -u -d -r1.1367 -r1.1368 --- NEWS 15 Sep 2005 02:34:56 -0000 1.1367 +++ NEWS 18 Sep 2005 08:17:56 -0000 1.1368 @@ -143,6 +143,8 @@ Extension Modules ----------------- +- Patch #1213831: Fix typo in unicodedata._getcode. + - Bug #1007046: os.startfile() did not accept unicode strings encoded in the file system encoding. From loewis at users.sourceforge.net Sun Sep 18 10:17:59 2005 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 Sep 2005 10:17:59 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules unicodedata.c,2.34,2.35 Message-ID: <20050918081759.C725D1E4006@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14856/Modules Modified Files: unicodedata.c Log Message: Patch #1213831: Fix typo in unicodedata._getcode. Will backport to Python 2.4. Index: unicodedata.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v retrieving revision 2.34 retrieving revision 2.35 diff -u -d -r2.34 -r2.35 --- unicodedata.c 4 Jun 2005 07:31:48 -0000 2.34 +++ unicodedata.c 18 Sep 2005 08:17:56 -0000 2.35 @@ -820,7 +820,7 @@ pos += len; find_syllable(pos, &len, &T, TCount, 2); pos += len; - if (V != -1 && V != -1 && T != -1 && pos-name == namelen) { + if (L != -1 && V != -1 && T != -1 && pos-name == namelen) { *code = SBase + (L*VCount+V)*TCount + T; return 1; } From loewis at users.sourceforge.net Sun Sep 18 10:18:54 2005 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 Sep 2005 10:18:54 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules unicodedata.c, 2.32, 2.32.2.1 Message-ID: <20050918081854.C0F1C1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15221/Modules Modified Files: Tag: release24-maint unicodedata.c Log Message: Patch #1213831: Fix typo in unicodedata._getcode. Index: unicodedata.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v retrieving revision 2.32 retrieving revision 2.32.2.1 diff -u -d -r2.32 -r2.32.2.1 --- unicodedata.c 4 Aug 2004 07:38:34 -0000 2.32 +++ unicodedata.c 18 Sep 2005 08:18:51 -0000 2.32.2.1 @@ -753,7 +753,7 @@ pos += len; find_syllable(pos, &len, &T, TCount, 2); pos += len; - if (V != -1 && V != -1 && T != -1 && pos-name == namelen) { + if (L != -1 && V != -1 && T != -1 && pos-name == namelen) { *code = SBase + (L*VCount+V)*TCount + T; return 1; } From loewis at users.sourceforge.net Sun Sep 18 10:18:54 2005 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 Sep 2005 10:18:54 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.99, 1.1193.2.100 Message-ID: <20050918081854.D8FBE1E4006@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15221/Misc Modified Files: Tag: release24-maint NEWS Log Message: Patch #1213831: Fix typo in unicodedata._getcode. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.99 retrieving revision 1.1193.2.100 diff -u -d -r1.1193.2.99 -r1.1193.2.100 --- NEWS 15 Sep 2005 02:42:05 -0000 1.1193.2.99 +++ NEWS 18 Sep 2005 08:18:51 -0000 1.1193.2.100 @@ -65,6 +65,8 @@ Extension Modules ----------------- +- Patch #1213831: Fix typo in unicodedata._getcode. + - Bug #1007046: os.startfile() did not accept unicode strings encoded in the file system encoding. From loewis at users.sourceforge.net Sun Sep 18 10:34:43 2005 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 Sep 2005 10:34:43 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1368,1.1369 Message-ID: <20050918083443.4F68E1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18277/Misc Modified Files: NEWS Log Message: Patch #1268314: Cache lines in StreamReader.readlines for performance. Will backport to Python 2.4. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1368 retrieving revision 1.1369 diff -u -d -r1.1368 -r1.1369 --- NEWS 18 Sep 2005 08:17:56 -0000 1.1368 +++ NEWS 18 Sep 2005 08:34:39 -0000 1.1369 @@ -219,6 +219,8 @@ Library ------- +- Patch #1268314: Cache lines in StreamReader.readlines for performance. + - Bug #1290505: Fix clearing the regex cache for time.strptime(). - Bug #1167128: Fix size of a symlink in a tarfile to be 0. From loewis at users.sourceforge.net Sun Sep 18 10:34:43 2005 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 Sep 2005 10:34:43 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib codecs.py,1.48,1.49 Message-ID: <20050918083443.9C9531E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18277/Lib Modified Files: codecs.py Log Message: Patch #1268314: Cache lines in StreamReader.readlines for performance. Will backport to Python 2.4. Index: codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- codecs.py 1 Sep 2005 11:56:53 -0000 1.48 +++ codecs.py 18 Sep 2005 08:34:39 -0000 1.49 @@ -232,6 +232,7 @@ # For str->str decoding this will stay a str # For str->unicode decoding the first read will promote it to unicode self.charbuffer = "" + self.linebuffer = None def decode(self, input, errors='strict'): raise NotImplementedError @@ -264,6 +265,11 @@ optional encoding endings or state markers are available on the stream, these should be read too. """ + # If we have lines cached, first merge them back into characters + if self.linebuffer: + self.charbuffer = "".join(self.linebuffer) + self.linebuffer = None + # read until we get the required number of characters (if available) while True: # can the request can be satisfied from the character buffer? @@ -316,6 +322,20 @@ read() method. """ + # If we have lines cached from an earlier read, return + # them unconditionally + if self.linebuffer: + line = self.linebuffer[0] + del self.linebuffer[0] + if len(self.linebuffer) == 1: + # revert to charbuffer mode; we might need more data + # next time + self.charbuffer = self.linebuffer[0] + self.linebuffer = None + if not keepends: + line = line.splitlines(False)[0] + return line + readsize = size or 72 line = "" # If size is given, we call read() only once @@ -331,6 +351,22 @@ line += data lines = line.splitlines(True) if lines: + if len(lines) > 1: + # More than one line result; the first line is a full line + # to return + line = lines[0] + del lines[0] + if len(lines) > 1: + # cache the remaining lines + lines[-1] += self.charbuffer + self.linebuffer = lines + self.charbuffer = None + else: + # only one remaining line, put it back into charbuffer + self.charbuffer = lines[0] + self.charbuffer + if not keepends: + line = line.splitlines(False)[0] + break line0withend = lines[0] line0withoutend = lines[0].splitlines(False)[0] if line0withend != line0withoutend: # We really have a line end @@ -376,6 +412,7 @@ """ self.bytebuffer = "" self.charbuffer = u"" + self.linebuffer = None def seek(self, offset, whence=0): """ Set the input stream's current position. From loewis at users.sourceforge.net Sun Sep 18 10:45:38 2005 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 Sep 2005 10:45:38 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.100, 1.1193.2.101 Message-ID: <20050918084538.D9E541E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18448/Misc Modified Files: Tag: release24-maint NEWS Log Message: Patch #1268314: Cache lines in StreamReader.readlines for performance. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.100 retrieving revision 1.1193.2.101 diff -u -d -r1.1193.2.100 -r1.1193.2.101 --- NEWS 18 Sep 2005 08:18:51 -0000 1.1193.2.100 +++ NEWS 18 Sep 2005 08:45:35 -0000 1.1193.2.101 @@ -94,6 +94,8 @@ Library ------- +- Patch #1268314: Cache lines in StreamReader.readlines for performance. + - Bug #1290505: time.strptime() was not invalidating its regex cache when the locale changed. From loewis at users.sourceforge.net Sun Sep 18 10:45:38 2005 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 Sep 2005 10:45:38 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib codecs.py, 1.35.2.10, 1.35.2.11 Message-ID: <20050918084538.E231D1E4006@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18448/Lib Modified Files: Tag: release24-maint codecs.py Log Message: Patch #1268314: Cache lines in StreamReader.readlines for performance. Index: codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v retrieving revision 1.35.2.10 retrieving revision 1.35.2.11 diff -u -d -r1.35.2.10 -r1.35.2.11 --- codecs.py 1 Sep 2005 12:03:14 -0000 1.35.2.10 +++ codecs.py 18 Sep 2005 08:45:35 -0000 1.35.2.11 @@ -232,6 +232,7 @@ # For str->str decoding this will stay a str # For str->unicode decoding the first read will promote it to unicode self.charbuffer = "" + self.linebuffer = None def decode(self, input, errors='strict'): raise NotImplementedError @@ -264,6 +265,11 @@ optional encoding endings or state markers are available on the stream, these should be read too. """ + # If we have lines cached, first merge them back into characters + if self.linebuffer: + self.charbuffer = "".join(self.linebuffer) + self.linebuffer = None + # read until we get the required number of characters (if available) while True: # can the request can be satisfied from the character buffer? @@ -316,6 +322,20 @@ read() method. """ + # If we have lines cached from an earlier read, return + # them unconditionally + if self.linebuffer: + line = self.linebuffer[0] + del self.linebuffer[0] + if len(self.linebuffer) == 1: + # revert to charbuffer mode; we might need more data + # next time + self.charbuffer = self.linebuffer[0] + self.linebuffer = None + if not keepends: + line = line.splitlines(False)[0] + return line + readsize = size or 72 line = "" # If size is given, we call read() only once @@ -331,6 +351,22 @@ line += data lines = line.splitlines(True) if lines: + if len(lines) > 1: + # More than one line result; the first line is a full line + # to return + line = lines[0] + del lines[0] + if len(lines) > 1: + # cache the remaining lines + lines[-1] += self.charbuffer + self.linebuffer = lines + self.charbuffer = None + else: + # only one remaining line, put it back into charbuffer + self.charbuffer = lines[0] + self.charbuffer + if not keepends: + line = line.splitlines(False)[0] + break line0withend = lines[0] line0withoutend = lines[0].splitlines(False)[0] if line0withend != line0withoutend: # We really have a line end @@ -376,6 +412,7 @@ """ self.bytebuffer = "" self.charbuffer = u"" + self.linebuffer = None def seek(self, offset, whence=0): """ Set the input stream's current position. From birkenfeld at users.sourceforge.net Sun Sep 18 15:03:20 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sun, 18 Sep 2005 15:03:20 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib sre_parse.py,1.63,1.63.2.1 Message-ID: <20050918130320.BC26D1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv719/Lib Modified Files: Tag: release24-maint sre_parse.py Log Message: Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than considering it exactly like a '*'. Backport from 2.5 branch. Index: sre_parse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_parse.py,v retrieving revision 1.63 retrieving revision 1.63.2.1 diff -u -d -r1.63 -r1.63.2.1 --- sre_parse.py 3 Sep 2004 20:15:56 -0000 1.63 +++ sre_parse.py 18 Sep 2005 13:03:16 -0000 1.63.2.1 @@ -474,6 +474,9 @@ elif this == "+": min, max = 1, MAXREPEAT elif this == "{": + if source.next == "}": + subpatternappend((LITERAL, ord(this))) + continue here = source.tell() min, max = 0, MAXREPEAT lo = hi = "" From birkenfeld at users.sourceforge.net Sun Sep 18 15:03:20 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sun, 18 Sep 2005 15:03:20 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_re.py, 1.53.2.2, 1.53.2.3 Message-ID: <20050918130320.CD1671E4006@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv719/Lib/test Modified Files: Tag: release24-maint test_re.py Log Message: Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than considering it exactly like a '*'. Backport from 2.5 branch. Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.53.2.2 retrieving revision 1.53.2.3 diff -u -d -r1.53.2.2 -r1.53.2.3 --- test_re.py 3 Jun 2005 14:02:48 -0000 1.53.2.2 +++ test_re.py 18 Sep 2005 13:03:16 -0000 1.53.2.3 @@ -297,6 +297,9 @@ self.assertNotEqual(re.match("^x{1,4}?$", "xxx"), None) self.assertNotEqual(re.match("^x{3,4}?$", "xxx"), None) + self.assertEqual(re.match("^x{}$", "xxx"), None) + self.assertNotEqual(re.match("^x{}$", "x{}"), None) + def test_getattr(self): self.assertEqual(re.match("(a)", "a").pos, 0) self.assertEqual(re.match("(a)", "a").endpos, 1) From birkenfeld at users.sourceforge.net Sun Sep 18 15:03:20 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sun, 18 Sep 2005 15:03:20 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.101, 1.1193.2.102 Message-ID: <20050918130320.D9A281E4007@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv719/Misc Modified Files: Tag: release24-maint NEWS Log Message: Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than considering it exactly like a '*'. Backport from 2.5 branch. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.101 retrieving revision 1.1193.2.102 diff -u -d -r1.1193.2.101 -r1.1193.2.102 --- NEWS 18 Sep 2005 08:45:35 -0000 1.1193.2.101 +++ NEWS 18 Sep 2005 13:03:16 -0000 1.1193.2.102 @@ -165,6 +165,10 @@ from the input stream, so that the output is a byte string in the correct encoding instead of a unicode string. +- Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than + considering it exactly like a '*'. + + Build ----- From goodger at users.sourceforge.net Sun Sep 18 17:10:14 2005 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Sun, 18 Sep 2005 17:10:14 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep-0350.txt, NONE, 1.1 pep-0000.txt, 1.343, 1.344 Message-ID: <20050918151014.87D931E4005@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28258 Modified Files: pep-0000.txt Added Files: pep-0350.txt Log Message: added PEP 350, "Codetags", by Micah Elliott --- NEW FILE: pep-0350.txt --- PEP: 350 Title: Codetags Version: $Revision: 1.1 $ Last-Modified: $Date: 2005/09/18 15:10:08 $ Author: Micah Elliott Status: Draft Type: Informational Content-Type: text/x-rst Created: 27-Jun-2005 Post-History: 10-Aug-2005 Abstract ======== This informational PEP aims to provide guidelines for consistent use of Codetags, which would enable the construction of standard utilities to take advantage of the Codetag information, as well as making Python code more uniform across projects. Codetags also represent a very lightweight programming micro-paradigm and become useful for project management, documentation, change tracking, and project health monitoring. This is submitted as a PEP because I feel its ideas are Pythonic, although the concepts are not unique to Python programming. Herein are the definition of Codetags, the philosophy behind them, a motivation for standardized conventions, a specification, a toolset description, and possible objections to the Codetag project/paradigm. This PEP is also living as a wiki_ for people to add comments. What Are Codetags? ================== Programmers widely use ad-hoc code comment markup conventions to serve as reminders of sections of code that need closer inspection or review. Examples of markup include ``FIXME``, ``TODO``, ``XXX``, ``BUG``, but there many more in wide use in existing software. Such markup will henceforth be referred to as *Codetags*. These Codetags may show up in application code, unit tests, scripts, general documentation, or wherever suitable. Philosophy ========== If you subscribe to most of these values, then Codetags will likely be useful for you. 1. As much information as possible should be contained **inside the source code** (application code or unit tests). This along with use of Codetags impedes duplication. Most documentation can be generated from that source code; e.g., by using help2man, man2html, docutils, epydoc/pydoc, ctdoc, etc. 2. Information should be almost **never duplicated** -- it should be recorded in a single original format and all other locations should be automatically generated from the original, or simply be referenced. This is the *SPOT* rule. 3. Documentation that gets into customers' hands should be **auto-generated** from single sources into all other output formats. People want documentation in many forms. It is thus important to have a documentation system that can generate all of these. 4. Whenever information is subject to (and suited for) user feedback/input (e.g., FAQ, RFC, PEP), it should be contained in a **repository** (e.g. a wiki, usenet, or mailing lists). 5. There should not be a dedicated, disjoint **documentation team** for any non-huge project. The developers writing the code know the code best, and they should be the ones to describe it. 6. **Plain text** (with non-invasive markup) is the best form of writing anything. All other formats are to be generated from the plain text. 7. **Revision control** should be used for almost everything. And modifications should be checked in at least daily. Motivation ========== * **Various productivity tools can be built around Codetags.** See Tools_. * **Encourages consistency.** Historically, a subset of these Codetags has been used informally in the majority of source code in existence, whether in Python or in other languages. Tags have been used in an inconsistent manner with different spellings, semantics, format, and placement. For example, some programmers might include datestamps and/or user identifiers, limit to a single line or not, spell the Codetag differently than others, etc. * **Encourages adherence to SPOT/DRY principle.** E.g., generating a roadmap dynamically from Codetags instead of keeping TODOs in sync with separate roadmap document. * **Easy to remember.** All Codetags must be concise, intuitive, and semantically non-overlapping with others. The format must also be simple. * **Use not required/imposed.** If you don't use Codetags already, there's no obligation to start, and no risk of affecting code (but see Objections_). A small subset can be adopted and the Tools_ will still be useful (a few Codetags have probably already been adopted on an ad-hoc basis anyway). Also it is very easy to identify and remove if a Codetag is no longer deemed useful. Then it is effectively *committed* and recorded by revision control simply by checking in. * **Gives a global view of code.** Tools can be used to generate documentation and reports. * **A logical location for capturing CRCs/Stories/Requirements.** The XP community often does not electronically capture Stories, but Codetags seem like a good place to locate them. * **Extremely lightweight process.** Creating tickets in a tracking system for every thought degrades development velocity. Even if a ticketing system is employed, Codetags are useful for simply containing links to those tickets. Examples ======== This shows a simple Codetag as commonly found in sources everywhere (with the addition of a trailing ``<>``):: def foo(): # FIXME: Seems like this loop should be finite. <> while True: ... The following contrived example demonstrates a more common use of Codetagging. It uses some of the available fields to specify the owners (a pair of developers with initials *MDE* and *CLE*), the Work Week of expected completion (*w14*), and the priority of the item (*p2*):: def foo(): # FIXME: Seems like this loop should be finite. while True: ... Specification ============= This describes the format: syntax, mnemonic names, fields, and semantics. General Syntax -------------- Each Codetag should be inside a comment, and can be any number of lines. It should match the indentation of surrounding code. The end of the Codetag is marked by a pair of angle brackets ``<>`` containing optional fields, which must not be split onto multiple lines. .. NOTE: This PEP's text originally did not conform to the "inside a comment" rule. Documents can have comments too! I fixed that. -Ed. There can be multiple fields per Codetag, all of which are optional. In short, a Codetag consists of a mnemonic, a colon, commentary text, an opening angle bracket, an optional list of fields, and a closing angle bracket. E.g., :: # MNEMONIC: Some (maybe multi-line) commentary. .. FIXME: Add completion vs target date?? Mnemonics --------- The Codetags of interest are listed below, using the following format: | ``recommended mnemonic (& synonym list)`` | *canonical name*: semantics ``FIXME (XXX, DEBUG, BROKEN, RFCTR, OOPS, SMELL, NEEDSWORK)`` *Fix me*: Areas of problematic or ugly code needing refactoring or cleanup. ``NOFIX (DONTFIX, NEVERFIX, NOBUG)`` *Will Not Be Fixed*: Problems that are well-known but will never be addressed due to design problems or domain limitations. ``!!! (ALERT)`` *Alerts*: In need of immediate attention. ``GLOSS (GLOSSARY)`` *Glossary*: Definitions for project glossary. ``DOC (DOCUMENT)`` *Needs Documentation*: Areas of code that still need to be documented. ``REQ (REQUIREMENT, STORY)`` *Requirements*: Satisfactions of specific, formal requirements. ``IDEA`` *Ideas*: Possible RFE candidates, but less formal than RFE. ``BUG (BUGFIX)`` *Bugs*: Reported defects tracked in bug database. ``NOTE (HELP)`` *Notes*: Sections where a code reviewer found something that needs discussion or further investigation. ``SEE (REF)`` *See*: Pointers to other code, web link, etc. ``STAT (STATUS)`` *Status*: File-level statistical indicator of work needing done on this file. ``RFE (FEETCH, NYI, FR, FTRQ, FTR)`` *Requests For Enhancement*: Roadmap items not yet implemented. ``HACK (CLEVER)`` *Hacks*: Temporary code to force inflexible functionality, or simply a test change, or workaround a known problem. ``CAV (CAVEAT, WARNING, CAUTION)`` *Caveats*: Implementation details/gotchas that stand out as non-intuitive. ``RVDBY (REVIEWED)`` *Reviewed By*: File-level indicator of programmer(s) who performed recent code review. ``??? (QUESTION, QUEST, QSTN, WTF)`` *Questions*: Misunderstood details. ``CRED (CREDIT, THANKS)`` *Credits*: Accreditations for external provision of enlightenment. ``TODO (MLSTN, DONE, YAGNI, TBD, TOBEDONE)`` *To do*: Informal tasks/features that are pending completion. .. NOTE: TBD and TOBEDONE belong here, not with FIXME ``PORT (PORTABILITY, WKRD)`` *Portability*: Workarounds specific to OS, Python version, etc. ``FAQ`` *Frequently Asked Questions*: Interesting areas that require external explanation. File-level Codetags might be better suited as properties in the revision control system. Some of these are temporary (e.g., ``FIXME``) while others are persistent (e.g., ``REQ``). Synonyms should probably be deprecated in the interest of minimalism and consistency. I chose a mnemonic over a synonym using three criteria: descriptiveness, length (shorter is better), commonly used. Choosing between ``FIXME`` and ``XXX`` is difficult. ``XXX`` seems to be more common, but much less descriptive. Furthermore, ``XXX`` is a useful placeholder in a piece of code having a value that is unknown. `Sun says`__ that ``XXX`` and ``FIXME`` are slightly different, giving ``XXX`` higher severity. __ http://java.sun.com/docs/codeconv/html/CodeConventions.doc9.html#395 ``DONE`` is always a completed ``TODO`` item, but this should probably be indicated through the revision control system. It may be a useful metric to count ``NOTE`` tags: a high count may indicate a problem. ``FAQ`` is probably more appropriately documented in a wiki where users can more easily contribute. Fields ------ All fields are optional. It should be possible for groups to define or add their own, but the proposed standard fields are as follows: ``pN`` *Priority* level. Range is from 0..3 with 3 being the highest. A *Severity* field could also exist, or it could be factored into this single number. ``iN`` Development cycle *Iteration*. Useful for grouping Codetags into completion target groups. ``XXX[,YYY]...`` List of *Initials* of owners of completion responsibility. There should be no digits in initials. .. ???: should initials be uppercase or lowercase? I prefer uppercase, personally. .. NOTE: I agree that uppercase is better but I'll leave that open to users. ``wWW[.D]`` *Workweek* target completion (estimate). A day of the week can be optionally specified. Origination and completion are freebies with revision control. .. ???: Since *workweek* and *date* are redundant we might want to decide on one or other. Date is longer but is better understood by most so the likely keeper. .. NOTE: *Workweek* indicates a completion estimate, but *date* simply indicates when the comment was added. They're not redundant. However, rather than workweek (which isn't used much in my experience), it might be better to have a "c" (completion estimate) tag with date content. ``yyyy[-mm[-dd]]`` The *Date* the comment was added, in `ISO 8601`_ format (digits and hyphens only). Tools ===== Currently, programmers (and sometimes analysts) typically use *grep* to generate a list of items corresponding to a single Codetag. However, various hypothetical productivity tools could take advantage of a consistent Codetag format. Some example tools follow. .. NOTE: Codetag tools are mostly unimplemented (but I'm getting started!) Document Generator Possible docs: glossary, roadmap, manpages Codetag History Track (with revision control system interface) when a ``BUG`` tag (or any codetag) originated/resolved in a code section Code Statistics A project Health-O-Meter Codetag Lint Notify of invalid use of Codetags, and aid in porting to Codetag Story Manager/Browser An electronic means to replace XP notecards. In MVC terms, the Codetag is the Model, and the Story Manager could be a graphical Viewer/Controller to do visual rearrangement, prioritization, and assignment, milestone management. Any Text Editor Used for changing, removing, adding, rearranging Codetags. There are some tools already in existence that take advantage of a smaller set of pseudo-Codetags (see References_). Objections ========== :Objection: Extreme Programming argues that such Codetags should not ever exist in code since the code is the documentation. :Defense: Maybe put the Codetags in the unit test files instead. Besides, it's tough to generate documentation from uncommented source code. ---- :Objection: Too much existing code has not followed proposed guidelines. :Defense: [Simple] utilities (*ctlint*) could convert existing codes. ---- :Objection: Causes duplication with tracking system. :Defense: Not really. If an item exists in the tracker, a simple ticket number as the Codetag commentary is sufficient. Maybe a duplicated title would be acceptable. Furthermore, it's too burdensome to have a ticket filed for every item that pops into a developer's mind on-the-go. ---- :Objection: Codetags are ugly and clutter code. :Defense: That is a good point. But I'd still rather have such info in a single place (the source code) than various other documents, likely getting duplicated or forgotten about. ---- :Objection: Codetags (and all comments) get out of date. :Defense: Not so much if other sources (externally visible documentation) depend on them being accurate. References ========== Some other tools have approached defining/exploiting Codetags. See http://tracos.org/codetag/wiki/Links. .. _wiki: http://tracos.org/codetag/wiki/Pep .. _ISO 8601: http://en.wikipedia.org/wiki/ISO_8601 .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.343 retrieving revision 1.344 diff -u -d -r1.343 -r1.344 --- pep-0000.txt 26 Aug 2005 06:01:04 -0000 1.343 +++ pep-0000.txt 18 Sep 2005 15:10:08 -0000 1.344 @@ -105,6 +105,7 @@ S 345 Metadata for Python Software Packages 1.2 Jones P 347 Migrating the Python CVS to Subversion von Löwis S 349 Allow str() to return unicode strings Schemenauer + I 350 Codetags Elliott S 754 IEEE 754 Floating Point Special Values Warnes Finished PEPs (done, implemented in CVS) @@ -394,6 +395,7 @@ P 347 Migrating the Python CVS to Subversion von Löwis SR 348 Exception Reorganization for Python 3.0 Cannon S 349 Allow str() to return unicode strings Schemenauer + I 350 Codetags Elliott SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes I 3000 Python 3.0 Plans Kuchling, Cannon @@ -438,6 +440,7 @@ Dubner, Michael P. dubnerm at mindless.com Dubois, Paul F. paul at pfdubois.com Eby, Phillip J. pje at telecommunity.com + Elliott, Micah mde at tracos.org Epler, Jeff jepler at unpythonic.net Eppstein, David eppstein at ics.uci.edu Evans, Clark C. cce at clarkevans.com From goodger at users.sourceforge.net Sun Sep 18 17:11:07 2005 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Sun, 18 Sep 2005 17:11:07 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep.css,1.5,1.6 Message-ID: <20050918151107.102CB1E4005@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28407 Modified Files: pep.css Log Message: updated stylesheet for reST PEPs Index: pep.css =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep.css,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- pep.css 12 Nov 2002 03:06:36 -0000 1.5 +++ pep.css 18 Sep 2005 15:11:03 -0000 1.6 @@ -8,11 +8,17 @@ Default cascading style sheet for the PEP HTML output of Docutils. */ +/* "! important" is used here to override other ``margin-top`` and + ``margin-bottom`` styles that are later in the stylesheet or + more specific. See http://www.w3.org/TR/CSS1#the-cascade */ .first { - margin-top: 0 } + margin-top: 0 ! important } -.last { - margin-bottom: 0 } +.last, .with-subtitle { + margin-bottom: 0 ! important } + +.hidden { + display: none } .navigation { width: 100% ; @@ -53,12 +59,15 @@ text-decoration: none ; color: black } +blockquote.epigraph { + margin: 2em 5em ; } + body { margin: 0px ; margin-bottom: 1em ; padding: 0px } -dd { +dl.docutils dd { margin-bottom: 0.5em } div.section { @@ -78,12 +87,18 @@ font-weight: bold ; text-align: center } -div.attention, div.caution, div.danger, div.error, div.hint, -div.important, div.note, div.tip, div.warning { +div.admonition, div.attention, div.caution, div.danger, div.error, +div.hint, div.important, div.note, div.tip, div.warning { margin: 2em ; border: medium outset ; padding: 1em } +div.admonition p.admonition-title, div.hint p.admonition-title, +div.important p.admonition-title, div.note p.admonition-title, +div.tip p.admonition-title { + font-weight: bold ; + font-family: sans-serif } + div.attention p.admonition-title, div.caution p.admonition-title, div.danger p.admonition-title, div.error p.admonition-title, div.warning p.admonition-title { @@ -91,21 +106,58 @@ font-weight: bold ; font-family: sans-serif } -div.hint p.admonition-title, div.important p.admonition-title, -div.note p.admonition-title, div.tip p.admonition-title { +/* Uncomment (and remove this text!) to get reduced vertical space in + compound paragraphs. +div.compound .compound-first, div.compound .compound-middle { + margin-bottom: 0.5em } + +div.compound .compound-last, div.compound .compound-middle { + margin-top: 0.5em } +*/ + +div.dedication { + margin: 2em 5em ; + text-align: center ; + font-style: italic } + +div.dedication p.topic-title { font-weight: bold ; - font-family: sans-serif } + font-style: normal } div.figure { margin-left: 2em } div.footer, div.header { + clear: both; font-size: smaller } div.footer { margin-left: 1em ; margin-right: 1em } +div.line-block { + display: block ; + margin-top: 1em ; + margin-bottom: 1em } + +div.line-block div.line-block { + margin-top: 0 ; + margin-bottom: 0 ; + margin-left: 1.5em } + +div.sidebar { + margin-left: 1em ; + border: medium outset ; + padding: 1em ; + background-color: #ffffee ; + width: 40% ; + float: right ; + clear: right } + +div.sidebar p.rubric { + font-family: sans-serif ; + font-size: medium } + div.system-messages { margin: 5em } @@ -123,6 +175,10 @@ div.topic { margin: 2em } +h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, +h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { + margin-top: 0.4em } + h1 { font-family: sans-serif ; font-size: large } @@ -149,9 +205,18 @@ font-style: italic ; font-size: x-small } -.section hr { +hr.docutils { width: 75% } +img.align-left { + clear: left } + +img.align-right { + clear: right } + +img.borderless { + border: 0 } + ol.simple, ul.simple { margin-bottom: 1em } @@ -170,6 +235,10 @@ ol.upperroman { list-style: upper-roman } +p.attribution { + text-align: right ; + margin-left: 50% } + p.caption { font-style: italic } @@ -180,10 +249,31 @@ p.label { white-space: nowrap } +p.rubric { + font-weight: bold ; + font-size: larger ; + color: maroon ; + text-align: center } + +p.sidebar-title { + font-family: sans-serif ; + font-weight: bold ; + font-size: larger } + +p.sidebar-subtitle { + font-family: sans-serif ; + font-weight: bold } + p.topic-title { font-family: sans-serif ; font-weight: bold } +pre.address { + margin-bottom: 0 ; + margin-top: 0 ; + font-family: serif ; + font-size: 100% } + pre.line-block { font-family: serif ; font-size: 100% } @@ -204,6 +294,9 @@ span.interpreted { font-family: sans-serif } +span.option { + white-space: nowrap } + span.option-argument { font-style: italic } @@ -213,11 +306,25 @@ span.problematic { color: red } -table { +span.section-subtitle { + /* font-size relative to parent (h1..h6 element) */ + font-size: 80% } + +table.citation { + border-left: solid thin gray } + +table.docinfo { + margin: 2em 4em } + +table.docutils { margin-top: 0.5em ; margin-bottom: 0.5em } -td, th { +table.footnote { + border-left: solid thin black } + +table.docutils td, table.docutils th, +table.docinfo td, table.docinfo th { padding-left: 0.5em ; padding-right: 0.5em ; vertical-align: top } @@ -228,12 +335,14 @@ th.field-name { font-weight: bold ; text-align: left ; - white-space: nowrap } + white-space: nowrap ; + padding-left: 0 } -h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { +h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, +h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { font-size: 100% } -tt { +tt.docutils { background-color: #eeeeee } ul.auto-toc { From montanaro at users.sourceforge.net Mon Sep 19 05:53:23 2005 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon, 19 Sep 2005 05:53:23 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test__locale.py, 1.9, 1.10 Message-ID: <20050919035323.85FE31E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10680/Lib/test Modified Files: test__locale.py Log Message: skip _locale test if OS X < 10.4 Index: test__locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test__locale.py,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- test__locale.py 1 Mar 2005 03:15:50 -0000 1.9 +++ test__locale.py 19 Sep 2005 03:53:19 -0000 1.10 @@ -2,6 +2,12 @@ from _locale import (setlocale, LC_NUMERIC, RADIXCHAR, THOUSEP, nl_langinfo, localeconv, Error) import unittest +from platform import uname + +if uname()[0] == "Darwin": + maj, min, mic = [int(part) for part in uname()[2].split(".")] + if (maj, min, mic) < (8, 0, 0): + raise TestSkipped("locale support broken for OS X < 10.4") candidate_locales = ['es_UY', 'fr_FR', 'fi_FI', 'es_CO', 'pt_PT', 'it_IT', 'et_EE', 'es_PY', 'no_NO', 'nl_NL', 'lv_LV', 'el_GR', 'be_BY', 'fr_BE', From montanaro at users.sourceforge.net Mon Sep 19 05:54:51 2005 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon, 19 Sep 2005 05:54:51 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1369,1.1370 Message-ID: <20050919035451.8EDDD1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10883/Misc Modified Files: NEWS Log Message: skip _locale test if OS X < 10.4 Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1369 retrieving revision 1.1370 diff -u -d -r1.1369 -r1.1370 --- NEWS 18 Sep 2005 08:34:39 -0000 1.1369 +++ NEWS 19 Sep 2005 03:54:46 -0000 1.1370 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- test__locale is skipped on OS X < 10.4 (only partial locale support is +present). + - SF bug #893549: parsing keyword arguments was broken with a few format codes. From nnorwitz at users.sourceforge.net Mon Sep 19 08:42:34 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 19 Sep 2005 08:42:34 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.329.2.4, 2.329.2.5 Message-ID: <20050919064234.64A8A1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2156/Modules Modified Files: Tag: release24-maint posixmodule.c Log Message: Fix problems reported by valgrind: * Fix memory leak in posix.access() * Fix use of uninitialized value in forkpty() - from the manpage it isn't clear if there are conditions where master_fd are uninitialized, but it's safer to initialize Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.329.2.4 retrieving revision 2.329.2.5 diff -u -d -r2.329.2.4 -r2.329.2.5 --- posixmodule.c 14 Sep 2005 20:51:40 -0000 2.329.2.4 +++ posixmodule.c 19 Sep 2005 06:42:30 -0000 2.329.2.5 @@ -1119,6 +1119,7 @@ Py_BEGIN_ALLOW_THREADS res = access(path, mode); Py_END_ALLOW_THREADS + PyMem_Free(path); return(PyBool_FromLong(res == 0)); } @@ -2950,7 +2951,7 @@ static PyObject * posix_forkpty(PyObject *self, PyObject *noargs) { - int master_fd, pid; + int master_fd = -1, pid; pid = forkpty(&master_fd, NULL, NULL, NULL); if (pid == -1) From nnorwitz at users.sourceforge.net Mon Sep 19 08:43:47 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 19 Sep 2005 08:43:47 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.340, 2.341 Message-ID: <20050919064347.F33691E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2648/Modules Modified Files: posixmodule.c Log Message: Forward port fixes for problems reported by valgrind Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.340 retrieving revision 2.341 diff -u -d -r2.340 -r2.341 --- posixmodule.c 14 Sep 2005 20:51:40 -0000 2.340 +++ posixmodule.c 19 Sep 2005 06:43:44 -0000 2.341 @@ -1179,6 +1179,7 @@ Py_BEGIN_ALLOW_THREADS res = access(path, mode); Py_END_ALLOW_THREADS + PyMem_Free(path); return(PyBool_FromLong(res == 0)); } @@ -3012,7 +3013,7 @@ static PyObject * posix_forkpty(PyObject *self, PyObject *noargs) { - int master_fd, pid; + int master_fd = -1, pid; pid = forkpty(&master_fd, NULL, NULL, NULL); if (pid == -1) From nnorwitz at users.sourceforge.net Mon Sep 19 08:45:56 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 19 Sep 2005 08:45:56 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.341, 2.342 Message-ID: <20050919064556.D3B2F1E400E@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2853/Modules Modified Files: posixmodule.c Log Message: Remove unnecessary/extra parens when returning a value. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.341 retrieving revision 2.342 diff -u -d -r2.341 -r2.342 --- posixmodule.c 19 Sep 2005 06:43:44 -0000 2.341 +++ posixmodule.c 19 Sep 2005 06:45:53 -0000 2.342 @@ -1166,7 +1166,7 @@ it is a simple dereference. */ res = _waccess(PyUnicode_AS_UNICODE(po), mode); Py_END_ALLOW_THREADS - return(PyBool_FromLong(res == 0)); + return PyBool_FromLong(res == 0); } /* Drop the argument parsing error as narrow strings are also valid. */ @@ -1180,7 +1180,7 @@ res = access(path, mode); Py_END_ALLOW_THREADS PyMem_Free(path); - return(PyBool_FromLong(res == 0)); + return PyBool_FromLong(res == 0); } #ifndef F_OK @@ -1222,8 +1222,8 @@ ret = ttyname(id); #endif if (ret == NULL) - return(posix_error()); - return(PyString_FromString(ret)); + return posix_error(); + return PyString_FromString(ret); } #endif @@ -1244,8 +1244,8 @@ ret = ctermid(buffer); #endif if (ret == NULL) - return(posix_error()); - return(PyString_FromString(buffer)); + return posix_error(); + return PyString_FromString(buffer); } #endif From nnorwitz at users.sourceforge.net Mon Sep 19 08:48:08 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 19 Sep 2005 08:48:08 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.102, 1.1193.2.103 Message-ID: <20050919064808.983BB1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3174/Misc Modified Files: Tag: release24-maint NEWS Log Message: Note fix of memory leak. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.102 retrieving revision 1.1193.2.103 diff -u -d -r1.1193.2.102 -r1.1193.2.103 --- NEWS 18 Sep 2005 13:03:16 -0000 1.1193.2.102 +++ NEWS 19 Sep 2005 06:48:05 -0000 1.1193.2.103 @@ -65,6 +65,8 @@ Extension Modules ----------------- +- Fix memory leak in posix.access(). + - Patch #1213831: Fix typo in unicodedata._getcode. - Bug #1007046: os.startfile() did not accept unicode strings encoded in From nnorwitz at users.sourceforge.net Mon Sep 19 08:49:30 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 19 Sep 2005 08:49:30 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1370,1.1371 Message-ID: <20050919064930.D121B1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3307/Misc Modified Files: NEWS Log Message: Note fix of memory leak. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1370 retrieving revision 1.1371 diff -u -d -r1.1370 -r1.1371 --- NEWS 19 Sep 2005 03:54:46 -0000 1.1370 +++ NEWS 19 Sep 2005 06:49:27 -0000 1.1371 @@ -146,6 +146,8 @@ Extension Modules ----------------- +- Fix memory leak in posix.access(). + - Patch #1213831: Fix typo in unicodedata._getcode. - Bug #1007046: os.startfile() did not accept unicode strings encoded in From arigo at users.sourceforge.net Mon Sep 19 11:11:07 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Mon, 19 Sep 2005 11:11:07 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib cgi.py,1.84,1.85 Message-ID: <20050919091107.D8D031E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31059 Modified Files: cgi.py Log Message: Reverted revision 1.83, which introduced a bug and subtle incompatibility issues. See bug #1112856. Index: cgi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgi.py,v retrieving revision 1.84 retrieving revision 1.85 diff -u -d -r1.84 -r1.85 --- cgi.py 2 Aug 2005 02:50:25 -0000 1.84 +++ cgi.py 19 Sep 2005 09:11:04 -0000 1.85 @@ -38,7 +38,8 @@ import sys import os import urllib -import email.Parser +import mimetools +import rfc822 import UserDict try: from cStringIO import StringIO @@ -107,8 +108,6 @@ # Parsing functions # ================= -_header_parser = email.Parser.HeaderParser() - # Maximum input we will accept when REQUEST_METHOD is POST # 0 ==> unlimited input maxlen = 0 @@ -271,7 +270,7 @@ data = None if terminator: # At start of next part. Read headers first. - headers = _header_parser.parse(fp) + headers = mimetools.Message(fp) clength = headers.getheader('content-length') if clength: try: @@ -408,9 +407,8 @@ disposition_options: dictionary of corresponding options - headers: a dictionary(-like) object (sometimes - email.Message.Message or a subclass thereof) containing *all* - headers + headers: a dictionary(-like) object (sometimes rfc822.Message or a + subclass thereof) containing *all* headers The class is subclassable, mostly for the purpose of overriding the make_file() method, which is called internally to come up with @@ -652,7 +650,7 @@ environ, keep_blank_values, strict_parsing) # Throw first part away while not part.done: - headers = _header_parser.parse(self.fp) + headers = rfc822.Message(self.fp) part = klass(self.fp, headers, ib, environ, keep_blank_values, strict_parsing) self.list.append(part) From gvanrossum at users.sourceforge.net Tue Sep 20 00:42:46 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Sep 2005 00:42:46 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Objects classobject.c, 2.178, 2.179 Message-ID: <20050919224246.513671E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13311/Objects Modified Files: classobject.c Log Message: A minor fix for 64-bit platforms: when __len__() returns Python int containing a value that doesn't fit in a C int, raise OverflowError rather than truncating silently (and having 50% chance of hitting the "it should be >= 0" error). Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.178 retrieving revision 2.179 diff -u -d -r2.178 -r2.179 --- classobject.c 19 Jun 2005 08:42:20 -0000 2.178 +++ classobject.c 19 Sep 2005 22:42:41 -0000 2.179 @@ -1013,7 +1013,17 @@ if (res == NULL) return -1; if (PyInt_Check(res)) { - outcome = PyInt_AsLong(res); + long temp = PyInt_AsLong(res); + outcome = (int)temp; +#if SIZEOF_INT < SIZEOF_LONG + /* Overflow check -- range of PyInt is more than C int */ + if (outcome != temp) { + PyErr_SetString(PyExc_OverflowError, + "__len__() should return 0 <= outcome < 2**32"); + outcome = -1; + } + else +#endif if (outcome < 0) PyErr_SetString(PyExc_ValueError, "__len__() should return >= 0"); From doko at users.sourceforge.net Tue Sep 20 09:02:52 2005 From: doko at users.sourceforge.net (doko@users.sourceforge.net) Date: Tue, 20 Sep 2005 09:02:52 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib locale.py,1.31,1.32 Message-ID: <20050920070252.D73841E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5791/Lib Modified Files: locale.py Log Message: - Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE to get the correct encoding. - Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of languages. Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- locale.py 1 Jan 2005 06:10:26 -0000 1.31 +++ locale.py 20 Sep 2005 07:02:49 -0000 1.32 @@ -306,7 +306,7 @@ else: return language + '.' + encoding -def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')): +def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')): """ Tries to determine the default locale settings and returns them as tuple (language code, encoding). @@ -351,6 +351,8 @@ for variable in envvars: localename = lookup(variable,None) if localename: + if variable == 'LANGUAGE': + localename = localename.split(':')[0] break else: localename = 'C' From doko at users.sourceforge.net Tue Sep 20 09:02:53 2005 From: doko at users.sourceforge.net (doko@users.sourceforge.net) Date: Tue, 20 Sep 2005 09:02:53 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1371,1.1372 Message-ID: <20050920070253.041951E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5791/Misc Modified Files: NEWS Log Message: - Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE to get the correct encoding. - Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of languages. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1371 retrieving revision 1.1372 diff -u -d -r1.1371 -r1.1372 --- NEWS 19 Sep 2005 06:49:27 -0000 1.1371 +++ NEWS 20 Sep 2005 07:02:49 -0000 1.1372 @@ -224,6 +224,12 @@ Library ------- +- Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE + to get the correct encoding. + +- Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of + languages. + - Patch #1268314: Cache lines in StreamReader.readlines for performance. - Bug #1290505: Fix clearing the regex cache for time.strptime(). From doko at users.sourceforge.net Tue Sep 20 09:03:24 2005 From: doko at users.sourceforge.net (doko@users.sourceforge.net) Date: Tue, 20 Sep 2005 09:03:24 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.103, 1.1193.2.104 Message-ID: <20050920070324.825441E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5971/Misc Modified Files: Tag: release24-maint NEWS Log Message: - Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE to get the correct encoding. - Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of languages. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.103 retrieving revision 1.1193.2.104 diff -u -d -r1.1193.2.103 -r1.1193.2.104 --- NEWS 19 Sep 2005 06:48:05 -0000 1.1193.2.103 +++ NEWS 20 Sep 2005 07:03:21 -0000 1.1193.2.104 @@ -96,6 +96,12 @@ Library ------- +- Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE + to get the correct encoding. + +- Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of + languages. + - Patch #1268314: Cache lines in StreamReader.readlines for performance. - Bug #1290505: time.strptime() was not invalidating its regex cache when the From doko at users.sourceforge.net Tue Sep 20 09:03:24 2005 From: doko at users.sourceforge.net (doko@users.sourceforge.net) Date: Tue, 20 Sep 2005 09:03:24 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib locale.py,1.28.4.1,1.28.4.2 Message-ID: <20050920070324.CC3691E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5971/Lib Modified Files: Tag: release24-maint locale.py Log Message: - Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE to get the correct encoding. - Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of languages. Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.28.4.1 retrieving revision 1.28.4.2 diff -u -d -r1.28.4.1 -r1.28.4.2 --- locale.py 1 Jan 2005 06:12:26 -0000 1.28.4.1 +++ locale.py 20 Sep 2005 07:03:21 -0000 1.28.4.2 @@ -293,7 +293,7 @@ else: return language + '.' + encoding -def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')): +def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')): """ Tries to determine the default locale settings and returns them as tuple (language code, encoding). @@ -338,6 +338,8 @@ for variable in envvars: localename = lookup(variable,None) if localename: + if variable == 'LANGUAGE': + localename = localename.split(':')[0] break else: localename = 'C' From anthony at python.org Tue Sep 20 15:06:50 2005 From: anthony at python.org (Anthony Baxter) Date: Tue, 20 Sep 2005 23:06:50 +1000 Subject: [Python-checkins] IMPORTANT: release24-maint branch is FROZEN from 2005-09-21 00:00 UTC for 2.4.2 Message-ID: <200509202306.54251.anthony@python.org> Starting in about 11 hours time, the release24-maint branch is FROZEN for the 2.4.2c1 release. The freeze will last for around a day, and then we're in a state of mostly-frozen for another week, until 2.4.2 (final). During that week, please don't check things into the branch unless you check with me first. Let's make this a nice painless release. I'll send another message once 2.4.2 is done. Thanks, Anthony -- Anthony Baxter It's never too late to have a happy childhood. From anthonybaxter at users.sourceforge.net Tue Sep 20 15:07:09 2005 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 20 Sep 2005 15:07:09 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.83.2.7, 2.83.2.8 Message-ID: <20050920130709.1D0E81E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14531 Modified Files: Tag: release24-maint patchlevel.h Log Message: pre-release machinations Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.83.2.7 retrieving revision 2.83.2.8 diff -u -d -r2.83.2.7 -r2.83.2.8 --- patchlevel.h 30 Aug 2005 12:26:43 -0000 2.83.2.7 +++ patchlevel.h 20 Sep 2005 13:07:04 -0000 2.83.2.8 @@ -21,12 +21,12 @@ /* Version parsed out into numeric values */ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 4 -#define PY_MICRO_VERSION 1 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 +#define PY_MICRO_VERSION 2 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "2.4.1+" +#define PY_VERSION "2.4.2c1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ From anthonybaxter at users.sourceforge.net Tue Sep 20 15:08:40 2005 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 20 Sep 2005 15:08:40 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.104, 1.1193.2.105 Message-ID: <20050920130840.EBFD01E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14691/Misc Modified Files: Tag: release24-maint NEWS Log Message: pre-release machinations Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.104 retrieving revision 1.1193.2.105 diff -u -d -r1.1193.2.104 -r1.1193.2.105 --- NEWS 20 Sep 2005 07:03:21 -0000 1.1193.2.104 +++ NEWS 20 Sep 2005 13:08:33 -0000 1.1193.2.105 @@ -4,10 +4,10 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) -What's New in Python 2.4.2a -=========================== +What's New in Python 2.4.2c1 +============================ -*Release date: XX-XXX-2005* +*Release date: 21-SEP-2005* Core and builtins ----------------- From anthonybaxter at users.sourceforge.net Tue Sep 20 15:09:20 2005 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 20 Sep 2005 15:09:20 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/idlelib NEWS.txt, 1.49.2.8, 1.49.2.9 idlever.py, 1.22.2.4, 1.22.2.5 Message-ID: <20050920130920.4EDCC1E4006@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14951/Lib/idlelib Modified Files: Tag: release24-maint NEWS.txt idlever.py Log Message: pre-release machinations Index: NEWS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v retrieving revision 1.49.2.8 retrieving revision 1.49.2.9 diff -u -d -r1.49.2.8 -r1.49.2.9 --- NEWS.txt 23 Aug 2005 17:38:55 -0000 1.49.2.8 +++ NEWS.txt 20 Sep 2005 13:09:16 -0000 1.49.2.9 @@ -1,7 +1,7 @@ What's New in IDLE 1.1.2c1? -========================= +=========================== -*Release date: XX-SEP-2005* +*Release date: 21-SEP-2005* - Mac line endings were incorrect when pasting code from some browsers when using X11 and the Fink distribution. Python Bug 1263656. Index: idlever.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/idlever.py,v retrieving revision 1.22.2.4 retrieving revision 1.22.2.5 diff -u -d -r1.22.2.4 -r1.22.2.5 --- idlever.py 29 Mar 2005 12:33:34 -0000 1.22.2.4 +++ idlever.py 20 Sep 2005 13:09:16 -0000 1.22.2.5 @@ -1 +1 @@ -IDLE_VERSION = "1.1.1" +IDLE_VERSION = "1.1.2c1" From anthonybaxter at users.sourceforge.net Tue Sep 20 15:09:20 2005 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 20 Sep 2005 15:09:20 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.4.spec, 1.8.2.2, 1.8.2.3 Message-ID: <20050920130920.740041E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14951/Misc/RPM Modified Files: Tag: release24-maint python-2.4.spec Log Message: pre-release machinations Index: python-2.4.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.4.spec,v retrieving revision 1.8.2.2 retrieving revision 1.8.2.3 diff -u -d -r1.8.2.2 -r1.8.2.3 --- python-2.4.spec 9 Mar 2005 11:54:28 -0000 1.8.2.2 +++ python-2.4.spec 20 Sep 2005 13:09:17 -0000 1.8.2.3 @@ -33,7 +33,7 @@ ################################# %define name python -%define version 2.4.1 +%define version 2.4.2c1 %define libvers 2.4 %define release 1pydotorg %define __prefix /usr From anthonybaxter at users.sourceforge.net Tue Sep 20 15:11:39 2005 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 20 Sep 2005 15:11:39 +0200 (CEST) Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt, 1.65.2.3, 1.65.2.4 pythoncore.vcproj, 1.25.2.3, 1.25.2.4 Message-ID: <20050920131139.8FF8B1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15440/PCbuild Modified Files: Tag: release24-maint BUILDno.txt pythoncore.vcproj Log Message: pre-release machinations Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.65.2.3 retrieving revision 1.65.2.4 diff -u -d -r1.65.2.3 -r1.65.2.4 --- BUILDno.txt 28 Mar 2005 09:04:20 -0000 1.65.2.3 +++ BUILDno.txt 20 Sep 2005 13:11:36 -0000 1.65.2.4 @@ -33,6 +33,8 @@ Windows Python BUILD numbers ---------------------------- + 66 2.4.2c1 + 21-Sep-2005 65 2.4.1 30-Mar-2005 64 2.4.1c2 Index: pythoncore.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.vcproj,v retrieving revision 1.25.2.3 retrieving revision 1.25.2.4 diff -u -d -r1.25.2.3 -r1.25.2.4 --- pythoncore.vcproj 28 Mar 2005 09:04:20 -0000 1.25.2.3 +++ pythoncore.vcproj 20 Sep 2005 13:11:36 -0000 1.25.2.4 @@ -1385,7 +1385,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="BUILD=65"/> + PreprocessorDefinitions="BUILD=66"/> @@ -1393,7 +1393,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="" - PreprocessorDefinitions="BUILD=65"/> + PreprocessorDefinitions="BUILD=66"/> @@ -1401,7 +1401,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="BUILD=65"/> + PreprocessorDefinitions="BUILD=66"/> Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15759 Modified Files: Tag: release24-maint LICENSE Log Message: pre-release machinations Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.33.2.1 retrieving revision 1.33.2.2 diff -u -d -r1.33.2.1 -r1.33.2.2 --- LICENSE 10 Mar 2005 13:45:23 -0000 1.33.2.1 +++ LICENSE 20 Sep 2005 13:12:48 -0000 1.33.2.2 @@ -50,6 +50,7 @@ 2.3.5 2.3.4 2005 PSF yes 2.4 2.3 2004 PSF yes 2.4.1 2.4.1 2005 PSF yes + 2.4.2 2.4.1 2005 PSF yes Footnotes: From fdrake at users.sourceforge.net Tue Sep 20 15:57:37 2005 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 20 Sep 2005 15:57:37 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/commontex license.tex, 1.6.2.2, 1.6.2.3 Message-ID: <20050920135737.4DDCF1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26015/commontex Modified Files: Tag: release24-maint license.tex Log Message: add 2.4.2 to the LaTeX version of the release history Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/license.tex,v retrieving revision 1.6.2.2 retrieving revision 1.6.2.3 diff -u -d -r1.6.2.2 -r1.6.2.3 --- license.tex 29 Mar 2005 15:57:11 -0000 1.6.2.2 +++ license.tex 20 Sep 2005 13:57:33 -0000 1.6.2.3 @@ -48,6 +48,7 @@ \linev{2.3.5}{2.3.4}{2005}{PSF}{yes} \linev{2.4}{2.3}{2004}{PSF}{yes} \linev{2.4.1}{2.4}{2005}{PSF}{yes} + \linev{2.4.2}{2.4.1}{2005}{PSF}{yes} \end{tablev} \note{GPL-compatible doesn't mean that we're distributing From jackjansen at users.sourceforge.net Tue Sep 20 17:13:57 2005 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 20 Sep 2005 17:13:57 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenGenerator.py, 1.23, 1.24 Message-ID: <20050920151357.8BEB91E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11983 Modified Files: bgenGenerator.py Log Message: Added support for (optionally) bracketing calls with Py_{BEGIN,END}_ALLOW_THREADS. Index: bgenGenerator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenGenerator.py,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- bgenGenerator.py 10 Jul 2005 20:37:50 -0000 1.23 +++ bgenGenerator.py 20 Sep 2005 15:13:53 -0000 1.24 @@ -216,6 +216,12 @@ def precheck(self): pass + def beginallowthreads(self): + pass + + def endallowthreads(self): + pass + def callit(self): args = "" s = "%s%s(" % (self.getrvforcallit(), self.callname) @@ -226,8 +232,10 @@ s = arg.passArgument() if args: s = sep + s args = args + s + self.beginallowthreads() Output("%s%s(%s);", self.getrvforcallit(), self.callname, args) + self.endallowthreads() def getrvforcallit(self): if self.rv: From anthonybaxter at users.sourceforge.net Tue Sep 20 17:17:20 2005 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 20 Sep 2005 17:17:20 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_xmlrpc.py, 1.5.4.1, 1.5.4.2 Message-ID: <20050920151720.87D6B1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13059 Modified Files: Tag: release24-maint test_xmlrpc.py Log Message: backport: test_default_encoding_issues(): Fully restore sys.setdefaultencoding. test_site often failed under "regrtest.py -r", because this xmlrpc test left sys with a setdefaultencoding attribute, but loading site.py removes that attribute and test_site.py verifies the attribute is gone. Changed this test to get rid of sys.setdefaultencoding if it didn't exist when this test started. Index: test_xmlrpc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmlrpc.py,v retrieving revision 1.5.4.1 retrieving revision 1.5.4.2 diff -u -d -r1.5.4.1 -r1.5.4.2 --- test_xmlrpc.py 11 Feb 2005 18:00:16 -0000 1.5.4.1 +++ test_xmlrpc.py 20 Sep 2005 15:17:16 -0000 1.5.4.2 @@ -63,13 +63,20 @@ """ + + # sys.setdefaultencoding() normally doesn't exist after site.py is + # loaded. reload(sys) is the way to get it back. old_encoding = sys.getdefaultencoding() + setdefaultencoding_existed = hasattr(sys, "setdefaultencoding") reload(sys) # ugh! sys.setdefaultencoding("iso-8859-1") try: (s, d), m = xmlrpclib.loads(utf8) finally: sys.setdefaultencoding(old_encoding) + if not setdefaultencoding_existed: + del sys.setdefaultencoding + items = d.items() if have_unicode: self.assertEquals(s, u"abc \x95") From gvanrossum at users.sourceforge.net Tue Sep 20 18:36:11 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Sep 2005 18:36:11 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.105, 1.1193.2.106 Message-ID: <20050920163611.2576E1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30524/Misc Modified Files: Tag: release24-maint NEWS Log Message: - On 64-bit platforms, when __len__() returns a value that cannot be represented as a C int, raise OverflowError. (Will forward-port.) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.105 retrieving revision 1.1193.2.106 diff -u -d -r1.1193.2.105 -r1.1193.2.106 --- NEWS 20 Sep 2005 13:08:33 -0000 1.1193.2.105 +++ NEWS 20 Sep 2005 16:36:07 -0000 1.1193.2.106 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- On 64-bit platforms, when __len__() returns a value that cannot be + represented as a C int, raise OverflowError. + - SF bug #893549: parsing keyword arguments was broken with a few format codes. From gvanrossum at users.sourceforge.net Tue Sep 20 18:36:11 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Sep 2005 18:36:11 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Objects classobject.c, 2.176.2.1, 2.176.2.2 typeobject.c, 2.264.2.3, 2.264.2.4 Message-ID: <20050920163611.2DC901E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30524/Objects Modified Files: Tag: release24-maint classobject.c typeobject.c Log Message: - On 64-bit platforms, when __len__() returns a value that cannot be represented as a C int, raise OverflowError. (Will forward-port.) Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.176.2.1 retrieving revision 2.176.2.2 diff -u -d -r2.176.2.1 -r2.176.2.2 --- classobject.c 31 Mar 2005 10:22:42 -0000 2.176.2.1 +++ classobject.c 20 Sep 2005 16:36:07 -0000 2.176.2.2 @@ -1013,7 +1013,17 @@ if (res == NULL) return -1; if (PyInt_Check(res)) { - outcome = PyInt_AsLong(res); + long temp = PyInt_AsLong(res); + outcome = (int)temp; +#if SIZEOF_INT < SIZEOF_LONG + /* Overflow check -- range of PyInt is more than C int */ + if (outcome != temp) { + PyErr_SetString(PyExc_OverflowError, + "__len__() should return 0 <= outcome < 2**31"); + outcome = -1; + } + else +#endif if (outcome < 0) PyErr_SetString(PyExc_ValueError, "__len__() should return >= 0"); Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.264.2.3 retrieving revision 2.264.2.4 diff -u -d -r2.264.2.3 -r2.264.2.4 --- typeobject.c 3 Jun 2005 14:13:47 -0000 2.264.2.3 +++ typeobject.c 20 Sep 2005 16:36:07 -0000 2.264.2.4 @@ -4071,14 +4071,24 @@ { static PyObject *len_str; PyObject *res = call_method(self, "__len__", &len_str, "()"); + long temp; int len; if (res == NULL) return -1; - len = (int)PyInt_AsLong(res); + temp = PyInt_AsLong(res); + len = (int)temp; Py_DECREF(res); if (len == -1 && PyErr_Occurred()) return -1; +#if SIZEOF_INT < SIZEOF_LONG + /* Overflow check -- range of PyInt is more than C int */ + if (len != temp) { + PyErr_SetString(PyExc_OverflowError, + "__len__() should return 0 <= outcome < 2**31"); + return -1; + } +#endif if (len < 0) { PyErr_SetString(PyExc_ValueError, "__len__() should return >= 0"); From arigo at users.sourceforge.net Tue Sep 20 20:07:51 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Tue, 20 Sep 2005 20:07:51 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python thread_pthread.h, 2.55, 2.56 Message-ID: <20050920180751.52AE51E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18091 Modified Files: thread_pthread.h Log Message: Don't call memset() before checking that the ptr is not NULL. Index: thread_pthread.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v retrieving revision 2.55 retrieving revision 2.56 diff -u -d -r2.55 -r2.56 --- thread_pthread.h 28 Mar 2005 12:34:20 -0000 2.55 +++ thread_pthread.h 20 Sep 2005 18:07:47 -0000 2.56 @@ -355,8 +355,8 @@ PyThread_init_thread(); lock = (pthread_lock *) malloc(sizeof(pthread_lock)); - memset((void *)lock, '\0', sizeof(pthread_lock)); if (lock) { + memset((void *)lock, '\0', sizeof(pthread_lock)); lock->locked = 0; status = pthread_mutex_init(&lock->mut, From arigo at users.sourceforge.net Tue Sep 20 20:13:07 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Tue, 20 Sep 2005 20:13:07 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python bltinmodule.c, 2.325, 2.326 Message-ID: <20050920181307.53CDC1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18581 Modified Files: bltinmodule.c Log Message: Removed a check "if (args != NULL)" which is always True and makes no sense. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.325 retrieving revision 2.326 diff -u -d -r2.325 -r2.326 --- bltinmodule.c 15 Sep 2005 10:46:13 -0000 2.325 +++ bltinmodule.c 20 Sep 2005 18:13:03 -0000 2.326 @@ -1908,11 +1908,9 @@ static char *kwlist[] = {"iterable", "cmp", "key", "reverse", 0}; long reverse; - if (args != NULL) { - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOi:sorted", - kwlist, &seq, &compare, &keyfunc, &reverse)) - return NULL; - } + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOi:sorted", + kwlist, &seq, &compare, &keyfunc, &reverse)) + return NULL; newlist = PySequence_List(seq); if (newlist == NULL) From arigo at users.sourceforge.net Tue Sep 20 20:34:05 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Tue, 20 Sep 2005 20:34:05 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python ceval.c,2.426,2.427 Message-ID: <20050920183405.A44211E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23503 Modified Files: ceval.c Log Message: clean-up tracing of C functions. In particular, don't call the trace func with an exception currently set! Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.426 retrieving revision 2.427 diff -u -d -r2.426 -r2.427 --- ceval.c 15 Aug 2005 18:14:19 -0000 2.426 +++ ceval.c 20 Sep 2005 18:34:01 -0000 2.427 @@ -102,7 +102,7 @@ static int call_trace(Py_tracefunc, PyObject *, PyFrameObject *, int, PyObject *); static void call_trace_protected(Py_tracefunc, PyObject *, - PyFrameObject *, int); + PyFrameObject *, int, PyObject *); static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *); static int maybe_call_line_trace(Py_tracefunc, PyObject *, PyFrameObject *, int *, int *, int *); @@ -2493,14 +2493,14 @@ else if (why == WHY_EXCEPTION) { call_trace_protected(tstate->c_tracefunc, tstate->c_traceobj, f, - PyTrace_RETURN); + PyTrace_RETURN, NULL); } } if (tstate->c_profilefunc) { if (why == WHY_EXCEPTION) call_trace_protected(tstate->c_profilefunc, tstate->c_profileobj, f, - PyTrace_RETURN); + PyTrace_RETURN, NULL); else if (call_trace(tstate->c_profilefunc, tstate->c_profileobj, f, PyTrace_RETURN, retval)) { @@ -3108,12 +3108,12 @@ static void call_trace_protected(Py_tracefunc func, PyObject *obj, PyFrameObject *frame, - int what) + int what, PyObject *arg) { PyObject *type, *value, *traceback; int err; PyErr_Fetch(&type, &value, &traceback); - err = call_trace(func, obj, frame, what, NULL); + err = call_trace(func, obj, frame, what, arg); if (err == 0) PyErr_Restore(type, value, traceback); else { @@ -3503,31 +3503,36 @@ nargs); } -#define C_TRACE(call) \ +#define C_TRACE(x, call) \ if (tstate->use_tracing && tstate->c_profilefunc) { \ if (call_trace(tstate->c_profilefunc, \ tstate->c_profileobj, \ tstate->frame, PyTrace_C_CALL, \ - func)) \ - { return NULL; } \ - call; \ - if (tstate->c_profilefunc != NULL) { \ - if (x == NULL) { \ - if (call_trace (tstate->c_profilefunc, \ - tstate->c_profileobj, \ - tstate->frame, PyTrace_C_EXCEPTION, \ - func)) \ - { return NULL; } \ - } else { \ - if (call_trace(tstate->c_profilefunc, \ - tstate->c_profileobj, \ - tstate->frame, PyTrace_C_RETURN, \ - func)) \ - { return NULL; } \ + func)) { \ + x = NULL; \ + } \ + else { \ + x = call; \ + if (tstate->c_profilefunc != NULL) { \ + if (x == NULL) { \ + call_trace_protected(tstate->c_profilefunc, \ + tstate->c_profileobj, \ + tstate->frame, PyTrace_C_EXCEPTION, \ + func); \ + /* XXX should pass (type, value, tb) */ \ + } else { \ + if (call_trace(tstate->c_profilefunc, \ + tstate->c_profileobj, \ + tstate->frame, PyTrace_C_RETURN, \ + func)) { \ + Py_DECREF(x); \ + x = NULL; \ + } \ + } \ } \ } \ } else { \ - call; \ + x = call; \ } static PyObject * @@ -3556,11 +3561,11 @@ PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); if (flags & METH_NOARGS && na == 0) { - C_TRACE(x=(*meth)(self,NULL)); + C_TRACE(x, (*meth)(self,NULL)); } else if (flags & METH_O && na == 1) { PyObject *arg = EXT_POP(*pp_stack); - C_TRACE(x=(*meth)(self,arg)); + C_TRACE(x, (*meth)(self,arg)); Py_DECREF(arg); } else { @@ -3572,7 +3577,7 @@ PyObject *callargs; callargs = load_args(pp_stack, na); READ_TIMESTAMP(*pintr0); - C_TRACE(x=PyCFunction_Call(func,callargs,NULL)); + C_TRACE(x, PyCFunction_Call(func,callargs,NULL)); READ_TIMESTAMP(*pintr1); Py_XDECREF(callargs); } From gvanrossum at users.sourceforge.net Tue Sep 20 20:49:58 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Sep 2005 20:49:58 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1372,1.1373 Message-ID: <20050920184958.7CEC01E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26848/Misc Modified Files: NEWS Log Message: - On 64-bit platforms, when __len__() returns a value that cannot be represented as a C int, raise OverflowError. (Forward port from 2.4.2; the patch to classobject.c was already in but needed a correction in the error message text.) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1372 retrieving revision 1.1373 diff -u -d -r1.1372 -r1.1373 --- NEWS 20 Sep 2005 07:02:49 -0000 1.1372 +++ NEWS 20 Sep 2005 18:49:54 -0000 1.1373 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- On 64-bit platforms, when __len__() returns a value that cannot be + represented as a C int, raise OverflowError. + - test__locale is skipped on OS X < 10.4 (only partial locale support is present). From gvanrossum at users.sourceforge.net Tue Sep 20 20:49:58 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Sep 2005 20:49:58 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Objects classobject.c, 2.179, 2.180 typeobject.c, 2.267, 2.268 Message-ID: <20050920184958.9E4D01E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26848/Objects Modified Files: classobject.c typeobject.c Log Message: - On 64-bit platforms, when __len__() returns a value that cannot be represented as a C int, raise OverflowError. (Forward port from 2.4.2; the patch to classobject.c was already in but needed a correction in the error message text.) Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.179 retrieving revision 2.180 diff -u -d -r2.179 -r2.180 --- classobject.c 19 Sep 2005 22:42:41 -0000 2.179 +++ classobject.c 20 Sep 2005 18:49:54 -0000 2.180 @@ -1019,7 +1019,7 @@ /* Overflow check -- range of PyInt is more than C int */ if (outcome != temp) { PyErr_SetString(PyExc_OverflowError, - "__len__() should return 0 <= outcome < 2**32"); + "__len__() should return 0 <= outcome < 2**31"); outcome = -1; } else Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.267 retrieving revision 2.268 diff -u -d -r2.267 -r2.268 --- typeobject.c 3 Jun 2005 14:12:21 -0000 2.267 +++ typeobject.c 20 Sep 2005 18:49:54 -0000 2.268 @@ -4071,14 +4071,24 @@ { static PyObject *len_str; PyObject *res = call_method(self, "__len__", &len_str, "()"); + long temp; int len; if (res == NULL) return -1; - len = (int)PyInt_AsLong(res); + temp = PyInt_AsLong(res); + len = (int)temp; Py_DECREF(res); if (len == -1 && PyErr_Occurred()) return -1; +#if SIZEOF_INT < SIZEOF_LONG + /* Overflow check -- range of PyInt is more than C int */ + if (len != temp) { + PyErr_SetString(PyExc_OverflowError, + "__len__() should return 0 <= outcome < 2**31"); + return -1; + } +#endif if (len < 0) { PyErr_SetString(PyExc_ValueError, "__len__() should return >= 0"); From arigo at users.sourceforge.net Tue Sep 20 20:50:16 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Tue, 20 Sep 2005 20:50:16 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib profile.py,1.62,1.63 Message-ID: <20050920185016.F3CF11E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26353 Modified Files: profile.py Log Message: test and fix for buggy handling of exceptions raised by C functions, causing the profiler to crash on an AssertionError if the same Python function catches multiple exceptions from C functions. Index: profile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/profile.py,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- profile.py 3 Mar 2005 11:39:44 -0000 1.62 +++ profile.py 20 Sep 2005 18:50:13 -0000 1.63 @@ -368,7 +368,7 @@ "exception": trace_dispatch_exception, "return": trace_dispatch_return, "c_call": trace_dispatch_c_call, - "c_exception": trace_dispatch_exception, + "c_exception": trace_dispatch_return, # the C function returned "c_return": trace_dispatch_return, } From arigo at users.sourceforge.net Tue Sep 20 20:50:17 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Tue, 20 Sep 2005 20:50:17 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_profile.py, 1.4, 1.5 Message-ID: <20050920185017.661401E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26353/test Modified Files: test_profile.py Log Message: test and fix for buggy handling of exceptions raised by C functions, causing the profiler to crash on an AssertionError if the same Python function catches multiple exceptions from C functions. Index: test_profile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_profile.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- test_profile.py 8 Jul 2004 04:22:19 -0000 1.4 +++ test_profile.py 20 Sep 2005 18:50:13 -0000 1.5 @@ -10,7 +10,7 @@ # included in the profile and would appear to consume all the time.) ticks = 0 -def test_main(): +def test_1(): global ticks ticks = 0 prof = profile.Profile(timer) @@ -95,6 +95,25 @@ vereq (x, 1) os.unlink (TESTFN) +def test_3(): + result = [] + def testfunc1(): + try: len(None) + except: pass + try: len(None) + except: pass + result.append(True) + def testfunc2(): + testfunc1() + testfunc1() + profile.runctx("testfunc2()", locals(), locals(), TESTFN) + vereq(result, [True, True]) + os.unlink(TESTFN) + +def test_main(): + test_1() + test_2() + test_3() + if __name__ == "__main__": test_main() - test_2() From arigo at users.sourceforge.net Tue Sep 20 21:04:05 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Tue, 20 Sep 2005 21:04:05 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules mmapmodule.c,2.50,2.51 Message-ID: <20050920190405.ADC3D1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30121 Modified Files: mmapmodule.c Log Message: C89 compliance. Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.50 retrieving revision 2.51 diff -u -d -r2.50 -r2.51 --- mmapmodule.c 24 Aug 2005 07:17:39 -0000 2.50 +++ mmapmodule.c 20 Sep 2005 19:04:02 -0000 2.51 @@ -421,12 +421,12 @@ return NULL; #else } else { + void *newmap; + if (ftruncate(self->fd, new_size) == -1) { PyErr_SetFromErrno(mmap_module_error); return NULL; } - - void *newmap; #ifdef MREMAP_MAYMOVE newmap = mremap(self->data, self->size, new_size, MREMAP_MAYMOVE); From gvanrossum at users.sourceforge.net Tue Sep 20 21:04:38 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Sep 2005 21:04:38 +0200 (CEST) Subject: [Python-checkins] python/dist/src README,1.184.2.4,1.184.2.5 Message-ID: <20050920190438.470291E4002@bag.python.org> Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30459 Modified Files: Tag: release24-maint README Log Message: Update 64-bit AIX and HP-UX build instructions. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.184.2.4 retrieving revision 1.184.2.5 diff -u -d -r1.184.2.4 -r1.184.2.5 --- README 14 Sep 2005 17:54:39 -0000 1.184.2.4 +++ README 20 Sep 2005 19:04:34 -0000 1.184.2.5 @@ -367,6 +367,14 @@ like "cc_r". For full C++ module support, set CC="xlC_r" (or CC="xlC" without thread support). +AIX 5.3: To build a 64-bit version with IBM's compiler, I used the + following: + + export PATH=/usr/bin:/usr/vacpp/bin + ./configure --with-gcc="xlc_r -q64" --with-cxx="xlC_r -q64" \ + --disable-ipv6 AR="ar -X64" + make + HP-UX: When using threading, you may have to add -D_REENTRANT to the OPT variable in the top-level Makefile; reported by Pat Knight, this seems to make a difference (at least for HP-UX 10.20) @@ -378,9 +386,7 @@ compiler, some experience has shown that the compiler's optimiser produces a completely broken version of python (see http://www.python.org/sf/814976). To work around this, - edit the Makefile and remove -O from the OPT line. (This is - old information; with the latest compiler this problem does - not occur.) + edit the Makefile and remove -O from the OPT line. To build a 64-bit executable on an Itanium 2 system using HP's compiler, use these environment variables: @@ -396,7 +402,8 @@ then *unset* the environment variables again before running make. (At least one of these flags causes the build to fail - if it remains set.) + if it remains set.) You still have to edit the Makefile and + remove -O from the OPT line. HP PA-RISC 2.0: A recent bug report (http://www.python.org/sf/546117) suggests that the C compiler in this 64-bit system has bugs From arigo at users.sourceforge.net Tue Sep 20 21:04:45 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Tue, 20 Sep 2005 21:04:45 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules mmapmodule.c, 2.48.4.1, 2.48.4.2 Message-ID: <20050920190445.ACEA21E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30133 Modified Files: Tag: release24-maint mmapmodule.c Log Message: C89 compliance. Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.48.4.1 retrieving revision 2.48.4.2 diff -u -d -r2.48.4.1 -r2.48.4.2 --- mmapmodule.c 24 Aug 2005 07:17:35 -0000 2.48.4.1 +++ mmapmodule.c 20 Sep 2005 19:04:42 -0000 2.48.4.2 @@ -421,12 +421,12 @@ return NULL; #else } else { + void *newmap; + if (ftruncate(self->fd, new_size) == -1) { PyErr_SetFromErrno(mmap_module_error); return NULL; } - - void *newmap; #ifdef MREMAP_MAYMOVE newmap = mremap(self->data, self->size, new_size, MREMAP_MAYMOVE); From gvanrossum at users.sourceforge.net Tue Sep 20 21:06:26 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Sep 2005 21:06:26 +0200 (CEST) Subject: [Python-checkins] python/dist/src README,1.190,1.191 Message-ID: <20050920190626.791801E4002@bag.python.org> Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31134 Modified Files: README Log Message: Update 64-bit AIX and HP-UX build instructions (forward port). Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.190 retrieving revision 1.191 diff -u -d -r1.190 -r1.191 --- README 14 Sep 2005 17:49:54 -0000 1.190 +++ README 20 Sep 2005 19:06:23 -0000 1.191 @@ -357,6 +357,14 @@ like "cc_r". For full C++ module support, set CC="xlC_r" (or CC="xlC" without thread support). +AIX 5.3: To build a 64-bit version with IBM's compiler, I used the + following: + + export PATH=/usr/bin:/usr/vacpp/bin + ./configure --with-gcc="xlc_r -q64" --with-cxx="xlC_r -q64" \ + --disable-ipv6 AR="ar -X64" + make + HP-UX: When using threading, you may have to add -D_REENTRANT to the OPT variable in the top-level Makefile; reported by Pat Knight, this seems to make a difference (at least for HP-UX 10.20) @@ -368,9 +376,7 @@ compiler, some experience has shown that the compiler's optimiser produces a completely broken version of python (see http://www.python.org/sf/814976). To work around this, - edit the Makefile and remove -O from the OPT line. (This is - old information; with the latest compiler this problem does - not occur.) + edit the Makefile and remove -O from the OPT line. To build a 64-bit executable on an Itanium 2 system using HP's compiler, use these environment variables: @@ -386,7 +392,8 @@ then *unset* the environment variables again before running make. (At least one of these flags causes the build to fail - if it remains set.) + if it remains set.) You still have to edit the Makefile and + remove -O from the OPT line. HP PA-RISC 2.0: A recent bug report (http://www.python.org/sf/546117) suggests that the C compiler in this 64-bit system has bugs From arigo at users.sourceforge.net Tue Sep 20 22:53:16 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Tue, 20 Sep 2005 22:53:16 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python ceval.c, 2.419.2.1, 2.419.2.2 Message-ID: <20050920205316.06FE11E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23307 Modified Files: Tag: release24-maint ceval.c Log Message: (backport) tracing of C functions: don't call the trace func with an exception currently set! Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.419.2.1 retrieving revision 2.419.2.2 diff -u -d -r2.419.2.1 -r2.419.2.2 --- ceval.c 15 Aug 2005 17:32:56 -0000 2.419.2.1 +++ ceval.c 20 Sep 2005 20:53:11 -0000 2.419.2.2 @@ -99,7 +99,7 @@ static int call_trace(Py_tracefunc, PyObject *, PyFrameObject *, int, PyObject *); static void call_trace_protected(Py_tracefunc, PyObject *, - PyFrameObject *, int); + PyFrameObject *, int, PyObject *); static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *); static int maybe_call_line_trace(Py_tracefunc, PyObject *, PyFrameObject *, int *, int *, int *); @@ -2475,14 +2475,14 @@ else if (why == WHY_EXCEPTION) { call_trace_protected(tstate->c_tracefunc, tstate->c_traceobj, f, - PyTrace_RETURN); + PyTrace_RETURN, NULL); } } if (tstate->c_profilefunc) { if (why == WHY_EXCEPTION) call_trace_protected(tstate->c_profilefunc, tstate->c_profileobj, f, - PyTrace_RETURN); + PyTrace_RETURN, NULL); else if (call_trace(tstate->c_profilefunc, tstate->c_profileobj, f, PyTrace_RETURN, retval)) { @@ -3090,12 +3090,12 @@ static void call_trace_protected(Py_tracefunc func, PyObject *obj, PyFrameObject *frame, - int what) + int what, PyObject *arg) { PyObject *type, *value, *traceback; int err; PyErr_Fetch(&type, &value, &traceback); - err = call_trace(func, obj, frame, what, NULL); + err = call_trace(func, obj, frame, what, arg); if (err == 0) PyErr_Restore(type, value, traceback); else { @@ -3481,31 +3481,36 @@ nargs); } -#define C_TRACE(call) \ +#define C_TRACE(x, call) \ if (tstate->use_tracing && tstate->c_profilefunc) { \ if (call_trace(tstate->c_profilefunc, \ tstate->c_profileobj, \ tstate->frame, PyTrace_C_CALL, \ - func)) \ - { return NULL; } \ - call; \ - if (tstate->c_profilefunc != NULL) { \ - if (x == NULL) { \ - if (call_trace (tstate->c_profilefunc, \ - tstate->c_profileobj, \ - tstate->frame, PyTrace_C_EXCEPTION, \ - func)) \ - { return NULL; } \ - } else { \ - if (call_trace(tstate->c_profilefunc, \ - tstate->c_profileobj, \ - tstate->frame, PyTrace_C_RETURN, \ - func)) \ - { return NULL; } \ + func)) { \ + x = NULL; \ + } \ + else { \ + x = call; \ + if (tstate->c_profilefunc != NULL) { \ + if (x == NULL) { \ + call_trace_protected(tstate->c_profilefunc, \ + tstate->c_profileobj, \ + tstate->frame, PyTrace_C_EXCEPTION, \ + func); \ + /* XXX should pass (type, value, tb) */ \ + } else { \ + if (call_trace(tstate->c_profilefunc, \ + tstate->c_profileobj, \ + tstate->frame, PyTrace_C_RETURN, \ + func)) { \ + Py_DECREF(x); \ + x = NULL; \ + } \ + } \ } \ } \ } else { \ - call; \ + x = call; \ } static PyObject * @@ -3534,11 +3539,11 @@ PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); if (flags & METH_NOARGS && na == 0) { - C_TRACE(x=(*meth)(self,NULL)); + C_TRACE(x, (*meth)(self,NULL)); } else if (flags & METH_O && na == 1) { PyObject *arg = EXT_POP(*pp_stack); - C_TRACE(x=(*meth)(self,arg)); + C_TRACE(x, (*meth)(self,arg)); Py_DECREF(arg); } else { @@ -3550,7 +3555,7 @@ PyObject *callargs; callargs = load_args(pp_stack, na); rdtscll(*pintr0); - C_TRACE(x=PyCFunction_Call(func,callargs,NULL)); + C_TRACE(x, PyCFunction_Call(func,callargs,NULL)); rdtscll(*pintr1); Py_XDECREF(callargs); } From arigo at users.sourceforge.net Tue Sep 20 22:53:27 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Tue, 20 Sep 2005 22:53:27 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib profile.py,1.58,1.58.4.1 Message-ID: <20050920205327.E6DD81E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23392 Modified Files: Tag: release24-maint profile.py Log Message: (backport) test and fix for buggy handling of exceptions raised by C functions, causing the profiler to crash on an AssertionError if the same Python function catches multiple exceptions from C functions. Index: profile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/profile.py,v retrieving revision 1.58 retrieving revision 1.58.4.1 diff -u -d -r1.58 -r1.58.4.1 --- profile.py 12 Jul 2004 23:38:01 -0000 1.58 +++ profile.py 20 Sep 2005 20:53:24 -0000 1.58.4.1 @@ -360,7 +360,7 @@ "exception": trace_dispatch_exception, "return": trace_dispatch_return, "c_call": trace_dispatch_c_call, - "c_exception": trace_dispatch_exception, + "c_exception": trace_dispatch_return, # the C function returned "c_return": trace_dispatch_return, } From arigo at users.sourceforge.net Tue Sep 20 22:53:28 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Tue, 20 Sep 2005 22:53:28 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_profile.py, 1.4, 1.4.4.1 Message-ID: <20050920205328.09A1F1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23392/test Modified Files: Tag: release24-maint test_profile.py Log Message: (backport) test and fix for buggy handling of exceptions raised by C functions, causing the profiler to crash on an AssertionError if the same Python function catches multiple exceptions from C functions. Index: test_profile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_profile.py,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -u -d -r1.4 -r1.4.4.1 --- test_profile.py 8 Jul 2004 04:22:19 -0000 1.4 +++ test_profile.py 20 Sep 2005 20:53:24 -0000 1.4.4.1 @@ -10,7 +10,7 @@ # included in the profile and would appear to consume all the time.) ticks = 0 -def test_main(): +def test_1(): global ticks ticks = 0 prof = profile.Profile(timer) @@ -95,6 +95,25 @@ vereq (x, 1) os.unlink (TESTFN) +def test_3(): + result = [] + def testfunc1(): + try: len(None) + except: pass + try: len(None) + except: pass + result.append(True) + def testfunc2(): + testfunc1() + testfunc1() + profile.runctx("testfunc2()", locals(), locals(), TESTFN) + vereq(result, [True, True]) + os.unlink(TESTFN) + +def test_main(): + test_1() + test_2() + test_3() + if __name__ == "__main__": test_main() - test_2() From jackjansen at users.sourceforge.net Tue Sep 20 23:11:23 2005 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 20 Sep 2005 23:11:23 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenHeapBuffer.py, 1.8, 1.9 Message-ID: <20050920211123.4C8171E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26912 Modified Files: bgenHeapBuffer.py Log Message: Added a class MallocHeapOutputBufferType for types that are passed as &buffer, &size and allocated by the called function. Index: bgenHeapBuffer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenHeapBuffer.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- bgenHeapBuffer.py 10 Jul 2005 20:37:50 -0000 1.8 +++ bgenHeapBuffer.py 20 Sep 2005 21:11:19 -0000 1.9 @@ -111,3 +111,32 @@ def passOutput(self, name): return "%s__out__, %s__len__, &%s__len__" % (name, name, name) + +class MallocHeapOutputBufferType(HeapOutputBufferType): + """Output buffer allocated by the called function -- passed as (&buffer, &size). + + Instantiate without parameters. + Call from Python without parameters. + """ + + def getargsCheck(self, name): + Output("%s__out__ = NULL;", name) + + def getAuxDeclarations(self, name): + return [] + + def passOutput(self, name): + return "&%s__out__, &%s__len__" % (name, name) + + def getargsFormat(self): + return "" + + def getargsArgs(self, name): + return None + + def mkvalueFormat(self): + return "z#" + + def cleanup(self, name): + Output("if( %s__out__ ) free(%s__out__);", name, name) + From fdrake at users.sourceforge.net Wed Sep 21 07:29:50 2005 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 21 Sep 2005 07:29:50 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc Makefile, 1.279.2.1, 1.279.2.2 Message-ID: <20050921052950.9BF911E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18314 Modified Files: Tag: release24-maint Makefile Log Message: the iSilo is not being built right now Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.279.2.1 retrieving revision 1.279.2.2 diff -u -d -r1.279.2.1 -r1.279.2.2 --- Makefile 22 Jul 2005 21:48:48 -0000 1.279.2.1 +++ Makefile 21 Sep 2005 05:29:47 -0000 1.279.2.2 @@ -691,7 +691,7 @@ # The small amount of additional work is a small price to pay for not # having to remember which order to do it in. ;) paperdist: distpdf distps pkglist -edist: disthtml distinfo zipisilo pkglist +edist: disthtml distinfo pkglist #zipisilo # The pkglist.html file is used as part of the download.html page on # python.org; it is not used as intermediate input here or as part of From nnorwitz at users.sourceforge.net Wed Sep 21 08:44:29 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 21 Sep 2005 08:44:29 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules/cjkcodecs multibytecodec.c, 1.3, 1.4 Message-ID: <20050921064429.1891C1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules/cjkcodecs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31553/Modules/cjkcodecs Modified Files: multibytecodec.c Log Message: SF Patch #1297028, cjkcodecs does not initialize type pointer Fix segfault. I tried to write a test, but it wouldn't crash when running regrtest. This really should have some sort of test. Should definitely be backported. Index: multibytecodec.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cjkcodecs/multibytecodec.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- multibytecodec.c 19 Aug 2004 17:49:56 -0000 1.3 +++ multibytecodec.c 21 Sep 2005 06:44:25 -0000 1.4 @@ -1265,6 +1265,10 @@ void init_multibytecodec(void) { + MultibyteCodec_Type.ob_type = &PyType_Type; + MultibyteStreamReader_Type.ob_type = &PyType_Type; + MultibyteStreamWriter_Type.ob_type = &PyType_Type; + Py_InitModule("_multibytecodec", __methods); if (PyErr_Occurred()) From nnorwitz at users.sourceforge.net Wed Sep 21 08:44:29 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 21 Sep 2005 08:44:29 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1373,1.1374 Message-ID: <20050921064429.4DEEA1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31553/Misc Modified Files: NEWS Log Message: SF Patch #1297028, cjkcodecs does not initialize type pointer Fix segfault. I tried to write a test, but it wouldn't crash when running regrtest. This really should have some sort of test. Should definitely be backported. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1373 retrieving revision 1.1374 diff -u -d -r1.1373 -r1.1374 --- NEWS 20 Sep 2005 18:49:54 -0000 1.1373 +++ NEWS 21 Sep 2005 06:44:25 -0000 1.1374 @@ -149,6 +149,9 @@ Extension Modules ----------------- +- Patch #1297028: fix segfault if call type on MultibyteCodec, + MultibyteStreamReader, or MultibyteStreamWriter + - Fix memory leak in posix.access(). - Patch #1213831: Fix typo in unicodedata._getcode. From jackjansen at users.sourceforge.net Wed Sep 21 22:52:15 2005 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 21 Sep 2005 22:52:15 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_macfs.py,1.7,1.8 Message-ID: <20050921205215.202E81E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18567 Modified Files: test_macfs.py Log Message: MacOSX 10.4 apparently does not allow the creation time to be set to later than the modification time. Changed the SetDates test to accomodate. Backport candidate. Index: test_macfs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_macfs.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- test_macfs.py 24 Apr 2003 16:02:52 -0000 1.7 +++ test_macfs.py 21 Sep 2005 20:52:11 -0000 1.8 @@ -48,9 +48,9 @@ import time fss = macfs.FSSpec(test_support.TESTFN) now = int(time.time()) - fss.SetDates(now, now-1, now-2) + fss.SetDates(now, now+1, now+2) dates = fss.GetDates() - self.assertEqual(dates, (now, now-1, now-2)) + self.assertEqual(dates, (now, now+1, now+2)) def test_ctor_type(self): fss = macfs.FSSpec(test_support.TESTFN) From mwh at users.sourceforge.net Thu Sep 22 11:19:05 2005 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 22 Sep 2005 11:19:05 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_StringIO.py, 1.19, 1.20 Message-ID: <20050922091905.11CFB1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29596/Lib/test Modified Files: test_StringIO.py Log Message: Patches #1298449 and #1298499: Add some missing checks for error returns in cStringIO.c. Thanks to Andrew Bennetts. This must be a backport candidate. Index: test_StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_StringIO.py,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- test_StringIO.py 1 Nov 2004 17:10:19 -0000 1.19 +++ test_StringIO.py 22 Sep 2005 09:19:01 -0000 1.20 @@ -44,6 +44,13 @@ f.seek(0) self.assertEqual(f.getvalue(), 'abc') + def test_writelines_error(self): + def errorGen(): + yield 'a' + raise KeyboardInterrupt() + f = self.MODULE.StringIO() + self.assertRaises(KeyboardInterrupt, f.writelines, errorGen()) + def test_truncate(self): eq = self.assertEqual f = self.MODULE.StringIO() From mwh at users.sourceforge.net Thu Sep 22 11:19:05 2005 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 22 Sep 2005 11:19:05 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules cStringIO.c,2.49,2.50 Message-ID: <20050922091905.148EC1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29596/Modules Modified Files: cStringIO.c Log Message: Patches #1298449 and #1298499: Add some missing checks for error returns in cStringIO.c. Thanks to Andrew Bennetts. This must be a backport candidate. Index: cStringIO.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v retrieving revision 2.49 retrieving revision 2.50 diff -u -d -r2.49 -r2.50 --- cStringIO.c 21 Aug 2004 06:55:43 -0000 2.49 +++ cStringIO.c 22 Sep 2005 09:19:01 -0000 2.50 @@ -241,7 +241,10 @@ line = PyString_FromStringAndSize (output, n); if (!line) goto err; - PyList_Append (result, line); + if (PyList_Append (result, line) == -1) { + Py_DECREF (line); + goto err; + } Py_DECREF (line); length += n; if (hint > 0 && length >= hint) @@ -440,13 +443,18 @@ Py_DECREF(it); Py_DECREF(s); return NULL; - } - Py_DECREF(s); - } - Py_DECREF(it); - Py_RETURN_NONE; -} + } + Py_DECREF(s); + } + Py_DECREF(it); + + /* See if PyIter_Next failed */ + if (PyErr_Occurred()) + return NULL; + + Py_RETURN_NONE; +} static struct PyMethodDef O_methods[] = { /* Common methods: */ {"flush", (PyCFunction)IO_flush, METH_NOARGS, IO_flush__doc__}, From mwh at users.sourceforge.net Thu Sep 22 11:19:05 2005 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 22 Sep 2005 11:19:05 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc ACKS, 1.295, 1.296 NEWS, 1.1374, 1.1375 Message-ID: <20050922091905.565A41E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29596/Misc Modified Files: ACKS NEWS Log Message: Patches #1298449 and #1298499: Add some missing checks for error returns in cStringIO.c. Thanks to Andrew Bennetts. This must be a backport candidate. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.295 retrieving revision 1.296 diff -u -d -r1.295 -r1.296 --- ACKS 12 May 2005 13:44:23 -0000 1.295 +++ ACKS 22 Sep 2005 09:19:01 -0000 1.296 @@ -50,6 +50,7 @@ Thomas Bellman Juan M. Bello Rivas Alexander Belopolsky +Andrew Bennetts Andy Bensky Michel Van den Bergh Eric Beser Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1374 retrieving revision 1.1375 diff -u -d -r1.1374 -r1.1375 --- NEWS 21 Sep 2005 06:44:25 -0000 1.1374 +++ NEWS 22 Sep 2005 09:19:01 -0000 1.1375 @@ -149,6 +149,9 @@ Extension Modules ----------------- +- Patches #1298449 and #1298499: Add some missing checks for error + returns in cStringIO.c. + - Patch #1297028: fix segfault if call type on MultibyteCodec, MultibyteStreamReader, or MultibyteStreamWriter From gvanrossum at users.sourceforge.net Thu Sep 22 17:35:41 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Sep 2005 17:35:41 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_macfs.py, 1.7, 1.7.16.1 Message-ID: <20050922153541.476461E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10358 Modified Files: Tag: release24-maint test_macfs.py Log Message: Backport Jack Jansen's fix for test_macfs.py (broke on OS X 10.4.2). Index: test_macfs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_macfs.py,v retrieving revision 1.7 retrieving revision 1.7.16.1 diff -u -d -r1.7 -r1.7.16.1 --- test_macfs.py 24 Apr 2003 16:02:52 -0000 1.7 +++ test_macfs.py 22 Sep 2005 15:35:36 -0000 1.7.16.1 @@ -48,9 +48,9 @@ import time fss = macfs.FSSpec(test_support.TESTFN) now = int(time.time()) - fss.SetDates(now, now-1, now-2) + fss.SetDates(now, now+1, now+2) dates = fss.GetDates() - self.assertEqual(dates, (now, now-1, now-2)) + self.assertEqual(dates, (now, now+1, now+2)) def test_ctor_type(self): fss = macfs.FSSpec(test_support.TESTFN) From fdrake at users.sourceforge.net Thu Sep 22 21:35:44 2005 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 Sep 2005 21:35:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/tools getpagecounts, 1.10, 1.10.4.1 Message-ID: <20050922193544.716C21E4006@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17480 Modified Files: Tag: release24-maint getpagecounts Log Message: update URL into the Python wiki Index: getpagecounts =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/getpagecounts,v retrieving revision 1.10 retrieving revision 1.10.4.1 diff -u -d -r1.10 -r1.10.4.1 --- getpagecounts 30 Jul 2003 02:55:28 -0000 1.10 +++ getpagecounts 22 Sep 2005 19:35:39 -0000 1.10.4.1 @@ -65,7 +65,7 @@ of it! To locate published copies of the larger manuals, or other Python reference material, consult the Python Bookstore at: - http://www.python.org/cgi-bin/moinmoin/PythonBooks + http://wiki.python.org/moin/PythonBooks The following manuals are included in this package: """ From fdrake at users.sourceforge.net Thu Sep 22 21:37:55 2005 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 Sep 2005 21:37:55 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/tools getpagecounts, 1.10, 1.11 Message-ID: <20050922193755.94FE91E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17840 Modified Files: getpagecounts Log Message: update URL into the Python wiki (forward port revision 1.10.4.1) Index: getpagecounts =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/getpagecounts,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- getpagecounts 30 Jul 2003 02:55:28 -0000 1.10 +++ getpagecounts 22 Sep 2005 19:37:52 -0000 1.11 @@ -65,7 +65,7 @@ of it! To locate published copies of the larger manuals, or other Python reference material, consult the Python Bookstore at: - http://www.python.org/cgi-bin/moinmoin/PythonBooks + http://wiki.python.org/moin/PythonBooks The following manuals are included in this package: """ From nnorwitz at users.sourceforge.net Fri Sep 23 05:23:49 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 23 Sep 2005 05:23:49 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.106, 1.1193.2.107 Message-ID: <20050923032349.F236A1E4014@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18764/Misc Modified Files: Tag: release24-maint NEWS Log Message: Backport fix for patch #1297028, cjkcodecs does not initialize type pointer Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.106 retrieving revision 1.1193.2.107 diff -u -d -r1.1193.2.106 -r1.1193.2.107 --- NEWS 20 Sep 2005 16:36:07 -0000 1.1193.2.106 +++ NEWS 23 Sep 2005 03:23:46 -0000 1.1193.2.107 @@ -4,6 +4,30 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) +What's New in Python 2.4.2 final? +================================= + +*Release date: XX-SEP-2005* + +Core and builtins +----------------- + + +Extension Modules +----------------- + +- Patch #1297028: fix segfault if call type on MultibyteCodec, + MultibyteStreamReader, or MultibyteStreamWriter. + + +Tests +----- + + +Build +----- + + What's New in Python 2.4.2c1 ============================ From nnorwitz at users.sourceforge.net Fri Sep 23 05:23:50 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 23 Sep 2005 05:23:50 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules/cjkcodecs multibytecodec.c, 1.3, 1.3.2.1 Message-ID: <20050923032350.0D0211E4016@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules/cjkcodecs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18764/Modules/cjkcodecs Modified Files: Tag: release24-maint multibytecodec.c Log Message: Backport fix for patch #1297028, cjkcodecs does not initialize type pointer Index: multibytecodec.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cjkcodecs/multibytecodec.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -d -r1.3 -r1.3.2.1 --- multibytecodec.c 19 Aug 2004 17:49:56 -0000 1.3 +++ multibytecodec.c 23 Sep 2005 03:23:46 -0000 1.3.2.1 @@ -1265,6 +1265,10 @@ void init_multibytecodec(void) { + MultibyteCodec_Type.ob_type = &PyType_Type; + MultibyteStreamReader_Type.ob_type = &PyType_Type; + MultibyteStreamWriter_Type.ob_type = &PyType_Type; + Py_InitModule("_multibytecodec", __methods); if (PyErr_Occurred()) From gvanrossum at users.sourceforge.net Fri Sep 23 05:56:04 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 23 Sep 2005 05:56:04 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.107, 1.1193.2.108 Message-ID: <20050923035604.52D551E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24004 Modified Files: Tag: release24-maint NEWS Log Message: News about the test_macfs fix. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.107 retrieving revision 1.1193.2.108 diff -u -d -r1.1193.2.107 -r1.1193.2.108 --- NEWS 23 Sep 2005 03:23:46 -0000 1.1193.2.107 +++ NEWS 23 Sep 2005 03:56:00 -0000 1.1193.2.108 @@ -23,6 +23,10 @@ Tests ----- +- Fixed failure in test_macfs on Mac OS X 10.4 (Tiger), which + apparently doesn't allow the creation time to be set later than the + modification time. Fixed by changing the test data. + Build ----- From nnorwitz at users.sourceforge.net Fri Sep 23 06:26:27 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 23 Sep 2005 06:26:27 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib libimaplib.tex, 1.33, 1.34 Message-ID: <20050923042627.BA5041E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28679/Doc/lib Modified Files: libimaplib.tex Log Message: SF #1297059, doc incorrect return type for search() method. (There is a description of returned values at the top, so just remove the sentance and correct an example.) Index: libimaplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimaplib.tex,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- libimaplib.tex 1 Jun 2005 23:50:52 -0000 1.33 +++ libimaplib.tex 23 Sep 2005 04:26:24 -0000 1.34 @@ -327,8 +327,7 @@ \end{methoddesc} \begin{methoddesc}{search}{charset, criterion\optional{, ...}} - Search mailbox for matching messages. Returned data contains a space - separated list of matching message numbers. \var{charset} may be + Search mailbox for matching messages. \var{charset} may be \code{None}, in which case no \samp{CHARSET} will be specified in the request to the server. The IMAP protocol requires that at least one criterion be specified; an exception will be raised when the server @@ -338,10 +337,10 @@ \begin{verbatim} # M is a connected IMAP4 instance... -msgnums = M.search(None, 'FROM', '"LDJ"') +typ, msgnums = M.search(None, 'FROM', '"LDJ"') # or: -msgnums = M.search(None, '(FROM "LDJ")') +typ, msgnums = M.search(None, '(FROM "LDJ")') \end{verbatim} \end{methoddesc} From nnorwitz at users.sourceforge.net Fri Sep 23 06:28:27 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 23 Sep 2005 06:28:27 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib libimaplib.tex, 1.30.4.2, 1.30.4.3 Message-ID: <20050923042827.88D371E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29068/Doc/lib Modified Files: Tag: release24-maint libimaplib.tex Log Message: Backport SF #1297059, doc incorrect return type for search() method. (There is a description of returned values at the top, so just remove the sentance and correct an example.) Index: libimaplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimaplib.tex,v retrieving revision 1.30.4.2 retrieving revision 1.30.4.3 diff -u -d -r1.30.4.2 -r1.30.4.3 --- libimaplib.tex 19 Jan 2005 04:47:50 -0000 1.30.4.2 +++ libimaplib.tex 23 Sep 2005 04:28:23 -0000 1.30.4.3 @@ -322,8 +322,7 @@ \end{methoddesc} \begin{methoddesc}{search}{charset, criterion\optional{, ...}} - Search mailbox for matching messages. Returned data contains a space - separated list of matching message numbers. \var{charset} may be + Search mailbox for matching messages. \var{charset} may be \code{None}, in which case no \samp{CHARSET} will be specified in the request to the server. The IMAP protocol requires that at least one criterion be specified; an exception will be raised when the server @@ -333,10 +332,10 @@ \begin{verbatim} # M is a connected IMAP4 instance... -msgnums = M.search(None, 'FROM', '"LDJ"') +typ, msgnums = M.search(None, 'FROM', '"LDJ"') # or: -msgnums = M.search(None, '(FROM "LDJ")') +typ, msgnums = M.search(None, '(FROM "LDJ")') \end{verbatim} \end{methoddesc} From mwh at users.sourceforge.net Fri Sep 23 10:14:43 2005 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Sep 2005 10:14:43 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.108, 1.1193.2.109 Message-ID: <20050923081443.7AE881E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7459/Misc Modified Files: Tag: release24-maint NEWS Log Message: Backport bugfix: Fix bug: [ 1163563 ] Sub threads execute in restricted mode basically by fixing bug 1010677 in a non-broken way. Backport candidate. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.108 retrieving revision 1.1193.2.109 diff -u -d -r1.1193.2.108 -r1.1193.2.109 --- NEWS 23 Sep 2005 03:56:00 -0000 1.1193.2.108 +++ NEWS 23 Sep 2005 08:14:39 -0000 1.1193.2.109 @@ -40,6 +40,12 @@ Core and builtins ----------------- +- SF bug #1163563: the original fix for bug #1010677 ("thread Module + Breaks PyGILState_Ensure()") broke badly in the case of multiple + interpreter states; back out that fix and do a better job (see + http://mail.python.org/pipermail/python-dev/2005-June/054258.html + for a longer write-up of the problem). + - On 64-bit platforms, when __len__() returns a value that cannot be represented as a C int, raise OverflowError. From mwh at users.sourceforge.net Fri Sep 23 10:14:43 2005 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Sep 2005 10:14:43 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules threadmodule.c, 2.59, 2.59.2.1 Message-ID: <20050923081443.8720F1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7459/Modules Modified Files: Tag: release24-maint threadmodule.c Log Message: Backport bugfix: Fix bug: [ 1163563 ] Sub threads execute in restricted mode basically by fixing bug 1010677 in a non-broken way. Backport candidate. Index: threadmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v retrieving revision 2.59 retrieving revision 2.59.2.1 diff -u -d -r2.59 -r2.59.2.1 --- threadmodule.c 24 Aug 2004 22:24:08 -0000 2.59 +++ threadmodule.c 23 Sep 2005 08:14:40 -0000 2.59.2.1 @@ -425,10 +425,12 @@ t_bootstrap(void *boot_raw) { struct bootstate *boot = (struct bootstate *) boot_raw; - PyGILState_STATE gstate; + PyThreadState *tstate; PyObject *res; - gstate = PyGILState_Ensure(); + tstate = PyThreadState_New(boot->interp); + + PyEval_AcquireThread(tstate); res = PyEval_CallObjectWithKeywords( boot->func, boot->args, boot->keyw); if (res == NULL) { @@ -453,7 +455,8 @@ Py_DECREF(boot->args); Py_XDECREF(boot->keyw); PyMem_DEL(boot_raw); - PyGILState_Release(gstate); + PyThreadState_Clear(tstate); + PyThreadState_DeleteCurrent(); PyThread_exit_thread(); } From mwh at users.sourceforge.net Fri Sep 23 10:14:43 2005 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Sep 2005 10:14:43 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python pystate.c, 2.38.2.2, 2.38.2.3 Message-ID: <20050923081443.BBCB71E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7459/Python Modified Files: Tag: release24-maint pystate.c Log Message: Backport bugfix: Fix bug: [ 1163563 ] Sub threads execute in restricted mode basically by fixing bug 1010677 in a non-broken way. Backport candidate. Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.38.2.2 retrieving revision 2.38.2.3 diff -u -d -r2.38.2.2 -r2.38.2.3 --- pystate.c 24 Apr 2005 19:32:34 -0000 2.38.2.2 +++ pystate.c 23 Sep 2005 08:14:40 -0000 2.38.2.3 @@ -36,6 +36,12 @@ #define HEAD_INIT() (void)(head_mutex || (head_mutex = PyThread_allocate_lock())) #define HEAD_LOCK() PyThread_acquire_lock(head_mutex, WAIT_LOCK) #define HEAD_UNLOCK() PyThread_release_lock(head_mutex) + +/* The single PyInterpreterState used by this process' + GILState implementation +*/ +static PyInterpreterState *autoInterpreterState = NULL; +static int autoTLSkey = 0; #else #define HEAD_INIT() /* Nothing */ #define HEAD_LOCK() /* Nothing */ @@ -47,6 +53,8 @@ PyThreadState *_PyThreadState_Current = NULL; PyThreadFrameGetter _PyThreadState_GetFrame = NULL; +static void _PyGILState_NoteThreadState(PyThreadState* tstate); + PyInterpreterState * PyInterpreterState_New(void) @@ -180,6 +188,8 @@ tstate->c_profileobj = NULL; tstate->c_traceobj = NULL; + _PyGILState_NoteThreadState(tstate); + HEAD_LOCK(); tstate->next = interp->tstate_head; interp->tstate_head = tstate; @@ -261,6 +271,8 @@ "PyThreadState_DeleteCurrent: no current tstate"); _PyThreadState_Current = NULL; tstate_delete_common(tstate); + if (autoTLSkey && PyThread_get_key_value(autoTLSkey) == tstate) + PyThread_delete_key_value(autoTLSkey); PyEval_ReleaseLock(); } #endif /* WITH_THREAD */ @@ -393,12 +405,6 @@ return tstate == _PyThreadState_Current; } -/* The single PyInterpreterState used by this process' - GILState implementation -*/ -static PyInterpreterState *autoInterpreterState = NULL; -static int autoTLSkey = 0; - /* Internal initialization/finalization functions called by Py_Initialize/Py_Finalize */ @@ -408,12 +414,10 @@ assert(i && t); /* must init with valid states */ autoTLSkey = PyThread_create_key(); autoInterpreterState = i; - /* Now stash the thread state for this thread in TLS */ assert(PyThread_get_key_value(autoTLSkey) == NULL); - if (PyThread_set_key_value(autoTLSkey, (void *)t) < 0) - Py_FatalError("Couldn't create autoTLSkey mapping"); - assert(t->gilstate_counter == 0); /* must be a new thread state */ - t->gilstate_counter = 1; + assert(t->gilstate_counter == 0); + + _PyGILState_NoteThreadState(t); } void @@ -424,6 +428,41 @@ autoInterpreterState = NULL;; } +/* When a thread state is created for a thread by some mechanism other than + PyGILState_Ensure, it's important that the GILState machinery knows about + it so it doesn't try to create another thread state for the thread (this is + a better fix for SF bug #1010677 than the first one attempted). +*/ +void +_PyGILState_NoteThreadState(PyThreadState* tstate) +{ + /* If autoTLSkey is 0, this must be the very first threadstate created + in Py_Initialize(). Don't do anything for now (we'll be back here + when _PyGILState_Init is called). */ + if (!autoTLSkey) + return; + + /* Stick the thread state for this thread in thread local storage. + + The only situation where you can legitimately have more than one + thread state for an OS level thread is when there are multiple + interpreters, when: + + a) You shouldn't really be using the PyGILState_ APIs anyway, + and: + + b) The slightly odd way PyThread_set_key_value works (see + comments by its implementation) means that the first thread + state created for that given OS level thread will "win", + which seems reasonable behaviour. + */ + if (PyThread_set_key_value(autoTLSkey, (void *)tstate) < 0) + Py_FatalError("Couldn't create autoTLSkey mapping"); + + /* PyGILState_Release must not try to delete this thread state. */ + tstate->gilstate_counter = 1; +} + /* The public functions */ PyThreadState * PyGILState_GetThisThreadState(void) @@ -450,8 +489,9 @@ tcur = PyThreadState_New(autoInterpreterState); if (tcur == NULL) Py_FatalError("Couldn't create thread-state for new thread"); - if (PyThread_set_key_value(autoTLSkey, (void *)tcur) < 0) - Py_FatalError("Couldn't create autoTLSkey mapping"); + /* This is our thread state! We'll need to delete it in the + matching call to PyGILState_Release(). */ + tcur->gilstate_counter = 0; current = 0; /* new thread state is never current */ } else @@ -498,8 +538,6 @@ * habit of coming back). */ PyThreadState_DeleteCurrent(); - /* Delete this thread from our TLS. */ - PyThread_delete_key_value(autoTLSkey); } /* Release the lock if necessary */ else if (oldstate == PyGILState_UNLOCKED) From montanaro at users.sourceforge.net Fri Sep 23 19:14:26 2005 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 23 Sep 2005 19:14:26 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Objects listsort.txt,1.6,1.7 Message-ID: <20050923171426.610621E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2376 Modified Files: listsort.txt Log Message: The key to the various sort columns got lost. Pulled from http://mail.python.org/pipermail/python-dev/2002-July/026876.html Index: listsort.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listsort.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- listsort.txt 10 Aug 2002 07:04:01 -0000 1.6 +++ listsort.txt 23 Sep 2005 17:14:22 -0000 1.7 @@ -54,6 +54,16 @@ + Here are exact comparison counts across all the tests in sortperf.py, when run with arguments "15 20 1". + Column Key: + *sort: random data + \sort: descending data + /sort: ascending data + 3sort: ascending, then 3 random exchanges + +sort: ascending, then 10 random at the end + ~sort: many duplicates + =sort: all equal + !sort: worst case scenario + First the trivial cases, trivial for samplesort because it special-cased them, and trivial for timsort because it naturally works on runs. Within an "n" block, the first line gives the # of compares done by samplesort, From astrand at users.sourceforge.net Fri Sep 23 19:37:33 2005 From: astrand at users.sourceforge.net (astrand@users.sourceforge.net) Date: Fri, 23 Sep 2005 19:37:33 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib subprocess.py,1.20,1.21 Message-ID: <20050923173733.AB9ED1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7025 Modified Files: subprocess.py Log Message: Changed license header: Now simply referring to PSF. This closes bug 1138653. Index: subprocess.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/subprocess.py,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- subprocess.py 28 Mar 2005 01:08:02 -0000 1.20 +++ subprocess.py 23 Sep 2005 17:37:29 -0000 1.21 @@ -4,30 +4,10 @@ # # This module should remain compatible with Python 2.2, see PEP 291. # -# Copyright (c) 2003-2004 by Peter Astrand +# Copyright (c) 2003-2005 by Peter Astrand # # Licensed to PSF under a Contributor Agreement. -# -# By obtaining, using, and/or copying this software and/or its -# associated documentation, you agree that you have read, understood, -# and will comply with the following terms and conditions: -# -# Permission to use, copy, modify, and distribute this software and -# its associated documentation for any purpose and without fee is -# hereby granted, provided that the above copyright notice appears in -# all copies, and that both that copyright notice and this permission -# notice appear in supporting documentation, and that the name of the -# author not be used in advertising or publicity pertaining to -# distribution of the software without specific, written prior -# permission. -# -# THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR -# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, -# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# See http://www.python.org/2.4/license for licensing details. r"""subprocess - Subprocesses with accessible I/O streams From astrand at users.sourceforge.net Fri Sep 23 19:42:39 2005 From: astrand at users.sourceforge.net (astrand@users.sourceforge.net) Date: Fri, 23 Sep 2005 19:42:39 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib subprocess.py, 1.8.2.4, 1.8.2.5 Message-ID: <20050923174239.BCDF71E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8036 Modified Files: Tag: release24-maint subprocess.py Log Message: Changed header to match the HEAD version: * Added note about Python 2.2 compatibility. * Changed license header: Now simply referring to PSF. This closes bug 1138653. Index: subprocess.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/subprocess.py,v retrieving revision 1.8.2.4 retrieving revision 1.8.2.5 diff -u -d -r1.8.2.4 -r1.8.2.5 --- subprocess.py 3 Mar 2005 21:11:06 -0000 1.8.2.4 +++ subprocess.py 23 Sep 2005 17:42:36 -0000 1.8.2.5 @@ -2,28 +2,12 @@ # # For more information about this module, see PEP 324. # -# Copyright (c) 2003-2004 by Peter Astrand -# -# By obtaining, using, and/or copying this software and/or its -# associated documentation, you agree that you have read, understood, -# and will comply with the following terms and conditions: +# This module should remain compatible with Python 2.2, see PEP 291. # -# Permission to use, copy, modify, and distribute this software and -# its associated documentation for any purpose and without fee is -# hereby granted, provided that the above copyright notice appears in -# all copies, and that both that copyright notice and this permission -# notice appear in supporting documentation, and that the name of the -# author not be used in advertising or publicity pertaining to -# distribution of the software without specific, written prior -# permission. +# Copyright (c) 2003-2005 by Peter Astrand # -# THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR -# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, -# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# Licensed to PSF under a Contributor Agreement. +# See http://www.python.org/2.4/license for licensing details. r"""subprocess - Subprocesses with accessible I/O streams From pje at users.sourceforge.net Sat Sep 24 16:30:47 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 16:30:47 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools EasyInstall.txt, 1.60, 1.61 Message-ID: <20050924143047.231701E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24033 Modified Files: EasyInstall.txt Log Message: Fix typo. Add setup for include/python2.X directory in non-root install instructions. Index: EasyInstall.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/EasyInstall.txt,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- EasyInstall.txt 17 Sep 2005 01:13:01 -0000 1.60 +++ EasyInstall.txt 24 Sep 2005 14:30:43 -0000 1.61 @@ -72,7 +72,7 @@ the scripts directory to it. Note that instead of changing your ``PATH`` to include the Python scripts -directory, you can also retarget the installtion location for scripts so they +directory, you can also retarget the installation location for scripts so they go on a directory that's already on the ``PATH``. For more information see the sections below on `Command-Line Options`_ and `Configuration Files`_. You can pass command line options (such as ``--script-dir``) to ``ez_setup.py`` to @@ -732,6 +732,8 @@ rm ~/lib/python2.4/site-packages mkdir ~/lib/python2.4/site-packages ln -s /usr/local/lib/python2.4/site-packages/* ~/lib/python2.4/site-packages + mkdir ~/include/python2.4 + ln -s /usr/local/include/python2.4/* ~/include/python2.4 If your ``sys.exec_prefix`` was different from your ``sys.prefix``, you will also need to do this:: From perky at users.sourceforge.net Sat Sep 24 16:58:51 2005 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sat, 24 Sep 2005 16:58:51 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1375,1.1376 Message-ID: <20050924145851.74F261E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27146/Misc Modified Files: NEWS Log Message: Patch #1288833: Removed thread lock from socket.getaddrinfo on FreeBSD 5.3 and later versions which got thread-safe getaddrinfo(3). (Reported by Maxim Sobolev) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1375 retrieving revision 1.1376 diff -u -d -r1.1375 -r1.1376 --- NEWS 22 Sep 2005 09:19:01 -0000 1.1375 +++ NEWS 24 Sep 2005 14:58:47 -0000 1.1376 @@ -149,6 +149,9 @@ Extension Modules ----------------- +- Patch #1288833: Removed thread lock from socket.getaddrinfo on + FreeBSD 5.3 and later versions which got thread-safe getaddrinfo(3). + - Patches #1298449 and #1298499: Add some missing checks for error returns in cStringIO.c. From perky at users.sourceforge.net Sat Sep 24 16:58:51 2005 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sat, 24 Sep 2005 16:58:51 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules socketmodule.c, 1.313, 1.314 Message-ID: <20050924145851.755B91E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27146/Modules Modified Files: socketmodule.c Log Message: Patch #1288833: Removed thread lock from socket.getaddrinfo on FreeBSD 5.3 and later versions which got thread-safe getaddrinfo(3). (Reported by Maxim Sobolev) Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.313 retrieving revision 1.314 diff -u -d -r1.313 -r1.314 --- socketmodule.c 14 Sep 2005 18:09:41 -0000 1.313 +++ socketmodule.c 24 Sep 2005 14:58:47 -0000 1.314 @@ -140,9 +140,14 @@ # define USE_GETHOSTBYNAME_LOCK #endif +/* To use __FreeBSD_version */ +#ifdef HAVE_SYS_PARAM_H +#include +#endif /* On systems on which getaddrinfo() is believed to not be thread-safe, (this includes the getaddrinfo emulation) protect access with a lock. */ -#if defined(WITH_THREAD) && (defined(__APPLE__) || defined(__FreeBSD__) || \ +#if defined(WITH_THREAD) && (defined(__APPLE__) || \ + (defined(__FreeBSD__) && __FreeBSD_version+0 < 503000) || \ defined(__OpenBSD__) || defined(__NetBSD__) || !defined(HAVE_GETADDRINFO)) #define USE_GETADDRINFO_LOCK #endif From pje at users.sourceforge.net Sat Sep 24 19:29:00 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 19:29:00 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools easy_install.py, 1.27, 1.28 setup.py, 1.39, 1.40 Message-ID: <20050924172900.18B271E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25640 Modified Files: easy_install.py setup.py Log Message: Improve backward compatibility, so that users running easy_install.py or python -m easy_install get a clearer error message. Index: easy_install.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/easy_install.py,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- easy_install.py 17 Sep 2005 01:13:02 -0000 1.27 +++ easy_install.py 24 Sep 2005 17:28:56 -0000 1.28 @@ -1,22 +1,15 @@ #!python """\ - -Easy Install ------------- - -A tool for doing automatic download/extract/build of distutils-based Python -packages. For detailed documentation, see the accompanying EasyInstall.txt -file, or visit the `EasyInstall home page`__. - -__ http://peak.telecommunity.com/DevCenter/EasyInstall +This script/module exists for backward compatibility only! It will go away +entirely in 0.7. Please start using the 'easy_install' script or .exe instead +of using 'python -m easy_install' or running 'easy_install.py' directly. """ -import sys -from setuptools.command.easy_install import * - if __name__ == '__main__': - print >>sys.stderr, "NOTE: python -m easy_install is deprecated." - print >>sys.stderr, "Please use the 'easy_install' command instead." - print >>sys.stderr - main(sys.argv[1:]) + import sys + print >>sys.stderr, \ + "Please use the 'easy_install' script or executable instead." + print >>sys.stderr, \ + "(i.e., don't include the '.py' extension and don't use 'python -m')" + sys.exit(2) Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setup.py,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- setup.py 18 Sep 2005 04:02:38 -0000 1.39 +++ setup.py 24 Sep 2005 17:28:56 -0000 1.40 @@ -14,13 +14,14 @@ lines.append(line) f.close() return ''.join(lines) - -VERSION = "0.6a2" +VERSION = "0.6a2" from setuptools import setup, find_packages import sys - from setuptools.command import __all__ as SETUP_COMMANDS +scripts = [] +if sys.platform != "win32": + scripts = ["easy_install.py"] # for backward compatibility only setup( name="setuptools", @@ -38,7 +39,6 @@ package_data = {'setuptools': ['launcher.exe']}, py_modules = ['pkg_resources', 'easy_install'], - zip_safe = False, # We want 'python -m easy_install' to work, for now :( entry_points = { "distutils.commands" : [ @@ -77,8 +77,8 @@ Topic :: Software Development :: Libraries :: Python Modules Topic :: System :: Archiving :: Packaging Topic :: System :: Systems Administration - Topic :: Utilities""".splitlines() if f.strip()] - + Topic :: Utilities""".splitlines() if f.strip()], + scripts = scripts, # uncomment for testing # setup_requires = ['setuptools>=0.6a0'], From pje at users.sourceforge.net Sat Sep 24 19:58:26 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 19:58:26 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command easy_install.py, 1.29, 1.30 Message-ID: <20050924175826.446DF1E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32232/setuptools/command Modified Files: easy_install.py Log Message: Implement smart version conflict resolution for scripts, so that installed applications will not have their eggs overridden by packages installed locally on sys.path. This should also make things work a bit better for "traditional" non-root Python setups on Unixy operating systems. See: http://mail.python.org/pipermail/distutils-sig/2005-September/005164.html for more details. Index: easy_install.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/easy_install.py,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- easy_install.py 17 Sep 2005 01:13:02 -0000 1.29 +++ easy_install.py 24 Sep 2005 17:58:22 -0000 1.30 @@ -462,6 +462,7 @@ script_text = get_script_header("") + ( "# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r\n" + "__requires__ = %(spec)r\n" "import sys\n" "from pkg_resources import load_entry_point\n" "\n" @@ -489,7 +490,6 @@ - def install_script(self, dist, script_name, script_text, dev_path=None): """Generate a legacy script wrapper and install it""" spec = str(dist.as_requirement()) @@ -497,6 +497,7 @@ if dev_path: script_text = get_script_header(script_text) + ( "# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r\n" + "__requires__ = %(spec)r\n" "from pkg_resources import require; require(%(spec)r)\n" "del require\n" "__file__ = %(dev_path)r\n" @@ -504,15 +505,14 @@ ) % locals() else: script_text = get_script_header(script_text) + ( - "#!python\n" "# EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r\n" + "__requires__ = %(spec)r\n" "import pkg_resources\n" "pkg_resources.run_script(%(spec)r, %(script_name)r)\n" ) % locals() self.write_script(script_name, script_text) - def write_script(self, script_name, contents, mode="t"): """Write an executable file to the scripts directory""" log.info("Installing %s script to %s", script_name, self.script_dir) From pje at users.sourceforge.net Sat Sep 24 19:58:26 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 19:58:26 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools pkg_resources.py, 1.70, 1.71 Message-ID: <20050924175826.5DA681E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32232 Modified Files: pkg_resources.py Log Message: Implement smart version conflict resolution for scripts, so that installed applications will not have their eggs overridden by packages installed locally on sys.path. This should also make things work a bit better for "traditional" non-root Python setups on Unixy operating systems. See: http://mail.python.org/pipermail/distutils-sig/2005-September/005164.html for more details. Index: pkg_resources.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.py,v retrieving revision 1.70 retrieving revision 1.71 diff -u -d -r1.70 -r1.71 --- pkg_resources.py 19 Aug 2005 01:01:53 -0000 1.70 +++ pkg_resources.py 24 Sep 2005 17:58:22 -0000 1.71 @@ -463,7 +463,7 @@ requirements = list(requirements)[::-1] # set up the stack processed = {} # set of processed requirements - best = {} # key -> dist + best = dict([(d.key,d) for d in self]) # key -> dist to_activate = [] while requirements: @@ -2131,19 +2131,35 @@ # Set up global resource manager - _manager = ResourceManager() - def _initialize(g): for name in dir(_manager): if not name.startswith('_'): g[name] = getattr(_manager, name) _initialize(globals()) - # Prepare the master working set and make the ``require()`` API available - working_set = WorkingSet() +try: + # Does the main program list any requirements? + from __main__ import __requires__ +except ImportError: + pass # No: just use the default working set based on sys.path +else: + # Yes: ensure the requirements are met, by prefixing sys.path if necessary + try: + working_set.require(__requires__) + except VersionConflict: # try it without defaults already on sys.path + working_set = WorkingSet([]) # by starting with an empty path + for dist in working_set.resolve( + parse_requirements(__requires__), Environment() + ): + working_set.add(dist) + for entry in sys.path: # add any missing entries from sys.path + if entry not in working_set.entries: + working_set.add_entry(entry) + sys.path[:] = working_set.entries # then copy back to sys.path + require = working_set.require iter_entry_points = working_set.iter_entry_points add_activation_listener = working_set.subscribe @@ -2153,21 +2169,5 @@ # Activate all distributions already on sys.path, and ensure that # all distributions added to the working set in the future (e.g. by # calling ``require()``) will get activated as well. -# add_activation_listener(lambda dist: dist.activate()) - - - - - - - - - - - - - - - From pje at users.sourceforge.net Sat Sep 24 21:44:30 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 21:44:30 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools setuptools.txt, 1.37, 1.38 Message-ID: <20050924194430.96EEF1E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22287 Modified Files: setuptools.txt Log Message: Fix a bug parsing #egg links reported by Ben Bangert on the distutils-sig. Index: setuptools.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.txt,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- setuptools.txt 18 Sep 2005 04:02:38 -0000 1.37 +++ setuptools.txt 24 Sep 2005 19:44:27 -0000 1.38 @@ -1066,8 +1066,11 @@ source distribution, or to HTML page(s) that have direct links to such, then EasyInstall will be able to locate downloads automatically. If you want to make Subversion checkouts available, then you should create links with either -``#egg=project`` or ``#egg=project-version`` added to the URL (replacing -``project`` and ``version`` with appropriate values). +``#egg=project`` or ``#egg=project-version`` added to the URL. You should +replace ``project`` and ``version`` with the values they would have in an egg +filename. (Be sure to actually generate an egg and then use the initial part +of the filename, rather than trying to guess what the escaped form of the +project name and version number will be.) Note that Subversion checkout links are of lower precedence than other kinds of distributions, so EasyInstall will not select a Subversion checkout for From pje at users.sourceforge.net Sat Sep 24 21:44:30 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 21:44:30 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools package_index.py, 1.20, 1.21 Message-ID: <20050924194430.A4E191E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22287/setuptools Modified Files: package_index.py Log Message: Fix a bug parsing #egg links reported by Ben Bangert on the distutils-sig. Index: package_index.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/package_index.py,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- package_index.py 14 Sep 2005 03:28:10 -0000 1.20 +++ package_index.py 24 Sep 2005 19:44:27 -0000 1.21 @@ -6,7 +6,7 @@ from distutils.errors import DistutilsError from md5 import md5 -EGG_FRAGMENT = re.compile('^egg=(\\w+(-\\w+)?)$') +EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.]+)$') HREF = re.compile("""href\\s*=\\s*['"]?([^'"> ]+)""", re.I) # this is here to fix emacs' cruddy broken syntax highlighting From pje at users.sourceforge.net Sat Sep 24 21:45:23 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 21:45:23 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools EasyInstall.txt, 1.61, 1.62 Message-ID: <20050924194523.78B8D1E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22537 Modified Files: EasyInstall.txt Log Message: Add release notes for changes made today. Index: EasyInstall.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/EasyInstall.txt,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- EasyInstall.txt 24 Sep 2005 14:30:43 -0000 1.61 +++ EasyInstall.txt 24 Sep 2005 19:45:20 -0000 1.62 @@ -778,14 +778,27 @@ in Exemaker. So, don't use Exemaker to wrap ``easy_install.py``, or at any rate don't expect it to work with all packages. +0.6a3 + * Improved error message when trying to use old ways of running + ``easy_install``. Removed the ability to run via ``python -m`` or by + running ``easy_install.py``; ``easy_install`` is the command to run on all + supported platforms. + + * Improved wrapper script generation and runtime initialization so that a + VersionConflict doesn't occur if you later install a competing version of a + needed package as the default version of that package. + + * Fixed a problem parsing version numbers in ``#egg=`` links. + 0.6a2 * EasyInstall can now install "console_scripts" defined by packages that use ``setuptools`` and define appropriate entry points. On Windows, console scripts get an ``.exe`` wrapper so you can just type their name. On other platforms, the scripts are installed without a file extension. - * Using ``python -m easy_install`` is now DEPRECATED, since an - ``easy_install`` wrapper is now available on all platforms. + * Using ``python -m easy_install`` or running ``easy_install.py`` is now + DEPRECATED, since an ``easy_install`` wrapper is now available on all + platforms. 0.6a1 * EasyInstall now does MD5 validation of downloads from PyPI, or from any link From pje at users.sourceforge.net Sat Sep 24 21:48:31 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 21:48:31 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/tests test_resources.py, 1.23, 1.24 Message-ID: <20050924194831.8F1DD1E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22907/setuptools/tests Modified Files: test_resources.py Log Message: Fix a problem with inconsistent quoting of "extras", reported by Ian Bicking on the distutils-sig. Index: test_resources.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests/test_resources.py,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- test_resources.py 14 Aug 2005 01:45:38 -0000 1.23 +++ test_resources.py 24 Sep 2005 19:48:28 -0000 1.24 @@ -333,7 +333,7 @@ self.assertEqual(r1,r2) self.assertEqual(r1,r3) self.assertEqual(r1.extras, ("foo","bar")) - self.assertEqual(r2.extras, ("bar","FOO")) + self.assertEqual(r2.extras, ("bar","foo")) # extras are normalized self.assertEqual(hash(r1), hash(r2)) self.assertEqual( hash(r1), hash(("twisted", ((">=",parse_version("1.2")),), From pje at users.sourceforge.net Sat Sep 24 21:48:31 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 21:48:31 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools pkg_resources.py, 1.71, 1.72 pkg_resources.txt, 1.14, 1.15 Message-ID: <20050924194831.9319A1E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22907 Modified Files: pkg_resources.py pkg_resources.txt Log Message: Fix a problem with inconsistent quoting of "extras", reported by Ian Bicking on the distutils-sig. Index: pkg_resources.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.py,v retrieving revision 1.71 retrieving revision 1.72 diff -u -d -r1.71 -r1.72 --- pkg_resources.py 24 Sep 2005 17:58:22 -0000 1.71 +++ pkg_resources.py 24 Sep 2005 19:48:28 -0000 1.72 @@ -61,6 +61,7 @@ # Parsing functions and string utilities 'parse_requirements', 'parse_version', 'safe_name', 'safe_version', 'get_platform', 'compatible_platforms', 'yield_lines', 'split_sections', + 'safe_extra', # filesystem utilities 'ensure_directory', 'normalize_path', @@ -79,7 +80,6 @@ 'run_main', 'AvailableDistributions', ] - class ResolutionError(Exception): """Abstract base for dependency resolution errors""" @@ -836,14 +836,14 @@ return re.sub('[^A-Za-z0-9.]+', '-', version) +def safe_extra(extra): + """Convert an arbitrary string to a standard 'extra' name - - - - - - - + Any runs of non-alphanumeric characters are replaced with a single '_', + and the result is always lowercased. + """ + return re.sub('[^A-Za-z0-9]+', '_', extra).lower() + @@ -1606,9 +1606,7 @@ self.name = name self.module_name = module_name self.attrs = tuple(attrs) - self.extras = Requirement.parse( - ("x[%s]" % ','.join(extras)).lower() - ).extras + self.extras = Requirement.parse(("x[%s]" % ','.join(extras))).extras self.dist = dist def __str__(self): @@ -1638,6 +1636,8 @@ map(working_set.add, working_set.resolve(self.dist.requires(self.extras),env,installer)) + + #@classmethod def parse(cls, src, dist=None): """Parse a single entry point from string `src` @@ -1810,7 +1810,7 @@ dm = self.__dep_map = {None: []} for name in 'requires.txt', 'depends.txt': for extra,reqs in split_sections(self._get_metadata(name)): - if extra: extra = extra.lower() + if extra: extra = safe_extra(extra) dm.setdefault(extra,[]).extend(parse_requirements(reqs)) return dm _dep_map = property(_dep_map) @@ -1822,7 +1822,7 @@ deps.extend(dm.get(None,())) for ext in extras: try: - deps.extend(dm[ext.lower()]) + deps.extend(dm[safe_extra(ext)]) except KeyError: raise UnknownExtra( "%s has no such extra feature %r" % (self, ext) @@ -2014,10 +2014,10 @@ index = [(parse_version(v),state_machine[op],op,v) for op,v in specs] index.sort() self.specs = [(op,ver) for parsed,trans,op,ver in index] - self.index, self.extras = index, tuple(extras) + self.index, self.extras = index, tuple(map(safe_extra,extras)) self.hashCmp = ( self.key, tuple([(op,parsed) for parsed,trans,op,ver in index]), - ImmutableSet(map(str.lower,extras)) + ImmutableSet(self.extras) ) self.__hash = hash(self.hashCmp) Index: pkg_resources.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- pkg_resources.txt 14 Sep 2005 03:33:49 -0000 1.14 +++ pkg_resources.txt 24 Sep 2005 19:48:28 -0000 1.15 @@ -522,7 +522,10 @@ or indexing. ``extras`` - A tuple of names of "extras" that this requirement calls for. + A tuple of names of "extras" that this requirement calls for. (These will + be all-lowercase and normalized using the ``safe_extra()`` parsing utility + function, so they may not exactly equal the extras the requirement was + created with.) Entry Points @@ -1413,6 +1416,12 @@ are generating a filename from this you should replace any "-" characters in the output with underscores. +``safe_extra(extra)`` + Return a "safe" form of an extra's name, suitable for use in a requirement + string or a setup script's ``extras_require`` keyword. This routine is + similar to ``safe_name()`` except that non-alphanumeric runs are replaced + by a single underbar (``_``), and the result is lowercased. + Platform Utilities ------------------ @@ -1479,6 +1488,10 @@ Release Notes/Change History ---------------------------- +0.6a3 + * Added ``safe_extra()`` parsing utility routine, and use it for Requirement, + EntryPoint, and Distribution objects' extras handling. + 0.6a1 * Enhanced performance of ``require()`` and related operations when all requirements are already in the working set, and enhanced performance of From pje at users.sourceforge.net Sat Sep 24 22:30:00 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 22:30:00 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools cli.exe, NONE, 1.1 gui.exe, NONE, 1.1 launcher.exe, 1.1, NONE Message-ID: <20050924203000.2B72C1E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30448/setuptools Added Files: cli.exe gui.exe Removed Files: launcher.exe Log Message: Support generating .pyw/.exe wrappers for Windows GUI scripts, and "normal" #! wrappers for GUI scripts on other platforms. --- NEW FILE: cli.exe --- (This appears to be a binary file; contents omitted.) --- NEW FILE: gui.exe --- (This appears to be a binary file; contents omitted.) --- launcher.exe DELETED --- From pje at users.sourceforge.net Sat Sep 24 22:30:00 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 22:30:00 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools launcher.c, 1.1, 1.2 setuptools.txt, 1.38, 1.39 Message-ID: <20050924203000.639021E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30448 Modified Files: launcher.c setuptools.txt Log Message: Support generating .pyw/.exe wrappers for Windows GUI scripts, and "normal" #! wrappers for GUI scripts on other platforms. Index: launcher.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/launcher.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- launcher.c 17 Sep 2005 01:13:02 -0000 1.1 +++ launcher.c 24 Sep 2005 20:29:57 -0000 1.2 @@ -12,7 +12,8 @@ To build/rebuild with mingw32, do this in the setuptools project directory: - gcc -mno-cygwin -O -s -o setuptools/launcher.exe launcher.c + gcc -DGUI=0 -mno-cygwin -O -s -o setuptools/cli.exe launcher.c + gcc -DGUI=1 -mwindows -mno-cygwin -O -s -o setuptools/gui.exe launcher.c It links to msvcrt.dll, but this shouldn't be a problem since it doesn't actually run Python in the same process. Note that using 'exec' instead @@ -32,14 +33,13 @@ int fail(char *format, char *data) { /* Print error message to stderr and return 1 */ fprintf(stderr, format, data); - return 1; + return 2; } - -int main(int argc, char **argv) { +int run(int argc, char **argv, int is_gui) { char python[256]; /* python executable's filename*/ char script[256]; /* the script's filename */ @@ -55,7 +55,7 @@ end = script + strlen(script); while( end>script && *end != '.') *end-- = '\0'; - strcat(script, "py"); + strcat(script, (GUI ? "pyw" : "py")); /* figure out the target python executable */ @@ -102,19 +102,19 @@ newargs[argc+1] = NULL; /* printf("args 0: %s\nargs 1: %s\n", newargs[0], newargs[1]); */ - + if (is_gui) { + /* Use exec, we don't need to wait for the GUI to finish */ + execv(newargs[0], (const char * const *)(newargs)); + return fail("Could not exec %s", python); /* shouldn't get here! */ + } + /* We *do* need to wait for a CLI to finish, so use spawn */ return spawnv(P_WAIT, newargs[0], (const char * const *)(newargs)); } - - - - - - - - +int WINAPI WinMain(HINSTANCE hI, HINSTANCE hP, LPSTR lpCmd, int nShow) { + return run(__argc, __argv, GUI); +} Index: setuptools.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.txt,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- setuptools.txt 24 Sep 2005 19:44:27 -0000 1.38 +++ setuptools.txt 24 Sep 2005 20:29:57 -0000 1.39 @@ -39,8 +39,9 @@ without needing to create a ``MANIFEST.in`` file, and without having to force regeneration of the ``MANIFEST`` file when your source tree changes. -* Automatically generate wrapper scripts or Windows (console) .exe files for - any number of "main" functions in your project. +* Automatically generate wrapper scripts or Windows (console and GUI) .exe + files for any number of "main" functions in your project. (Note: this is not + a py2exe replacement; the .exe files rely on the local Python installation.) * Transparent Pyrex support, so that your setup.py can list ``.pyx`` files and still work even when the end-user doesn't have Pyrex installed (as long as @@ -314,8 +315,8 @@ ``.exe`` file so that users don't have to change their ``PATHEXT`` settings. The way to use this feature is to define "entry points" in your setup script that indicate what function the generated script should import and run. For -example, to create two scripts called ``foo`` and ``bar``, you might do -something like this:: +example, to create two console scripts called ``foo`` and ``bar``, and a GUI +script called ``baz``, you might do something like this:: setup( # other arguments here... @@ -323,23 +324,31 @@ 'console_scripts': [ 'foo = my_package.some_module:main_func', 'bar = other_module:some_func', + ], + 'gui_scripts': [ + 'baz = my_package_gui.start_func', ] } ) When this project is installed on non-Windows platforms (using "setup.py -install", "setup.py develop", or by using EasyInstall), a pair of ``foo`` and -``bar`` scripts will be installed that import ``main_func`` and ``some_func`` -from the specified modules. The functions you specify are called with no -arguments, and their return value is passed to ``sys.exit()``, so you can -return an errorlevel or message to print to stderr. +install", "setup.py develop", or by using EasyInstall), a set of ``foo``, +``bar``, and ``baz`` scripts will be installed that import ``main_func`` and +``some_func`` from the specified modules. The functions you specify are called +with no arguments, and their return value is passed to ``sys.exit()``, so you +can return an errorlevel or message to print to stderr. -You may define as many "console script" entry points as you like, and each one -can optionally specify "extras" that it depends on, and that will be added to -``sys.path`` when the script is run. For more information on "extras", see -section below on `Declaring Extras`_. For more information on "entry points" -in general, see the section below on `Dynamic Discovery of Services and -Plugins`_. +On Windows, a set of ``foo.exe``, ``bar.exe``, and ``baz.exe`` launchers are +created, alongside a set of ``foo.py``, ``bar.py``, and ``baz.pyw`` files. The +``.exe`` wrappers find and execute the right version of Python to run the +``.py`` or ``.pyw`` file. + +You may define as many "console script" and "gui script" entry points as you +like, and each one can optionally specify "extras" that it depends on, that +will be added to ``sys.path`` when the script is run. For more information on +"extras", see the section below on `Declaring Extras`_. For more information +on "entry points" in general, see the section below on `Dynamic Discovery of +Services and Plugins`_. Declaring Dependencies @@ -1848,6 +1857,11 @@ Release Notes/Change History ---------------------------- +0.6a3 + * Added ``gui_scripts`` entry point group to allow installing GUI scripts + on Windows and other platforms. (The special handling is only for Windows; + other platforms are treated the same as for ``console_scripts``.) + 0.6a2 * Added ``console_scripts`` entry point group to allow installing scripts without the need to create separate script files. On Windows, console From pje at users.sourceforge.net Sat Sep 24 22:30:00 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 22:30:00 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools.egg-info entry_points.txt, 1.8, 1.9 Message-ID: <20050924203000.86BC31E4006@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.egg-info In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30448/setuptools.egg-info Modified Files: entry_points.txt Log Message: Support generating .pyw/.exe wrappers for Windows GUI scripts, and "normal" #! wrappers for GUI scripts on other platforms. Index: entry_points.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.egg-info/entry_points.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- entry_points.txt 18 Sep 2005 04:02:38 -0000 1.8 +++ entry_points.txt 24 Sep 2005 20:29:57 -0000 1.9 @@ -24,6 +24,7 @@ rotate = setuptools.command.rotate:rotate develop = setuptools.command.develop:develop setopt = setuptools.command.setopt:setopt +build_py = setuptools.command.build_py:build_py saveopts = setuptools.command.saveopts:saveopts egg_info = setuptools.command.egg_info:egg_info upload = setuptools.command.upload:upload From pje at users.sourceforge.net Sat Sep 24 22:30:00 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 22:30:00 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command develop.py, 1.6, 1.7 easy_install.py, 1.30, 1.31 Message-ID: <20050924203000.BDA201E4004@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30448/setuptools/command Modified Files: develop.py easy_install.py Log Message: Support generating .pyw/.exe wrappers for Windows GUI scripts, and "normal" #! wrappers for GUI scripts on other platforms. Index: develop.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/develop.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- develop.py 17 Sep 2005 01:13:02 -0000 1.6 +++ develop.py 24 Sep 2005 20:29:57 -0000 1.7 @@ -103,7 +103,7 @@ # create wrapper scripts in the script dir, pointing to dist.scripts # new-style... - self.install_console_scripts(dist) + self.install_wrapper_scripts(dist) # ...and old-style for script_name in self.distribution.scripts or []: Index: easy_install.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/easy_install.py,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- easy_install.py 24 Sep 2005 17:58:22 -0000 1.30 +++ easy_install.py 24 Sep 2005 20:29:57 -0000 1.31 @@ -10,7 +10,7 @@ __ http://peak.telecommunity.com/DevCenter/EasyInstall """ -import sys, os.path, zipimport, shutil, tempfile, zipfile +import sys, os.path, zipimport, shutil, tempfile, zipfile, re from glob import glob from setuptools import Command from setuptools.sandbox import run_setup @@ -247,7 +247,7 @@ def install_egg_scripts(self, dist): """Write all the scripts for `dist`, unless scripts are excluded""" - self.install_console_scripts(dist) + self.install_wrapper_scripts(dist) if self.exclude_scripts or not dist.metadata_isdir('scripts'): return @@ -440,52 +440,52 @@ return dst + def install_wrapper_scripts(self, dist): + if self.exclude_scripts: + return + for group in 'console_scripts', 'gui_scripts': + for name,ep in dist.get_entry_map(group).items(): + self._install_wrapper_script(dist, group, name, ep) - - - - - - - def install_console_scripts(self, dist): + def _install_wrapper_script(self, dist, group, name, entry_point): """Write new-style console scripts, unless excluded""" - - if self.exclude_scripts: - return spec = str(dist.as_requirement()) - group = 'console_scripts' - - for name,ep in dist.get_entry_map(group).items(): - - script_text = get_script_header("") + ( - "# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r\n" - "__requires__ = %(spec)r\n" - "import sys\n" - "from pkg_resources import load_entry_point\n" - "\n" - "sys.exit(\n" - " load_entry_point(%(spec)r, %(group)r, %(name)r)()\n" - ")\n" - ) % locals() + header = get_script_header("") + script_text = ( + "# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r\n" + "__requires__ = %(spec)r\n" + "import sys\n" + "from pkg_resources import load_entry_point\n" + "\n" + "sys.exit(\n" + " load_entry_point(%(spec)r, %(group)r, %(name)r)()\n" + ")\n" + ) % locals() - if sys.platform=='win32': - # On Windows, add a .py extension and an .exe launcher - self.write_script(name+'.py', script_text) - self.write_script( - name+'.exe', resource_string('setuptools','launcher.exe'), - 'b' # write in binary mode - ) + if sys.platform=='win32': + # On Windows, add a .py extension and an .exe launcher + if group=='gui_scripts': + ext, launcher = '.pyw', 'gui.exe' + new_header = re.sub('(?i)python.exe','pythonw.exe',header) else: - # On other platforms, we assume the right thing to do is to - # write the stub with no extension. - self.write_script(name, script_text) - - + ext, launcher = '.py', 'cli.exe' + new_header = re.sub('(?i)pythonw.exe','pythonw.exe',header) + if os.path.exists(new_header[2:-1]): + header = new_header + self.write_script(name+ext, header+script_text) + self.write_script( + name+'.exe', resource_string('setuptools', launcher), + 'b' # write in binary mode + ) + else: + # On other platforms, we assume the right thing to do is to just + # write the stub with no extension. + self.write_script(name, header+script_text) @@ -495,7 +495,7 @@ spec = str(dist.as_requirement()) if dev_path: - script_text = get_script_header(script_text) + ( + script_text = get_script_header(script_text) + ( "# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r\n" "__requires__ = %(spec)r\n" "from pkg_resources import require; require(%(spec)r)\n" @@ -504,7 +504,7 @@ "execfile(__file__)\n" ) % locals() else: - script_text = get_script_header(script_text) + ( + script_text = get_script_header(script_text) + ( "# EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r\n" "__requires__ = %(spec)r\n" "import pkg_resources\n" From rhettinger at users.sourceforge.net Sat Sep 24 23:23:08 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 24 Sep 2005 23:23:08 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1376,1.1377 Message-ID: <20050924212308.A68341E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7585/Misc Modified Files: NEWS Log Message: Convert iterator __len__() methods to a private API. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1376 retrieving revision 1.1377 diff -u -d -r1.1376 -r1.1377 --- NEWS 24 Sep 2005 14:58:47 -0000 1.1376 +++ NEWS 24 Sep 2005 21:23:05 -0000 1.1377 @@ -12,6 +12,10 @@ Core and builtins ----------------- +- All iterators now have a Boolean value of true. Formerly, some iterators + supported a __len__() method which evaluated to False when the iterator + was empty. + - On 64-bit platforms, when __len__() returns a value that cannot be represented as a C int, raise OverflowError. From rhettinger at users.sourceforge.net Sat Sep 24 23:23:08 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 24 Sep 2005 23:23:08 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Include abstract.h,2.51,2.52 Message-ID: <20050924212308.AEB151E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7585/Include Modified Files: abstract.h Log Message: Convert iterator __len__() methods to a private API. Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.51 retrieving revision 2.52 diff -u -d -r2.51 -r2.52 --- abstract.h 12 Mar 2004 16:38:17 -0000 2.51 +++ abstract.h 24 Sep 2005 21:23:05 -0000 2.52 @@ -422,6 +422,21 @@ PyAPI_FUNC(int) PyObject_Length(PyObject *o); #define PyObject_Length PyObject_Size + PyAPI_FUNC(int) _PyObject_LengthCue(PyObject *o); + + /* + Return the size of object o. If the object, o, provides + both sequence and mapping protocols, the sequence size is + returned. On error, -1 is returned. If the object provides + a _length_cue() method, its value is returned. This is the + equivalent to the Python expression: + try: + return len(o) + except (AttributeError, TypeError): + if hasattr(o, '_length_cue'): + return o._length_cue() + raise + */ PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); From rhettinger at users.sourceforge.net Sat Sep 24 23:23:08 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 24 Sep 2005 23:23:08 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_enumerate.py, 1.16, 1.17 test_iterlen.py, 1.2, 1.3 test_itertools.py, 1.39, 1.40 Message-ID: <20050924212308.CE63D1E4006@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7585/Lib/test Modified Files: test_enumerate.py test_iterlen.py test_itertools.py Log Message: Convert iterator __len__() methods to a private API. Index: test_enumerate.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_enumerate.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- test_enumerate.py 17 Jul 2005 23:16:18 -0000 1.16 +++ test_enumerate.py 24 Sep 2005 21:23:05 -0000 1.17 @@ -144,6 +144,7 @@ def test_len(self): # This is an implementation detail, not an interface requirement + from test.test_iterlen import len for s in ('hello', tuple('hello'), list('hello'), xrange(5)): self.assertEqual(len(reversed(s)), len(s)) r = reversed(s) Index: test_iterlen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iterlen.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- test_iterlen.py 8 Jul 2004 04:22:19 -0000 1.2 +++ test_iterlen.py 24 Sep 2005 21:23:05 -0000 1.3 @@ -43,12 +43,22 @@ import unittest from test import test_support -from itertools import repeat, count +from itertools import repeat from collections import deque from UserList import UserList +from __builtin__ import len as _len n = 10 +def len(obj): + try: + return _len(obj) + except TypeError: + try: + return obj._length_cue() + except AttributeError: + raise TypeError + class TestInvariantWithoutMutations(unittest.TestCase): def test_invariant(self): Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- test_itertools.py 27 Mar 2005 20:11:44 -0000 1.39 +++ test_itertools.py 24 Sep 2005 21:23:05 -0000 1.40 @@ -670,6 +670,7 @@ class LengthTransparency(unittest.TestCase): def test_repeat(self): + from test.test_iterlen import len self.assertEqual(len(repeat(None, 50)), 50) self.assertRaises(TypeError, len, repeat(None)) From rhettinger at users.sourceforge.net Sat Sep 24 23:23:08 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 24 Sep 2005 23:23:08 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules collectionsmodule.c, 1.39, 1.40 itertoolsmodule.c, 1.41, 1.42 Message-ID: <20050924212308.E0C881E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7585/Modules Modified Files: collectionsmodule.c itertoolsmodule.c Log Message: Convert iterator __len__() methods to a private API. Index: collectionsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/collectionsmodule.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- collectionsmodule.c 26 Aug 2005 06:42:30 -0000 1.39 +++ collectionsmodule.c 24 Sep 2005 21:23:05 -0000 1.40 @@ -935,15 +935,17 @@ return item; } -static int +static PyObject * dequeiter_len(dequeiterobject *it) { - return it->counter; + return PyInt_FromLong(it->counter); } -static PySequenceMethods dequeiter_as_sequence = { - (inquiry)dequeiter_len, /* sq_length */ - 0, /* sq_concat */ +PyDoc_STRVAR(length_cue_doc, "Private method returning an estimate of len(list(it))."); + +static PyMethodDef dequeiter_methods[] = { + {"_length_cue", (PyCFunction)dequeiter_len, METH_NOARGS, length_cue_doc}, + {NULL, NULL} /* sentinel */ }; PyTypeObject dequeiter_type = { @@ -960,7 +962,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &dequeiter_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -976,6 +978,7 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)dequeiter_next, /* tp_iternext */ + dequeiter_methods, /* tp_methods */ 0, }; @@ -1042,7 +1045,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &dequeiter_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -1058,6 +1061,7 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)dequereviter_next, /* tp_iternext */ + dequeiter_methods, /* tp_methods */ 0, }; Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- itertoolsmodule.c 26 Aug 2005 06:42:30 -0000 1.41 +++ itertoolsmodule.c 24 Sep 2005 21:23:05 -0000 1.42 @@ -2336,17 +2336,21 @@ return result; } -static int +static PyObject * repeat_len(repeatobject *ro) { - if (ro->cnt == -1) + if (ro->cnt == -1) { PyErr_SetString(PyExc_TypeError, "len() of unsized object"); - return (int)(ro->cnt); + return NULL; + } + return PyInt_FromLong(ro->cnt); } -static PySequenceMethods repeat_as_sequence = { - (inquiry)repeat_len, /* sq_length */ - 0, /* sq_concat */ +PyDoc_STRVAR(length_cue_doc, "Private method returning an estimate of len(list(it))."); + +static PyMethodDef repeat_methods[] = { + {"_length_cue", (PyCFunction)repeat_len, METH_NOARGS, length_cue_doc}, + {NULL, NULL} /* sentinel */ }; PyDoc_STRVAR(repeat_doc, @@ -2368,7 +2372,7 @@ 0, /* tp_compare */ (reprfunc)repeat_repr, /* tp_repr */ 0, /* tp_as_number */ - &repeat_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -2385,7 +2389,7 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)repeat_next, /* tp_iternext */ - 0, /* tp_methods */ + repeat_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ From rhettinger at users.sourceforge.net Sat Sep 24 23:23:08 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 24 Sep 2005 23:23:08 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python bltinmodule.c, 2.326, 2.327 Message-ID: <20050924212308.F245E1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7585/Python Modified Files: bltinmodule.c Log Message: Convert iterator __len__() methods to a private API. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.326 retrieving revision 2.327 diff -u -d -r2.326 -r2.327 --- bltinmodule.c 20 Sep 2005 18:13:03 -0000 2.326 +++ bltinmodule.c 24 Sep 2005 21:23:05 -0000 2.327 @@ -221,7 +221,7 @@ goto Fail_arg; /* Guess a result list size. */ - len = PyObject_Size(seq); + len = _PyObject_LengthCue(seq); if (len < 0) { if (!PyErr_ExceptionMatches(PyExc_TypeError) && !PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -873,7 +873,7 @@ } /* Update len. */ - curlen = PyObject_Size(curseq); + curlen = _PyObject_LengthCue(curseq); if (curlen < 0) { if (!PyErr_ExceptionMatches(PyExc_TypeError) && !PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -2108,7 +2108,7 @@ len = -1; /* unknown */ for (i = 0; i < itemsize; ++i) { PyObject *item = PyTuple_GET_ITEM(args, i); - int thislen = PyObject_Size(item); + int thislen = _PyObject_LengthCue(item); if (thislen < 0) { if (!PyErr_ExceptionMatches(PyExc_TypeError) && !PyErr_ExceptionMatches(PyExc_AttributeError)) { From rhettinger at users.sourceforge.net Sat Sep 24 23:23:09 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 24 Sep 2005 23:23:09 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Objects abstract.c, 2.138, 2.139 dictobject.c, 2.166, 2.167 enumobject.c, 1.18, 1.19 iterobject.c, 1.19, 1.20 listobject.c, 2.226, 2.227 rangeobject.c, 2.55, 2.56 setobject.c, 1.57, 1.58 tupleobject.c, 2.93, 2.94 Message-ID: <20050924212309.6600F1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7585/Objects Modified Files: abstract.c dictobject.c enumobject.c iterobject.c listobject.c rangeobject.c setobject.c tupleobject.c Log Message: Convert iterator __len__() methods to a private API. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.138 retrieving revision 2.139 diff -u -d -r2.138 -r2.139 --- abstract.c 21 Aug 2005 11:03:56 -0000 2.138 +++ abstract.c 24 Sep 2005 21:23:05 -0000 2.139 @@ -81,6 +81,31 @@ } #define PyObject_Length PyObject_Size +int +_PyObject_LengthCue(PyObject *o) +{ + int rv = PyObject_Size(o); + if (rv != -1) + return rv; + if (PyErr_ExceptionMatches(PyExc_TypeError) || + PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyObject *err_type, *err_value, *err_tb, *ro; + + PyErr_Fetch(&err_type, &err_value, &err_tb); + ro = PyObject_CallMethod(o, "_length_cue", NULL); + if (ro != NULL) { + rv = (int)PyInt_AsLong(ro); + Py_DECREF(ro); + Py_XDECREF(err_type); + Py_XDECREF(err_value); + Py_XDECREF(err_tb); + return rv; + } + PyErr_Restore(err_type, err_value, err_tb); + } + return -1; +} + PyObject * PyObject_GetItem(PyObject *o, PyObject *key) { @@ -1399,7 +1424,7 @@ return NULL; /* Guess result size and allocate space. */ - n = PyObject_Size(v); + n = _PyObject_LengthCue(v); if (n < 0) { if (!PyErr_ExceptionMatches(PyExc_TypeError) && !PyErr_ExceptionMatches(PyExc_AttributeError)) { Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.166 retrieving revision 2.167 diff -u -d -r2.166 -r2.167 --- dictobject.c 17 Aug 2005 02:19:36 -0000 2.166 +++ dictobject.c 24 Sep 2005 21:23:05 -0000 2.167 @@ -2054,17 +2054,20 @@ PyObject_Del(di); } -static int +static PyObject * dictiter_len(dictiterobject *di) { + int len = 0; if (di->di_dict != NULL && di->di_used == di->di_dict->ma_used) - return di->len; - return 0; + len = di->len; + return PyInt_FromLong(len); } -static PySequenceMethods dictiter_as_sequence = { - (inquiry)dictiter_len, /* sq_length */ - 0, /* sq_concat */ +PyDoc_STRVAR(length_cue_doc, "Private method returning an estimate of len(list(it))."); + +static PyMethodDef dictiter_methods[] = { + {"_length_cue", (PyCFunction)dictiter_len, METH_NOARGS, length_cue_doc}, + {NULL, NULL} /* sentinel */ }; static PyObject *dictiter_iternextkey(dictiterobject *di) @@ -2120,7 +2123,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &dictiter_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -2136,6 +2139,8 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)dictiter_iternextkey, /* tp_iternext */ + dictiter_methods, /* tp_methods */ + 0, }; static PyObject *dictiter_iternextvalue(dictiterobject *di) @@ -2191,7 +2196,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &dictiter_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -2207,6 +2212,8 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)dictiter_iternextvalue, /* tp_iternext */ + dictiter_methods, /* tp_methods */ + 0, }; static PyObject *dictiter_iternextitem(dictiterobject *di) @@ -2276,7 +2283,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &dictiter_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -2292,4 +2299,6 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)dictiter_iternextitem, /* tp_iternext */ + dictiter_methods, /* tp_methods */ + 0, }; Index: enumobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/enumobject.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- enumobject.c 1 Sep 2004 07:02:44 -0000 1.18 +++ enumobject.c 24 Sep 2005 21:23:05 -0000 1.19 @@ -239,23 +239,25 @@ "\n" "Return a reverse iterator"); -static int +static PyObject * reversed_len(reversedobject *ro) { int position, seqsize; if (ro->seq == NULL) - return 0; + return PyInt_FromLong(0); seqsize = PySequence_Size(ro->seq); if (seqsize == -1) - return -1; + return NULL; position = ro->index + 1; - return (seqsize < position) ? 0 : position; + return PyInt_FromLong((seqsize < position) ? 0 : position); } -static PySequenceMethods reversed_as_sequence = { - (inquiry)reversed_len, /* sq_length */ - 0, /* sq_concat */ +PyDoc_STRVAR(length_cue_doc, "Private method returning an estimate of len(list(it))."); + +static PyMethodDef reversediter_methods[] = { + {"_length_cue", (PyCFunction)reversed_len, METH_NOARGS, length_cue_doc}, + {NULL, NULL} /* sentinel */ }; PyTypeObject PyReversed_Type = { @@ -272,7 +274,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &reversed_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -289,7 +291,7 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)reversed_next, /* tp_iternext */ - 0, /* tp_methods */ + reversediter_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- iterobject.c 1 Sep 2004 07:02:44 -0000 1.19 +++ iterobject.c 24 Sep 2005 21:23:05 -0000 1.20 @@ -71,7 +71,7 @@ return NULL; } -static int +static PyObject * iter_len(seqiterobject *it) { int seqsize, len; @@ -79,17 +79,19 @@ if (it->it_seq) { seqsize = PySequence_Size(it->it_seq); if (seqsize == -1) - return -1; + return NULL; len = seqsize - it->it_index; if (len >= 0) - return len; + return PyInt_FromLong(len); } - return 0; + return PyInt_FromLong(0); } -static PySequenceMethods iter_as_sequence = { - (inquiry)iter_len, /* sq_length */ - 0, /* sq_concat */ +PyDoc_STRVAR(length_cue_doc, "Private method returning an estimate of len(list(it))."); + +static PyMethodDef seqiter_methods[] = { + {"_length_cue", (PyCFunction)iter_len, METH_NOARGS, length_cue_doc}, + {NULL, NULL} /* sentinel */ }; PyTypeObject PySeqIter_Type = { @@ -106,7 +108,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &iter_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -122,13 +124,8 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)iter_iternext, /* tp_iternext */ - 0, /* tp_methods */ + seqiter_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ }; /* -------------------------------------- */ @@ -236,10 +233,4 @@ PyObject_SelfIter, /* tp_iter */ (iternextfunc)calliter_iternext, /* tp_iternext */ 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ }; Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.226 retrieving revision 2.227 diff -u -d -r2.226 -r2.227 --- listobject.c 21 Aug 2005 11:03:57 -0000 2.226 +++ listobject.c 24 Sep 2005 21:23:05 -0000 2.227 @@ -775,7 +775,7 @@ iternext = *it->ob_type->tp_iternext; /* Guess a result list size. */ - n = PyObject_Size(b); + n = _PyObject_LengthCue(b); if (n < 0) { if (!PyErr_ExceptionMatches(PyExc_TypeError) && !PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -2764,21 +2764,23 @@ return NULL; } -static int +static PyObject * listiter_len(listiterobject *it) { int len; if (it->it_seq) { len = PyList_GET_SIZE(it->it_seq) - it->it_index; if (len >= 0) - return len; + return PyInt_FromLong((long)len); } - return 0; + return PyInt_FromLong(0); } -static PySequenceMethods listiter_as_sequence = { - (inquiry)listiter_len, /* sq_length */ - 0, /* sq_concat */ +PyDoc_STRVAR(length_cue_doc, "Private method returning an estimate of len(list(it))."); + +static PyMethodDef listiter_methods[] = { + {"_length_cue", (PyCFunction)listiter_len, METH_NOARGS, length_cue_doc}, + {NULL, NULL} /* sentinel */ }; PyTypeObject PyListIter_Type = { @@ -2795,7 +2797,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &listiter_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -2811,13 +2813,8 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)listiter_next, /* tp_iternext */ - 0, /* tp_methods */ + listiter_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ }; /*********************** List Reverse Iterator **************************/ Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.55 retrieving revision 2.56 diff -u -d -r2.55 -r2.56 --- rangeobject.c 26 Aug 2005 06:42:30 -0000 2.55 +++ rangeobject.c 24 Sep 2005 21:23:05 -0000 2.56 @@ -262,17 +262,18 @@ return NULL; } -static int +static PyObject * rangeiter_len(rangeiterobject *r) { - return r->len - r->index; + return PyInt_FromLong(r->len - r->index); } -static PySequenceMethods rangeiter_as_sequence = { - (inquiry)rangeiter_len, /* sq_length */ - 0, /* sq_concat */ -}; +PyDoc_STRVAR(length_cue_doc, "Private method returning an estimate of len(list(it))."); +static PyMethodDef rangeiter_methods[] = { + {"_length_cue", (PyCFunction)rangeiter_len, METH_NOARGS, length_cue_doc}, + {NULL, NULL} /* sentinel */ +}; static PyTypeObject Pyrangeiter_Type = { PyObject_HEAD_INIT(&PyType_Type) @@ -288,7 +289,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &rangeiter_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -304,5 +305,6 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)rangeiter_next, /* tp_iternext */ - 0, /* tp_methods */ + rangeiter_methods, /* tp_methods */ + 0, }; Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- setobject.c 16 Sep 2005 07:14:21 -0000 1.57 +++ setobject.c 24 Sep 2005 21:23:05 -0000 1.58 @@ -749,17 +749,20 @@ PyObject_Del(si); } -static int +static PyObject * setiter_len(setiterobject *si) { + int len = 0; if (si->si_set != NULL && si->si_used == si->si_set->used) - return si->len; - return 0; + len = si->len; + return PyInt_FromLong(len); } -static PySequenceMethods setiter_as_sequence = { - (inquiry)setiter_len, /* sq_length */ - 0, /* sq_concat */ +PyDoc_STRVAR(length_cue_doc, "Private method returning an estimate of len(list(it))."); + +static PyMethodDef setiter_methods[] = { + {"_length_cue", (PyCFunction)setiter_len, METH_NOARGS, length_cue_doc}, + {NULL, NULL} /* sentinel */ }; static PyObject *setiter_iternext(setiterobject *si) @@ -814,7 +817,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &setiter_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -830,6 +833,8 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)setiter_iternext, /* tp_iternext */ + setiter_methods, /* tp_methods */ + 0, }; static int Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.93 retrieving revision 2.94 diff -u -d -r2.93 -r2.94 --- tupleobject.c 10 Jun 2004 18:39:35 -0000 2.93 +++ tupleobject.c 24 Sep 2005 21:23:05 -0000 2.94 @@ -851,17 +851,20 @@ return NULL; } -static int +static PyObject * tupleiter_len(tupleiterobject *it) { + int len = 0; if (it->it_seq) - return PyTuple_GET_SIZE(it->it_seq) - it->it_index; - return 0; + len = PyTuple_GET_SIZE(it->it_seq) - it->it_index; + return PyInt_FromLong(len); } -static PySequenceMethods tupleiter_as_sequence = { - (inquiry)tupleiter_len, /* sq_length */ - 0, /* sq_concat */ +PyDoc_STRVAR(length_cue_doc, "Private method returning an estimate of len(list(it))."); + +static PyMethodDef tupleiter_methods[] = { + {"_length_cue", (PyCFunction)tupleiter_len, METH_NOARGS, length_cue_doc}, + {NULL, NULL} /* sentinel */ }; PyTypeObject PyTupleIter_Type = { @@ -878,7 +881,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &tupleiter_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -894,4 +897,6 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)tupleiter_next, /* tp_iternext */ + tupleiter_methods, /* tp_methods */ + 0, }; From pje at users.sourceforge.net Sat Sep 24 23:41:02 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 23:41:02 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools ez_setup.py, 1.31, 1.32 setup.py, 1.40, 1.41 setuptools.txt, 1.39, 1.40 Message-ID: <20050924214102.EE2891E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10934 Modified Files: ez_setup.py setup.py setuptools.txt Log Message: 0.6a3 release. Index: ez_setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/ez_setup.py,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- ez_setup.py 18 Sep 2005 04:02:38 -0000 1.31 +++ ez_setup.py 24 Sep 2005 21:40:59 -0000 1.32 @@ -14,7 +14,7 @@ This file can also be run as a script to install or upgrade setuptools. """ import sys -DEFAULT_VERSION = "0.6a2" +DEFAULT_VERSION = "0.6a3" DEFAULT_URL = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3] md5_data = { @@ -24,6 +24,8 @@ 'setuptools-0.6a1-py2.4.egg': '8256b5f1cd9e348ea6877b5ddd56257d', 'setuptools-0.6a2-py2.3.egg': 'b98da449da411267c37a738f0ab625ba', 'setuptools-0.6a2-py2.4.egg': 'be5b88bc30aed63fdefd2683be135c3b', + 'setuptools-0.6a3-py2.3.egg': 'ee0e325de78f23aab79d33106dc2a8c8', + 'setuptools-0.6a3-py2.4.egg': 'd95453d525a456d6c23e7a5eea89a063', } import sys, os Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setup.py,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- setup.py 24 Sep 2005 17:28:56 -0000 1.40 +++ setup.py 24 Sep 2005 21:40:59 -0000 1.41 @@ -15,7 +15,7 @@ f.close() return ''.join(lines) -VERSION = "0.6a2" +VERSION = "0.6a3" from setuptools import setup, find_packages import sys from setuptools.command import __all__ as SETUP_COMMANDS Index: setuptools.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.txt,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- setuptools.txt 24 Sep 2005 20:29:57 -0000 1.39 +++ setuptools.txt 24 Sep 2005 21:40:59 -0000 1.40 @@ -1610,6 +1610,8 @@ provide a ``--test-suite`` option, an error will occur. +.. _upload: + ``upload`` - Upload source and/or egg distributions to PyPI =========================================================== From pje at users.sourceforge.net Sat Sep 24 23:41:03 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat, 24 Sep 2005 23:41:03 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools __init__.py, 1.24, 1.25 Message-ID: <20050924214103.14A6A1E4006@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10934/setuptools Modified Files: __init__.py Log Message: 0.6a3 release. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/__init__.py,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- __init__.py 18 Sep 2005 04:02:38 -0000 1.24 +++ __init__.py 24 Sep 2005 21:40:59 -0000 1.25 @@ -1,3 +1,4 @@ + """Extensions to the 'distutils' for large or complex distributions""" from setuptools.dist import Distribution, Feature, _get_unpatched import distutils.core, setuptools.command @@ -7,7 +8,7 @@ from distutils.util import convert_path import os.path -__version__ = '0.6a2' +__version__ = '0.6a3' __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' From arigo at users.sourceforge.net Sun Sep 25 00:58:44 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Sun, 25 Sep 2005 00:58:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Objects typeobject.c, 2.268, 2.269 Message-ID: <20050924225844.8E2F01E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28175 Modified Files: typeobject.c Log Message: (pedronis, arigo) segfault when a class contain a non-list value in the (undocumented) special attribute __slotnames__. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.268 retrieving revision 2.269 diff -u -d -r2.268 -r2.269 --- typeobject.c 20 Sep 2005 18:49:54 -0000 2.268 +++ typeobject.c 24 Sep 2005 22:58:41 -0000 2.269 @@ -2522,7 +2522,7 @@ clsdict = ((PyTypeObject *)cls)->tp_dict; slotnames = PyDict_GetItemString(clsdict, "__slotnames__"); - if (slotnames != NULL) { + if (slotnames != NULL && PyList_Check(slotnames)) { Py_INCREF(slotnames); return slotnames; } From birkenfeld at users.sourceforge.net Sun Sep 25 08:16:31 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sun, 25 Sep 2005 08:16:31 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.329.2.5, 2.329.2.6 Message-ID: <20050925061631.B7CB31E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4077/Modules Modified Files: Tag: release24-maint posixmodule.c Log Message: Commit memory leaking fix. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.329.2.5 retrieving revision 2.329.2.6 diff -u -d -r2.329.2.5 -r2.329.2.6 --- posixmodule.c 19 Sep 2005 06:42:30 -0000 2.329.2.5 +++ posixmodule.c 25 Sep 2005 06:16:28 -0000 2.329.2.6 @@ -7189,8 +7189,12 @@ Py_BEGIN_ALLOW_THREADS rc = ShellExecute((HWND)0, NULL, filepath, NULL, NULL, SW_SHOWNORMAL); Py_END_ALLOW_THREADS - if (rc <= (HINSTANCE)32) - return win32_error("startfile", filepath); + if (rc <= (HINSTANCE)32) { + PyObject *errval = win32_error("startfile", filepath); + PyMem_Free(filepath); + return errval; + } + PyMem_Free(filepath); Py_INCREF(Py_None); return Py_None; } From birkenfeld at users.sourceforge.net Sun Sep 25 08:16:44 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Sun, 25 Sep 2005 08:16:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.342, 2.343 Message-ID: <20050925061644.3846D1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4118/Modules Modified Files: posixmodule.c Log Message: Commit memory leaking fix. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.342 retrieving revision 2.343 diff -u -d -r2.342 -r2.343 --- posixmodule.c 19 Sep 2005 06:45:53 -0000 2.342 +++ posixmodule.c 25 Sep 2005 06:16:40 -0000 2.343 @@ -7255,8 +7255,12 @@ Py_BEGIN_ALLOW_THREADS rc = ShellExecute((HWND)0, NULL, filepath, NULL, NULL, SW_SHOWNORMAL); Py_END_ALLOW_THREADS - if (rc <= (HINSTANCE)32) - return win32_error("startfile", filepath); + if (rc <= (HINSTANCE)32) { + PyObject *errval = win32_error("startfile", filepath); + PyMem_Free(filepath); + return errval; + } + PyMem_Free(filepath); Py_INCREF(Py_None); return Py_None; } From arigo at users.sourceforge.net Sun Sep 25 13:45:49 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Sun, 25 Sep 2005 13:45:49 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test inspect_fodder2.py, 1.4, 1.5 test_inspect.py, 1.20, 1.21 Message-ID: <20050925114549.245901E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26856/test Modified Files: inspect_fodder2.py test_inspect.py Log Message: some more fixes and tests for inspect.getsource(), triggered by crashes from the PyPy project as well as the SF bug #1295909. Index: inspect_fodder2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/inspect_fodder2.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- inspect_fodder2.py 12 Mar 2005 16:37:11 -0000 1.4 +++ inspect_fodder2.py 25 Sep 2005 11:45:45 -0000 1.5 @@ -64,3 +64,27 @@ y): x+y, None, ] + +# line 68 +def func69(): + class cls70: + def func71(): + pass + return cls70 +extra74 = 74 + +# line 76 +def func77(): pass +(extra78, stuff78) = 'xy' +extra79 = 'stop' + +# line 81 +class cls82: + def func83(): pass +(extra84, stuff84) = 'xy' +extra85 = 'stop' + +# line 87 +def func88(): + # comment + return 90 Index: test_inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- test_inspect.py 12 Mar 2005 16:37:11 -0000 1.20 +++ test_inspect.py 25 Sep 2005 11:45:45 -0000 1.21 @@ -238,6 +238,18 @@ def test_multiline_sig(self): self.assertSourceEqual(mod2.multiline_sig[0], 63, 64) + def test_nested_class(self): + self.assertSourceEqual(mod2.func69().func71, 71, 72) + + def test_one_liner_followed_by_non_name(self): + self.assertSourceEqual(mod2.func77, 77, 77) + + def test_one_liner_dedent_non_name(self): + self.assertSourceEqual(mod2.cls82.func83, 83, 83) + + def test_with_comment_instead_of_docstring(self): + self.assertSourceEqual(mod2.func88, 88, 90) + # Helper for testing classify_class_attrs. def attrs_wo_objs(cls): return [t[:3] for t in inspect.classify_class_attrs(cls)] From arigo at users.sourceforge.net Sun Sep 25 13:45:49 2005 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Sun, 25 Sep 2005 13:45:49 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib inspect.py,1.62,1.63 Message-ID: <20050925114549.447FB1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26856 Modified Files: inspect.py Log Message: some more fixes and tests for inspect.getsource(), triggered by crashes from the PyPy project as well as the SF bug #1295909. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- inspect.py 12 Mar 2005 16:37:08 -0000 1.62 +++ inspect.py 25 Sep 2005 11:45:45 -0000 1.63 @@ -485,19 +485,6 @@ comments[-1:] = [] return string.join(comments, '') -class ListReader: - """Provide a readline() method to return lines from a list of strings.""" - def __init__(self, lines): - self.lines = lines - self.index = 0 - - def readline(self): - i = self.index - if i < len(self.lines): - self.index = i + 1 - return self.lines[i] - else: return '' - class EndOfBlock(Exception): pass class BlockFinder: @@ -507,40 +494,46 @@ self.islambda = False self.started = False self.passline = False - self.last = 0 + self.last = 1 def tokeneater(self, type, token, (srow, scol), (erow, ecol), line): if not self.started: + # look for the first "def", "class" or "lambda" if token in ("def", "class", "lambda"): if token == "lambda": self.islambda = True self.started = True - self.passline = True + self.passline = True # skip to the end of the line elif type == tokenize.NEWLINE: - self.passline = False + self.passline = False # stop skipping when a NEWLINE is seen self.last = srow + if self.islambda: # lambdas always end at the first NEWLINE + raise EndOfBlock elif self.passline: pass - elif self.islambda: - raise EndOfBlock, self.last elif type == tokenize.INDENT: self.indent = self.indent + 1 self.passline = True elif type == tokenize.DEDENT: self.indent = self.indent - 1 - if self.indent == 0: - raise EndOfBlock, self.last - elif type == tokenize.NAME and scol == 0: - raise EndOfBlock, self.last + # the end of matching indent/dedent pairs end a block + # (note that this only works for "def"/"class" blocks, + # not e.g. for "if: else:" or "try: finally:" blocks) + if self.indent <= 0: + raise EndOfBlock + elif self.indent == 0 and type not in (tokenize.COMMENT, tokenize.NL): + # any other token on the same indentation level end the previous + # block as well, except the pseudo-tokens COMMENT and NL. + raise EndOfBlock def getblock(lines): """Extract the block of code at the top of the given list of lines.""" + blockfinder = BlockFinder() try: - tokenize.tokenize(ListReader(lines).readline, BlockFinder().tokeneater) - except EndOfBlock, eob: - return lines[:eob.args[0]] - # Fooling the indent/dedent logic implies a one-line definition - return lines[:1] + tokenize.tokenize(iter(lines).next, blockfinder.tokeneater) + except (EndOfBlock, IndentationError): + pass + return lines[:blockfinder.last] def getsourcelines(object): """Return a list of source lines and starting line number for an object. From vsajip at users.sourceforge.net Mon Sep 26 02:14:50 2005 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Mon, 26 Sep 2005 02:14:50 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib liblogging.tex, 1.39, 1.40 Message-ID: <20050926001450.40A0A1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23285 Modified Files: liblogging.tex Log Message: Minor clarification of effective level calculation Index: liblogging.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblogging.tex,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- liblogging.tex 18 Aug 2005 21:45:31 -0000 1.39 +++ liblogging.tex 26 Sep 2005 00:14:46 -0000 1.40 @@ -334,6 +334,20 @@ to be processed when the logger is the root logger, or delegation to the parent when the logger is a non-root logger). Note that the root logger is created with level \constant{WARNING}. + +The term "delegation to the parent" means that if a logger has a level +of NOTSET, its chain of ancestor loggers is traversed until either an +ancestor with a level other than NOTSET is found, or the root is +reached. + +If an ancestor is found with a level other than NOTSET, then that +ancestor's level is treated as the effective level of the logger where +the ancestor search began, and is used to determine how a logging +event is handled. + +If the root is reached, and it has a level of NOTSET, then all +messages will be processed. Otherwise, the root's level will be used +as the effective level. \end{methoddesc} \begin{methoddesc}{isEnabledFor}{lvl} From pje at users.sourceforge.net Mon Sep 26 02:35:38 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Mon, 26 Sep 2005 02:35:38 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/tests test_resources.py, 1.24, 1.25 Message-ID: <20050926003538.B44DE1E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27298/setuptools/tests Modified Files: test_resources.py Log Message: Ensure that WorkingSet.resolve() (and therefore require() as well) returns a list of the relevant distributions, even if they are found in the working set rather than the environment. This fixes some problems in the 0.6a3 release. Index: test_resources.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests/test_resources.py,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- test_resources.py 24 Sep 2005 19:48:28 -0000 1.24 +++ test_resources.py 26 Sep 2005 00:35:35 -0000 1.25 @@ -123,7 +123,6 @@ def testResolve(self): ad = Environment([]); ws = WorkingSet([]) - # Resolving no requirements -> nothing to install self.assertEqual( list(ws.resolve([],ad)), [] ) @@ -131,7 +130,6 @@ self.assertRaises( DistributionNotFound, ws.resolve, parse_requirements("Foo"), ad ) - Foo = Distribution.from_filename( "/foo_dir/Foo-1.2.egg", metadata=Metadata(('depends.txt', "[bar]\nBaz>=2.0")) @@ -139,10 +137,12 @@ ad.add(Foo) # Request thing(s) that are available -> list to activate - self.assertEqual( - list(ws.resolve(parse_requirements("Foo"), ad)), [Foo] - ) - + for i in range(3): + targets = list(ws.resolve(parse_requirements("Foo"), ad)) + self.assertEqual(targets, [Foo]) + map(ws.add,targets) + ws = WorkingSet([]) # reset + # Request an extra that causes an unresolved dependency for "Baz" self.assertRaises( DistributionNotFound, ws.resolve,parse_requirements("Foo[bar]"), ad From pje at users.sourceforge.net Mon Sep 26 02:35:38 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Mon, 26 Sep 2005 02:35:38 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools pkg_resources.py, 1.72, 1.73 pkg_resources.txt, 1.15, 1.16 Message-ID: <20050926003538.B98321E4006@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27298 Modified Files: pkg_resources.py pkg_resources.txt Log Message: Ensure that WorkingSet.resolve() (and therefore require() as well) returns a list of the relevant distributions, even if they are found in the working set rather than the environment. This fixes some problems in the 0.6a3 release. Index: pkg_resources.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.py,v retrieving revision 1.72 retrieving revision 1.73 diff -u -d -r1.72 -r1.73 --- pkg_resources.py 24 Sep 2005 19:48:28 -0000 1.72 +++ pkg_resources.py 26 Sep 2005 00:35:35 -0000 1.73 @@ -463,7 +463,7 @@ requirements = list(requirements)[::-1] # set up the stack processed = {} # set of processed requirements - best = dict([(d.key,d) for d in self]) # key -> dist + best = {} # key -> dist to_activate = [] while requirements: @@ -471,20 +471,20 @@ if req in processed: # Ignore cyclic or redundant dependencies continue - dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map - if env is None: - env = Environment(self.entries) - dist = best[req.key] = env.best_match(req, self, installer) + dist = self.by_key.get(req.key) if dist is None: - raise DistributionNotFound(req) # XXX put more info here + if env is None: + env = Environment(self.entries) + dist = best[req.key] = env.best_match(req, self, installer) + if dist is None: + raise DistributionNotFound(req) # XXX put more info here to_activate.append(dist) elif dist not in req: # Oops, the "best" so far conflicts with a dependency raise VersionConflict(dist,req) # XXX put more info here - requirements.extend(dist.requires(req.extras)[::-1]) processed[req] = True Index: pkg_resources.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- pkg_resources.txt 24 Sep 2005 19:48:28 -0000 1.15 +++ pkg_resources.txt 26 Sep 2005 00:35:35 -0000 1.16 @@ -1488,6 +1488,9 @@ Release Notes/Change History ---------------------------- +0.6a4 + * Fix a bug in ``WorkingSet.resolve()`` that was introduced in 0.6a3. + 0.6a3 * Added ``safe_extra()`` parsing utility routine, and use it for Requirement, EntryPoint, and Distribution objects' extras handling. From pje at users.sourceforge.net Mon Sep 26 02:46:03 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Mon, 26 Sep 2005 02:46:03 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools ez_setup.py, 1.32, 1.33 setup.py, 1.41, 1.42 Message-ID: <20050926004603.54B041E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30902 Modified Files: ez_setup.py setup.py Log Message: 0.6a4 bugfix release. Index: ez_setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/ez_setup.py,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- ez_setup.py 24 Sep 2005 21:40:59 -0000 1.32 +++ ez_setup.py 26 Sep 2005 00:46:00 -0000 1.33 @@ -14,7 +14,7 @@ This file can also be run as a script to install or upgrade setuptools. """ import sys -DEFAULT_VERSION = "0.6a3" +DEFAULT_VERSION = "0.6a4" DEFAULT_URL = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3] md5_data = { @@ -26,6 +26,8 @@ 'setuptools-0.6a2-py2.4.egg': 'be5b88bc30aed63fdefd2683be135c3b', 'setuptools-0.6a3-py2.3.egg': 'ee0e325de78f23aab79d33106dc2a8c8', 'setuptools-0.6a3-py2.4.egg': 'd95453d525a456d6c23e7a5eea89a063', + 'setuptools-0.6a4-py2.3.egg': 'e958cbed4623bbf47dd1f268b99d7784', + 'setuptools-0.6a4-py2.4.egg': '7f33c3ac2ef1296f0ab4fac1de4767d8', } import sys, os Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setup.py,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- setup.py 24 Sep 2005 21:40:59 -0000 1.41 +++ setup.py 26 Sep 2005 00:46:00 -0000 1.42 @@ -15,7 +15,7 @@ f.close() return ''.join(lines) -VERSION = "0.6a3" +VERSION = "0.6a4" from setuptools import setup, find_packages import sys from setuptools.command import __all__ as SETUP_COMMANDS From pje at users.sourceforge.net Mon Sep 26 02:46:03 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Mon, 26 Sep 2005 02:46:03 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools __init__.py, 1.25, 1.26 Message-ID: <20050926004603.610651E4006@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30902/setuptools Modified Files: __init__.py Log Message: 0.6a4 bugfix release. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/__init__.py,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- __init__.py 24 Sep 2005 21:40:59 -0000 1.25 +++ __init__.py 26 Sep 2005 00:46:00 -0000 1.26 @@ -8,7 +8,7 @@ from distutils.util import convert_path import os.path -__version__ = '0.6a3' +__version__ = '0.6a4' __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' From mwh at users.sourceforge.net Mon Sep 26 15:15:37 2005 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 26 Sep 2005 15:15:37 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_StringIO.py, 1.19, 1.19.2.1 Message-ID: <20050926131537.B94C31E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv360/Lib/test Modified Files: Tag: release24-maint test_StringIO.py Log Message: Backport (with Anthony's blessing (in fact he reminded me to do it :)): Patches #1298449 and #1298499: Add some missing checks for error returns in cStringIO.c. Thanks to Andrew Bennetts. This must be a backport candidate. Index: test_StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_StringIO.py,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -u -d -r1.19 -r1.19.2.1 --- test_StringIO.py 1 Nov 2004 17:10:19 -0000 1.19 +++ test_StringIO.py 26 Sep 2005 13:15:34 -0000 1.19.2.1 @@ -44,6 +44,13 @@ f.seek(0) self.assertEqual(f.getvalue(), 'abc') + def test_writelines_error(self): + def errorGen(): + yield 'a' + raise KeyboardInterrupt() + f = self.MODULE.StringIO() + self.assertRaises(KeyboardInterrupt, f.writelines, errorGen()) + def test_truncate(self): eq = self.assertEqual f = self.MODULE.StringIO() From mwh at users.sourceforge.net Mon Sep 26 15:15:37 2005 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 26 Sep 2005 15:15:37 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc ACKS, 1.289.2.2, 1.289.2.3 NEWS, 1.1193.2.109, 1.1193.2.110 Message-ID: <20050926131537.B61601E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv360/Misc Modified Files: Tag: release24-maint ACKS NEWS Log Message: Backport (with Anthony's blessing (in fact he reminded me to do it :)): Patches #1298449 and #1298499: Add some missing checks for error returns in cStringIO.c. Thanks to Andrew Bennetts. This must be a backport candidate. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.289.2.2 retrieving revision 1.289.2.3 diff -u -d -r1.289.2.2 -r1.289.2.3 --- ACKS 12 May 2005 13:45:11 -0000 1.289.2.2 +++ ACKS 26 Sep 2005 13:15:34 -0000 1.289.2.3 @@ -49,6 +49,7 @@ Thomas Bellman Juan M. Bello Rivas Alexander Belopolsky +Andrew Bennetts Andy Bensky Michel Van den Bergh Eric Beser Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.109 retrieving revision 1.1193.2.110 diff -u -d -r1.1193.2.109 -r1.1193.2.110 --- NEWS 23 Sep 2005 08:14:39 -0000 1.1193.2.109 +++ NEWS 26 Sep 2005 13:15:34 -0000 1.1193.2.110 @@ -16,6 +16,9 @@ Extension Modules ----------------- +- Patches #1298449 and #1298499: Add some missing checks for error + returns in cStringIO.c. + - Patch #1297028: fix segfault if call type on MultibyteCodec, MultibyteStreamReader, or MultibyteStreamWriter. From mwh at users.sourceforge.net Mon Sep 26 15:15:37 2005 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 26 Sep 2005 15:15:37 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules cStringIO.c, 2.49, 2.49.2.1 Message-ID: <20050926131537.D454B1E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv360/Modules Modified Files: Tag: release24-maint cStringIO.c Log Message: Backport (with Anthony's blessing (in fact he reminded me to do it :)): Patches #1298449 and #1298499: Add some missing checks for error returns in cStringIO.c. Thanks to Andrew Bennetts. This must be a backport candidate. Index: cStringIO.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v retrieving revision 2.49 retrieving revision 2.49.2.1 diff -u -d -r2.49 -r2.49.2.1 --- cStringIO.c 21 Aug 2004 06:55:43 -0000 2.49 +++ cStringIO.c 26 Sep 2005 13:15:34 -0000 2.49.2.1 @@ -241,7 +241,10 @@ line = PyString_FromStringAndSize (output, n); if (!line) goto err; - PyList_Append (result, line); + if (PyList_Append (result, line) == -1) { + Py_DECREF (line); + goto err; + } Py_DECREF (line); length += n; if (hint > 0 && length >= hint) @@ -440,11 +443,17 @@ Py_DECREF(it); Py_DECREF(s); return NULL; - } - Py_DECREF(s); - } - Py_DECREF(it); - Py_RETURN_NONE; + } + Py_DECREF(s); + } + + Py_DECREF(it); + + /* See if PyIter_Next failed */ + if (PyErr_Occurred()) + return NULL; + + Py_RETURN_NONE; } static struct PyMethodDef O_methods[] = { From goodger at users.sourceforge.net Mon Sep 26 21:56:57 2005 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Mon, 26 Sep 2005 21:56:57 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep-0350.txt,1.1,1.2 Message-ID: <20050926195657.A57A11E4002@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6969 Modified Files: pep-0350.txt Log Message: revision by the author Index: pep-0350.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0350.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pep-0350.txt 18 Sep 2005 15:10:08 -0000 1.1 +++ pep-0350.txt 26 Sep 2005 19:56:53 -0000 1.2 @@ -14,16 +14,17 @@ ======== This informational PEP aims to provide guidelines for consistent use -of Codetags, which would enable the construction of standard utilities -to take advantage of the Codetag information, as well as making Python -code more uniform across projects. Codetags also represent a very -lightweight programming micro-paradigm and become useful for project -management, documentation, change tracking, and project health -monitoring. This is submitted as a PEP because I feel its ideas are -Pythonic, although the concepts are not unique to Python programming. -Herein are the definition of Codetags, the philosophy behind them, a -motivation for standardized conventions, a specification, a toolset -description, and possible objections to the Codetag project/paradigm. +of *codetags*, which would enable the construction of standard +utilities to take advantage of the codetag information, as well as +making Python code more uniform across projects. Codetags also +represent a very lightweight programming micro-paradigm and become +useful for project management, documentation, change tracking, and +project health monitoring. This is submitted as a PEP because its +ideas are Pythonic, although the concepts are not unique to Python +programming. Herein are the definition of codetags, the philosophy +behind them, a motivation for standardized conventions, some examples, +a specification, a toolset description, and possible objections to the +Codetag project/paradigm. This PEP is also living as a wiki_ for people to add comments. @@ -35,27 +36,32 @@ as reminders of sections of code that need closer inspection or review. Examples of markup include ``FIXME``, ``TODO``, ``XXX``, ``BUG``, but there many more in wide use in existing software. Such -markup will henceforth be referred to as *Codetags*. These Codetags +markup will henceforth be referred to as *codetags*. These codetags may show up in application code, unit tests, scripts, general documentation, or wherever suitable. +Codetags have been under discussion and in use (hundreds of codetags +in the Python 2.4 sources) in many places (e.g., c2_) for many years. +See References_ for further historic and current information. + Philosophy ========== -If you subscribe to most of these values, then Codetags will likely be +If you subscribe to most of these values, then codetags will likely be useful for you. 1. As much information as possible should be contained **inside the source code** (application code or unit tests). This along with - use of Codetags impedes duplication. Most documentation can be + use of codetags impedes duplication. Most documentation can be generated from that source code; e.g., by using help2man, man2html, docutils, epydoc/pydoc, ctdoc, etc. 2. Information should be almost **never duplicated** -- it should be recorded in a single original format and all other locations should be automatically generated from the original, or simply be - referenced. This is the *SPOT* rule. + referenced. This is famously known as the Single Point Of + Truth (SPOT) or Don't Repeat Yourself (DRY) rule. 3. Documentation that gets into customers' hands should be **auto-generated** from single sources into all other output @@ -63,58 +69,63 @@ important to have a documentation system that can generate all of these. -4. Whenever information is subject to (and suited for) user - feedback/input (e.g., FAQ, RFC, PEP), it should be contained in a - **repository** (e.g. a wiki, usenet, or mailing lists). - -5. There should not be a dedicated, disjoint **documentation team** - for any non-huge project. The developers writing the code know the - code best, and they should be the ones to describe it. +4. The **developers are the documentation team**. They write the code + and should know the code the best. There should not be a + dedicated, disjoint documentation team for any non-huge project. -6. **Plain text** (with non-invasive markup) is the best form of +5. **Plain text** (with non-invasive markup) is the best format for writing anything. All other formats are to be generated from the plain text. -7. **Revision control** should be used for almost everything. And - modifications should be checked in at least daily. +Codetag design was influenced by the following goals: + +A. Comments should be short whenever possible. + +B. Codetag fields should be optional and of minimal length. Default + values and custom fields can be set by individual code shops. + +C. Codetags should be minimalistic. The quicker it is to jot + something down, the more likely it is to get jotted. + +D. The most common use of codetags will only have zero to two fields + specified, and these should be the easiest to type and read. Motivation ========== -* **Various productivity tools can be built around Codetags.** +* **Various productivity tools can be built around codetags.** See Tools_. * **Encourages consistency.** - Historically, a subset of these Codetags has been used informally in + Historically, a subset of these codetags has been used informally in the majority of source code in existence, whether in Python or in other languages. Tags have been used in an inconsistent manner with - different spellings, semantics, format, and placement. For example, + different spellings, semantics, format, and placement. For example, some programmers might include datestamps and/or user identifiers, - limit to a single line or not, spell the Codetag differently than + limit to a single line or not, spell the codetag differently than others, etc. * **Encourages adherence to SPOT/DRY principle.** - E.g., generating a roadmap dynamically from Codetags instead of + E.g., generating a roadmap dynamically from codetags instead of keeping TODOs in sync with separate roadmap document. * **Easy to remember.** - All Codetags must be concise, intuitive, and semantically + All codetags must be concise, intuitive, and semantically non-overlapping with others. The format must also be simple. * **Use not required/imposed.** - If you don't use Codetags already, there's no obligation to start, + If you don't use codetags already, there's no obligation to start, and no risk of affecting code (but see Objections_). A small subset - can be adopted and the Tools_ will still be useful (a few Codetags + can be adopted and the Tools_ will still be useful (a few codetags have probably already been adopted on an ad-hoc basis anyway). Also - it is very easy to identify and remove if a Codetag is no longer - deemed useful. Then it is effectively *committed* and recorded by - revision control simply by checking in. + it is very easy to identify and remove (and possibly record) a + codetag that is no longer deemed useful. * **Gives a global view of code.** @@ -123,224 +134,344 @@ * **A logical location for capturing CRCs/Stories/Requirements.** The XP community often does not electronically capture Stories, but - Codetags seem like a good place to locate them. + codetags seem like a good place to locate them. * **Extremely lightweight process.** Creating tickets in a tracking system for every thought degrades development velocity. Even if a ticketing system is employed, - Codetags are useful for simply containing links to those tickets. + codetags are useful for simply containing links to those tickets. Examples ======== -This shows a simple Codetag as commonly found in sources everywhere +This shows a simple codetag as commonly found in sources everywhere (with the addition of a trailing ``<>``):: - def foo(): - # FIXME: Seems like this loop should be finite. <> - while True: ... + # FIXME: Seems like this loop should be finite. <> + while True: ... -The following contrived example demonstrates a more common use of -Codetagging. It uses some of the available fields to specify the -owners (a pair of developers with initials *MDE* and *CLE*), the Work -Week of expected completion (*w14*), and the priority of the item -(*p2*):: +The following contrived example demonstrates a typical use of +codetags. It uses some of the available fields to specify the +assignees (a pair of programmers with initials *MDE* and *CLE*), the +Date of expected completion (*Week 14*), and the Priority of the item +(*2*):: - def foo(): - # FIXME: Seems like this loop should be finite. - while True: ... + # FIXME: Seems like this loop should be finite. + while True: ... + +This codetag shows a bug with fields describing author, discovery +(origination) date, due date, and priority:: + + # BUG: Crashes if run on Sundays. + # + if day == 'Sunday': ... + +Here is a demonstration of how not to use codetags. This has many +problems: 1) Codetags cannot share a line with code; 2) Missing colon +after mnemonic; 3) A codetag referring to codetags is usually useless, +and worse, it is not completable; 4) No need to have a bunch of fields +for a trivial codetag; 5) Fields with unknown values (``t:XXX``) +should not be used:: + + i = i + 1 # TODO Add some more codetags. + # Specification ============= This describes the format: syntax, mnemonic names, fields, and -semantics. +semantics, and also the separate DONE File. General Syntax -------------- -Each Codetag should be inside a comment, and can be any number of -lines. It should match the indentation of surrounding code. The end -of the Codetag is marked by a pair of angle brackets ``<>`` containing -optional fields, which must not be split onto multiple lines. - -.. NOTE: This PEP's text originally did not conform to the "inside a - comment" rule. Documents can have comments too! I fixed that. - -Ed. +Each codetag should be inside a comment, and can be any number of +lines. It should not share a line with code. It should match the +indentation of surrounding code. The end of the codetag is marked by +a pair of angle brackets ``<>`` containing optional fields, which must +not be split onto multiple lines. It is preferred to have a codetag +in ``#`` comments instead of string comments. There can be multiple +fields per codetag, all of which are optional. -There can be multiple fields per Codetag, all of which are optional. +.. NOTE: It may be reasonable to allow fields to fit on multiple + lines, but it complicates parsing and defeats minimalism if you + use this many fields. -In short, a Codetag consists of a mnemonic, a colon, commentary text, +In short, a codetag consists of a mnemonic, a colon, commentary text, an opening angle bracket, an optional list of fields, and a closing -angle bracket. E.g., :: +angle bracket. E.g., :: # MNEMONIC: Some (maybe multi-line) commentary. -.. FIXME: Add completion vs target date?? - Mnemonics --------- -The Codetags of interest are listed below, using the following format: +The codetags of interest are listed below, using the following format: | ``recommended mnemonic (& synonym list)`` | *canonical name*: semantics -``FIXME (XXX, DEBUG, BROKEN, RFCTR, OOPS, SMELL, NEEDSWORK)`` +``TODO (MILESTONE, MLSTN, DONE, YAGNI, TBD, TOBEDONE)`` + *To do*: Informal tasks/features that are pending completion. + +``FIXME (XXX, DEBUG, BROKEN, REFACTOR, REFACT, RFCTR, OOPS, SMELL, NEEDSWORK, INSPECT)`` *Fix me*: Areas of problematic or ugly code needing refactoring or - cleanup. + cleanup. -``NOFIX (DONTFIX, NEVERFIX, NOBUG)`` +``BUG (BUGFIX)`` + *Bugs*: Reported defects tracked in bug database. + +``NOBUG (NOFIX, WONTFIX, DONTFIX, NEVERFIX, UNFIXABLE, CANTFIX)`` *Will Not Be Fixed*: Problems that are well-known but will never be addressed due to design problems or domain limitations. -``!!! (ALERT)`` - *Alerts*: In need of immediate attention. - -``GLOSS (GLOSSARY)`` - *Glossary*: Definitions for project glossary. - -``DOC (DOCUMENT)`` - *Needs Documentation*: Areas of code that still need to be - documented. - ``REQ (REQUIREMENT, STORY)`` *Requirements*: Satisfactions of specific, formal requirements. +``RFE (FEETCH, NYI, FR, FTRQ, FTR)`` + *Requests For Enhancement*: Roadmap items not yet implemented. + ``IDEA`` *Ideas*: Possible RFE candidates, but less formal than RFE. -``BUG (BUGFIX)`` - *Bugs*: Reported defects tracked in bug database. - -``NOTE (HELP)`` - *Notes*: Sections where a code reviewer found something that needs - discussion or further investigation. - -``SEE (REF)`` - *See*: Pointers to other code, web link, etc. - -``STAT (STATUS)`` - *Status*: File-level statistical indicator of work needing done on - this file. +``??? (QUESTION, QUEST, QSTN, WTF)`` + *Questions*: Misunderstood details. -``RFE (FEETCH, NYI, FR, FTRQ, FTR)`` - *Requests For Enhancement*: Roadmap items not yet implemented. +``!!! (ALERT)`` + *Alerts*: In need of immediate attention. -``HACK (CLEVER)`` +``HACK (CLEVER, MAGIC)`` *Hacks*: Temporary code to force inflexible functionality, or simply a test change, or workaround a known problem. -``CAV (CAVEAT, WARNING, CAUTION)`` +``PORT (PORTABILITY, WKRD)`` + *Portability*: Workarounds specific to OS, Python version, etc. + +``CAVEAT (CAV, CAVT, WARNING, CAUTION)`` *Caveats*: Implementation details/gotchas that stand out as - non-intuitive. + non-intuitive. -``RVDBY (REVIEWED)`` - *Reviewed By*: File-level indicator of programmer(s) who performed - recent code review. +``NOTE (HELP)`` + *Notes*: Sections where a code reviewer found something that needs + discussion or further investigation. -``??? (QUESTION, QUEST, QSTN, WTF)`` - *Questions*: Misunderstood details. +``FAQ`` + *Frequently Asked Questions*: Interesting areas that require + external explanation. -``CRED (CREDIT, THANKS)`` - *Credits*: Accreditations for external provision of enlightenment. +``GLOSS (GLOSSARY)`` + *Glossary*: Definitions for project glossary. -``TODO (MLSTN, DONE, YAGNI, TBD, TOBEDONE)`` - *To do*: Informal tasks/features that are pending completion. +``SEE (REF, REFERENCE)`` + *See*: Pointers to other code, web link, etc. - .. NOTE: TBD and TOBEDONE belong here, not with FIXME +``DOCDO (TODOC, DODOC, NEEDSDOC, EXPLAIN, DOCUMENT)`` + *Needs Documentation*: Areas of code that still need to be + documented. -``PORT (PORTABILITY, WKRD)`` - *Portability*: Workarounds specific to OS, Python version, etc. +``CRED (CREDIT, THANKS)`` + *Credits*: Accreditations for external provision of enlightenment. -``FAQ`` - *Frequently Asked Questions*: Interesting areas that require - external explanation. +``STAT (STATUS)`` + *Status*: File-level statistical indicator of maturity of this + file. -File-level Codetags might be better suited as properties in the -revision control system. +``RVD (REVIEWED, REVIEW)`` + *Reviewed*: File-level indicator that review was conducted. + +File-level codetags might be better suited as properties in the +revision control system, but might still be appropriately specified in +a codetag. Some of these are temporary (e.g., ``FIXME``) while others are -persistent (e.g., ``REQ``). Synonyms should probably be deprecated in -the interest of minimalism and consistency. I chose a mnemonic over a -synonym using three criteria: descriptiveness, length (shorter is -better), commonly used. +persistent (e.g., ``REQ``). A mnemonic was chosen over a synonym +using three criteria: descriptiveness, length (shorter is better), +commonly used. -Choosing between ``FIXME`` and ``XXX`` is difficult. ``XXX`` seems to +Choosing between ``FIXME`` and ``XXX`` is difficult. ``XXX`` seems to be more common, but much less descriptive. Furthermore, ``XXX`` is a useful placeholder in a piece of code having a value that is unknown. -`Sun says`__ that ``XXX`` and ``FIXME`` are slightly different, giving -``XXX`` higher severity. +Thus ``FIXME`` is the preferred spelling. `Sun says`__ that ``XXX`` +and ``FIXME`` are slightly different, giving ``XXX`` higher severity. +However, with decades of chaos on this topic, and too many millions of +developers who won't be influenced by Sun, it is easy to rightly call +them synonyms. __ http://java.sun.com/docs/codeconv/html/CodeConventions.doc9.html#395 ``DONE`` is always a completed ``TODO`` item, but this should probably -be indicated through the revision control system. +be indicated through the revision control system and/or a completion +recording mechanism (see `DONE File`_). It may be a useful metric to count ``NOTE`` tags: a high count may -indicate a problem. +indicate a design (or other) problem. But of course the majority of +codetags indicate areas of code needing some attention. -``FAQ`` is probably more appropriately documented in a wiki where -users can more easily contribute. +An ``FAQ`` is probably more appropriately documented in a wiki where +users can more easily view and contribute. Fields ------ -All fields are optional. It should be possible for groups to define or -add their own, but the proposed standard fields are as follows: +All fields are optional. The proposed standard fields are described +in this section. Note that upper case field characters are intended +to be replaced. -``pN`` - *Priority* level. Range is from 0..3 with 3 being the highest. A - *Severity* field could also exist, or it could be factored into - this single number. +The *Originator/Assignee* and *Origination Date/Week* fields are the +most common and don't usually require a prefix. -``iN`` - Development cycle *Iteration*. Useful for grouping Codetags into +.. NOTE: the colon after the prefix is a new addition that became + necessary when it was pointed out that a "codename" field (with no + digits) such as "cTiger" would be indistinguishable from a username. + + +.. NOTE: This section started out with just assignee and due week. It + has grown into a lot of fields by request. It is still probably + best to use a tracking system for any items that deserve it, and + not duplicate everything in a codetag (field). + +This lengthy list of fields is liable to scare people (the intended +minimalists) away from adopting codetags, but keep in mind that these +only exist to support programmers who either 1) like to keep ``BUG`` +or ``RFE`` codetags in a complete form, or 2) are using codetags as +their complete and only tracking system. In other words, many of +these fields will be used very rarely. They are gathered largely from +industry-wide conventions, and example sources include `GCC +Bugzilla`__ and `Python's SourceForge`__ tracking systems. + +.. ???: Maybe codetags inside packages (__init__.py files) could have + special global significance. + +__ http://gcc.gnu.org/bugzilla/ +__ http://sourceforge.net/tracker/?group_id=5470 + +``AAA[,BBB]...`` + List of *Originator* or *Assignee* initials (the context + determines which unless both should exist). It is also okay to + use usernames such as ``MicahE`` instead of initials. Initials + (in upper case) are the preferred form. + +``a:AAA[,BBB]...`` + List of *Assignee* initials. This is necessary only in (rare) + cases where a codetag has both an assignee and an originator, and + they are different. Otherwise the ``a:`` prefix is omitted, and + context determines the intent. E.g., ``FIXME`` usually has an + *Assignee*, and ``NOTE`` usually has an *Originator*, but if a + ``FIXME`` was originated (and initialed) by a reviewer, then the + assignee's initials would need a ``a:`` prefix. + +``YYYY[-MM[-DD]]`` or ``WW[.D]w`` + The *Origination Date* indicating when the comment was added, in + `ISO 8601`_ format (digits and hyphens only). Or *Origination + Week*, an alternative form for specifying an *Origination Date*. + A day of the week can be optionally specified. The ``w`` suffix + is necessary for distinguishing from a date. + +``d:YYYY[-MM[-DD]]`` or ``d:WW[.D]w`` + *Due Date (d)* target completion (estimate). Or *Due Week (d)*, + an alternative to specifying a *Due Date*. + +``p:N`` + *Priority (p)* level. Range (N) is from 0..3 with 3 being the + highest. 0..3 are analogous to low, medium, high, and + showstopper/critical. The *Severity* field could be factored into + this single number, and doing so is recommended since having both + is subject to varying interpretation. The range and order should + be customizable. The existence of this field is important for any + tool that itemizes codetags. Thus a (customizable) default value + should be supported. + +``t:NNNN`` + *Tracker (t)* number corresponding to associated Ticket ID in + separate tracking system. + +The following fields are also available but expected to be less +common. + +``c:AAAA`` + *Category (c)* indicating some specific area affected by this + item. + +``s:AAAA`` + *Status (s)* indicating state of item. Examples are "unexplored", + "understood", "inprogress", "fixed", "done", "closed". Note that + when an item is completed it is probably better to remove the + codetag and record it in a `DONE File`_. + +``i:N`` + Development cycle *Iteration (i)*. Useful for grouping codetags into completion target groups. -``XXX[,YYY]...`` - List of *Initials* of owners of completion responsibility. There - should be no digits in initials. +``r:N`` + Development cycle *Release (r)*. Useful for grouping codetags into + completion target groups. - .. ???: should initials be uppercase or lowercase? I prefer - uppercase, personally. + .. NOTE: SourceForge does not recognize a severity and I think + that *Priority* (along with separate RFE codetags) should + encompass and obviate *Severity*. - .. NOTE: I agree that uppercase is better but I'll leave that open - to users. + .. NOTE: The tools will need an ability to sort codetags in order + of targeted completion. I feel that *Priority* should be a + unique, lone indicator of that addressability order. Other + categories such as *Severity*, *Customer Importance*, etc. are + related to business logic and should not be recognized by the + codetag tools. If some groups want to have such logic, then it + is best factored (externally) into a single value (priority) + that can determine an ordering of actionable items. -``wWW[.D]`` - *Workweek* target completion (estimate). A day of the week can be - optionally specified. Origination and completion are freebies - with revision control. +To summarize, the non-prefixed fields are initials and origination +date, and the prefixed fields are: assignee (a), due (d), priority +(p), tracker (t), category (c), status (s), iteration (i), and release +(r). - .. ???: Since *workweek* and *date* are redundant we might want to - decide on one or other. Date is longer but is better - understood by most so the likely keeper. +It should be possible for groups to define or add their own fields, +and these should have upper case prefixes to distinguish them from the +standard set. Examples of custom fields are *Operating System (O)*, +*Severity (S)*, *Affected Version (A)*, *Customer (C)*, etc. - .. NOTE: *Workweek* indicates a completion estimate, but *date* - simply indicates when the comment was added. They're not - redundant. However, rather than workweek (which isn't used - much in my experience), it might be better to have a "c" - (completion estimate) tag with date content. -``yyyy[-mm[-dd]]`` - The *Date* the comment was added, in `ISO 8601`_ format (digits - and hyphens only). +DONE File +--------- + +Some codetags have an ability to be *completed* (e.g., ``FIXME``, +``TODO``, ``BUG``). It is often important to retain completed items +by recording them with a completion date stamp. Such completed items +are best stored in a single location, global to a project (or maybe a +package). The proposed format is most easily described by an example, +say ``~/src/fooproj/DONE``:: + + # TODO: Recurse into subdirs only on blue + # moons. + [2005-09-26 Oops, I underestimated this one a bit. Should have + used Warsaw's First Law!] + + # FIXME: ... + ... + +You can see that the codetag is copied verbatim from the original +source file. The date stamp is then entered on the following line +with an optional post-mortem commentary. The entry is terminated by a +blank line (``\n\n``). + +It may sound burdensome to have to delete codetag lines every time one +gets completed. But in practice it is quite easy to setup a Vim or +Emacs mapping to auto-record a codetag deletion in this format (sans +the commentary). Tools ===== Currently, programmers (and sometimes analysts) typically use *grep* -to generate a list of items corresponding to a single Codetag. +to generate a list of items corresponding to a single codetag. However, various hypothetical productivity tools could take advantage -of a consistent Codetag format. Some example tools follow. +of a consistent codetag format. Some example tools follow. .. NOTE: Codetag tools are mostly unimplemented (but I'm getting started!) @@ -356,30 +487,35 @@ A project Health-O-Meter Codetag Lint - Notify of invalid use of Codetags, and aid in porting to Codetag + Notify of invalid use of codetags, and aid in porting to codetags Story Manager/Browser An electronic means to replace XP notecards. In MVC terms, the - Codetag is the Model, and the Story Manager could be a graphical + codetag is the Model, and the Story Manager could be a graphical Viewer/Controller to do visual rearrangement, prioritization, and assignment, milestone management. Any Text Editor - Used for changing, removing, adding, rearranging Codetags. + Used for changing, removing, adding, rearranging, recording + codetags. There are some tools already in existence that take advantage of a -smaller set of pseudo-Codetags (see References_). +smaller set of pseudo-codetags (see References_). There is also an +example codetags implementation under way, known as the `Codetag +Project`__. + +__ http://tracos.org/codetag Objections ========== -:Objection: Extreme Programming argues that such Codetags should not +:Objection: Extreme Programming argues that such codetags should not ever exist in code since the code is the documentation. -:Defense: Maybe put the Codetags in the unit test files instead. - Besides, it's tough to generate documentation from uncommented - source code. +:Defense: Maybe you should put the codetags in the unit test files + instead. Besides, it's tough to generate documentation from + uncommented source code. ---- @@ -392,11 +528,13 @@ :Objection: Causes duplication with tracking system. -:Defense: Not really. If an item exists in the tracker, a simple - ticket number as the Codetag commentary is sufficient. Maybe a - duplicated title would be acceptable. Furthermore, it's too - burdensome to have a ticket filed for every item that pops into a - developer's mind on-the-go. +:Defense: Not really, unless fields are abused. If an item exists in + the tracker, a simple ticket number in the codetag tracker field + is sufficient. Maybe a duplicated title would be acceptable. + Furthermore, it's too burdensome to have a ticket filed for every + item that pops into a developer's mind on-the-go. Additionally, + the tracking system could possibly be obviated for simple or small + projects that can reasonably fit the relevant data into a codetag. ---- @@ -404,24 +542,120 @@ :Defense: That is a good point. But I'd still rather have such info in a single place (the source code) than various other documents, - likely getting duplicated or forgotten about. + likely getting duplicated or forgotten about. The completed + codetags can be sent off to the `DONE File`_, or to the bit + bucket. ---- :Objection: Codetags (and all comments) get out of date. :Defense: Not so much if other sources (externally visible - documentation) depend on them being accurate. + documentation) depend on their being accurate. + +---- + +:Objection: Codetags tend to only rarely have estimated completion + dates of any sort. OK, the fields are optional, but you want to + suggest fields that actually will be widely used. + +:Defense: If an item is inestimable don't bother with specifying a + date field. Using tools to display items with order and/or color + by due date and/or priority, it is easier to make estimates. + Having your roadmap be a dynamic reflection of your codetags makes + you much more likely to keep the codetags accurate. + +---- + +:Objection: Named variables for the field parameters in the ``<>`` + should be used instead of cryptic one-character prefixes. I.e., + should rather be . + +:Defense: It is just too much typing/verbosity to spell out fields. I + argue that ``p:3 i:2`` is as readable as ``priority=3, + iteration=2`` and is much more likely to by typed and remembered + (see bullet C in Philosophy_). In this case practicality beats + purity. There are not many fields to keep track of so one letter + prefixes are suitable. + +---- + +:Objection: Synonyms should be deprecated since it is better to have a + single way to spell something. + +:Defense: Many programmers prefer short mnemonic names, especially in + comments. This is why short mnemonics were chosen as the primary + names. However, others feel that an explicit spelling is less + confusing and less prone to error. There will always be two camps + on this subject. Thus synonyms (and complete, full spellings) + should remain supported. + +---- + +:Objection: It is cruel to use [for mnemonics] opaque acronyms and + abbreviations which drop vowels; it's hard to figure these things + out. On that basis I hate: MLSTN RFCTR RFE FEETCH, NYI, FR, FTRQ, + FTR WKRD RVDBY + +:Defense: Mnemonics are preferred since they are pretty easy to + remember and take up less space. If programmers didn't like + dropping vowels we would be able to fit very little code on a + line. The space is important for those who write comments that + often fit on a single line. But when using a canon everywhere it + is much less likely to get something to fit on a line. + +---- + +:Objection: It takes too long to type the fields. + +:Defense: Then don't use (most or any of) them, especially if you're + the only programmer. Terminating a codetag with ``<>`` is a small + chore, and in doing so you enable the use of the proposed tools. + Editor auto-completion of codetags is also useful: You can + program your editor to stamp a template (e.g. ``# FIXME . ``) with just a keystroke or two. + +---- + +:Objection: *WorkWeek* is an obscure and uncommon time unit. + +:Defense: That's true but it is a highly suitable unit of granularity + for estimation/targeting purposes, and it is very compact. The + `ISO 8601`_ is widely understood but allows you to only specify + either a specific day (restrictive) or month (broad). + +---- + +:Objection: I aesthetically dislike for the comment to be terminated + with <> in the empty field case. + +:Defense: It is necessary to have a terminator since codetags may be + followed by non-codetag comments. Or codetags could be limited to + a single line, but that's prohibitive. I can't think of any + single-character terminator that is appropriate and significantly + better than <>. Maybe ``@`` could be a terminator, but then most + codetags will have an unnecessary @. + +---- + +:Objection: I can't use codetags when writing HTML, or less + specifically, XML. Maybe ``@fields@`` would be a better than + ```` as the delimiters. + +:Defense: Maybe you're right, but ``<>`` looks nicer whenever + applicable. XML/SGML could use ``@`` while more common + programming languages stick to ``<>``. References ========== -Some other tools have approached defining/exploiting Codetags. +Some other tools have approached defining/exploiting codetags. See http://tracos.org/codetag/wiki/Links. .. _wiki: http://tracos.org/codetag/wiki/Pep .. _ISO 8601: http://en.wikipedia.org/wiki/ISO_8601 +.. _c2: http://c2.com/cgi/wiki?FixmeComment .. Local Variables: From goodger at users.sourceforge.net Tue Sep 27 01:38:18 2005 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue, 27 Sep 2005 01:38:18 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep-0350.txt,1.2,1.3 Message-ID: <20050926233818.4FE571E4002@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30563 Modified Files: pep-0350.txt Log Message: minor revision by the author Index: pep-0350.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0350.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pep-0350.txt 26 Sep 2005 19:56:53 -0000 1.2 +++ pep-0350.txt 26 Sep 2005 23:38:14 -0000 1.3 @@ -7,7 +7,7 @@ Type: Informational Content-Type: text/x-rst Created: 27-Jun-2005 -Post-History: 10-Aug-2005 +Post-History: 10-Aug-2005, 26-Sep-2005 Abstract @@ -20,11 +20,11 @@ represent a very lightweight programming micro-paradigm and become useful for project management, documentation, change tracking, and project health monitoring. This is submitted as a PEP because its -ideas are Pythonic, although the concepts are not unique to Python -programming. Herein are the definition of codetags, the philosophy -behind them, a motivation for standardized conventions, some examples, -a specification, a toolset description, and possible objections to the -Codetag project/paradigm. +ideas are thought to be Pythonic, although the concepts are not unique +to Python programming. Herein are the definition of codetags, the +philosophy behind them, a motivation for standardized conventions, +some examples, a specification, a toolset description, and possible +objections to the Codetag project/paradigm. This PEP is also living as a wiki_ for people to add comments. @@ -270,7 +270,7 @@ ``SEE (REF, REFERENCE)`` *See*: Pointers to other code, web link, etc. -``DOCDO (TODOC, DODOC, NEEDSDOC, EXPLAIN, DOCUMENT)`` +``TODOC (DOCDO, DODOC, NEEDSDOC, EXPLAIN, DOCUMENT)`` *Needs Documentation*: Areas of code that still need to be documented. From loewis at users.sourceforge.net Tue Sep 27 21:16:37 2005 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 27 Sep 2005 21:16:37 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Tools/msi msilib.py, 1.4.2.1, 1.4.2.2 Message-ID: <20050927191637.30A1C1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Tools/msi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26795 Modified Files: Tag: release24-maint msilib.py Log Message: Use lzx:21 for compression. Index: msilib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/msi/msilib.py,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -d -r1.4.2.1 -r1.4.2.2 --- msilib.py 15 Mar 2005 00:37:45 -0000 1.4.2.1 +++ msilib.py 27 Sep 2005 19:16:32 -0000 1.4.2.2 @@ -393,7 +393,7 @@ else: print "WARNING: cabarc.exe not found in registry" cabarc = "cabarc.exe" - f = popen2.popen4(r'"%s" n %s.cab @%s.txt' % (cabarc, self.name, self.name))[0] + f = popen2.popen4(r'"%s" -m lzx:21 n %s.cab @%s.txt' % (cabarc, self.name, self.name))[0] for line in f: if line.startswith(" -- adding "): sys.stdout.write(".") From loewis at users.sourceforge.net Tue Sep 27 21:17:06 2005 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 27 Sep 2005 21:17:06 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Tools/msi msilib.py,1.5,1.6 Message-ID: <20050927191706.E40521E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Tools/msi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26913 Modified Files: msilib.py Log Message: Use lzx:21 for compression. Backported to 2.4 Index: msilib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/msi/msilib.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- msilib.py 15 Mar 2005 00:39:40 -0000 1.5 +++ msilib.py 27 Sep 2005 19:17:03 -0000 1.6 @@ -393,7 +393,7 @@ else: print "WARNING: cabarc.exe not found in registry" cabarc = "cabarc.exe" - f = popen2.popen4(r'"%s" n %s.cab @%s.txt' % (cabarc, self.name, self.name))[0] + f = popen2.popen4(r'"%s" -m lzx:21 n %s.cab @%s.txt' % (cabarc, self.name, self.name))[0] for line in f: if line.startswith(" -- adding "): sys.stdout.write(".") From anthonybaxter at users.sourceforge.net Wed Sep 28 04:15:17 2005 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Wed, 28 Sep 2005 04:15:17 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.83.2.8, 2.83.2.9 Message-ID: <20050928021517.704041E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29339/Include Modified Files: Tag: release24-maint patchlevel.h Log Message: 2.4.2 release stuff Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.83.2.8 retrieving revision 2.83.2.9 diff -u -d -r2.83.2.8 -r2.83.2.9 --- patchlevel.h 20 Sep 2005 13:07:04 -0000 2.83.2.8 +++ patchlevel.h 28 Sep 2005 02:15:13 -0000 2.83.2.9 @@ -22,11 +22,11 @@ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 4 #define PY_MICRO_VERSION 2 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "2.4.2c1" +#define PY_VERSION "2.4.2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ From anthonybaxter at users.sourceforge.net Wed Sep 28 04:15:18 2005 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Wed, 28 Sep 2005 04:15:18 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/idlelib NEWS.txt, 1.49.2.9, 1.49.2.10 idlever.py, 1.22.2.5, 1.22.2.6 Message-ID: <20050928021518.79A681E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29339/Lib/idlelib Modified Files: Tag: release24-maint NEWS.txt idlever.py Log Message: 2.4.2 release stuff Index: NEWS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v retrieving revision 1.49.2.9 retrieving revision 1.49.2.10 diff -u -d -r1.49.2.9 -r1.49.2.10 --- NEWS.txt 20 Sep 2005 13:09:16 -0000 1.49.2.9 +++ NEWS.txt 28 Sep 2005 02:15:15 -0000 1.49.2.10 @@ -1,3 +1,8 @@ +What's New in IDLE 1.1.2? +========================= + +*Release date: 28-SEP-2005* + What's New in IDLE 1.1.2c1? =========================== Index: idlever.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/idlever.py,v retrieving revision 1.22.2.5 retrieving revision 1.22.2.6 diff -u -d -r1.22.2.5 -r1.22.2.6 --- idlever.py 20 Sep 2005 13:09:16 -0000 1.22.2.5 +++ idlever.py 28 Sep 2005 02:15:15 -0000 1.22.2.6 @@ -1 +1 @@ -IDLE_VERSION = "1.1.2c1" +IDLE_VERSION = "1.1.2" From anthonybaxter at users.sourceforge.net Wed Sep 28 04:15:18 2005 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Wed, 28 Sep 2005 04:15:18 +0200 (CEST) Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt, 1.65.2.4, 1.65.2.5 pythoncore.vcproj, 1.25.2.4, 1.25.2.5 Message-ID: <20050928021518.8486A1E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29339/PCbuild Modified Files: Tag: release24-maint BUILDno.txt pythoncore.vcproj Log Message: 2.4.2 release stuff Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.65.2.4 retrieving revision 1.65.2.5 diff -u -d -r1.65.2.4 -r1.65.2.5 --- BUILDno.txt 20 Sep 2005 13:11:36 -0000 1.65.2.4 +++ BUILDno.txt 28 Sep 2005 02:15:14 -0000 1.65.2.5 @@ -33,6 +33,8 @@ Windows Python BUILD numbers ---------------------------- + 67 2.4.2 + 28-Sep-2005 66 2.4.2c1 21-Sep-2005 65 2.4.1 Index: pythoncore.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.vcproj,v retrieving revision 1.25.2.4 retrieving revision 1.25.2.5 diff -u -d -r1.25.2.4 -r1.25.2.5 --- pythoncore.vcproj 20 Sep 2005 13:11:36 -0000 1.25.2.4 +++ pythoncore.vcproj 28 Sep 2005 02:15:14 -0000 1.25.2.5 @@ -1385,7 +1385,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="BUILD=66"/> + PreprocessorDefinitions="BUILD=67"/> @@ -1393,7 +1393,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="" - PreprocessorDefinitions="BUILD=66"/> + PreprocessorDefinitions="BUILD=67"/> @@ -1401,7 +1401,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="BUILD=66"/> + PreprocessorDefinitions="BUILD=67"/> Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29339/Misc/RPM Modified Files: Tag: release24-maint python-2.4.spec Log Message: 2.4.2 release stuff Index: python-2.4.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.4.spec,v retrieving revision 1.8.2.3 retrieving revision 1.8.2.4 diff -u -d -r1.8.2.3 -r1.8.2.4 --- python-2.4.spec 20 Sep 2005 13:09:17 -0000 1.8.2.3 +++ python-2.4.spec 28 Sep 2005 02:15:15 -0000 1.8.2.4 @@ -33,7 +33,7 @@ ################################# %define name python -%define version 2.4.2c1 +%define version 2.4.2 %define libvers 2.4 %define release 1pydotorg %define __prefix /usr From anthonybaxter at users.sourceforge.net Wed Sep 28 04:15:18 2005 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Wed, 28 Sep 2005 04:15:18 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.110, 1.1193.2.111 Message-ID: <20050928021518.CE1431E4004@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29339/Misc Modified Files: Tag: release24-maint NEWS Log Message: 2.4.2 release stuff Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.110 retrieving revision 1.1193.2.111 diff -u -d -r1.1193.2.110 -r1.1193.2.111 --- NEWS 26 Sep 2005 13:15:34 -0000 1.1193.2.110 +++ NEWS 28 Sep 2005 02:15:14 -0000 1.1193.2.111 @@ -7,11 +7,7 @@ What's New in Python 2.4.2 final? ================================= -*Release date: XX-SEP-2005* - -Core and builtins ------------------ - +*Release date: 28-SEP-2005* Extension Modules ----------------- @@ -22,7 +18,6 @@ - Patch #1297028: fix segfault if call type on MultibyteCodec, MultibyteStreamReader, or MultibyteStreamWriter. - Tests ----- @@ -30,10 +25,11 @@ apparently doesn't allow the creation time to be set later than the modification time. Fixed by changing the test data. - Build ----- +- The Windows .msi files are now compressed using lzx:21. This produces a + significantly smaller installer. What's New in Python 2.4.2c1 ============================ From fdrake at users.sourceforge.net Wed Sep 28 05:38:42 2005 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 28 Sep 2005 05:38:42 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/commontex boilerplate.tex, 1.3.4.1, 1.3.4.2 Message-ID: <20050928033842.98A291E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13459/commontex Modified Files: Tag: release24-maint boilerplate.tex Log Message: set release date Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/boilerplate.tex,v retrieving revision 1.3.4.1 retrieving revision 1.3.4.2 diff -u -d -r1.3.4.1 -r1.3.4.2 --- boilerplate.tex 29 Mar 2005 15:57:08 -0000 1.3.4.1 +++ boilerplate.tex 28 Sep 2005 03:38:39 -0000 1.3.4.2 @@ -5,5 +5,5 @@ Email: \email{docs at python.org} } -\date{30 March 2005} % XXX update before final release! +\date{28 September 2005} % XXX update before final release! \input{patchlevel} % include Python version information From fdrake at users.sourceforge.net Wed Sep 28 06:21:39 2005 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 28 Sep 2005 06:21:39 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep-0101.txt,1.49,1.50 Message-ID: <20050928042139.41FC21E4002@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19961 Modified Files: pep-0101.txt Log Message: - update a couple of file paths that have changed - add item to update release date for documentation (final releases only) Index: pep-0101.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0101.txt,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- pep-0101.txt 27 May 2004 05:55:55 -0000 1.49 +++ pep-0101.txt 28 Sep 2005 04:21:36 -0000 1.50 @@ -98,6 +98,9 @@ ___ Check with the IDLE maintainer to be sure that Lib/idlelib/NEWS.txt has been similarly updated. + ___ For final (non-alpha/beta/candidate) releases, make sure the + release date is fully spelled out in Doc/commontex/boilerplate.tex. + ___ Tag and/or branch the tree for release X.YaZ If you're releasing an alpha/beta/release candidate, you will @@ -182,7 +185,7 @@ number changes, also update the LICENSE file. ___ There's a copy of the license in - Doc/texinputs/license.tex; Fred usually takes care of that. + Doc/commontex/license.tex; Fred usually takes care of that. ___ Check the years on the copyright notice. If the last release was some time last year, add the current year to the copyright @@ -194,7 +197,7 @@ ___ Python/getcopyright.c - ___ Doc/texinputs/copyright.tex + ___ Doc/commontex/copyright.tex ___ PC/python_nt.rc sets up the DLL version resource for Windows (displayed when you right-click on the DLL and select From birkenfeld at users.sourceforge.net Wed Sep 28 14:53:15 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 28 Sep 2005 14:53:15 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.66,1.67 Message-ID: <20050928125315.5B7D51E4075@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29275/Doc/api Modified Files: concrete.tex Log Message: bug [ 1306449 ] PyString_AsStringAndSize() return value documented wrong Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- concrete.tex 3 Sep 2005 07:27:26 -0000 1.66 +++ concrete.tex 28 Sep 2005 12:53:12 -0000 1.67 @@ -664,8 +664,8 @@ \var{size})}. It must not be deallocated. If \var{string} is a Unicode object, this function computes the default encoding of \var{string} and operates on that. If \var{string} is not a string - object at all, \cfunction{PyString_AsString()} returns \NULL{} and - raises \exception{TypeError}. + object at all, \cfunction{PyString_AsStringAndSize()} returns + \code{-1} and raises \exception{TypeError}. \end{cfuncdesc} \begin{cfuncdesc}{void}{PyString_Concat}{PyObject **string, From birkenfeld at users.sourceforge.net Wed Sep 28 14:53:25 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Wed, 28 Sep 2005 14:53:25 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex, 1.58.2.3, 1.58.2.4 Message-ID: <20050928125325.93FC61E40ED@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29279/Doc/api Modified Files: Tag: release24-maint concrete.tex Log Message: backport of bugfix [ 1306449 ] PyString_AsStringAndSize() return value documented wrong Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.58.2.3 retrieving revision 1.58.2.4 diff -u -d -r1.58.2.3 -r1.58.2.4 --- concrete.tex 3 Sep 2005 07:27:37 -0000 1.58.2.3 +++ concrete.tex 28 Sep 2005 12:53:22 -0000 1.58.2.4 @@ -664,8 +664,8 @@ \var{size})}. It must not be deallocated. If \var{string} is a Unicode object, this function computes the default encoding of \var{string} and operates on that. If \var{string} is not a string - object at all, \cfunction{PyString_AsString()} returns \NULL{} and - raises \exception{TypeError}. + object at all, \cfunction{PyString_AsStringAndSize()} returns + \code{-1} and raises \exception{TypeError}. \end{cfuncdesc} \begin{cfuncdesc}{void}{PyString_Concat}{PyObject **string, From akuchling at users.sourceforge.net Wed Sep 28 16:10:57 2005 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 28 Sep 2005 16:10:57 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep-0206.txt,1.13,1.14 Message-ID: <20050928141057.06EEC1E4002@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15294 Modified Files: pep-0206.txt Log Message: Withdraw PEP 206 Index: pep-0206.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0206.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- pep-0206.txt 27 Jun 2005 20:31:59 -0000 1.13 +++ pep-0206.txt 28 Sep 2005 14:10:52 -0000 1.14 @@ -2,7 +2,7 @@ Title: Python Advanced Library Version: $Revision$ Author: A.M. Kuchling -Status: Draft +Status: Withdrawn Introduction From akuchling at users.sourceforge.net Wed Sep 28 16:11:32 2005 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 28 Sep 2005 16:11:32 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.344,1.345 Message-ID: <20050928141132.902DB1E400A@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15430 Modified Files: pep-0000.txt Log Message: Withdraw PEP 206; add Richard Jones as co-author of PEP314 Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.344 retrieving revision 1.345 diff -u -d -r1.344 -r1.345 --- pep-0000.txt 18 Sep 2005 15:10:08 -0000 1.344 +++ pep-0000.txt 28 Sep 2005 14:11:28 -0000 1.345 @@ -69,7 +69,6 @@ Open PEPs (under consideration) - I 206 Python Advanced Library Kuchling S 209 Adding Multidimensional Arrays Barrett, Oliphant S 228 Reworking Python's Numeric Model Zadka, GvR S 237 Unifying Long Integers and Integers Zadka, GvR @@ -90,7 +89,7 @@ S 299 Special __main__() function in modules Epler S 302 New Import Hooks JvR S 304 Controlling Generation of Bytecode Files Montanaro - S 314 Metadata for Python Software Packages v1.1 Kuchling + S 314 Metadata for Python Software Packages v1.1 Kuchling, Jones S 315 Enhanced While Loop Carroll, Hettinger S 321 Date/Time Parsing and Formatting Kuchling S 323 Copyable Iterators Martelli @@ -172,6 +171,7 @@ Deferred, Abandoned, Withdrawn, and Rejected PEPs SR 204 Range Literals Wouters + IR 206 Python Advanced Library Kuchling SD 211 Adding A New Outer Product Operator Wilson SD 212 Loop Counter Iteration Schneider-Kamp SD 213 Attribute Access Handlers Prescod @@ -252,7 +252,7 @@ SF 203 Augmented Assignments Wouters SR 204 Range Literals Wouters S 205 Weak References Drake - I 206 Python Advanced Library Kuchling + IR 206 Python Advanced Library Kuchling SF 207 Rich Comparisons GvR, Ascher SF 208 Reworking the Coercion Model Schemenauer, Lemburg S 209 Adding Multidimensional Arrays Barrett, Oliphant @@ -359,7 +359,7 @@ SF 311 Simplified GIL Acquisition for Extensions Hammond SD 312 Simple Implicit Lambda Suzi, Martelli SR 313 Adding Roman Numeral Literals to Python Meyer - S 314 Metadata for Python Software Packages v1.1 Kuchling + S 314 Metadata for Python Software Packages v1.1 Kuchling, Jones S 315 Enhanced While Loop Carroll, Hettinger SD 316 Programming by Contract for Python Way SR 317 Eliminate Implicit Exception Instantiation Taschuk From birkenfeld at users.sourceforge.net Thu Sep 29 15:40:52 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 15:40:52 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1377,1.1378 Message-ID: <20050929134052.735DE1E4034@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3752/Misc Modified Files: NEWS Log Message: Fix parse errors in readline module when compiling without threads. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1377 retrieving revision 1.1378 diff -u -d -r1.1377 -r1.1378 --- NEWS 24 Sep 2005 21:23:05 -0000 1.1377 +++ NEWS 29 Sep 2005 13:40:48 -0000 1.1378 @@ -153,6 +153,8 @@ Extension Modules ----------------- +- Fix parse errors in the readline module when compiling without threads. + - Patch #1288833: Removed thread lock from socket.getaddrinfo on FreeBSD 5.3 and later versions which got thread-safe getaddrinfo(3). From birkenfeld at users.sourceforge.net Thu Sep 29 15:40:52 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 15:40:52 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules readline.c,2.84,2.85 Message-ID: <20050929134052.9AC071E404A@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3752/Modules Modified Files: readline.c Log Message: Fix parse errors in readline module when compiling without threads. Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.84 retrieving revision 2.85 diff -u -d -r2.84 -r2.85 --- readline.c 7 Apr 2005 10:11:17 -0000 2.84 +++ readline.c 29 Sep 2005 13:40:49 -0000 2.85 @@ -603,6 +603,7 @@ #ifdef WITH_THREAD PyGILState_Release(gilstate); #endif + return result; } return result; } @@ -655,6 +656,7 @@ #ifdef WITH_THREAD PyGILState_Release(gilstate); #endif + return result; } return result; } From birkenfeld at users.sourceforge.net Thu Sep 29 15:42:48 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 15:42:48 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.111, 1.1193.2.112 Message-ID: <20050929134248.AB6A91E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4197/Misc Modified Files: Tag: release24-maint NEWS Log Message: backport: fix parse errors in readline Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.111 retrieving revision 1.1193.2.112 diff -u -d -r1.1193.2.111 -r1.1193.2.112 --- NEWS 28 Sep 2005 02:15:14 -0000 1.1193.2.111 +++ NEWS 29 Sep 2005 13:42:45 -0000 1.1193.2.112 @@ -4,6 +4,17 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) +What's New in Python 2.4.3a0? +============================= + +*Release date: XX-XX-200X* + +Extension Modules +----------------- + +- Fix parse errors in the readline module when compiling without threads. + + What's New in Python 2.4.2 final? ================================= @@ -31,8 +42,9 @@ - The Windows .msi files are now compressed using lzx:21. This produces a significantly smaller installer. -What's New in Python 2.4.2c1 -============================ + +What's New in Python 2.4.2c1? +============================= *Release date: 21-SEP-2005* From birkenfeld at users.sourceforge.net Thu Sep 29 15:42:48 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 15:42:48 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules readline.c, 2.79.2.3, 2.79.2.4 Message-ID: <20050929134248.ABFA31E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4197/Modules Modified Files: Tag: release24-maint readline.c Log Message: backport: fix parse errors in readline Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.79.2.3 retrieving revision 2.79.2.4 diff -u -d -r2.79.2.3 -r2.79.2.4 --- readline.c 7 Apr 2005 10:19:45 -0000 2.79.2.3 +++ readline.c 29 Sep 2005 13:42:45 -0000 2.79.2.4 @@ -605,6 +605,7 @@ #ifdef WITH_THREAD PyGILState_Release(gilstate); #endif + return result; } return result; } @@ -657,6 +658,7 @@ #ifdef WITH_THREAD PyGILState_Release(gilstate); #endif + return result; } return result; } From pje at users.sourceforge.net Thu Sep 29 18:49:58 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Thu, 29 Sep 2005 18:49:58 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools setup.py, 1.42, 1.43 Message-ID: <20050929164958.5C5081E434D@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19021 Modified Files: setup.py Log Message: Bugfixes. :( Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setup.py,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- setup.py 26 Sep 2005 00:46:00 -0000 1.42 +++ setup.py 29 Sep 2005 16:49:54 -0000 1.43 @@ -36,7 +36,7 @@ url = "http://peak.telecommunity.com/DevCenter/setuptools", test_suite = 'setuptools.tests.test_suite', packages = find_packages(), - package_data = {'setuptools': ['launcher.exe']}, + package_data = {'setuptools': ['*.exe']}, py_modules = ['pkg_resources', 'easy_install'], zip_safe = False, # We want 'python -m easy_install' to work, for now :( From pje at users.sourceforge.net Thu Sep 29 18:49:58 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Thu, 29 Sep 2005 18:49:58 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/tests test_resources.py, 1.25, 1.26 Message-ID: <20050929164958.832F21E4353@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19021/setuptools/tests Modified Files: test_resources.py Log Message: Bugfixes. :( Index: test_resources.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests/test_resources.py,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- test_resources.py 26 Sep 2005 00:35:35 -0000 1.25 +++ test_resources.py 29 Sep 2005 16:49:55 -0000 1.26 @@ -23,7 +23,7 @@ def testCollection(self): # empty path should produce no distributions - ad = Environment([], python=None) + ad = Environment([], platform=None, python=None) self.assertEqual(list(ad), []) self.assertEqual(ad['FooPkg'],[]) From pje at users.sourceforge.net Thu Sep 29 19:05:46 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Thu, 29 Sep 2005 19:05:46 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools __init__.py, 1.26, 1.27 Message-ID: <20050929170546.AD1751E400D@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22660/setuptools Modified Files: __init__.py Log Message: 0.6a5 brown bag bug fix release. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/__init__.py,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- __init__.py 26 Sep 2005 00:46:00 -0000 1.26 +++ __init__.py 29 Sep 2005 17:05:43 -0000 1.27 @@ -8,7 +8,7 @@ from distutils.util import convert_path import os.path -__version__ = '0.6a4' +__version__ = '0.6a5' __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' From pje at users.sourceforge.net Thu Sep 29 19:05:46 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Thu, 29 Sep 2005 19:05:46 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools ez_setup.py, 1.33, 1.34 setup.py, 1.43, 1.44 setuptools.txt, 1.40, 1.41 Message-ID: <20050929170546.E114C1E400D@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22660 Modified Files: ez_setup.py setup.py setuptools.txt Log Message: 0.6a5 brown bag bug fix release. Index: ez_setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/ez_setup.py,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- ez_setup.py 26 Sep 2005 00:46:00 -0000 1.33 +++ ez_setup.py 29 Sep 2005 17:05:43 -0000 1.34 @@ -14,7 +14,7 @@ This file can also be run as a script to install or upgrade setuptools. """ import sys -DEFAULT_VERSION = "0.6a4" +DEFAULT_VERSION = "0.6a5" DEFAULT_URL = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3] md5_data = { @@ -28,6 +28,8 @@ 'setuptools-0.6a3-py2.4.egg': 'd95453d525a456d6c23e7a5eea89a063', 'setuptools-0.6a4-py2.3.egg': 'e958cbed4623bbf47dd1f268b99d7784', 'setuptools-0.6a4-py2.4.egg': '7f33c3ac2ef1296f0ab4fac1de4767d8', + 'setuptools-0.6a5-py2.3.egg': '748408389c49bcd2d84f6ae0b01695b1', + 'setuptools-0.6a5-py2.4.egg': '999bacde623f4284bfb3ea77941d2627', } import sys, os Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setup.py,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- setup.py 29 Sep 2005 16:49:54 -0000 1.43 +++ setup.py 29 Sep 2005 17:05:43 -0000 1.44 @@ -15,7 +15,7 @@ f.close() return ''.join(lines) -VERSION = "0.6a4" +VERSION = "0.6a5" from setuptools import setup, find_packages import sys from setuptools.command import __all__ as SETUP_COMMANDS Index: setuptools.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.txt,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- setuptools.txt 24 Sep 2005 21:40:59 -0000 1.40 +++ setuptools.txt 29 Sep 2005 17:05:43 -0000 1.41 @@ -1859,6 +1859,9 @@ Release Notes/Change History ---------------------------- +0.6a5 + * Fixed missing gui/cli .exe files in distribution. Fixed bugs in tests. + 0.6a3 * Added ``gui_scripts`` entry point group to allow installing GUI scripts on Windows and other platforms. (The special handling is only for Windows; From pje at users.sourceforge.net Thu Sep 29 19:05:48 2005 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Thu, 29 Sep 2005 19:05:48 +0200 (CEST) Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools.egg-info entry_points.txt, 1.9, 1.10 Message-ID: <20050929170548.0549E1E4005@bag.python.org> Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.egg-info In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22660/setuptools.egg-info Modified Files: entry_points.txt Log Message: 0.6a5 brown bag bug fix release. Index: entry_points.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools.egg-info/entry_points.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- entry_points.txt 24 Sep 2005 20:29:57 -0000 1.9 +++ entry_points.txt 29 Sep 2005 17:05:43 -0000 1.10 @@ -24,7 +24,6 @@ rotate = setuptools.command.rotate:rotate develop = setuptools.command.develop:develop setopt = setuptools.command.setopt:setopt -build_py = setuptools.command.build_py:build_py saveopts = setuptools.command.saveopts:saveopts egg_info = setuptools.command.egg_info:egg_info upload = setuptools.command.upload:upload From jhylton at users.sourceforge.net Thu Sep 29 21:28:02 2005 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 29 Sep 2005 21:28:02 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.64,1.1.2.65 Message-ID: <20050929192802.461DD1E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26680/Python Modified Files: Tag: ast-branch ast.c Log Message: Add a few missing syntax errors. Report error for f(lambda x:x[0] = 3) as in recent-ish change to old compiler. Add error reporting for generator expressions in assignment context. Note that test_genexps still fails because the syntax error printed doesn't match what doctest expects. In particular, it prints a strange generated filename. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.64 retrieving revision 1.1.2.65 diff -u -d -r1.1.2.64 -r1.1.2.65 --- ast.c 30 Aug 2005 23:37:45 -0000 1.1.2.64 +++ ast.c 29 Sep 2005 19:27:58 -0000 1.1.2.65 @@ -1694,7 +1694,18 @@ e = ast_for_expr(c, CHILD(ch, 0)); if (!e) goto error; - assert(e->kind == Name_kind); + /* f(lambda x: x[0] = 3) ends up getting parsed with + * LHS test = lambda x: x[0], and RHS test = 3. + * SF bug 132313 points out that complaining about a keyword + * then is very confusing. + */ + if (e->kind == Lambda_kind) { + ast_error(CHILD(ch, 0), "lambda cannot contain assignment"); + goto error; + } else if (e->kind != Name_kind) { + ast_error(CHILD(ch, 0), "keyword can't be an expression"); + goto error; + } key = e->v.Name.id; free(e); e = ast_for_expr(c, CHILD(ch, 2)); @@ -1769,6 +1780,11 @@ expr1 = ast_for_testlist(c, CHILD(n, 0)); if (!expr1) return NULL; + if (expr1->kind == GeneratorExp_kind) { + ast_error(CHILD(n, 0), "augmented assignment to generator " + "expression not possible"); + return NULL; + } if (expr1->kind == Name_kind) { char *var_name = PyString_AS_STRING(expr1->v.Name.id); if (var_name[0] == 'N' && !strcmp(var_name, "None")) { @@ -1800,6 +1816,13 @@ for (i = 0; i < NCH(n) - 2; i += 2) { expr_ty e = ast_for_testlist(c, CHILD(n, i)); + if (e->kind == GeneratorExp_kind) { + ast_error(CHILD(n, i), + "assignment to generator expression not possible"); + asdl_seq_free(targets); + return NULL; + } + /* set context to assign */ if (!e) { asdl_seq_free(targets); From birkenfeld at users.sourceforge.net Thu Sep 29 22:16:10 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 22:16:10 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1378,1.1379 Message-ID: <20050929201610.87ECC1E4052@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7050/Misc Modified Files: NEWS Log Message: bug [ 1296004 ] MemoryError in httplib Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1378 retrieving revision 1.1379 diff -u -d -r1.1378 -r1.1379 --- NEWS 29 Sep 2005 13:40:48 -0000 1.1378 +++ NEWS 29 Sep 2005 20:16:07 -0000 1.1379 @@ -242,6 +242,9 @@ Library ------- +- Bug #1296004: httplib.py: Limit maximal amount of data read from the + socket to avoid a MemoryError on Windows. + - Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE to get the correct encoding. From birkenfeld at users.sourceforge.net Thu Sep 29 22:16:10 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 22:16:10 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.95,1.96 Message-ID: <20050929201610.E1D531E4119@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7050/Lib Modified Files: httplib.py Log Message: bug [ 1296004 ] MemoryError in httplib Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.95 retrieving revision 1.96 diff -u -d -r1.95 -r1.96 --- httplib.py 26 Jun 2005 22:06:54 -0000 1.95 +++ httplib.py 29 Sep 2005 20:16:07 -0000 1.96 @@ -153,6 +153,9 @@ INSUFFICIENT_STORAGE = 507 NOT_EXTENDED = 510 +# maximal amount of data to read at one time in _safe_read +MAXAMOUNT = 1048576 + class HTTPMessage(mimetools.Message): def addheader(self, key, value): @@ -541,14 +544,14 @@ reading. If the bytes are truly not available (due to EOF), then the IncompleteRead exception can be used to detect the problem. """ - s = '' + s = [] while amt > 0: - chunk = self.fp.read(amt) + chunk = self.fp.read(min(amt, MAXAMOUNT)) if not chunk: raise IncompleteRead(s) - s += chunk + s.append(chunk) amt -= len(chunk) - return s + return ''.join(s) def getheader(self, name, default=None): if self.msg is None: From birkenfeld at users.sourceforge.net Thu Sep 29 22:16:16 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 22:16:16 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.112, 1.1193.2.113 Message-ID: <20050929201616.4E3571E4076@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7067/Misc Modified Files: Tag: release24-maint NEWS Log Message: backport bug [ 1296004 ] MemoryError in httplib Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.112 retrieving revision 1.1193.2.113 diff -u -d -r1.1193.2.112 -r1.1193.2.113 --- NEWS 29 Sep 2005 13:42:45 -0000 1.1193.2.112 +++ NEWS 29 Sep 2005 20:16:12 -0000 1.1193.2.113 @@ -14,6 +14,12 @@ - Fix parse errors in the readline module when compiling without threads. +Library +------- + +- Bug #1296004: httplib.py: Limit maximal amount of data read from the + socket to avoid a MemoryError on Windows. + What's New in Python 2.4.2 final? ================================= From birkenfeld at users.sourceforge.net Thu Sep 29 22:16:16 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 22:16:16 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib httplib.py, 1.94.2.1, 1.94.2.2 Message-ID: <20050929201616.581111E4175@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7067/Lib Modified Files: Tag: release24-maint httplib.py Log Message: backport bug [ 1296004 ] MemoryError in httplib Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.94.2.1 retrieving revision 1.94.2.2 diff -u -d -r1.94.2.1 -r1.94.2.2 --- httplib.py 26 Jun 2005 22:06:56 -0000 1.94.2.1 +++ httplib.py 29 Sep 2005 20:16:12 -0000 1.94.2.2 @@ -153,6 +153,9 @@ INSUFFICIENT_STORAGE = 507 NOT_EXTENDED = 510 +# maximal amount of data to read at one time in _safe_read +MAXAMOUNT = 1048576 + class HTTPMessage(mimetools.Message): def addheader(self, key, value): @@ -541,14 +544,14 @@ reading. If the bytes are truly not available (due to EOF), then the IncompleteRead exception can be used to detect the problem. """ - s = '' + s = [] while amt > 0: - chunk = self.fp.read(amt) + chunk = self.fp.read(min(amt, MAXAMOUNT)) if not chunk: raise IncompleteRead(s) - s += chunk + s.append(chunk) amt -= len(chunk) - return s + return ''.join(s) def getheader(self, name, default=None): if self.msg is None: From birkenfeld at users.sourceforge.net Thu Sep 29 22:24:10 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 22:24:10 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib libshlex.tex,1.18,1.19 Message-ID: <20050929202410.0D2EC1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8876/Doc/lib Modified Files: libshlex.tex Log Message: bug [ 1298120 ] shlex does not support unicode Index: libshlex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshlex.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- libshlex.tex 31 Dec 2003 05:18:46 -0000 1.18 +++ libshlex.tex 29 Sep 2005 20:24:06 -0000 1.19 @@ -15,6 +15,8 @@ be useful for writing minilanguages, (for example, in run control files for Python applications) or for parsing quoted strings. +\note{The \module{shlex} module currently does not support Unicode input.} + The \module{shlex} module defines the following functions: \begin{funcdesc}{split}{s\optional{, comments}} From birkenfeld at users.sourceforge.net Thu Sep 29 22:24:15 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 22:24:15 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib libshlex.tex, 1.18, 1.18.4.1 Message-ID: <20050929202415.A22F41E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8889/Doc/lib Modified Files: Tag: release24-maint libshlex.tex Log Message: backport bug [ 1298120 ] shlex does not support unicode Index: libshlex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshlex.tex,v retrieving revision 1.18 retrieving revision 1.18.4.1 diff -u -d -r1.18 -r1.18.4.1 --- libshlex.tex 31 Dec 2003 05:18:46 -0000 1.18 +++ libshlex.tex 29 Sep 2005 20:24:12 -0000 1.18.4.1 @@ -15,6 +15,8 @@ be useful for writing minilanguages, (for example, in run control files for Python applications) or for parsing quoted strings. +\note{The \module{shlex} module currently does not support Unicode input.} + The \module{shlex} module defines the following functions: \begin{funcdesc}{split}{s\optional{, comments}} From birkenfeld at users.sourceforge.net Thu Sep 29 22:49:19 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 22:49:19 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib xdrlib.py,1.17,1.18 Message-ID: <20050929204919.40A8C1E4008@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14211/Lib Modified Files: xdrlib.py Log Message: patch [ 1300515 ] xdrlib.py: pack_fstring() did not use null bytes for padding Index: xdrlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xdrlib.py,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- xdrlib.py 24 Feb 2005 20:22:11 -0000 1.17 +++ xdrlib.py 29 Sep 2005 20:49:16 -0000 1.18 @@ -79,8 +79,8 @@ def pack_fstring(self, n, s): if n < 0: raise ValueError, 'fstring size must be nonnegative' - n = ((n+3)/4)*4 data = s[:n] + n = ((n+3)/4)*4 data = data + (n - len(data)) * '\0' self.__buf.write(data) From birkenfeld at users.sourceforge.net Thu Sep 29 22:49:19 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 22:49:19 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1379,1.1380 Message-ID: <20050929204919.44B421E401E@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14211/Misc Modified Files: NEWS Log Message: patch [ 1300515 ] xdrlib.py: pack_fstring() did not use null bytes for padding Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1379 retrieving revision 1.1380 diff -u -d -r1.1379 -r1.1380 --- NEWS 29 Sep 2005 20:16:07 -0000 1.1379 +++ NEWS 29 Sep 2005 20:49:16 -0000 1.1380 @@ -242,6 +242,9 @@ Library ------- +- Patch #1300515: xdrlib.py: Fix pack_fstring() to really use null bytes + for padding. + - Bug #1296004: httplib.py: Limit maximal amount of data read from the socket to avoid a MemoryError on Windows. From birkenfeld at users.sourceforge.net Thu Sep 29 22:49:24 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 22:49:24 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.113, 1.1193.2.114 Message-ID: <20050929204924.88CEB1E4006@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14223/Misc Modified Files: Tag: release24-maint NEWS Log Message: backport patch [ 1300515 ] xdrlib.py: pack_fstring() did not use null bytes for padding Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.113 retrieving revision 1.1193.2.114 diff -u -d -r1.1193.2.113 -r1.1193.2.114 --- NEWS 29 Sep 2005 20:16:12 -0000 1.1193.2.113 +++ NEWS 29 Sep 2005 20:49:21 -0000 1.1193.2.114 @@ -17,6 +17,9 @@ Library ------- +- Patch #1300515: xdrlib.py: Fix pack_fstring() to really use null bytes + for padding. + - Bug #1296004: httplib.py: Limit maximal amount of data read from the socket to avoid a MemoryError on Windows. From birkenfeld at users.sourceforge.net Thu Sep 29 22:49:24 2005 From: birkenfeld at users.sourceforge.net (birkenfeld@users.sourceforge.net) Date: Thu, 29 Sep 2005 22:49:24 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib xdrlib.py,1.16,1.16.4.1 Message-ID: <20050929204924.C7E8D1E4006@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14223/Lib Modified Files: Tag: release24-maint xdrlib.py Log Message: backport patch [ 1300515 ] xdrlib.py: pack_fstring() did not use null bytes for padding Index: xdrlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xdrlib.py,v retrieving revision 1.16 retrieving revision 1.16.4.1 diff -u -d -r1.16 -r1.16.4.1 --- xdrlib.py 12 Feb 2004 17:35:07 -0000 1.16 +++ xdrlib.py 29 Sep 2005 20:49:21 -0000 1.16.4.1 @@ -79,8 +79,8 @@ def pack_fstring(self, n, s): if n < 0: raise ValueError, 'fstring size must be nonnegative' - n = ((n+3)/4)*4 data = s[:n] + n = ((n+3)/4)*4 data = data + (n - len(data)) * '\0' self.__buf.write(data) From rhettinger at users.sourceforge.net Fri Sep 30 03:52:02 2005 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 30 Sep 2005 03:52:02 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep-0000.txt, 1.345, 1.346 pep-0308.txt, 1.20, 1.21 Message-ID: <20050930015202.397C51E4002@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14980 Modified Files: pep-0000.txt pep-0308.txt Log Message: Record pronouncement on conditional expressions. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.345 retrieving revision 1.346 diff -u -d -r1.345 -r1.346 --- pep-0000.txt 28 Sep 2005 14:11:28 -0000 1.345 +++ pep-0000.txt 30 Sep 2005 01:51:58 -0000 1.346 @@ -63,6 +63,7 @@ Accepted PEPs (accepted; may not be implemented yet) + SA 308 If-then-else expression GvR, Hettinger SA 328 Imports: Multi-Line and Absolute/Relative Aahz SA 342 Coroutines via Enhanced Generators GvR, Eby SA 343 Anonymous Block Redux and Generator Enhancements GvR @@ -203,7 +204,6 @@ SR 295 Interpretation of multiline string constants Koltsov SR 296 Adding a bytes Object Type Gilbert SR 303 Extend divmod() for Multiple Divisors Bellman - SR 308 If-then-else expression GvR, Hettinger SR 310 Reliable Acquisition/Release Pairs Hudson, Moore SD 312 Simple Implicit Lambda Suzi, Martelli SR 313 Adding Roman Numeral Literals to Python Meyer @@ -353,7 +353,7 @@ SF 305 CSV File API Montanaro, et al I 306 How to Change Python's Grammar Hudson SF 307 Extensions to the pickle protocol GvR, Peters - SR 308 If-then-else expression GvR, Hettinger + SA 308 If-then-else expression GvR, Hettinger SF 309 Partial Function Application Harris S 310 Reliable Acquisition/Release Pairs Hudson, Moore SF 311 Simplified GIL Acquisition for Extensions Hammond Index: pep-0308.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0308.txt,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- pep-0308.txt 13 Aug 2003 18:06:34 -0000 1.20 +++ pep-0308.txt 30 Sep 2005 01:51:58 -0000 1.21 @@ -3,14 +3,43 @@ Version: $Revision$ Last-Modified: $Date$ Author: Guido van Rossum, Raymond D. Hettinger -Status: Rejected +Status: Accepted Type: Standards Track Content-Type: text/plain Created: 7-Feb-2003 Post-History: 7-Feb-2003, 11-Feb-2003 +Adding a conditional expression -Introduction + On 9/29/2005, Guido decided to add conditional expressions in the + form of "X if C else Y". [1] + + The motivating use case was the prevalance of error-prone attempts + to achieve the same effect using "and" and "or". [2] + + Previous community efforts to add a conditional expression were + stymied by a lack of consensus on the best syntax. That issue was + resolved by simply deferring to a BDFL best judgment call. + + The decision was validated by reviewing the how the syntax fared when + applied throughout the standard library (this review approximates a + sampling of real-world use cases, across a variety of applications, + written by a number of programmers with diverse backgrounds). [3] + +References + + [1] Pronouncement + http://mail.python.org/pipermail/python-dev/2005-September/056846.html + + [2] Motivating use case: + http://mail.python.org/pipermail/python-dev/2005-September/056546.html + http://mail.python.org/pipermail/python-dev/2005-September/056510.html + + [3] Review in the context of real-world code fragments: + http://mail.python.org/pipermail/python-dev/2005-September/056803.html + + +Introduction to earlier draft of the PEP (kept for historical purposes) Requests for an if-then-else ("ternary") expression keep coming up on comp.lang.python. This PEP contains a concrete proposal of a From nnorwitz at users.sourceforge.net Fri Sep 30 06:46:52 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 30 Sep 2005 06:46:52 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_minidom.py, 1.41, 1.42 Message-ID: <20050930044652.BAB2C1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11176/Lib/test Modified Files: test_minidom.py Log Message: Patch #1309009, Fix segfault in pyexpat when the XML document is in latin_1, but Python incorrectly assumes it is in UTF-8 format Will backport. Index: test_minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_minidom.py,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- test_minidom.py 25 Aug 2005 22:14:15 -0000 1.41 +++ test_minidom.py 30 Sep 2005 04:46:49 -0000 1.42 @@ -889,6 +889,15 @@ and doc.toxml('utf-8') == '\xe2\x82\xac' and doc.toxml('iso-8859-15') == '\xa4', "testEncodings - encoding EURO SIGN") + + # Verify that character decoding errors throw exceptions instead of crashing + try: + doc = parseString('Comment \xe7a va ? Tr\xe8s bien ?') + except UnicodeDecodeError: + pass + else: + print 'parsing with bad encoding should raise a UnicodeDecodeError' + doc.unlink() class UserDataHandler: From nnorwitz at users.sourceforge.net Fri Sep 30 06:46:52 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 30 Sep 2005 06:46:52 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc ACKS, 1.296, 1.297 NEWS, 1.1380, 1.1381 Message-ID: <20050930044652.DA99A1E4006@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11176/Misc Modified Files: ACKS NEWS Log Message: Patch #1309009, Fix segfault in pyexpat when the XML document is in latin_1, but Python incorrectly assumes it is in UTF-8 format Will backport. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.296 retrieving revision 1.297 diff -u -d -r1.296 -r1.297 --- ACKS 22 Sep 2005 09:19:01 -0000 1.296 +++ ACKS 30 Sep 2005 04:46:49 -0000 1.297 @@ -305,6 +305,7 @@ Jiba Orjan Johansen Simon Johnston +Evan Jones Richard Jones Irmen de Jong Lucas de Jonge Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1380 retrieving revision 1.1381 diff -u -d -r1.1380 -r1.1381 --- NEWS 29 Sep 2005 20:49:16 -0000 1.1380 +++ NEWS 30 Sep 2005 04:46:49 -0000 1.1381 @@ -153,6 +153,9 @@ Extension Modules ----------------- +- Patch #1309009, Fix segfault in pyexpat when the XML document is in latin_1, + but Python incorrectly assumes it is in UTF-8 format + - Fix parse errors in the readline module when compiling without threads. - Patch #1288833: Removed thread lock from socket.getaddrinfo on From nnorwitz at users.sourceforge.net Fri Sep 30 06:46:53 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 30 Sep 2005 06:46:53 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.90,2.91 Message-ID: <20050930044653.024601E4007@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11176/Modules Modified Files: pyexpat.c Log Message: Patch #1309009, Fix segfault in pyexpat when the XML document is in latin_1, but Python incorrectly assumes it is in UTF-8 format Will backport. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.90 retrieving revision 2.91 diff -u -d -r2.90 -r2.91 --- pyexpat.c 4 Mar 2005 14:37:01 -0000 2.90 +++ pyexpat.c 30 Sep 2005 04:46:49 -0000 2.91 @@ -417,6 +417,9 @@ { PyObject *result = STRING_CONV_FUNC(str); PyObject *value; + /* result can be NULL if the unicode conversion failed. */ + if (!result) + return result; if (!self->intern) return result; value = PyDict_GetItem(self->intern, result); @@ -572,7 +575,9 @@ Py_DECREF(v); } } - args = Py_BuildValue("(NN)", string_intern(self, name), container); + args = string_intern(self, name); + if (args != NULL) + args = Py_BuildValue("(NN)", args, container); if (args == NULL) { Py_DECREF(container); return; From nnorwitz at users.sourceforge.net Fri Sep 30 06:58:26 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 30 Sep 2005 06:58:26 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Misc ACKS, 1.289.2.3, 1.289.2.4 NEWS, 1.1193.2.114, 1.1193.2.115 Message-ID: <20050930045826.6F8781E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12823/Misc Modified Files: Tag: release24-maint ACKS NEWS Log Message: - Patch #1309009, Fix segfault in pyexpat when the XML document is in latin_1, but Python incorrectly assumes it is in UTF-8 format Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.289.2.3 retrieving revision 1.289.2.4 diff -u -d -r1.289.2.3 -r1.289.2.4 --- ACKS 26 Sep 2005 13:15:34 -0000 1.289.2.3 +++ ACKS 30 Sep 2005 04:58:23 -0000 1.289.2.4 @@ -303,6 +303,7 @@ Jiba Orjan Johansen Simon Johnston +Evan Jones Richard Jones Irmen de Jong Lucas de Jonge Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.114 retrieving revision 1.1193.2.115 diff -u -d -r1.1193.2.114 -r1.1193.2.115 --- NEWS 29 Sep 2005 20:49:21 -0000 1.1193.2.114 +++ NEWS 30 Sep 2005 04:58:23 -0000 1.1193.2.115 @@ -4,7 +4,7 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) -What's New in Python 2.4.3a0? +What's New in Python 2.4.3c1? ============================= *Release date: XX-XX-200X* @@ -12,6 +12,9 @@ Extension Modules ----------------- +- Patch #1309009, Fix segfault in pyexpat when the XML document is in latin_1, + but Python incorrectly assumes it is in UTF-8 format + - Fix parse errors in the readline module when compiling without threads. Library From nnorwitz at users.sourceforge.net Fri Sep 30 06:58:26 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 30 Sep 2005 06:58:26 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Modules pyexpat.c, 2.89.2.1, 2.89.2.2 Message-ID: <20050930045826.727F31E4003@bag.python.org> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12823/Modules Modified Files: Tag: release24-maint pyexpat.c Log Message: - Patch #1309009, Fix segfault in pyexpat when the XML document is in latin_1, but Python incorrectly assumes it is in UTF-8 format Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.89.2.1 retrieving revision 2.89.2.2 diff -u -d -r2.89.2.1 -r2.89.2.2 --- pyexpat.c 4 Mar 2005 14:38:07 -0000 2.89.2.1 +++ pyexpat.c 30 Sep 2005 04:58:23 -0000 2.89.2.2 @@ -417,6 +417,9 @@ { PyObject *result = STRING_CONV_FUNC(str); PyObject *value; + /* result can be NULL if the unicode conversion failed. */ + if (!result) + return result; if (!self->intern) return result; value = PyDict_GetItem(self->intern, result); @@ -572,7 +575,9 @@ Py_DECREF(v); } } - args = Py_BuildValue("(NN)", string_intern(self, name), container); + args = string_intern(self, name); + if (args != NULL) + args = Py_BuildValue("(NN)", args, container); if (args == NULL) { Py_DECREF(container); return; From nnorwitz at users.sourceforge.net Fri Sep 30 06:58:26 2005 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 30 Sep 2005 06:58:26 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Lib/test test_minidom.py, 1.39.4.2, 1.39.4.3 Message-ID: <20050930045826.896D11E4005@bag.python.org> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12823/Lib/test Modified Files: Tag: release24-maint test_minidom.py Log Message: - Patch #1309009, Fix segfault in pyexpat when the XML document is in latin_1, but Python incorrectly assumes it is in UTF-8 format Index: test_minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_minidom.py,v retrieving revision 1.39.4.2 retrieving revision 1.39.4.3 diff -u -d -r1.39.4.2 -r1.39.4.3 --- test_minidom.py 25 Aug 2005 22:14:21 -0000 1.39.4.2 +++ test_minidom.py 30 Sep 2005 04:58:23 -0000 1.39.4.3 @@ -889,6 +889,15 @@ and doc.toxml('utf-8') == '\xe2\x82\xac' and doc.toxml('iso-8859-15') == '\xa4', "testEncodings - encoding EURO SIGN") + + # Verify that character decoding errors throw exceptions instead of crashing + try: + doc = parseString('Comment \xe7a va ? Tr\xe8s bien ?') + except UnicodeDecodeError: + pass + else: + print 'parsing with bad encoding should raise a UnicodeDecodeError' + doc.unlink() class UserDataHandler: From mwh at users.sourceforge.net Fri Sep 30 10:17:44 2005 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 30 Sep 2005 10:17:44 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python pystate.c, 2.38.2.3, 2.38.2.4 Message-ID: <20050930081744.223AC1E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15986/Python Modified Files: Tag: release24-maint pystate.c Log Message: Fix bug: [ 1307978 ] Unsatisfied symbols: _PyGILState_NoteThreadState (code) (note that this only happens in a threads-disabled build). Will forward port momentarily. Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.38.2.3 retrieving revision 2.38.2.4 diff -u -d -r2.38.2.3 -r2.38.2.4 --- pystate.c 23 Sep 2005 08:14:40 -0000 2.38.2.3 +++ pystate.c 30 Sep 2005 08:17:40 -0000 2.38.2.4 @@ -53,7 +53,9 @@ PyThreadState *_PyThreadState_Current = NULL; PyThreadFrameGetter _PyThreadState_GetFrame = NULL; +#ifdef WITH_THREAD static void _PyGILState_NoteThreadState(PyThreadState* tstate); +#endif PyInterpreterState * @@ -188,7 +190,9 @@ tstate->c_profileobj = NULL; tstate->c_traceobj = NULL; +#ifdef WITH_THREAD _PyGILState_NoteThreadState(tstate); +#endif HEAD_LOCK(); tstate->next = interp->tstate_head; From mwh at users.sourceforge.net Fri Sep 30 10:20:27 2005 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 30 Sep 2005 10:20:27 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Python pystate.c,2.42,2.43 Message-ID: <20050930082027.C18481E405F@bag.python.org> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16774/Python Modified Files: pystate.c Log Message: Forward port bugfix: [ 1307978 ] Unsatisfied symbols: _PyGILState_NoteThreadState (code) (note that this only happens in a threads-disabled build). Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.42 retrieving revision 2.43 diff -u -d -r2.42 -r2.43 --- pystate.c 20 Jun 2005 16:52:57 -0000 2.42 +++ pystate.c 30 Sep 2005 08:20:24 -0000 2.43 @@ -53,7 +53,9 @@ PyThreadState *_PyThreadState_Current = NULL; PyThreadFrameGetter _PyThreadState_GetFrame = NULL; +#ifdef WITH_THREAD static void _PyGILState_NoteThreadState(PyThreadState* tstate); +#endif PyInterpreterState * @@ -188,7 +190,9 @@ tstate->c_profileobj = NULL; tstate->c_traceobj = NULL; +#ifdef WITH_THREAD _PyGILState_NoteThreadState(tstate); +#endif HEAD_LOCK(); tstate->next = interp->tstate_head; From vsajip at users.sourceforge.net Fri Sep 30 14:08:28 2005 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Fri, 30 Sep 2005 14:08:28 +0200 (CEST) Subject: [Python-checkins] python/dist/src/Doc/lib liblogging.tex, 1.33.2.5, 1.33.2.6 Message-ID: <20050930120828.7EA141E4002@bag.python.org> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30582 Modified Files: Tag: release24-maint liblogging.tex Log Message: Minor clarification of effective level calculation Index: liblogging.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblogging.tex,v retrieving revision 1.33.2.5 retrieving revision 1.33.2.6 diff -u -d -r1.33.2.5 -r1.33.2.6 --- liblogging.tex 16 Sep 2005 10:55:57 -0000 1.33.2.5 +++ liblogging.tex 30 Sep 2005 12:08:25 -0000 1.33.2.6 @@ -334,6 +334,20 @@ to be processed when the logger is the root logger, or delegation to the parent when the logger is a non-root logger). Note that the root logger is created with level \constant{WARNING}. + +The term "delegation to the parent" means that if a logger has a level +of NOTSET, its chain of ancestor loggers is traversed until either an +ancestor with a level other than NOTSET is found, or the root is +reached. + +If an ancestor is found with a level other than NOTSET, then that +ancestor's level is treated as the effective level of the logger where +the ancestor search began, and is used to determine how a logging +event is handled. + +If the root is reached, and it has a level of NOTSET, then all +messages will be processed. Otherwise, the root's level will be used +as the effective level. \end{methoddesc} \begin{methoddesc}{isEnabledFor}{lvl} From goodger at users.sourceforge.net Fri Sep 30 15:41:38 2005 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 30 Sep 2005 15:41:38 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep-0308.txt,1.21,1.22 Message-ID: <20050930134138.409631E4002@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18085 Modified Files: pep-0308.txt Log Message: fixed typo; added whitespace Index: pep-0308.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0308.txt,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- pep-0308.txt 30 Sep 2005 01:51:58 -0000 1.21 +++ pep-0308.txt 30 Sep 2005 13:41:34 -0000 1.22 @@ -9,6 +9,7 @@ Created: 7-Feb-2003 Post-History: 7-Feb-2003, 11-Feb-2003 + Adding a conditional expression On 9/29/2005, Guido decided to add conditional expressions in the @@ -21,11 +22,12 @@ stymied by a lack of consensus on the best syntax. That issue was resolved by simply deferring to a BDFL best judgment call. - The decision was validated by reviewing the how the syntax fared when + The decision was validated by reviewing how the syntax fared when applied throughout the standard library (this review approximates a sampling of real-world use cases, across a variety of applications, written by a number of programmers with diverse backgrounds). [3] + References [1] Pronouncement From gvanrossum at users.sourceforge.net Fri Sep 30 16:42:39 2005 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 30 Sep 2005 16:42:39 +0200 (CEST) Subject: [Python-checkins] python/nondist/peps pep-0000.txt, 1.346, 1.347 pep-0308.txt, 1.22, 1.23 Message-ID: <20050930144239.5AC121E400A@bag.python.org> Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv510 Modified Files: pep-0000.txt pep-0308.txt Log Message: Rename PEP 308 to "Conditional Expressions". Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.346 retrieving revision 1.347 diff -u -d -r1.346 -r1.347 --- pep-0000.txt 30 Sep 2005 01:51:58 -0000 1.346 +++ pep-0000.txt 30 Sep 2005 14:42:36 -0000 1.347 @@ -63,7 +63,7 @@ Accepted PEPs (accepted; may not be implemented yet) - SA 308 If-then-else expression GvR, Hettinger + SA 308 Conditional Expressions GvR, Hettinger SA 328 Imports: Multi-Line and Absolute/Relative Aahz SA 342 Coroutines via Enhanced Generators GvR, Eby SA 343 Anonymous Block Redux and Generator Enhancements GvR @@ -353,7 +353,7 @@ SF 305 CSV File API Montanaro, et al I 306 How to Change Python's Grammar Hudson SF 307 Extensions to the pickle protocol GvR, Peters - SA 308 If-then-else expression GvR, Hettinger + SA 308 Conditional Expressions GvR, Hettinger SF 309 Partial Function Application Harris S 310 Reliable Acquisition/Release Pairs Hudson, Moore SF 311 Simplified GIL Acquisition for Extensions Hammond Index: pep-0308.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0308.txt,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- pep-0308.txt 30 Sep 2005 13:41:34 -0000 1.22 +++ pep-0308.txt 30 Sep 2005 14:42:36 -0000 1.23 @@ -1,5 +1,5 @@ PEP: 308 -Title: If-then-else expression +Title: Conditional Expressions Version: $Revision$ Last-Modified: $Date$ Author: Guido van Rossum, Raymond D. Hettinger