From guido@cnri.reston.va.us Wed Mar 1 15:06:56 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Wed, 1 Mar 2000 10:06:56 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Include intobject.h,2.15,2.16 listobject.h,2.16,2.17 object.h,2.49,2.50 objimpl.h,2.13,2.14 tupleobject.h,2.19,2.20 Message-ID: <200003011506.KAA14290@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Include In directory eric:/projects/python/develop/guido/src/Include Modified Files: intobject.h listobject.h object.h objimpl.h tupleobject.h Log Message: Got rid of silly "123456789-..." lines in comments. Index: intobject.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Include/intobject.h,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -r2.15 -r2.16 *** intobject.h 1999/10/12 19:54:34 2.15 --- intobject.h 2000/03/01 15:06:53 2.16 *************** *** 39,44 **** /* - 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 - PyIntObject represents a (long) integer. This is an immutable object; an integer cannot change its value after creation. --- 39,42 ---- *************** *** 69,74 **** /* - 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 - False and True are special intobjects used by Boolean expressions. All values of type Boolean must point to either of these; but in --- 67,70 ---- Index: listobject.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Include/listobject.h,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -r2.16 -r2.17 *** listobject.h 1998/12/04 18:48:05 2.16 --- listobject.h 2000/03/01 15:06:53 2.17 *************** *** 39,44 **** /* - 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 - Another generally useful object type is an list of object pointers. This is a mutable type: the list items can be changed, and items can be --- 39,42 ---- Index: object.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Include/object.h,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -r2.49 -r2.50 *** object.h 2000/02/28 15:00:40 2.49 --- object.h 2000/03/01 15:06:53 2.50 *************** *** 39,44 **** /* - 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 - Objects are structures allocated on the heap. Special rules apply to the use of objects to ensure they are properly garbage-collected. --- 39,42 ---- *************** *** 81,86 **** A standard interface exists for objects that contain an array of items whose size is determined when the object is allocated. - - 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 */ --- 79,82 ---- *************** *** 122,127 **** /* - 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 - Type objects contain a string containing the type name (to help somewhat in debugging), the allocation parameters (see newobj() and newvarobj()), --- 118,121 ---- *************** *** 330,335 **** /* - 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 - The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement reference counts. Py_DECREF calls the object's deallocator function; for --- 324,327 ---- *************** *** 474,479 **** /* - 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 - More conventions ================ --- 466,469 ---- *************** *** 523,528 **** it carefully, it may save lots of calls to Py_INCREF() and Py_DECREF() at times. - - 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 */ --- 513,516 ---- Index: objimpl.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Include/objimpl.h,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** objimpl.h 1998/12/04 18:48:13 2.13 --- objimpl.h 2000/03/01 15:06:53 2.14 *************** *** 37,42 **** /* - 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 - Additional macros for modules that implement new object types. You must first include "object.h". --- 37,40 ---- Index: tupleobject.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Include/tupleobject.h,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -r2.19 -r2.20 *** tupleobject.h 1998/12/04 18:48:25 2.19 --- tupleobject.h 2000/03/01 15:06:53 2.20 *************** *** 39,44 **** /* - 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 - Another generally useful object type is an tuple of object pointers. This is a mutable type: the tuple items can be changed (but not their --- 39,42 ---- From fdrake@weyr.cnri.reston.va.us Wed Mar 1 16:21:19 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 1 Mar 2000 11:21:19 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.20.2.3,1.20.2.4 Message-ID: <200003011621.LAA02513@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libstdtypes.tex Log Message: Added a note to the [].append() description pointing out that multi-arg append has been deprecated since 1.4 and noting that it will be removed in 1.6. Re-ordered and re-numbered the notes for a couple of tables so that don't seem so messy. This has the (welcome) side effect that the note about [].append() is the first in it's list. Index: libstdtypes.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.20.2.3 retrieving revision 1.20.2.4 diff -C2 -r1.20.2.3 -r1.20.2.4 *** libstdtypes.tex 2000/02/14 21:52:16 1.20.2.3 --- libstdtypes.tex 2000/03/01 16:21:16 1.20.2.4 *************** *** 334,341 **** \hline \lineiii{\var{s} + \var{t}}{the concatenation of \var{s} and \var{t}}{} ! \lineiii{\var{s} * \var{n}\textrm{,} \var{n} * \var{s}}{\var{n} copies of \var{s} concatenated}{(3)} \hline ! \lineiii{\var{s}[\var{i}]}{\var{i}'th item of \var{s}, origin 0}{(1)} ! \lineiii{\var{s}[\var{i}:\var{j}]}{slice of \var{s} from \var{i} to \var{j}}{(1), (2)} \hline \lineiii{len(\var{s})}{length of \var{s}}{} --- 334,341 ---- \hline \lineiii{\var{s} + \var{t}}{the concatenation of \var{s} and \var{t}}{} ! \lineiii{\var{s} * \var{n}\textrm{,} \var{n} * \var{s}}{\var{n} copies of \var{s} concatenated}{(1)} \hline ! \lineiii{\var{s}[\var{i}]}{\var{i}'th item of \var{s}, origin 0}{(2)} ! \lineiii{\var{s}[\var{i}:\var{j}]}{slice of \var{s} from \var{i} to \var{j}}{(2), (3)} \hline \lineiii{len(\var{s})}{length of \var{s}}{} *************** *** 358,368 **** \begin{description} ! ! \item[(1)] If \var{i} or \var{j} is negative, the index is relative to the end of the string, i.e., \code{len(\var{s}) + \var{i}} or \code{len(\var{s}) + \var{j}} is substituted. But note that \code{-0} is still \code{0}. ! \item[(2)] The slice of \var{s} from \var{i} to \var{j} is defined as the sequence of items with index \var{k} such that \code{\var{i} <= \var{k} < \var{j}}. If \var{i} or \var{j} is greater than --- 358,371 ---- \begin{description} ! \item[(1)] Values of \var{n} less than \code{0} are treated as ! \code{0} (which yields an empty sequence of the same type as ! \var{s}). ! ! \item[(2)] If \var{i} or \var{j} is negative, the index is relative to the end of the string, i.e., \code{len(\var{s}) + \var{i}} or \code{len(\var{s}) + \var{j}} is substituted. But note that \code{-0} is still \code{0}. ! \item[(3)] The slice of \var{s} from \var{i} to \var{j} is defined as the sequence of items with index \var{k} such that \code{\var{i} <= \var{k} < \var{j}}. If \var{i} or \var{j} is greater than *************** *** 370,378 **** use \code{0}. If \var{j} is omitted, use \code{len(\var{s})}. If \var{i} is greater than or equal to \var{j}, the slice is empty. - - \item[(3)] Values of \var{n} less than \code{0} are treated as - \code{0} (which yields an empty sequence of the same type as - \var{s}). - \end{description} --- 373,376 ---- *************** *** 454,464 **** {same as \code{\var{s}[\var{i}:\var{j}] = []}}{} \lineiii{\var{s}.append(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = [\var{x}]}}{} \lineiii{\var{s}.extend(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = \var{x}}}{(5)} \lineiii{\var{s}.count(\var{x})} {return number of \var{i}'s for which \code{\var{s}[\var{i}] == \var{x}}}{} \lineiii{\var{s}.index(\var{x})} ! {return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(1)} \lineiii{\var{s}.insert(\var{i}, \var{x})} {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]} --- 452,462 ---- {same as \code{\var{s}[\var{i}:\var{j}] = []}}{} \lineiii{\var{s}.append(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = [\var{x}]}}{(1)} \lineiii{\var{s}.extend(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = \var{x}}}{(2)} \lineiii{\var{s}.count(\var{x})} {return number of \var{i}'s for which \code{\var{s}[\var{i}] == \var{x}}}{} \lineiii{\var{s}.index(\var{x})} ! {return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(3)} \lineiii{\var{s}.insert(\var{i}, \var{x})} {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]} *************** *** 467,475 **** {same as \code{\var{x} = \var{s}[\var{i}]; del \var{s}[\var{i}]; return \var{x}}}{(4)} \lineiii{\var{s}.remove(\var{x})} ! {same as \code{del \var{s}[\var{s}.index(\var{x})]}}{(1)} \lineiii{\var{s}.reverse()} ! {reverses the items of \var{s} in place}{(3)} \lineiii{\var{s}.sort(\optional{\var{cmpfunc}})} ! {sort the items of \var{s} in place}{(2), (3)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} --- 465,473 ---- {same as \code{\var{x} = \var{s}[\var{i}]; del \var{s}[\var{i}]; return \var{x}}}{(4)} \lineiii{\var{s}.remove(\var{x})} ! {same as \code{del \var{s}[\var{s}.index(\var{x})]}}{(3)} \lineiii{\var{s}.reverse()} ! {reverses the items of \var{s} in place}{(5)} \lineiii{\var{s}.sort(\optional{\var{cmpfunc}})} ! {sort the items of \var{s} in place}{(5), (6)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} *************** *** 486,493 **** Notes: \begin{description} ! \item[(1)] Raises \exception{ValueError} when \var{x} is not found in \var{s}. ! \item[(2)] The \method{sort()} method takes an optional argument specifying a comparison function of two arguments (list items) which should return \code{-1}, \code{0} or \code{1} depending on whether --- 484,510 ---- Notes: \begin{description} ! \item[(1)] The C implementation of Python has historically accepted ! multiple parameters and implicitly joined them into a tuple; this ! will no longer work in Python 1.6. Use of this misfeature has been ! deprecated since Python 1.4. ! ! \item[(2)] Raises an exception when \var{x} is not a list object. The ! \method{extend()} method is experimental and not supported by ! mutable sequence types other than lists. ! ! \item[(3)] Raises \exception{ValueError} when \var{x} is not found in \var{s}. + + \item[(4)] The \method{pop()} method is experimental and not supported + by other mutable sequence types than lists. The optional argument + \var{i} defaults to \code{-1}, so that by default the last item is + removed and returned. ! \item[(5)] The \method{sort()} and \method{reverse()} methods modify the ! list in place for economy of space when sorting or reversing a large ! list. They don't return the sorted or reversed list to remind you ! of this side effect. ! ! \item[(6)] The \method{sort()} method takes an optional argument specifying a comparison function of two arguments (list items) which should return \code{-1}, \code{0} or \code{1} depending on whether *************** *** 499,516 **** \function{sort()} with a comparison function that reverses the ordering of the elements. - - \item[(3)] The \method{sort()} and \method{reverse()} methods modify the - list in place for economy of space when sorting or reversing a large - list. They don't return the sorted or reversed list to remind you - of this side effect. - - \item[(4)] The \method{pop()} method is experimental and not supported - by other mutable sequence types than lists. The optional argument - \var{i} defaults to \code{-1}, so that by default the last item is - removed and returned. - - \item[(5)] Raises an exception when \var{x} is not a list object. The - \method{extend()} method is experimental and not supported by - mutable types other than lists. \end{description} --- 516,519 ---- Return-Path: Delivered-To: python-checkins@python.org Received: from cnri.reston.va.us (ns.CNRI.Reston.VA.US [132.151.1.1]) by dinsdale.python.org (Postfix) with ESMTP id 6A4371CE85 for ; Wed, 1 Mar 2000 13:58:00 -0500 (EST) Received: from newcnri.cnri.reston.va.us (newcnri [132.151.1.84]) by cnri.reston.va.us (8.9.1a/8.9.1) with ESMTP id NAA25742 for ; Wed, 1 Mar 2000 13:58:00 -0500 (EST) Received: from thrak.cnri.reston.va.us (thrak.cnri.reston.va.us [10.27.10.43]) by newcnri.cnri.reston.va.us (8.9.1b+Sun/8.9.1) with ESMTP id NAA08809 for ; Wed, 1 Mar 2000 13:59:51 -0500 (EST) Received: (from gward@localhost) by thrak.cnri.reston.va.us (8.8.8+Sun/8.8.8) id NAA22564 for python-checkins@python.org; Wed, 1 Mar 2000 13:59:50 -0500 (EST) Date: Wed, 1 Mar 2000 13:59:50 -0500 (EST) From: Greg Ward Message-Id: <200003011859.NAA22564@thrak.cnri.reston.va.us> To: python-checkins@python.org Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.124,2.125 Sender: python-checkins-admin@python.org Errors-To: python-checkins-admin@python.org X-BeenThere: python-checkins@python.org X-Mailman-Version: 1.2 (beta 1) Precedence: bulk List-Id: Check-in messages from the Python maintainers Update of /projects/cvsroot/python/dist/src/Modules In directory thrak:/scratch/python/src/Modules Modified Files: posixmodule.c Log Message: Fix compiler warning: only use "_r" form of 'ctermid()' and 'tmpnam()' when building a threaded Python. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.124 retrieving revision 2.125 diff -C2 -r2.124 -r2.125 *** posixmodule.c 2000/02/25 17:51:00 2.124 --- posixmodule.c 2000/03/01 18:59:47 2.125 *************** *** 650,654 **** return NULL; ! #ifdef HAVE_CTERMID_R ret = ctermid_r(buffer); #else --- 650,654 ---- return NULL; ! #if defined(HAVE_CTERMID_R) && defined(WITH_THREAD) ret = ctermid_r(buffer); #else *************** *** 3343,3347 **** if (!PyArg_ParseTuple(args, ":tmpnam")) return NULL; ! #ifdef HAVE_TMPNAM_R name = tmpnam_r(buffer); #else --- 3343,3347 ---- if (!PyArg_ParseTuple(args, ":tmpnam")) return NULL; ! #if defined(HAVE_TMPNAM_R) && defined(WITH_THREAD) name = tmpnam_r(buffer); #else From fdrake@weyr.cnri.reston.va.us Wed Mar 1 20:27:01 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 1 Mar 2000 15:27:01 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/tools node2label.pl,1.9,1.9.4.1 Message-ID: <200003012027.PAA05196@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/tools In directory weyr:/home/fdrake/projects/python/Doc-152p2/tools Modified Files: Tag: release152p1-patches node2label.pl Log Message: Small change to be less destructive. Longer URLs will be visible to the user (we never get rid of the #SECTION..... fragment identifier), but sub-page targetting will work better. This makes more sense for the internal navigation, which otherwise broke in the few places that used \subsubsection markup. This was reported by Peter Funk . Index: node2label.pl =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/tools/node2label.pl,v retrieving revision 1.9 retrieving revision 1.9.4.1 diff -C2 -r1.9 -r1.9.4.1 *** node2label.pl 1999/02/10 17:08:00 1.9 --- node2label.pl 2000/03/01 20:26:58 1.9.4.1 *************** *** 42,46 **** $label = $nodes{$node}; if (s/(HREF|href)=\"$node([\#\"])/$1=\"$label.html$2/g) { ! s/(HREF|href)=\"$label.html#(l2h-)?SECTION\d+/$1=\"$label.html/g; $newnames{$node} = "$label.html"; } --- 42,46 ---- $label = $nodes{$node}; if (s/(HREF|href)=\"$node([\#\"])/$1=\"$label.html$2/g) { ! s/(HREF|href)=\"$label.html/href=\"$label.html/g; $newnames{$node} = "$label.html"; } Return-Path: Delivered-To: python-checkins@python.org Received: from cnri.reston.va.us (ns.CNRI.Reston.VA.US [132.151.1.1]) by dinsdale.python.org (Postfix) with ESMTP id 945871CEA8 for ; Wed, 1 Mar 2000 16:50:08 -0500 (EST) Received: from newcnri.cnri.reston.va.us (newcnri [132.151.1.84]) by cnri.reston.va.us (8.9.1a/8.9.1) with ESMTP id QAA27036 for ; Wed, 1 Mar 2000 16:50:09 -0500 (EST) Received: from thrak.cnri.reston.va.us (thrak.cnri.reston.va.us [10.27.10.43]) by newcnri.cnri.reston.va.us (8.9.1b+Sun/8.9.1) with ESMTP id QAA11852 for ; Wed, 1 Mar 2000 16:52:00 -0500 (EST) Received: (from gward@localhost) by thrak.cnri.reston.va.us (8.8.8+Sun/8.8.8) id QAA24075 for python-checkins@python.org; Wed, 1 Mar 2000 16:51:59 -0500 (EST) Date: Wed, 1 Mar 2000 16:51:59 -0500 (EST) From: Greg Ward Message-Id: <200003012151.QAA24075@thrak.cnri.reston.va.us> To: python-checkins@python.org Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.125,2.126 Sender: python-checkins-admin@python.org Errors-To: python-checkins-admin@python.org X-BeenThere: python-checkins@python.org X-Mailman-Version: 1.2 (beta 1) Precedence: bulk List-Id: Check-in messages from the Python maintainers Update of /projects/cvsroot/python/dist/src/Modules In directory thrak:/scratch/python/src/Modules Modified Files: posixmodule.c Log Message: Second attempt to fix the ctermid_r/tmpnam_r warnings: define USE_CTERMID_R and USE_TMPNAM_R at the top of the file and refer to them later; this catches a second reference to 'tmpnam_r' that I didn't spot first time around. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.125 retrieving revision 2.126 diff -C2 -r2.125 -r2.126 *** posixmodule.c 2000/03/01 18:59:47 2.125 --- posixmodule.c 2000/03/01 21:51:56 2.126 *************** *** 275,278 **** --- 275,288 ---- #endif /* UNION_WAIT */ + /* Don't use the "_r" form if we don't need it (also, won't have a + prototype for it, at least on Solaris -- maybe others as well?). */ + #if defined(HAVE_CTERMID_R) && defined(WITH_THREAD) + #define USE_CTERMID_R + #endif + + #if defined(HAVE_TMPNAM_R) && defined(WITH_THREAD) + #define USE_TMPNAM_R + #endif + /* Return a dictionary corresponding to the POSIX environment table */ *************** *** 650,654 **** return NULL; ! #if defined(HAVE_CTERMID_R) && defined(WITH_THREAD) ret = ctermid_r(buffer); #else --- 660,664 ---- return NULL; ! #ifdef USE_CTERMID_R ret = ctermid_r(buffer); #else *************** *** 3343,3347 **** if (!PyArg_ParseTuple(args, ":tmpnam")) return NULL; ! #if defined(HAVE_TMPNAM_R) && defined(WITH_THREAD) name = tmpnam_r(buffer); #else --- 3353,3357 ---- if (!PyArg_ParseTuple(args, ":tmpnam")) return NULL; ! #ifdef USE_TMPNAM_R name = tmpnam_r(buffer); #else *************** *** 3351,3355 **** PyErr_SetObject(PyExc_OSError, Py_BuildValue("is", 0, ! #ifdef HAVE_TMPNAM_R "unexpected NULL from tmpnam_r" #else --- 3361,3365 ---- PyErr_SetObject(PyExc_OSError, Py_BuildValue("is", 0, ! #ifdef USE_TMPNAM_R "unexpected NULL from tmpnam_r" #else From fdrake@weyr.cnri.reston.va.us Wed Mar 1 22:05:21 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 1 Mar 2000 17:05:21 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/html Makefile,1.26,1.26.4.1 Message-ID: <200003012205.RAA06383@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/html In directory weyr:/home/fdrake/projects/python/Doc-152p2/html Modified Files: Tag: release152p1-patches Makefile Log Message: Make the HTML output dependent on tools/node2label.pl. Index: Makefile =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/html/Makefile,v retrieving revision 1.26 retrieving revision 1.26.4.1 diff -C2 -r1.26 -r1.26.4.1 *** Makefile 1999/04/29 19:04:55 1.26 --- Makefile 2000/03/01 22:05:18 1.26.4.1 *************** *** 54,58 **** tut: tut/tut.html ! $(INDEXFILES): $(COMMONPERL) $(TOPDIR)/html/about.dat # The index.html target is at the end since it screws up font-lock. --- 54,60 ---- tut: tut/tut.html ! $(INDEXFILES): $(COMMONPERL) \ ! $(TOPDIR)/html/about.dat \ ! $(TOPDIR)/tools/node2label.pl # The index.html target is at the end since it screws up font-lock. From fdrake@weyr.cnri.reston.va.us Wed Mar 1 22:35:15 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 1 Mar 2000 17:35:15 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/tools node2label.pl,1.9.4.1,1.9.4.2 Message-ID: <200003012235.RAA06803@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/tools In directory weyr:/home/fdrake/projects/python/Doc-152p2/tools Modified Files: Tag: release152p1-patches node2label.pl Log Message: Ugh. Fixed an even more subtle bug here; this should fix the index problems caused by partial translation of links to the "logical" file names. This script did not support the use of both single- and double-quotes, but the generated HTML used both. (It used to only use double-quotes.) Index: node2label.pl =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/tools/node2label.pl,v retrieving revision 1.9.4.1 retrieving revision 1.9.4.2 diff -C2 -r1.9.4.1 -r1.9.4.2 *** node2label.pl 2000/03/01 20:26:58 1.9.4.1 --- node2label.pl 2000/03/01 22:35:12 1.9.4.2 *************** *** 33,46 **** # don't want to do one s/// per line per node # so look for lines with hrefs, then do s/// on nodes present ! if (/(HREF|href)=\"([^\#\"]*)html[\#\"]/) { ! @parts = split(/(HREF|href)\=\"/); shift @parts; for $node (@parts) { ! $node =~ s/[\#\"].*$//g; chop($node); if (defined($nodes{$node})) { $label = $nodes{$node}; ! if (s/(HREF|href)=\"$node([\#\"])/$1=\"$label.html$2/g) { ! s/(HREF|href)=\"$label.html/href=\"$label.html/g; $newnames{$node} = "$label.html"; } --- 33,46 ---- # don't want to do one s/// per line per node # so look for lines with hrefs, then do s/// on nodes present ! if (/(HREF|href)=[\"\']([^\#\"\']*)html[\#\"\']/) { ! @parts = split(/(HREF|href)\=[\"\']/); shift @parts; for $node (@parts) { ! $node =~ s/[\#\"\'].*$//g; chop($node); if (defined($nodes{$node})) { $label = $nodes{$node}; ! if (s/(HREF|href)=([\"\'])$node([\#\"\'])/href=$2$label.html$3/g) { ! s/(HREF|href)=([\"\'])$label.html/href=$2$label.html/g; $newnames{$node} = "$label.html"; } From guido@cnri.reston.va.us Thu Mar 2 13:55:04 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Thu, 2 Mar 2000 08:55:04 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python errors.c,2.43,2.44 Message-ID: <200003021355.IAA16580@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: errors.c Log Message: Mark discovered a bug in his patch: he didn't *use* PyExc_WindowsError in PyErr_SetFromWindowsErrWithFilename() like he intended to... :-) Index: errors.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/errors.c,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -r2.43 -r2.44 *** errors.c 2000/02/21 16:50:31 2.43 --- errors.c 2000/03/02 13:55:01 2.44 *************** *** 385,389 **** v = Py_BuildValue("(is)", err, s); if (v != NULL) { ! PyErr_SetObject(PyExc_EnvironmentError, v); Py_DECREF(v); } --- 385,389 ---- v = Py_BuildValue("(is)", err, s); if (v != NULL) { ! PyErr_SetObject(PyExc_WindowsError, v); Py_DECREF(v); } From jhylton@cnri.reston.va.us Thu Mar 2 19:07:01 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Thu, 2 Mar 2000 14:07:01 -0500 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle ParenMatch.py,NONE,1.1 Message-ID: <200003021907.OAA27492@goon.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory goon.cnri.reston.va.us:/home/jhylton/python/src/Tools/idle Added Files: ParenMatch.py Log Message: paren matching extension. warning: in current version of IDLE, can not run this extension and CallTips extension at the same time. From guido@cnri.reston.va.us Fri Mar 3 14:51:13 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 3 Mar 2000 09:51:13 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle PyParse.py,1.4,1.5 Message-ID: <200003031451.JAA21192@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory eric:/projects/python/develop/guido/src/Tools/idle Modified Files: PyParse.py Log Message: Patch by Tim Peters: Changes the one regexp in PyParse capable of making the re module blow the C stack when passed unreasonable <0.9 wink> program text. Jeremy Hylton provoked this with a program of the form: x = (1, 2, ... # 9997 lines deleted here 10000, ) Programs "like this" will no longer (no matter how many lines they contain) trigger re death. OTOH, you can now make another class of unreasonable program that will take much longer to parse. Index: PyParse.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/PyParse.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** PyParse.py 1999/06/07 14:28:14 1.4 --- PyParse.py 2000/03/03 14:51:11 1.5 *************** *** 84,96 **** """, re.VERBOSE).match ! # Chew up non-special chars as quickly as possible, but retaining ! # enough info to determine the last non-ws char seen; if match is ! # successful, and m.group(1) isn't None, m.end(1) less 1 is the ! # index of the last non-ws char matched. _chew_ordinaryre = re.compile(r""" ! (?: \s+ ! | ( [^\s[\](){}#'"\\]+ ) ! )+ """, re.VERBOSE).match --- 84,94 ---- """, re.VERBOSE).match ! # Chew up non-special chars as quickly as possible. If match is ! # successful, m.end() less 1 is the index of the last boring char ! # matched. If match is unsuccessful, the string starts with an ! # interesting char. _chew_ordinaryre = re.compile(r""" ! [^[\](){}#'"\\]+ """, re.VERBOSE).match *************** *** 387,394 **** m = _chew_ordinaryre(str, p, q) if m: ! i = m.end(1) - 1 # last non-ws (if any) if i >= 0: lastch = str[i] - p = m.end() if p >= q: break --- 385,396 ---- m = _chew_ordinaryre(str, p, q) if m: ! # we skipped at least one boring char ! p = m.end() ! # back up over totally boring whitespace ! i = p-1 # index of last boring char ! while i >= 0 and str[i] in " \t\n": ! i = i-1 if i >= 0: lastch = str[i] if p >= q: break From fdrake@weyr.cnri.reston.va.us Fri Mar 3 14:58:33 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Mar 2000 09:58:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc TODO,1.24.2.4,1.24.2.5 Message-ID: <200003031458.JAA13382@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc In directory weyr:/home/fdrake/projects/python/Doc-152p2 Modified Files: Tag: release152p1-patches TODO Log Message: Remove one item from the list, move another to the right section Index: TODO =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/TODO,v retrieving revision 1.24.2.4 retrieving revision 1.24.2.5 diff -C2 -r1.24.2.4 -r1.24.2.5 *** TODO 2000/02/21 21:04:11 1.24.2.4 --- TODO 2000/03/03 14:58:31 1.24.2.5 *************** *** 28,35 **** the extension manual if the function is mentioned. - * Ask Vladimir Marangozov to document - the memory allocation APIs; this could be part of his proposed - cleanup. ;) - * PyErr_SetInterrupt(): XXX comment about platform dependence should be resolved, or explain the problem. Ask Guido for explanation. --- 28,31 ---- *************** *** 51,61 **** Also noted by Albert Hofkamp . - * Update the pickle documentation to describe all of the current - behavior; only a subset is described. __reduce__, etc. Partial - update submitted by Jim Kerr . - Library Reference ----------------- * Straighten out random/whrandom. Things are generally in the right --- 47,57 ---- Also noted by Albert Hofkamp . Library Reference ----------------- + + * Update the pickle documentation to describe all of the current + behavior; only a subset is described. __reduce__, etc. Partial + update submitted by Jim Kerr . * Straighten out random/whrandom. Things are generally in the right From fdrake@weyr.cnri.reston.va.us Fri Mar 3 15:37:41 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Mar 2000 10:37:41 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs python.sty,1.53,1.53.2.1 Message-ID: <200003031537.KAA13633@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/texinputs In directory weyr:/home/fdrake/projects/python/Doc-152p2/texinputs Modified Files: Tag: release152p1-patches python.sty Log Message: ctypedesc environment: Accept an optional parameter: name to use in the index. This is needed so that function types don't get the whole signature in the index, sorted by return type. csimplemacro environment: Poorly named environment used only for the Py_*_THREADS macros, which are weird beasts. But ctypedesc is no longer suitable since it annotates the name in the index with "(C type)". Index: python.sty =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.53 retrieving revision 1.53.2.1 diff -C2 -r1.53 -r1.53.2.1 *** python.sty 1999/06/29 18:15:59 1.53 --- python.sty 2000/03/03 15:37:38 1.53.2.1 *************** *** 529,536 **** % C data types ----------------------------------------------------------- ! % \begin{ctypedesc}{typedef name} ! \newenvironment{ctypedesc}[1]{ \begin{fulllineitems} ! \item[\bfcode{#1}\ttindex{#1}] }{\end{fulllineitems}} --- 529,551 ---- % C data types ----------------------------------------------------------- ! % \begin{ctypedesc}[index name]{typedef name} ! \let\py@classbadkey=\@undefined ! ! \newenvironment{ctypedesc}[2][\py@badkey]{ \begin{fulllineitems} ! \item[\bfcode{#2}% ! \ifx#1\@undefined% ! \withsubitem{(C type)}{\ttindex{#2}}% ! \else% ! \withsubitem{(C type)}{\ttindex{#1}}% ! \fi] ! }{\end{fulllineitems}} ! ! % Funky macros ----------------------------------------------------------- ! % \begin{csimplemacro}{name} ! % -- "simple" because it has no args; NOT for constant definitions! ! \newenvironment{csimplemacrodesc}[1]{ ! \begin{fulllineitems} ! \item[\bfcode{#1}\withsubitem{(macro)}{\ttindex{#1}}] }{\end{fulllineitems}} From fdrake@weyr.cnri.reston.va.us Fri Mar 3 16:28:28 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Mar 2000 11:28:28 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.65.2.5,1.65.2.6 Message-ID: <200003031628.LAA14127@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/perl In directory weyr:/home/fdrake/projects/python/Doc-152p2/perl Modified Files: Tag: release152p1-patches python.perl Log Message: Update to reflect the latest changes to python.sty. Index: python.perl =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.65.2.5 retrieving revision 1.65.2.6 diff -C2 -r1.65.2.5 -r1.65.2.6 *** python.perl 2000/02/21 17:05:09 1.65.2.5 --- python.perl 2000/03/03 16:28:25 1.65.2.6 *************** *** 350,354 **** sub new_link_info{ my $name = "l2h-" . ++$globals{'max_id'}; ! my $aname = ''; my $ahref = gen_link($CURRENT_FILE, $name); return ($name, $aname, $ahref); --- 350,354 ---- sub new_link_info{ my $name = "l2h-" . ++$globals{'max_id'}; ! my $aname = ""; my $ahref = gen_link($CURRENT_FILE, $name); return ($name, $aname, $ahref); *************** *** 623,633 **** } sub do_env_ctypedesc{ local($_) = @_; my $type_name = next_argument(); ! my $idx = make_str_index_entry("$type_name" ! . get_indexsubitem()); ! $idx =~ s/ \(.*\)//; ! return "
$idx\n
" . $_ . '
' --- 623,644 ---- } + sub do_env_csimplemacrodesc{ + local($_) = @_; + my $name = next_argument(); + my $idx = make_str_index_entry("$name"); + return "
$idx\n
" + . $_ + . '
' + } + sub do_env_ctypedesc{ local($_) = @_; + my $index_name = next_optional_argument(); my $type_name = next_argument(); ! $index_name = $type_name ! unless $index_name; ! my($name,$aname,$ahref) = new_link_info(); ! add_index_entry("$index_name (C type)", $ahref); ! return "
$aname$type_name\n
" . $_ . '
' From fdrake@weyr.cnri.reston.va.us Fri Mar 3 16:30:13 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Mar 2000 11:30:13 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/tools buildindex.py,1.10,1.10.4.1 Message-ID: <200003031630.LAA14159@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/tools In directory weyr:/home/fdrake/projects/python/Doc-152p2/tools Modified Files: Tag: release152p1-patches buildindex.py Log Message: Fix up regular expression that tosses and from the entry; it didn't catch all cases so lots of stuff got indexed under '<' instead of the appropriate letter. Index: buildindex.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/tools/buildindex.py,v retrieving revision 1.10 retrieving revision 1.10.4.1 diff -C2 -r1.10 -r1.10.4.1 *** buildindex.py 1999/02/24 16:36:48 1.10 --- buildindex.py 2000/03/03 16:30:11 1.10.4.1 *************** *** 1,5 **** #! /usr/bin/env python ! __version__ = '$Revision: 1.10 $' import os --- 1,5 ---- #! /usr/bin/env python ! __version__ = '$Revision: 1.10.4.1 $' import os *************** *** 78,82 **** ! _rmtt = re.compile(r"(.*)(.*)(.*)$", re.IGNORECASE) _rmparens = re.compile(r"\(\)") --- 78,82 ---- ! _rmtt = re.compile(r"""(.*)(.*)(.*)$""", re.IGNORECASE) _rmparens = re.compile(r"\(\)") From fdrake@weyr.cnri.reston.va.us Fri Mar 3 16:32:50 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Mar 2000 11:32:50 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.56.2.15,1.56.2.16 Message-ID: <200003031632.LAA14198@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/api In directory weyr:/home/fdrake/projects/python/Doc-152p2/api Modified Files: Tag: release152p1-patches api.tex Log Message: Update to the new markup so that a better index is generated in a few cases. Restructure the "Defining New Types" chapter (incomplete). Index: api.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/api/api.tex,v retrieving revision 1.56.2.15 retrieving revision 1.56.2.16 diff -C2 -r1.56.2.15 -r1.56.2.16 *** api.tex 2000/02/29 16:12:55 1.56.2.15 --- api.tex 2000/03/03 16:32:47 1.56.2.16 *************** *** 1122,1126 **** \end{cfuncdesc} ! \begin{ctypedesc}{struct _frozen} This is the structure type definition for frozen module descriptors, as generated by the \program{freeze}\index{freeze utility} utility --- 1122,1126 ---- \end{cfuncdesc} ! \begin{ctypedesc}[_frozen]{struct _frozen} This is the structure type definition for frozen module descriptors, as generated by the \program{freeze}\index{freeze utility} utility *************** *** 3162,3167 **** \end{cfuncdesc} ! % XXX These aren't really C types, but the ctypedesc macro is the simplest! ! \begin{ctypedesc}{Py_BEGIN_ALLOW_THREADS} This macro expands to \samp{\{ PyThreadState *_save; _save = PyEval_SaveThread();}. --- 3162,3166 ---- \end{cfuncdesc} ! \begin{csimplemacrodesc}{Py_BEGIN_ALLOW_THREADS} This macro expands to \samp{\{ PyThreadState *_save; _save = PyEval_SaveThread();}. *************** *** 3170,3176 **** discussion of this macro. It is a no-op when thread support is disabled at compile time. ! \end{ctypedesc} ! \begin{ctypedesc}{Py_END_ALLOW_THREADS} This macro expands to \samp{PyEval_RestoreThread(_save); \}}. --- 3169,3175 ---- discussion of this macro. It is a no-op when thread support is disabled at compile time. ! \end{csimplemacrodesc} ! \begin{csimplemacrodesc}{Py_END_ALLOW_THREADS} This macro expands to \samp{PyEval_RestoreThread(_save); \}}. *************** *** 3179,3197 **** discussion of this macro. It is a no-op when thread support is disabled at compile time. ! \end{ctypedesc} ! \begin{ctypedesc}{Py_BEGIN_BLOCK_THREADS} This macro expands to \samp{PyEval_RestoreThread(_save);} i.e. it is equivalent to \code{Py_END_ALLOW_THREADS} without the closing brace. It is a no-op when thread support is disabled at compile time. ! \end{ctypedesc} ! \begin{ctypedesc}{Py_BEGIN_UNBLOCK_THREADS} This macro expands to \samp{_save = PyEval_SaveThread();} i.e. it is equivalent to \code{Py_BEGIN_ALLOW_THREADS} without the opening brace and variable declaration. It is a no-op when thread support is disabled at compile time. ! \end{ctypedesc} All of the following functions are only available when thread support --- 3178,3196 ---- discussion of this macro. It is a no-op when thread support is disabled at compile time. ! \end{csimplemacrodesc} ! \begin{csimplemacrodesc}{Py_BEGIN_BLOCK_THREADS} This macro expands to \samp{PyEval_RestoreThread(_save);} i.e. it is equivalent to \code{Py_END_ALLOW_THREADS} without the closing brace. It is a no-op when thread support is disabled at compile time. ! \end{csimplemacrodesc} ! \begin{csimplemacrodesc}{Py_BEGIN_UNBLOCK_THREADS} This macro expands to \samp{_save = PyEval_SaveThread();} i.e. it is equivalent to \code{Py_BEGIN_ALLOW_THREADS} without the opening brace and variable declaration. It is a no-op when thread support is disabled at compile time. ! \end{csimplemacrodesc} All of the following functions are only available when thread support *************** *** 3487,3490 **** --- 3486,3498 ---- Py_BuildValue + DL_IMPORT + + Py*_Check + + _Py_NoneStruct + + + \section{Common Object Structures \label{common-structs}} + PyObject, PyVarObject *************** *** 3497,3534 **** setattrofunc, cmpfunc, reprfunc, hashfunc - \begin{ctypedesc}{int (*getreadbufferproc) (PyObject *self, int segment, - void **ptrptr)} - \end{ctypedesc} ! \begin{ctypedesc}{int (*getwritebufferproc) (PyObject *self, int segment, ! void **ptrptr)} ! Return a pointer to a writable memory buffer in \code{*\var{ptrptr}}; ! the memory buffer must correspond to buffer segment \var{segment}. ! Must return \code{-1} and set an exception on error. ! \exception{TypeError} should be raised if the object only supports ! read-only buffers, and \exception{SystemError} should be raised when ! \var{segment} specifies a segment that doesn't exist. ! % Why doesn't it raise ValueError for this one? ! % GJS: because you shouldn't be calling it with an invalid ! % segment. That indicates a blatant programming error in the C ! % code. ! \end{ctypedesc} ! \begin{ctypedesc}{int (*getsegcountproc) (PyObject *self, int *lenp)} ! \end{ctypedesc} ! \begin{ctypedesc}{int (*getcharbufferproc) (PyObject *self, int segment, ! const char **ptrptr)} ! \end{ctypedesc} PyNumberMethods PySequenceMethods - PyMappingMethods ! \begin{ctypedesc}{PyBufferProcs} ! \code{PyBufferProcs} defines a set of slots for a Python type ! object. These slots are used to implement the ``buffer interface.'' The buffer interface exports a model where an object can expose its --- 3505,3526 ---- setattrofunc, cmpfunc, reprfunc, hashfunc ! \section{Mapping Object Structures \label{mapping-structs}} ! PyMappingMethods ! ! \section{Number Object Structures \label{number-structs}} PyNumberMethods + + \section{Sequence Object Structures \label{sequence-structs}} + PySequenceMethods ! \section{Buffer Object Structures \label{buffer-structs}} ! \sectionauthor{Greg J. Stein}{greg@lyra.org} The buffer interface exports a model where an object can expose its *************** *** 3539,3544 **** If an object does not export the buffer interface, then its \member{tp_as_buffer} member in the \ctype{PyTypeObject} structure ! should be \NULL{}. Otherwise, \member{tp_as_buffer} will point to a ! \ctype{PyBufferProcs} structure. \emph{Note:} it is very important that your --- 3531,3536 ---- If an object does not export the buffer interface, then its \member{tp_as_buffer} member in the \ctype{PyTypeObject} structure ! should be \NULL{}. Otherwise, the \member{tp_as_buffer} will point to ! a \ctype{PyBufferProcs} structure. \emph{Note:} it is very important that your *************** *** 3550,3553 **** --- 3542,3550 ---- to be able to test for its presence before using it. + + \begin{ctypedesc}{PyBufferProcs} + \code{PyBufferProcs} defines a set of slots for a Python type + object. These slots are used to implement the ``buffer interface.'' + The first slot in the \ctype{PyBufferProcs} structure is \member{bf_getreadbuffer}, which has type *************** *** 3593,3606 **** binary in nature, and those which have character-based content. ! \emph{Note:} the current policy seems to state that these ! characters may be multi-byte characters. This implies that a buffer ! size of \var{N} does not mean there are \var{N} characters present. \end{ctypedesc} ! DL_IMPORT ! Py*_Check ! _Py_NoneStruct --- 3590,3623 ---- binary in nature, and those which have character-based content. ! \emph{Note:} The current policy seems to state that these characters ! may be multi-byte characters. This implies that a buffer size of ! \var{N} does not mean there are \var{N} characters present. \end{ctypedesc} ! \begin{ctypedesc}[getreadbufferproc]{int (*getreadbufferproc) ! (PyObject *self, int segment, void **ptrptr)} ! \end{ctypedesc} ! \begin{ctypedesc}[getwritebufferproc]{int (*getwritebufferproc) ! (PyObject *self, int segment, void **ptrptr)} ! Return a pointer to a writable memory buffer in \code{*\var{ptrptr}}; ! the memory buffer must correspond to buffer segment \var{segment}. ! Must return \code{-1} and set an exception on error. ! \exception{TypeError} should be raised if the object only supports ! read-only buffers, and \exception{SystemError} should be raised when ! \var{segment} specifies a segment that doesn't exist. ! % Why doesn't it raise ValueError for this one? ! % GJS: because you shouldn't be calling it with an invalid ! % segment. That indicates a blatant programming error in the C ! % code. ! \end{ctypedesc} ! \begin{ctypedesc}[getsegcountproc]{int (*getsegcountproc) ! (PyObject *self, int *lenp)} ! \end{ctypedesc} ! ! \begin{ctypedesc}[getcharbufferproc]{int (*getcharbufferproc) ! (PyObject *self, int segment, const char **ptrptr)} ! \end{ctypedesc} From fdrake@weyr.cnri.reston.va.us Fri Mar 3 17:54:16 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Mar 2000 12:54:16 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/doc doc.tex,1.12.2.2,1.12.2.3 Message-ID: <200003031754.MAA15514@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/doc In directory weyr:/home/fdrake/projects/python/Doc-152p2/doc Modified Files: Tag: release152p1-patches doc.tex Log Message: \sectionauthor: now documented. \email: note that the domain name should be lowercase. Index: doc.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.12.2.2 retrieving revision 1.12.2.3 diff -C2 -r1.12.2.2 -r1.12.2.3 *** doc.tex 2000/02/21 15:29:55 1.12.2.2 --- doc.tex 2000/03/03 17:54:13 1.12.2.3 *************** *** 224,227 **** --- 224,240 ---- facilities. + \subsection{Meta-information Markup \label{meta-info}} + + \begin{macrodesc}{sectionauthor}{\p{author}\p{email}} + Identifies the author of the current section. \var{author} + should be the author's name such that it can be used for + presentation (though it isn't), and \var{email} should be the + author's email address. The domain name portion of + the address should be lower case. + + No presentation is generated from this markup, but it is used to + help keep track of contributions. + \end{macrodesc} + \subsection{Information Units \label{info-units}} *************** *** 405,409 **** \begin{macrodesc}{email}{\p{address}} An email address. Note that this is \emph{not} hyperlinked in ! any of the possible output formats. \end{macrodesc} --- 418,423 ---- \begin{macrodesc}{email}{\p{address}} An email address. Note that this is \emph{not} hyperlinked in ! any of the possible output formats. The domain name portion of ! the address should be lower case. \end{macrodesc} From jhylton@cnri.reston.va.us Fri Mar 3 20:44:00 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Fri, 3 Mar 2000 15:44:00 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib ConfigParser.py,1.16,1.17 Message-ID: <200003032044.PAA08614@bitdiddle.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory bitdiddle:/home/jhylton/python/src/Lib Modified Files: ConfigParser.py Log Message: allow comments beginning with ; in key: value as well as key = value Index: ConfigParser.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** ConfigParser.py 2000/02/28 23:23:55 1.16 --- ConfigParser.py 2000/03/03 20:43:57 1.17 *************** *** 359,363 **** optname, vi, optval = mo.group('option', 'vi', 'value') optname = string.lower(optname) ! if vi == '=' and ';' in optval: # ';' is a comment delimiter only if it follows # a spacing character --- 359,363 ---- optname, vi, optval = mo.group('option', 'vi', 'value') optname = string.lower(optname) ! if vi in ('=', ':') and ';' in optval: # ';' is a comment delimiter only if it follows # a spacing character From fdrake@weyr.cnri.reston.va.us Fri Mar 3 22:41:48 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Mar 2000 17:41:48 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libundoc.tex,1.67.2.3,1.67.2.4 Message-ID: <200003032241.RAA16419@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libundoc.tex Log Message: Update description of what to do about obsolete modules; previous explanation did not accomodate some being .py and some .so. Index: libundoc.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libundoc.tex,v retrieving revision 1.67.2.3 retrieving revision 1.67.2.4 diff -C2 -r1.67.2.3 -r1.67.2.4 *** libundoc.tex 2000/02/21 16:21:21 1.67.2.3 --- libundoc.tex 2000/03/03 22:41:45 1.67.2.4 *************** *** 87,98 **** ! \section{Obsolete} ! These modules are not on the standard module search path; ! \indexiii{module}{search}{path} ! but are available in the directory \file{lib-old/} installed under ! \file{\textrm{\$prefix}/lib/python1.5/}. % $ <-- bow to font lock ! To use any of these modules, add that directory to \code{sys.path}, ! possibly using \envvar{PYTHONPATH}. \begin{description} --- 87,107 ---- ! \section{Obsolete \label{obsolete-modules}} ! These modules are not normally available for import; additional work ! must be done to make them available. ! ! Those which are written in Python will be installed into the directory ! \file{lib-old/} installed as part of the standard library. To use ! these, the directory must be added to \code{sys.path}, possibly using ! \envvar{PYTHONPATH}. ! ! Obsolete extension modules written in C are not built by default. ! Under \UNIX, these must be enabled by uncommenting the appropriate ! lines in \file{Modules/Setup} in the build tree and either rebuilding ! Python if the modules are statically linked, or building and ! installing the shared object if using dynamically-loaded extensions. ! ! % XXX need Windows instructions! \begin{description} From jhylton@cnri.reston.va.us Fri Mar 3 22:57:45 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Fri, 3 Mar 2000 17:57:45 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle IdleConf.py,NONE,1.1 config-unix.txt,NONE,1.1 config-win.txt,NONE,1.1 config.txt,NONE,1.1 Message-ID: <200003032257.RAA08714@bitdiddle.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory bitdiddle:/home/jhylton/python/src/Tools/idle Added Files: IdleConf.py config-unix.txt config-win.txt config.txt Log Message: a ConfigParser for idle and three configuration files From jhylton@cnri.reston.va.us Fri Mar 3 23:00:44 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Fri, 3 Mar 2000 18:00:44 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle IdleConf.py,1.1,1.2 Message-ID: <200003032300.SAA08733@bitdiddle.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory bitdiddle:/home/jhylton/python/src/Tools/idle Modified Files: IdleConf.py Log Message: default to cwd if os.environ['HOME'] does not exist Index: IdleConf.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/IdleConf.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** IdleConf.py 2000/03/03 22:57:41 1.1 --- IdleConf.py 2000/03/03 23:00:41 1.2 *************** *** 101,110 **** platfile = os.path.join(dir, "config-%s.txt" % sys.platform) for file in (os.path.join(dir, "config.txt"), genplatfile, platfile, ! # XXX watch out for KeyError ! os.path.join(os.environ['HOME'], ".idle"), ): try: --- 101,114 ---- platfile = os.path.join(dir, "config-%s.txt" % sys.platform) + + try: + homedir = os.environ['HOME'] + except KeyError: + homedir = os.getcwd() for file in (os.path.join(dir, "config.txt"), genplatfile, platfile, ! os.path.join(homedir, ".idle"), ): try: From jhylton@cnri.reston.va.us Fri Mar 3 23:06:48 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Fri, 3 Mar 2000 18:06:48 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle ColorDelegator.py,1.8,1.9 EditorWindow.py,1.30,1.31 ParenMatch.py,1.1,1.2 PyShell.py,1.24,1.25 idle.py,1.1,1.2 extend.py,1.4,NONE Message-ID: <200003032306.SAA08771@bitdiddle.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory bitdiddle:/home/jhylton/python/src/Tools/idle Modified Files: ColorDelegator.py EditorWindow.py ParenMatch.py PyShell.py idle.py Removed Files: extend.py Log Message: migrate to use of IdleConf and config files to set options idle.py: Load the config files before anything else happens XXX Need to define standard way to get files relative to the IDLE install dir PyShell.py: ColorDelegator.py: Get color defns out of IdleConf instead of IdlePrefs EditorWindow.py: Replace hard-coded font & window size with config options Get extension names via IdleConf.getextensions extend.py: Obsolete. Extensions defined in config file. ParenMatch.py: Use config file for extension options. Revise comment about parser requirements. Simplify logic on find returning None. Index: ColorDelegator.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/ColorDelegator.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** ColorDelegator.py 1999/04/26 22:20:38 1.8 --- ColorDelegator.py 2000/03/03 23:06:44 1.9 *************** *** 5,9 **** from Tkinter import * from Delegator import Delegator ! import IdlePrefs #$ event <> --- 5,9 ---- from Tkinter import * from Delegator import Delegator ! from IdleConf import IdleConf #$ event <> *************** *** 52,78 **** self.tag_raise('sel') ! cprefs = IdlePrefs.ColorPrefs() tagdefs = { ! "COMMENT": {"foreground": cprefs.CComment[0], ! "background": cprefs.CComment[1]}, ! "KEYWORD": {"foreground": cprefs.CKeyword[0], ! "background": cprefs.CKeyword[1]}, ! "STRING": {"foreground": cprefs.CString[0], ! "background": cprefs.CString[1]}, ! "DEFINITION": {"foreground": cprefs.CDefinition[0], ! "background": cprefs.CDefinition[1]}, ! ! "SYNC": {"background": cprefs.CSync[0], ! "background": cprefs.CSync[1]}, ! "TODO": {"background": cprefs.CTodo[0], ! "background": cprefs.CTodo[1]}, ! ! "BREAK": {"background": cprefs.CBreak[0], ! "background": cprefs.CBreak[1]}, ! # The following is used by ReplaceDialog: ! "hit": {"foreground": cprefs.CHit[0], ! "background": cprefs.CHit[1]}, } --- 52,67 ---- self.tag_raise('sel') ! cconf = IdleConf.getsection('Colors') tagdefs = { ! "COMMENT": cconf.getcolor("comment"), ! "KEYWORD": cconf.getcolor("keyword"), ! "STRING": cconf.getcolor("string"), ! "DEFINITION": cconf.getcolor("definition"), ! "SYNC": cconf.getcolor("sync"), ! "TODO": cconf.getcolor("todo"), ! "BREAK": cconf.getcolor("break"), # The following is used by ReplaceDialog: ! "hit": cconf.getcolor("hit"), } Index: EditorWindow.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/EditorWindow.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** EditorWindow.py 2000/02/17 16:14:16 1.30 --- EditorWindow.py 2000/03/03 23:06:44 1.31 *************** *** 9,30 **** import idlever import WindowList - # Customization of default window size and font - # standard - WIDTH = 80 - HEIGHT = 24 - if sys.platform[:3] == 'win': - FONT = ("courier new", 10) - else: - FONT = ("courier", 10) - if 0: - # for demos (on Windows) - WIDTH = 70 - HEIGHT = 16 - FONT = ("lucida console", 14) - if 0: - # for Windows 98 - FONT = ("lucida console", 8) - # The default tab setting for a Text widget, in average-width characters. TK_TABWIDTH_DEFAULT = 8 --- 9,14 ---- import idlever import WindowList + from IdleConf import IdleConf # The default tab setting for a Text widget, in average-width characters. TK_TABWIDTH_DEFAULT = 8 *************** *** 111,115 **** def __init__(self, flist=None, filename=None, key=None, root=None): ! cprefs = self.ColorDelegator.cprefs self.flist = flist root = root or flist.root --- 95,100 ---- def __init__(self, flist=None, filename=None, key=None, root=None): ! edconf = IdleConf.getsection('EditorWindow') ! coconf = IdleConf.getsection('Colors') self.flist = flist root = root or flist.root *************** *** 122,132 **** self.text_frame = text_frame = Frame(top) self.text = text = Text(text_frame, name='text', padx=5, ! foreground=cprefs.CNormal[0], ! background=cprefs.CNormal[1], ! highlightcolor=cprefs.CHilite[0], ! highlightbackground=cprefs.CHilite[1], ! insertbackground=cprefs.CCursor[1], ! width=WIDTH, height=HEIGHT, ! wrap="none") self.createmenubar() --- 107,118 ---- self.text_frame = text_frame = Frame(top) self.text = text = Text(text_frame, name='text', padx=5, ! foreground=coconf.getdef('normal-foreground'), ! background=coconf.getdef('normal-background'), ! highlightcolor=coconf.getdef('hilite-foreground'), ! highlightbackground=coconf.getdef('hilite-background'), ! insertbackground=coconf.getdef('cursor-background'), ! width=edconf.getint('width'), ! height=edconf.getint('height'), ! wrap="none") self.createmenubar() *************** *** 157,161 **** text['yscrollcommand'] = vbar.set ! text['font'] = FONT text_frame.pack(side=LEFT, fill=BOTH, expand=1) text.pack(side=TOP, fill=BOTH, expand=1) --- 143,147 ---- text['yscrollcommand'] = vbar.set ! text['font'] = edconf.get('font-name'), edconf.get('font-size') text_frame.pack(side=LEFT, fill=BOTH, expand=1) text.pack(side=TOP, fill=BOTH, expand=1) *************** *** 545,550 **** def get_standard_extension_names(self): ! import extend ! return extend.standard def load_extension(self, name): --- 531,535 ---- def get_standard_extension_names(self): ! return IdleConf.getextensions() def load_extension(self, name): Index: ParenMatch.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/ParenMatch.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ParenMatch.py 2000/03/02 19:06:57 1.1 --- ParenMatch.py 2000/03/03 23:06:44 1.2 *************** *** 15,18 **** --- 15,19 ---- import PyParse from AutoIndent import AutoIndent, index2line + from IdleConf import IdleConf class ParenMatch: *************** *** 56,65 **** unix_keydefs = {} ! STYLE = "default" # or "expression" ! FLASH_DELAY = 500 ! HILITE_CONFIG = {"foreground": "black", ! "background": "#43cd80", # SeaGreen3 ! } ! BELL = 1 # set to false for no bell def __init__(self, editwin): --- 57,66 ---- unix_keydefs = {} ! iconf = IdleConf.getsection('ParenMatch') ! STYLE = iconf.get('style') ! FLASH_DELAY = iconf.getint('flash-delay') ! HILITE_CONFIG = iconf.getcolor('hilite') ! BELL = iconf.getboolean('bell') ! del iconf def __init__(self, editwin): *************** *** 157,163 **** startatindex = `startat` + ".0" # rawtext needs to contain everything up to the last ! # character, which was the close paren. also need to ! # append "\n" to please the parser, which seems to expect ! # a complete line rawtext = self.text.get(startatindex, "insert")[:-1] + "\n" y.set_str(rawtext) --- 158,163 ---- startatindex = `startat` + ".0" # rawtext needs to contain everything up to the last ! # character, which was the close paren. the parser also ! # requires that the last line ends with "\n" rawtext = self.text.get(startatindex, "insert")[:-1] + "\n" y.set_str(rawtext) *************** *** 175,181 **** lno = index2line(self.text.index("insert")) i, buf = self._find_offset_in_buf(lno) ! if i is None: ! return i ! if keysym_type(buf[i]) != right_keysym_type: return None lines_back = buf[i:].count("\n") - 1 --- 175,180 ---- lno = index2line(self.text.index("insert")) i, buf = self._find_offset_in_buf(lno) ! if i is None \ ! or keysym_type(buf[i]) != right_keysym_type: return None lines_back = buf[i:].count("\n") - 1 Index: PyShell.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/PyShell.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** PyShell.py 1999/06/25 17:26:34 1.24 --- PyShell.py 2000/03/03 23:06:44 1.25 *************** *** 17,20 **** --- 17,21 ---- from ColorDelegator import ColorDelegator from OutputWindow import OutputWindow + from IdleConf import IdleConf import idlever *************** *** 115,133 **** tagdefs = ColorDelegator.tagdefs.copy() ! cprefs = ColorDelegator.cprefs tagdefs.update({ ! "stdin": {"foreground": cprefs.CStdIn[0], ! "background": cprefs.CStdIn[1]}, ! "stdout": {"foreground": cprefs.CStdOut[0], ! "background": cprefs.CStdOut[1]}, ! "stderr": {"foreground": cprefs.CStdErr[0], ! "background": cprefs.CStdErr[1]}, ! "console": {"foreground": cprefs.CConsole[0], ! "background": cprefs.CConsole[1]}, ! "ERROR": {"background": cprefs.CError[0], ! "background": cprefs.CError[1]}, ! None: {"foreground": cprefs.CNormal[0], ! "background": cprefs.CNormal[1]}, }) --- 116,128 ---- tagdefs = ColorDelegator.tagdefs.copy() ! cconf = IdleConf.getsection('Colors') tagdefs.update({ ! "stdin": cconf.getcolor("stdin"), ! "stdout": cconf.getcolor("stdout"), ! "stderr": cconf.getcolor("stderr"), ! "console": cconf.getcolor("console"), ! "ERROR": cconf.getcolor("ERROR"), ! None: cconf.getcolor("normal"), }) Index: idle.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/idle.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** idle.py 1999/01/28 18:50:31 1.1 --- idle.py 2000/03/03 23:06:45 1.2 *************** *** 1,3 **** --- 1,12 ---- #! /usr/bin/env python + + import os + import sys + import IdleConf + + idle_dir = os.path.split(sys.argv[0])[0] + IdleConf.load(idle_dir) + + # defer importing Pyshell until IdleConf is loaded import PyShell PyShell.main() From jhylton@cnri.reston.va.us Fri Mar 3 23:08:11 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Fri, 3 Mar 2000 18:08:11 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle IdlePrefs.py,1.3,NONE Message-ID: <200003032308.SAA08791@bitdiddle.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory bitdiddle:/home/jhylton/python/src/Tools/idle Removed Files: IdlePrefs.py Log Message: superceded by IdleConf/config.txt From guido@cnri.reston.va.us Mon Mar 6 14:14:04 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 6 Mar 2000 09:14:04 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle IdleConf.py,1.2,1.3 Message-ID: <200003061414.JAA09668@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory eric:/projects/python/develop/guido/src/Tools/idle Modified Files: IdleConf.py Log Message: Don't use 1.6-isms (s.startswith()) -- we want to distribute this before 1.6 is out so it has to be compatible with 1.5.2. Index: IdleConf.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/IdleConf.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** IdleConf.py 2000/03/03 23:00:41 1.2 --- IdleConf.py 2000/03/06 14:14:02 1.3 *************** *** 92,99 **** _dir = dir ! if sys.platform.startswith('win'): genplatfile = os.path.join(dir, "config-win.txt") # XXX don't know what the platform string is on a Mac ! elif sys.platform.startswith('mac'): genplatfile = os.path.join(dir, "config-mac.txt") else: --- 92,99 ---- _dir = dir ! if sys.platform[:3] == 'win': genplatfile = os.path.join(dir, "config-win.txt") # XXX don't know what the platform string is on a Mac ! elif sys.platform[:3] == 'mac': genplatfile = os.path.join(dir, "config-mac.txt") else: From guido@cnri.reston.va.us Mon Mar 6 14:16:44 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 6 Mar 2000 09:16:44 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle ParenMatch.py,1.2,1.3 Message-ID: <200003061416.JAA09690@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory eric:/projects/python/develop/guido/src/Tools/idle Modified Files: ParenMatch.py Log Message: Don't use 1.6-isms (s.startswith()) -- we want to distribute this before 1.6 is out so it has to be compatible with 1.5.2. Index: ParenMatch.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/ParenMatch.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ParenMatch.py 2000/03/03 23:06:44 1.2 --- ParenMatch.py 2000/03/06 14:16:41 1.3 *************** *** 178,185 **** or keysym_type(buf[i]) != right_keysym_type: return None ! lines_back = buf[i:].count("\n") - 1 # subtract one for the "\n" added to please the parser upto_open = buf[:i] ! j = upto_open.rfind("\n") + 1 # offset of column 0 of line offset = i - j return "%d.%d" % (lno - lines_back, offset) --- 178,185 ---- or keysym_type(buf[i]) != right_keysym_type: return None ! lines_back = string.count(buf[i:], "\n") - 1 # subtract one for the "\n" added to please the parser upto_open = buf[:i] ! j = string.rfind(upto_open, "\n") + 1 # offset of column 0 of line offset = i - j return "%d.%d" % (lno - lines_back, offset) From guido@cnri.reston.va.us Mon Mar 6 14:43:23 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 6 Mar 2000 09:43:23 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle IdleConf.py,1.3,1.4 Message-ID: <200003061443.JAA09820@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory eric:/projects/python/develop/guido/src/Tools/idle Modified Files: IdleConf.py Log Message: In getdef(), don't die when the section doesn't exist. Index: IdleConf.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/IdleConf.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** IdleConf.py 2000/03/06 14:14:02 1.3 --- IdleConf.py 2000/03/06 14:43:20 1.4 *************** *** 3,7 **** import os import sys ! from ConfigParser import ConfigParser, NoOptionError class IdleConfParser(ConfigParser): --- 3,7 ---- import os import sys ! from ConfigParser import ConfigParser, NoOptionError, NoSectionError class IdleConfParser(ConfigParser): *************** *** 27,31 **** try: return self.get(sec, options, raw, vars) ! except NoOptionError: return default --- 27,31 ---- try: return self.get(sec, options, raw, vars) ! except (NoSectionError, NoOptionError): return default From bwarsaw@cnri.reston.va.us Mon Mar 6 14:52:21 2000 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Mon, 6 Mar 2000 09:52:21 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.55,2.56 Message-ID: <200003061452.JAA24242@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory anthem:/home/bwarsaw/projects/python/Objects Modified Files: stringobject.c Log Message: string_join(): Fix memory leaks discovered by Charles Waldman (and a few other paths through the function that leaked). Index: stringobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/stringobject.c,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -r2.55 -r2.56 *** stringobject.c 2000/02/29 13:59:28 2.55 --- stringobject.c 2000/03/06 14:52:18 2.56 *************** *** 710,715 **** slen = PyString_GET_SIZE(sitem); while (reslen + slen + seplen >= sz) { ! if (_PyString_Resize(&res, sz*2)) goto finally; sz *= 2; p = PyString_AsString(res) + reslen; --- 710,717 ---- slen = PyString_GET_SIZE(sitem); while (reslen + slen + seplen >= sz) { ! if (_PyString_Resize(&res, sz*2)) { ! Py_DECREF(sitem); goto finally; + } sz *= 2; p = PyString_AsString(res) + reslen; *************** *** 721,724 **** --- 723,727 ---- } memcpy(p, PyString_AS_STRING(sitem), slen); + Py_DECREF(sitem); p += slen; reslen += slen; *************** *** 729,740 **** PyObject *item = PySequence_GetItem(seq, i); PyObject *sitem; ! if (!item || !(sitem = PyObject_Str(item))) { ! Py_XDECREF(item); goto finally; ! } slen = PyString_GET_SIZE(sitem); while (reslen + slen + seplen >= sz) { ! if (_PyString_Resize(&res, sz*2)) goto finally; sz *= 2; p = PyString_AsString(res) + reslen; --- 732,749 ---- PyObject *item = PySequence_GetItem(seq, i); PyObject *sitem; ! ! if (!item) goto finally; ! sitem = PyObject_Str(item); ! Py_DECREF(item); ! if (!sitem) ! goto finally; ! slen = PyString_GET_SIZE(sitem); while (reslen + slen + seplen >= sz) { ! if (_PyString_Resize(&res, sz*2)) { ! Py_DECREF(sitem); goto finally; + } sz *= 2; p = PyString_AsString(res) + reslen; *************** *** 746,749 **** --- 755,759 ---- } memcpy(p, PyString_AS_STRING(sitem), slen); + Py_DECREF(sitem); p += slen; reslen += slen; From fdrake@weyr.cnri.reston.va.us Mon Mar 6 16:24:18 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 6 Mar 2000 11:24:18 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libselect.tex,1.14,1.14.4.1 Message-ID: <200003061624.LAA18391@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libselect.tex Log Message: Typo fix: "used or regular files" --> "used on regular files"; noted by Cheng Zhang . Index: libselect.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libselect.tex,v retrieving revision 1.14 retrieving revision 1.14.4.1 diff -C2 -r1.14 -r1.14.4.1 *** libselect.tex 1999/04/21 17:57:15 1.14 --- libselect.tex 2000/03/06 16:24:15 1.14.4.1 *************** *** 10,14 **** works for sockets; on other operating systems, it also works for other file types (in particular, on \UNIX{}, it works on pipes). It cannot ! be used or regular files to determine whether a file has grown since it was last read. --- 10,14 ---- works for sockets; on other operating systems, it also works for other file types (in particular, on \UNIX{}, it works on pipes). It cannot ! be used on regular files to determine whether a file has grown since it was last read. From fdrake@weyr.cnri.reston.va.us Mon Mar 6 16:57:09 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 6 Mar 2000 11:57:09 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.20.2.4,1.20.2.5 Message-ID: <200003061657.LAA18823@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libstdtypes.tex Log Message: "described section" --> "described in section" Index: libstdtypes.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.20.2.4 retrieving revision 1.20.2.5 diff -C2 -r1.20.2.4 -r1.20.2.5 *** libstdtypes.tex 2000/03/01 16:21:16 1.20.2.4 --- libstdtypes.tex 2000/03/06 16:57:06 1.20.2.5 *************** *** 731,735 **** File objects are implemented using \C{}'s \code{stdio} package and can be created with the built-in function ! \function{open()}\bifuncindex{open} described section \ref{built-in-funcs}, ``Built-in Functions.'' They are also returned by some other built-in functions and methods, e.g., --- 731,735 ---- File objects are implemented using \C{}'s \code{stdio} package and can be created with the built-in function ! \function{open()}\bifuncindex{open} described in section \ref{built-in-funcs}, ``Built-in Functions.'' They are also returned by some other built-in functions and methods, e.g., From fdrake@weyr.cnri.reston.va.us Mon Mar 6 16:59:26 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 6 Mar 2000 11:59:26 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/tools mkhtml.sh,1.10.4.1,1.10.4.2 Message-ID: <200003061659.LAA18851@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/tools In directory weyr:/home/fdrake/projects/python/Doc-152p2/tools Modified Files: Tag: release152p1-patches mkhtml.sh Log Message: Add the links from the top of each document to the index of all documents. Only effects the manuals, not the howtos (doc, mac). Index: mkhtml.sh =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/tools/mkhtml.sh,v retrieving revision 1.10.4.1 retrieving revision 1.10.4.2 diff -C2 -r1.10.4.1 -r1.10.4.2 *** mkhtml.sh 2000/02/16 18:50:09 1.10.4.1 --- mkhtml.sh 2000/03/06 16:59:23 1.10.4.2 *************** *** 36,39 **** --- 36,41 ---- latex2html \ -no_auto_link \ + -up_url '../index.html' \ + -up_title 'Documentation Index' \ -init_file $srcdir/perl/l2hinit.perl \ -address '
Send comments on this document to python-docs@python.org.' \ From fdrake@weyr.cnri.reston.va.us Mon Mar 6 17:00:57 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 6 Mar 2000 12:00:57 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/tools buildindex.py,1.10.4.1,1.10.4.2 Message-ID: <200003061700.MAA18878@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/tools In directory weyr:/home/fdrake/projects/python/Doc-152p2/tools Modified Files: Tag: release152p1-patches buildindex.py Log Message: When an entry with sub-entries is continued across columns, make sure the entry name in the second column is marked as a continuation so the reader knows to look at the end of the preceeding column. Index: buildindex.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/tools/buildindex.py,v retrieving revision 1.10.4.1 retrieving revision 1.10.4.2 diff -C2 -r1.10.4.1 -r1.10.4.2 *** buildindex.py 2000/03/03 16:30:11 1.10.4.1 --- buildindex.py 2000/03/06 17:00:55 1.10.4.2 *************** *** 1,5 **** #! /usr/bin/env python ! __version__ = '$Revision: 1.10.4.1 $' import os --- 1,5 ---- #! /usr/bin/env python ! __version__ = '$Revision: 1.10.4.2 $' import os *************** *** 12,15 **** --- 12,17 ---- __rmjunk = re.compile("<#\d+#>") + continuation = 0 + def __init__(self, link, str, seqno): self.links = [link] *************** *** 176,179 **** --- 178,197 ---- end = start + colheight cols.append(nodes[start:end]) + # + # If items continue across columns, make sure they are marked + # as continuations so the user knows to look at the previous column. + # + for i in range(len(cols) - 1): + try: + prev = cols[i][-1] + next = cols[i + 1][0] + except IndexError: + return cols + else: + n = min(len(prev.key), len(next.key)) + for j in range(n): + if prev.key[j] != next.key[j]: + break + next.continuation = j + 1 return cols *************** *** 205,210 **** term = node.text[i] level = level + 1 ! append("\n
%s\n
\n%s
" ! % (term, level * DL_LEVEL_INDENT)) append("\n%s
%s%s" % (level * DL_LEVEL_INDENT, node.links[0], node.text[-1])) --- 223,232 ---- term = node.text[i] level = level + 1 ! if node.continuation > i: ! extra = " (continued)" ! else: ! extra = "" ! append("\n
%s%s\n
\n%s
" ! % (term, extra, level * DL_LEVEL_INDENT)) append("\n%s
%s%s" % (level * DL_LEVEL_INDENT, node.links[0], node.text[-1])) From fdrake@weyr.cnri.reston.va.us Mon Mar 6 17:04:12 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 6 Mar 2000 12:04:12 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.56.2.16,1.56.2.17 Message-ID: <200003061704.MAA18914@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/api In directory weyr:/home/fdrake/projects/python/Doc-152p2/api Modified Files: Tag: release152p1-patches api.tex Log Message: Some additional reorganization of stuff in the buffer section in the last chapter; still not complete. Index: api.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/api/api.tex,v retrieving revision 1.56.2.16 retrieving revision 1.56.2.17 diff -C2 -r1.56.2.16 -r1.56.2.17 *** api.tex 2000/03/03 16:32:47 1.56.2.16 --- api.tex 2000/03/06 17:04:08 1.56.2.17 *************** *** 3248,3251 **** --- 3248,3252 ---- \sectionauthor{Vladimir Marangozov}{Vladimir.Marangozov@inrialpes.fr} + \section{Overview \label{memoryOverview}} *************** *** 3321,3324 **** --- 3322,3326 ---- the I/O buffer escapes completely the Python memory manager. + \section{Memory Interface \label{memoryInterface}} *************** *** 3508,3522 **** \section{Mapping Object Structures \label{mapping-structs}} ! PyMappingMethods \section{Number Object Structures \label{number-structs}} ! PyNumberMethods \section{Sequence Object Structures \label{sequence-structs}} ! PySequenceMethods --- 3510,3533 ---- \section{Mapping Object Structures \label{mapping-structs}} ! \begin{ctypedesc}{PyMappingMethods} ! Structure used to hold pointers to the functions used to implement the ! mapping protocol for an extension type. ! \end{ctypedesc} \section{Number Object Structures \label{number-structs}} ! \begin{ctypedesc}{PyNumberMethods} ! Structure used to hold pointers to the functions an extension type ! uses to implement the number protocol. ! \end{ctypedesc} \section{Sequence Object Structures \label{sequence-structs}} ! \begin{ctypedesc}{PySequenceMethods} ! Structure used to hold pointers to the functions which an object uses ! to implement the sequence protocol. ! \end{ctypedesc} *************** *** 3526,3531 **** The buffer interface exports a model where an object can expose its internal data as a set of chunks of data, each chunk specified as a ! pointer/length pair. These chunks are called ! ``segments'' and are presumed to be non-contiguous in memory. If an object does not export the buffer interface, then its --- 3537,3542 ---- The buffer interface exports a model where an object can expose its internal data as a set of chunks of data, each chunk specified as a ! pointer/length pair. These chunks are called ``segments'' and are ! presumed to be non-contiguous in memory. If an object does not export the buffer interface, then its *************** *** 3534,3568 **** a \ctype{PyBufferProcs} structure. ! \emph{Note:} it is very important that your \ctype{PyTypeObject} structure uses \code{Py_TPFLAGS_DEFAULT} for the ! value of the \member{tp_flags} member. This tells the Python runtime ! that your \ctype{PyBufferProcs} structure contains the ! \member{bf_getcharbuffer} slot. Older versions of Python did not have ! this member, so a new Python interpreter using an old extension needs ! to be able to test for its presence before using it. ! \begin{ctypedesc}{PyBufferProcs} ! \code{PyBufferProcs} defines a set of slots for a Python type ! object. These slots are used to implement the ``buffer interface.'' ! The first slot in the \ctype{PyBufferProcs} structure is ! \member{bf_getreadbuffer}, which has type \ctype{getreadbufferproc}. If this slot is \NULL{}, then the object does not support reading from the internal data. This is ! non-sensical, so implementors should fill this in. The read-buffer ! function is allowed to raise an exception and return ! \code{-1}. Callers should test for \NULL{} before using the slot and ! should check for an exception after calling the function. The ! \var{segment} which is passed must be zero or positive, and strictly ! less than the number of segments returned by the ! \member{bf_getsegcount} slot function. The next slot is \member{bf_getwritebuffer} having type \ctype{getwritebufferproc}. This slot may be \NULL{} if the object ! does not allow writing into its returned buffers. If the slot function ! is present, it is allowed to raise an exception and return \code{-1}. ! The \var{segment} follows the same restrictions as for ! \member{bf_getreadbuffer}. The third slot is \member{bf_getsegcount}, with type --- 3545,3569 ---- a \ctype{PyBufferProcs} structure. ! \emph{Note:} It is very important that your \ctype{PyTypeObject} structure uses \code{Py_TPFLAGS_DEFAULT} for the ! value of the \member{tp_flags} member rather than \code{0}. This ! tells the Python runtime that your \ctype{PyBufferProcs} structure ! contains the \member{bf_getcharbuffer} slot. Older versions of Python ! did not have this member, so a new Python interpreter using an old ! extension needs to be able to test for its presence before using it. \begin{ctypedesc}{PyBufferProcs} ! Structure used to hold the function pointers which define an ! implementation of the buffer protocol. ! The first slot is \member{bf_getreadbuffer}, of type \ctype{getreadbufferproc}. If this slot is \NULL{}, then the object does not support reading from the internal data. This is ! non-sensical, so implementors should fill this in, but callers should ! test that the slot contains a non-\NULL{} value. The next slot is \member{bf_getwritebuffer} having type \ctype{getwritebufferproc}. This slot may be \NULL{} if the object ! does not allow writing into its returned buffers. The third slot is \member{bf_getsegcount}, with type *************** *** 3570,3592 **** inform the caller how many segments the object contains. Simple objects such as \ctype{PyString_Type} and ! \ctype{PyBuffer_Type} objects contain a single segment. The ! \var{lenp} parameter may be \NULL{}. If not, then the implementation ! should store the total size of all buffer segments into \code{*lenp}. ! The last slot is \member{bf_getcharbuffer}, which has type ! \ctype{getcharbufferproc}. This slot will only be present if the \code{Py_TPFLAGS_HAVE_GETCHARBUFFER} flag is present in ! \member{tp_flags} of the object's \ctype{PyTypeObject}. Before using this slot, the caller should test whether it is present by using the ! \cfunction{PyType_HasFeature()} macro. Assuming the slot is present, ! then it may be \NULL{} indicating that the object's contents cannot be ! used a \emph{8-bit characters}. The slot function may also raise an ! error if the object's contents cannot be interpreted as 8-bit ! characters. For example, if the object is an array ! which is configured to hold floating point values, an exception may be ! raised if a caller attempts to use \member{bf_getcharbuffer} to fetch ! a sequence of 8-bit characters. This notion of exporting the internal ! buffers as ``text'' is used to distinguish between objects that are ! binary in nature, and those which have character-based content. \emph{Note:} The current policy seems to state that these characters --- 3571,3592 ---- inform the caller how many segments the object contains. Simple objects such as \ctype{PyString_Type} and ! \ctype{PyBuffer_Type} objects contain a single segment. ! The last slot is \member{bf_getcharbuffer}, of type ! \ctype{getcharbufferproc}. This slot will only be present if the \code{Py_TPFLAGS_HAVE_GETCHARBUFFER} flag is present in ! \member{tp_flags} of the object's \ctype{PyTypeObject}. Before using this slot, the caller should test whether it is present by using the ! \cfunction{PyType_HasFeature()}\ttindex{PyType_HasFeature()} function. ! If present, it may be \NULL, indicating that the object's contents ! cannot be used as \emph{8-bit characters}. ! The slot function may also raise an error if the object's contents ! cannot be interpreted as 8-bit characters. For example, if the object ! is an array which is configured to hold floating point values, an ! exception may be raised if a caller attempts to use ! \member{bf_getcharbuffer} to fetch a sequence of 8-bit characters. ! This notion of exporting the internal buffers as ``text'' is used to ! distinguish between objects that are binary in nature, and those which ! have character-based content. \emph{Note:} The current policy seems to state that these characters *************** *** 3595,3600 **** --- 3595,3614 ---- \end{ctypedesc} + \begin{datadesc}{Py_TPFLAGS_HAVE_GETCHARBUFFER} + Flag bit set in the type structure to indicate that the + \member{bf_getcharbuffer} slot is known. This being set does not + indicate that the object supports the buffer interface or that the + \member{bf_getcharbuffer} slot is non-\NULL. + \end{datadesc} + \begin{ctypedesc}[getreadbufferproc]{int (*getreadbufferproc) (PyObject *self, int segment, void **ptrptr)} + Return a pointer to a readable segment of the buffer. This function + is allowed to raise an exception, in which case it must return + \code{-1}. The \var{segment} which is passed must be zero or + positive, and strictly less than the number of segments returned by + the \member{bf_getsegcount} slot function. On success, returns + \code{0} and sets \code{*\var{ptrptr}} to a pointer to the buffer + memory. \end{ctypedesc} *************** *** 3615,3618 **** --- 3629,3636 ---- \begin{ctypedesc}[getsegcountproc]{int (*getsegcountproc) (PyObject *self, int *lenp)} + Return the number of memory segments which comprise the buffer. If + \var{lenp} is not \NULL, the implementation must report the sum of the + sizes (in bytes) of all segments in \code{*\var{lenp}}. + The function cannot fail. \end{ctypedesc} From guido@cnri.reston.va.us Mon Mar 6 17:16:08 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 6 Mar 2000 12:16:08 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle idle.pyw,1.2,1.3 Message-ID: <200003061716.MAA10378@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory eric:/projects/python/develop/guido/src/Tools/idle Modified Files: idle.pyw Log Message: Defer all the work to idle.py, which has recently become too complicated to copy in-line here. Index: idle.pyw =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/idle.pyw,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** idle.pyw 1999/01/02 21:28:52 1.2 --- idle.pyw 2000/03/06 17:16:05 1.3 *************** *** 1,5 **** try: ! import PyShell ! PyShell.main() except SystemExit: raise --- 1,4 ---- try: ! import idle except SystemExit: raise From jhylton@cnri.reston.va.us Mon Mar 6 18:35:58 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Mon, 6 Mar 2000 13:35:58 -0500 Subject: [Python-checkins] CVS: /python/nondist/src/Compiler/compiler - New directory Message-ID: <200003061835.NAA04028@goon.cnri.reston.va.us> Update of /projects/cvsroot//python/nondist/src/Compiler/compiler In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler/compiler Log Message: Directory /projects/cvsroot//python/nondist/src/Compiler/compiler added to the repository From jhylton@cnri.reston.va.us Mon Mar 6 18:47:31 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Mon, 6 Mar 2000 13:47:31 -0500 Subject: [Python-checkins] CVS: /python/nondist/src/Compiler debug.py,1.2,1.3 Message-ID: <200003061847.NAA04079@goon.cnri.reston.va.us> Update of /projects/cvsroot//python/nondist/src/Compiler In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler Modified Files: debug.py Log Message: give it a main() Index: debug.py =================================================================== RCS file: /projects/cvsroot//python/nondist/src/Compiler/debug.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** debug.py 2000/02/10 00:43:52 1.2 --- debug.py 2000/03/06 18:47:25 1.3 *************** *** 24,27 **** --- 24,31 ---- walk(obj, match) + def main(filename, codename=None): + co = loadCode(filename) + walk(co, codename) + if __name__ == "__main__": import sys *************** *** 31,37 **** filename = sys.argv[1] codename = None ! co = loadCode(filename) ! walk(co, codename) ! --- 35,39 ---- filename = sys.argv[1] codename = None ! main(filename, codename) From jhylton@cnri.reston.va.us Mon Mar 6 18:49:34 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Mon, 6 Mar 2000 13:49:34 -0500 Subject: [Python-checkins] CVS: /python/nondist/src/Compiler/compiler visitor.py,NONE,1.1 Message-ID: <200003061849.NAA04115@goon.cnri.reston.va.us> Update of /projects/cvsroot//python/nondist/src/Compiler/compiler In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler/compiler Added Files: visitor.py Log Message: factor out the tree walking/visitor code that was in compile.py From jhylton@cnri.reston.va.us Mon Mar 6 18:50:51 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Mon, 6 Mar 2000 13:50:51 -0500 Subject: [Python-checkins] CVS: /python/nondist/src/Compiler/compiler ast.py,1.7,1.8 transformer.py,1.7,1.8 Message-ID: <200003061850.NAA04139@goon.cnri.reston.va.us> Update of /projects/cvsroot//python/nondist/src/Compiler/compiler In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler/compiler Modified Files: ast.py transformer.py Log Message: change node Classdef to Class add doc string to transformer module add two helper functions: parse(buf) -> AST parseFile(path) -> AST Index: ast.py =================================================================== RCS file: /projects/cvsroot//python/nondist/src/Compiler/compiler/ast.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** ast.py 2000/02/17 22:06:20 1.7 --- ast.py 2000/03/06 18:50:48 1.8 *************** *** 115,120 **** return "Lambda(%s,%s,%s,%s)" % self._children[1:] ! class Classdef(Node): ! nodes['classdef'] = 'Classdef' def __init__(self, name, bases, doc, code): --- 115,120 ---- return "Lambda(%s,%s,%s,%s)" % self._children[1:] ! class Class(Node): ! nodes['class'] = 'Class' def __init__(self, name, bases, doc, code): *************** *** 123,130 **** self.doc = doc self.code = code ! self._children = ('classdef', name, bases, doc, code) def __repr__(self): ! return "Classdef(%s,%s,%s,%s)" % self._children[1:] class Pass(EmptyNode): --- 123,130 ---- self.doc = doc self.code = code ! self._children = ('class', name, bases, doc, code) def __repr__(self): ! return "Class(%s,%s,%s,%s)" % self._children[1:] class Pass(EmptyNode): Index: transformer.py =================================================================== RCS file: /projects/cvsroot//python/nondist/src/Compiler/compiler/transformer.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** transformer.py 2000/02/16 00:51:37 1.7 --- transformer.py 2000/03/06 18:50:48 1.8 *************** *** 1,15 **** # Copyright 1997-1998 Greg Stein and Bill Tutt # - # transformer.py -- transforms Python parse trees - # - # Takes an input parse tree and transforms it into a higher-level parse - # tree that is a bit more amenable to code generation. Essentially, it - # simply introduces some additional semantics. - # # Written by Greg Stein (gstein@lyra.org) # and Bill Tutt (rassilon@lima.mudlib.org) # February 1997. # ! # Support for Node subclasses written by # Jeremy Hylton (jeremy@cnri.reston.va.us) # --- 1,19 ---- + """Parse tree transformation module. + + Transforms Python source code into an abstract syntax tree (AST) + defined in the ast module. + + The simplest ways to invoke this module are via parse and parseFile. + parse(buf) -> AST + parseFile(path) -> AST + """ + # Copyright 1997-1998 Greg Stein and Bill Tutt # # Written by Greg Stein (gstein@lyra.org) # and Bill Tutt (rassilon@lima.mudlib.org) # February 1997. # ! # Support for Node subclasses written and other revisions by # Jeremy Hylton (jeremy@cnri.reston.va.us) # *************** *** 84,93 **** # - """Parse tree transformation module. - - Exposes the Transformer class with a number of methods for returning a - "cleansed AST" instead of the parse tree that the parser exposes. - """ - import ast import parser --- 88,91 ---- *************** *** 103,106 **** --- 101,113 ---- from consts import OP_ASSIGN, OP_DELETE, OP_APPLY + def parseFile(path): + f = open(path) + src = f.read() + f.close() + return parse(src) + + def parse(buf): + return Transformer().parsesuite(buf) + def asList(nodes): l = [] *************** *** 263,267 **** code = self.com_node(nodelist[-1]) ! n = Node('classdef', name, bases, doc, code) n.lineno = nodelist[1][2] return n --- 270,274 ---- code = self.com_node(nodelist[-1]) ! n = Node('class', name, bases, doc, code) n.lineno = nodelist[1][2] return n *************** *** 1192,1200 **** ] - # Local Variables: - # mode: python - # indent-tabs-mode: nil - # py-indent-offset: 2 - # py-smart-indentation: nil - # End: --- 1199,1201 ---- From jhylton@cnri.reston.va.us Mon Mar 6 18:53:18 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Mon, 6 Mar 2000 13:53:18 -0500 Subject: [Python-checkins] CVS: /python/nondist/src/Compiler/compiler pyassem.py,1.6,1.7 Message-ID: <200003061853.NAA04161@goon.cnri.reston.va.us> Update of /projects/cvsroot//python/nondist/src/Compiler/compiler In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler/compiler Modified Files: pyassem.py Log Message: revise arguments for addCode method on lnotab. take several numbers that are internally converted to chars, rather than taking a string. Index: pyassem.py =================================================================== RCS file: /projects/cvsroot//python/nondist/src/Compiler/compiler/pyassem.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** pyassem.py 2000/02/21 22:46:00 1.6 --- pyassem.py 2000/03/06 18:53:14 1.7 *************** *** 144,158 **** opname = t[0] if len(t) == 1: ! lnotab.addCode(chr(self.opnum[opname])) elif len(t) == 2: - oparg = self._convertArg(opname, t[1]) if opname == 'SET_LINENO': lnotab.nextLine(oparg) try: hi, lo = divmod(oparg, 256) except TypeError: raise TypeError, "untranslated arg: %s, %s" % (opname, oparg) ! lnotab.addCode(chr(self.opnum[opname]) + chr(lo) + ! chr(hi)) # why is a module a special case? if self.flags == 0: --- 144,160 ---- opname = t[0] if len(t) == 1: ! lnotab.addCode(self.opnum[opname]) elif len(t) == 2: if opname == 'SET_LINENO': + oparg = t[1] lnotab.nextLine(oparg) + else: + oparg = self._convertArg(opname, t[1]) try: hi, lo = divmod(oparg, 256) except TypeError: raise TypeError, "untranslated arg: %s, %s" % (opname, oparg) ! lnotab.addCode(self.opnum[opname], lo, hi) ! # why is a module a special case? if self.flags == 0: *************** *** 325,331 **** self.lnotab = [] ! def addCode(self, code): ! self.code.append(code) ! self.codeOffset = self.codeOffset + len(code) def nextLine(self, lineno): --- 327,334 ---- self.lnotab = [] ! def addCode(self, *args): ! for arg in args: ! self.code.append(chr(arg)) ! self.codeOffset = self.codeOffset + len(args) def nextLine(self, lineno): *************** *** 452,458 **** ('IMPORT_', 1), ] ! # special cases ! ! #: UNPACK_TUPLE, UNPACK_LIST, BUILD_TUPLE, # BUILD_LIST, CALL_FUNCTION, MAKE_FUNCTION, BUILD_SLICE def UNPACK_TUPLE(self, count): --- 455,461 ---- ('IMPORT_', 1), ] ! ! # special cases: ! # UNPACK_TUPLE, UNPACK_LIST, BUILD_TUPLE, # BUILD_LIST, CALL_FUNCTION, MAKE_FUNCTION, BUILD_SLICE def UNPACK_TUPLE(self, count): From jhylton@cnri.reston.va.us Mon Mar 6 18:54:33 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Mon, 6 Mar 2000 13:54:33 -0500 Subject: [Python-checkins] CVS: /python/nondist/src/Compiler/compiler visitor.py,1.1,1.2 Message-ID: <200003061854.NAA04185@goon.cnri.reston.va.us> Update of /projects/cvsroot//python/nondist/src/Compiler/compiler In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler/compiler Modified Files: visitor.py Log Message: fix import to refer to compiler package Index: visitor.py =================================================================== RCS file: /projects/cvsroot//python/nondist/src/Compiler/compiler/visitor.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** visitor.py 2000/03/06 18:49:31 1.1 --- visitor.py 2000/03/06 18:54:30 1.2 *************** *** 1,3 **** ! from tools import ast class ASTVisitor: --- 1,3 ---- ! from compiler import ast class ASTVisitor: From jhylton@cnri.reston.va.us Mon Mar 6 19:04:16 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Mon, 6 Mar 2000 14:04:16 -0500 Subject: [Python-checkins] CVS: /python/nondist/src/Compiler/compiler __init__.py,1.1,1.2 Message-ID: <200003061904.OAA04231@goon.cnri.reston.va.us> Update of /projects/cvsroot//python/nondist/src/Compiler/compiler In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler/compiler Modified Files: __init__.py Log Message: add a doc string import some useful functions from contained modules Index: __init__.py =================================================================== RCS file: /projects/cvsroot//python/nondist/src/Compiler/compiler/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** __init__.py 2000/02/04 00:25:34 1.1 --- __init__.py 2000/03/06 19:04:14 1.2 *************** *** 0 **** --- 1,20 ---- + """Package for parsing and compiling Python source code + + There are several functions defined at the top level that are imported + from modules contained in the package. + + parse(buf) -> AST + Donverts a string containing Python source code to an abstract + syntax tree (AST). The AST is defined in compiler.ast. + + parseFile(path) -> AST + The same as parse(open(path)) + + walk(ast, visitor, verbose=None) + Does a pre-order walk over the ast using the visitor instance. + See compiler.visitor for details. + """ + + from transformer import parse, parseFile + from visitor import walk + From jhylton@cnri.reston.va.us Mon Mar 6 19:10:57 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Mon, 6 Mar 2000 14:10:57 -0500 Subject: [Python-checkins] CVS: /python/nondist/src/Compiler/compiler pycodegen.py,1.17,1.18 Message-ID: <200003061910.OAA04281@goon.cnri.reston.va.us> Update of /projects/cvsroot//python/nondist/src/Compiler/compiler In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler/compiler Modified Files: pycodegen.py Log Message: rename compile.py to pycodegen.py fix imports remove parse functions and visitor code track name change: Classdef to Class add some comments and tweak order of visitXXX methods get rid of if __name__ == "__main__ section Index: pycodegen.py =================================================================== RCS file: /projects/cvsroot//python/nondist/src/Compiler/compiler/pycodegen.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** pycodegen.py 2000/02/17 22:09:35 1.17 --- pycodegen.py 2000/03/06 19:10:54 1.18 *************** *** 6,10 **** """ ! from p2c import transformer, ast from pyassem import StackRef, PyAssembler, TupleArg import dis --- 6,10 ---- """ ! from compiler import parseFile, ast, visitor, walk, parse from pyassem import StackRef, PyAssembler, TupleArg import dis *************** *** 19,159 **** import types - def parse(path): - f = open(path) - src = f.read() - f.close() - t = transformer.Transformer() - return t.parsesuite(src) - - def walk(tree, visitor, verbose=None, walker=None): - if walker: - w = walker() - else: - w = ASTVisitor() - if verbose is not None: - w.VERBOSE = verbose - w.preorder(tree, visitor) - return w.visitor - - def dumpNode(node): - print node.__class__ - for attr in dir(node): - if attr[0] != '_': - print "\t", "%-10.10s" % attr, getattr(node, attr) - - class ASTVisitor: - """Performs a depth-first walk of the AST - - The ASTVisitor will walk the AST, performing either a preorder or - postorder traversal depending on which method is called. - - methods: - preorder(tree, visitor) - postorder(tree, visitor) - tree: an instance of ast.Node - visitor: an instance with visitXXX methods - - The ASTVisitor is responsible for walking over the tree in the - correct order. For each node, it checks the visitor argument for - a method named 'visitNodeType' where NodeType is the name of the - node's class, e.g. Classdef. If the method exists, it is called - with the node as its sole argument. - - The visitor method for a particular node type can control how - child nodes are visited during a preorder walk. (It can't control - the order during a postorder walk, because it is called _after_ - the walk has occurred.) The ASTVisitor modifies the visitor - argument by adding a visit method to the visitor; this method can - be used to visit a particular child node. If the visitor method - returns a true value, the ASTVisitor will not traverse the child - nodes. - - XXX The interface for controlling the preorder walk needs to be - re-considered. The current interface is convenient for visitors - that mostly let the ASTVisitor do everything. For something like - a code generator, where you want to walk to occur in a specific - order, it's a pain to add "return 1" to the end of each method. - - XXX Perhaps I can use a postorder walk for the code generator? - """ - - VERBOSE = 0 - - def __init__(self): - self.node = None - - def preorder(self, tree, visitor): - """Do preorder walk of tree using visitor""" - self.visitor = visitor - visitor.visit = self._preorder - self._preorder(tree) - - def _preorder(self, node): - stop = self.dispatch(node) - if stop: - return - for child in node.getChildren(): - if isinstance(child, ast.Node): - self._preorder(child) - - def postorder(self, tree, visitor): - """Do preorder walk of tree using visitor""" - self.visitor = visitor - visitor.visit = self._postorder - self._postorder(tree) - - def _postorder(self, tree): - for child in node.getChildren(): - if isinstance(child, ast.Node): - self._preorder(child) - self.dispatch(node) - - def dispatch(self, node): - self.node = node - className = node.__class__.__name__ - meth = getattr(self.visitor, 'visit' + className, None) - if self.VERBOSE > 0: - if self.VERBOSE == 1: - if meth is None: - print "dispatch", className - else: - print "dispatch", className, (meth and meth.__name__ or '') - if meth: - return meth(node) - - class ExampleASTVisitor(ASTVisitor): - """Prints examples of the nodes that aren't visited - - This visitor-driver is only useful for development, when it's - helpful to develop a visitor incremently, and get feedback on what - you still have to do. - """ - examples = {} - - def dispatch(self, node): - self.node = node - className = node.__class__.__name__ - meth = getattr(self.visitor, 'visit' + className, None) - if self.VERBOSE > 0: - if self.VERBOSE == 1: - if meth is None: - print "dispatch", className - else: - print "dispatch", className, (meth and meth.__name__ or '') - if meth: - return meth(node) - else: - klass = node.__class__ - if self.VERBOSE < 2: - if self.examples.has_key(klass): - return - self.examples[klass] = klass - print - print klass - for attr in dir(node): - if attr[0] != '_': - print "\t", "%-12.12s" % attr, getattr(node, attr) - print - class CodeGenerator: """Generate bytecode for the Python VM""" --- 19,22 ---- *************** *** 312,316 **** self.emit('POP_TOP') ! def visitClassdef(self, node): self.emit('SET_LINENO', node.lineno) self.emit('LOAD_CONST', node.name) --- 175,179 ---- self.emit('POP_TOP') ! def visitClass(self, node): self.emit('SET_LINENO', node.lineno) self.emit('LOAD_CONST', node.name) *************** *** 661,664 **** --- 524,529 ---- visitAssList = visitAssTuple + # binary ops + def binaryOp(self, node, op): self.visit(node.left) *************** *** 667,675 **** return 1 - def unaryOp(self, node, op): - self.visit(node.expr) - self.emit(op) - return 1 - def visitAdd(self, node): return self.binaryOp(node, 'BINARY_ADD') --- 532,535 ---- *************** *** 696,699 **** --- 556,566 ---- return self.binaryOp(node, 'BINARY_RSHIFT') + # unary ops + + def unaryOp(self, node, op): + self.visit(node.expr) + self.emit(op) + return 1 + def visitInvert(self, node): return self.unaryOp(node, 'UNARY_INVERT') *************** *** 714,717 **** --- 581,586 ---- return self.unaryOp(node, 'UNARY_CONVERT') + # bit ops + def bitOp(self, nodes, op): self.visit(nodes[0]) *************** *** 730,743 **** return self.bitOp(node.nodes, 'BINARY_XOR') - def visitTest(self, node, jump): - end = StackRef() - for child in node.nodes[:-1]: - self.visit(child) - self.emit(jump, end) - self.emit('POP_TOP') - self.visit(node.nodes[-1]) - end.bind(self.code.getCurInst()) - return 1 - def visitAssert(self, node): # XXX __debug__ and AssertionError appear to be special cases --- 599,602 ---- *************** *** 758,761 **** --- 617,630 ---- return 1 + def visitTest(self, node, jump): + end = StackRef() + for child in node.nodes[:-1]: + self.visit(child) + self.emit(jump, end) + self.emit('POP_TOP') + self.visit(node.nodes[-1]) + end.bind(self.code.getCurInst()) + return 1 + def visitAnd(self, node): return self.visitTest(node, 'JUMP_IF_FALSE') *************** *** 880,884 **** self.names.add(name) ! def visitClassdef(self, node): self.names.add(node.name) return 1 --- 749,753 ---- self.names.add(name) ! def visitClass(self, node): self.names.add(node.name) return 1 *************** *** 922,927 **** def compile(self): ! t = transformer.Transformer() ! self.ast = t.parsesuite(self.source) cg = CodeGenerator(self.filename) walk(self.ast, cg) --- 791,795 ---- def compile(self): ! self.ast = parse(self.source) cg = CodeGenerator(self.filename) walk(self.ast, cg) *************** *** 951,971 **** mod.dump(filename + 'c') - if __name__ == "__main__": - import getopt - - VERBOSE = 0 - opts, args = getopt.getopt(sys.argv[1:], 'vq') - for k, v in opts: - if k == '-v': - VERBOSE = 1 - ASTVisitor.VERBOSE = ASTVisitor.VERBOSE + 1 - if k == '-q': - f = open('/dev/null', 'wb') - sys.stdout = f - if not args: - print "no files to compile" - else: - for filename in args: - if VERBOSE: - print filename - compile(filename) --- 819,820 ---- From jhylton@cnri.reston.va.us Mon Mar 6 19:12:36 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Mon, 6 Mar 2000 14:12:36 -0500 Subject: [Python-checkins] CVS: /python/nondist/src/Compiler/compiler __init__.py,1.2,1.3 Message-ID: <200003061912.OAA04298@goon.cnri.reston.va.us> Update of /projects/cvsroot//python/nondist/src/Compiler/compiler In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler/compiler Modified Files: __init__.py Log Message: import compile function form pycodegen Index: __init__.py =================================================================== RCS file: /projects/cvsroot//python/nondist/src/Compiler/compiler/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** __init__.py 2000/03/06 19:04:14 1.2 --- __init__.py 2000/03/06 19:12:33 1.3 *************** *** 14,20 **** --- 14,24 ---- Does a pre-order walk over the ast using the visitor instance. See compiler.visitor for details. + + compile(filename) + Generates a .pyc file by compilining filename. """ from transformer import parse, parseFile from visitor import walk + from pycodegen import compile From jhylton@cnri.reston.va.us Mon Mar 6 19:13:23 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Mon, 6 Mar 2000 14:13:23 -0500 Subject: [Python-checkins] CVS: /python/nondist/src/Compiler compile.py,NONE,1.1 Message-ID: <200003061913.OAA04318@goon.cnri.reston.va.us> Update of /projects/cvsroot//python/nondist/src/Compiler In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler Added Files: compile.py Log Message: compiler command-line interface moved here from compiler.pycodegen From guido@cnri.reston.va.us Mon Mar 6 20:40:02 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 6 Mar 2000 15:40:02 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib pdb.py,1.42,1.43 Message-ID: <200003062040.PAA11116@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: pdb.py Log Message: Sjoerd Mullender: When you set a breakpoint on a function with a multi-line argument list, the breakpoint is actually set on the second line of the arguments instead of the first line of the body. This patch fixes that. Index: pdb.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/pdb.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -r1.42 -r1.43 *** pdb.py 2000/02/04 15:39:30 1.42 --- pdb.py 2000/03/06 20:39:59 1.43 *************** *** 330,335 **** # set at 'def' statements are moved one line onward if line[:3] == 'def': ! incomment = '' while 1: lineno = lineno+1 line = linecache.getline(filename, lineno) --- 330,353 ---- # set at 'def' statements are moved one line onward if line[:3] == 'def': ! instr = '' ! brackets = 0 while 1: + skipone = 0 + for c in line: + if instr: + if skipone: + skipone = 0 + elif c == '\\': + skipone = 1 + elif c == instr: + instr = '' + elif c == '#': + break + elif c in ('"',"'"): + instr = c + elif c in ('(','{','['): + brackets = brackets + 1 + elif c in (')','}',']'): + brackets = brackets - 1 lineno = lineno+1 line = linecache.getline(filename, lineno) *************** *** 338,356 **** return 0 line = string.strip(line) - if incomment: - if len(line) < 3: continue - if (line[-3:] == incomment): - incomment = '' - continue if not line: continue # Blank line ! if len(line) >= 3: ! if (line[:3] == '"""' ! or line[:3] == "'''"): ! if line[-3:] == line[:3]: ! # one-line string ! continue ! incomment = line[:3] ! continue ! if line[0] != '#': break return lineno --- 356,362 ---- return 0 line = string.strip(line) if not line: continue # Blank line ! if brackets <= 0 and line[0] not in ('#','"',"'"): ! break return lineno From guido@cnri.reston.va.us Mon Mar 6 21:00:31 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 6 Mar 2000 16:00:31 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_contains.py,NONE,1.1 Message-ID: <200003062100.QAA11247@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib/test In directory eric:/projects/python/develop/guido/src/Lib/test Added Files: test_contains.py Log Message: Test cases for __contains__ code, by Moshe Zadka. From guido@cnri.reston.va.us Mon Mar 6 21:08:10 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 6 Mar 2000 16:08:10 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_contains,NONE,1.1 Message-ID: <200003062108.QAA11451@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib/test/output In directory eric:/projects/python/develop/guido/src/Lib/test/output Added Files: test_contains Log Message: test_contains output From fdrake@weyr.cnri.reston.va.us Tue Mar 7 14:05:19 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 7 Mar 2000 09:05:19 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.96,1.97 Message-ID: <200003071405.JAA21256@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: socketmodule.c Log Message: Fixed inet_ntoa() docstring. Index: socketmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -r1.96 -r1.97 *** socketmodule.c 2000/02/29 13:59:23 1.96 --- socketmodule.c 2000/03/07 14:05:16 1.97 *************** *** 1887,1891 **** static char inet_ntoa_doc[] = ! "inet_aton(packed_ip) -> ip_address_string\n\ \n\ Convert an IP address from 32-bit packed binary format to string format"; --- 1887,1891 ---- static char inet_ntoa_doc[] = ! "inet_ntoa(packed_ip) -> ip_address_string\n\ \n\ Convert an IP address from 32-bit packed binary format to string format"; From guido@cnri.reston.va.us Tue Mar 7 15:05:53 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Mar 2000 10:05:53 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle PyShell.py,1.25,1.26 Message-ID: <200003071505.KAA13776@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory eric:/projects/python/develop/guido/src/Tools/idle Modified Files: PyShell.py Log Message: If we're in the current input and there's only whitespace beyond the cursor, erase that whitespace first. This avoids a particularly confusing case where hitting Return at the end of the command didn't do what it was expected to do -- because it wasn't considered to be at the end of the command. Now it is. Index: PyShell.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/PyShell.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** PyShell.py 2000/03/03 23:06:44 1.25 --- PyShell.py 2000/03/07 15:05:50 1.26 *************** *** 528,531 **** --- 528,536 ---- self.recall(self.text.get("insert linestart", "insert lineend")) return "break" + # If we're in the current input and there's only whitespace + # beyond the cursor, erase that whitespace first + s = self.text.get("insert", "end-1c") + if s and not string.strip(s): + self.text.delete("insert", "end-1c") # If we're in the current input before its last line, # insert a newline right at the insert point From guido@cnri.reston.va.us Tue Mar 7 15:17:55 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Mar 2000 10:17:55 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle TODO.txt,1.12,1.13 Message-ID: <200003071517.KAA13826@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory eric:/projects/python/develop/guido/src/Tools/idle Modified Files: TODO.txt Log Message: Added a bunch of TODO items that recently came up in the idle-dev list. Also removed a bunch of items Index: TODO.txt =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/TODO.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** TODO.txt 2000/02/15 17:15:36 1.12 --- TODO.txt 2000/03/07 15:17:53 1.13 *************** *** 10,14 **** - debugger should be global resource (attached to flist, not to shell) - fix the stupid bug where you need to step twice - - after closing and reopening PyShell, debugger no longer works :-( - display class name in stack viewer entries for methods - suppress tracing through IDLE internals (e.g. print) --- 10,13 ---- *************** *** 21,29 **** - Filter region command - Optional horizontal scroll bar ! - more emacsisms: ! - parentheses matching - M-[, M-] to move by paragraphs - incremental search? - - ^K should cut to buffer - search should indicate wrap-around in some way - restructure state sensitive code to avoid testing flags all the time --- 20,27 ---- - Filter region command - Optional horizontal scroll bar ! - more Emacsisms: ! - ^K should cut to buffer - M-[, M-] to move by paragraphs - incremental search? - search should indicate wrap-around in some way - restructure state sensitive code to avoid testing flags all the time *************** *** 32,41 **** - check file mtimes at various points - Pluggable interface with RCS/CVS/Perforce/Clearcase - - status bar??? - better help? - don't open second class browser on same module (nor second path browser) - unify class and path browsers ! - use a tree widget instead of a smalltalk/NeXT style multicolumn browser ! Need to define a standard way whereby one can determine one is running inside IDLE (needed for Tk mainloop, also handy for $PYTHONSTARTUP) - Add more utility methods for use by extensions (a la get_selection) --- 30,37 ---- - check file mtimes at various points - Pluggable interface with RCS/CVS/Perforce/Clearcase - better help? - don't open second class browser on same module (nor second path browser) - unify class and path browsers ! - Need to define a standard way whereby one can determine one is running inside IDLE (needed for Tk mainloop, also handy for $PYTHONSTARTUP) - Add more utility methods for use by extensions (a la get_selection) *************** *** 45,48 **** --- 41,45 ---- it loads up UserDict.py and finds the first def or class for UserDict. - need a way to force colorization on/off + - need a way to force auto-indent on/off Details: *************** *** 57,60 **** --- 54,62 ---- - sometimes forward slashes in pathname remain - sometimes star in window name remains in Windows menu + - With unix bindings, ESC by itself is ignored + - Sometimes for no apparent reason a selection from the cursor to the + end of the command buffer appears, which is hard to get rid of + because it stays when you are typing! + - The Line/Col in the status bar can be wrong initially in PyShell Structural problems: *************** *** 68,72 **** Jeff Bauer suggests: - - The editor should show the current line number. - Open Module doesn't appear to handle hierarchical packages. - Class browser should also allow hierarchical packages. --- 70,73 ---- *************** *** 96,138 **** ------------------ - + PTUI has a status line - + PTUI's help is better (HTML!) + PTUI can attach a shell to any module ! + PTUI has more bells and whistles: open multiple append ! examine ! ! ? PTUI's fontify is faster but synchronous (and still too slow); ! does a lousy job if editing affects lines below - - PTUI's shell is worse: - no coloring; - no editing of multi-line commands; - ^P seems to permanently remove some text from the buffer - - - PTUI's undo is worse: - no redo; - one char at a time - - - PTUI's GUI is a tad ugly: - I don't like the multiple buffers in one window model; - I don't like the big buttons at the top of the widow - - - PTUI lacks an integrated debugger - - - PTUI lacks path and class browsers - - - PTUI lacks many of IDLE's features: - - expand word - - regular expression search - - search files (grep) - - (un)tabify - - center - - zoom height - ====================================================================== --- 97,109 ---- ------------------ + PTUI's help is better (HTML!) + PTUI can attach a shell to any module ! + PTUI has some more I/O commands: open multiple append ! examine (what's that?) ====================================================================== *************** *** 150,151 **** --- 121,205 ---- ====================================================================== + + Robin Friedrich's items: + + Things I'd like to see: + - I'd like support for shift-click extending the selection. There's a + bug now that it doesn't work the first time you try it. + - Printing is needed. How hard can that be on Windows? + - The python-mode trick of autoindenting a line with is neat and + very handy. + - (someday) a spellchecker for docstrings and comments. + - a pagedown/up command key which moves to next class/def statement (top + level) + - split window capability + - DnD text relocation/copying + + Things I don't want to see. + - line numbers... will probably slow things down way too much. + - Please use another icon for the tree browser leaf. The small snake + isn't cutting it. + + ---------------------------------------------------------------------- + + - Customizable views (multi-window or multi-pane). (Markus Gritsch) + + - Being able to double click (maybe double right click) on a callable + object in the editor which shows the source of the object, if + possible. (Gerrit Holl) + + - Hooks into the guts, like in Emacs. (Mike Romberg) + + - Sharing the editor with a remote tutor. (Martijn Faassen) + + - Multiple views on the same file. (Tony J Ibbs) + + - Store breakpoints in a global (per-project) database (GvR); Dirk + Heise adds: save some space-trimmed context and search around when + reopening a file that might have been edited by someone else. + + - Capture menu events in extensions without changing the IDLE source. + (Matthias Barmeier) + + - Use overlapping panels (a "notebook" in MFC terms I think) for info + that doesn't need to be accessible simultaneously (e.g. HTML source + and output). Use multi-pane windows for info that does need to be + shown together (e.g. class browser and source). (Albert Brandl) + + - A project should invisibly track all symbols, for instant search, + replace and cross-ref. Projects should be allowed to span multiple + directories, hosts, etc. Project management files are placed in a + directory you specify. A global mapping between project names and + project directories should exist [not so sure --GvR]. (Tim Peters) + + - Merge attr-tips and auto-expand. (Mark Hammond, Tim Peters) + + - Python Shell should behave more like a "shell window" as users know + it -- i.e. you can only edit the current command, and the cursor can't + escape from the command area. (Albert Brandl) + + - Set X11 class to "idle/Idle", set icon and title to something + beginning with "idle" -- for window manangers. (Randall Hopper) + + - Config files editable through a preferences dialog. (me) + + - Config files still editable outside the preferences dialog. + (Randall Hopper) + + - When you're editing a command in PyShell, and there are only blank + lines below the cursor, hitting Return should ignore or delete those + blank lines rather than deciding you're not on the last line. (me) + + - Run command (F5 c.s.) should be more like Pythonwin's Run -- a + dialog with options to give command line arguments, run the debugger, + etc. (me) + + - Shouldn't be able to delete part of the prompt (or any text before + it) in the PyShell. (Martijn Faassen) + + - Emacs style auto-fill (also smart about comments and strings). + (Jeremy Hylton) + + - Output of Run Script should go to a separate output window, not to + the shell window. Output of separate runs should all go to the same + window but clearly delimited. (David Scherer) From guido@cnri.reston.va.us Tue Mar 7 15:19:33 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Mar 2000 10:19:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib aifc.py,1.35,1.36 Message-ID: <200003071519.KAA13858@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: aifc.py Log Message: Sjoerd Mullender: The (relatively) new chunk module uses seek, not setpos. One instance of the call still needed to be fixed. Index: aifc.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/aifc.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** aifc.py 2000/02/02 15:10:15 1.35 --- aifc.py 2000/03/07 15:19:31 1.36 *************** *** 405,409 **** pos = self._soundpos * self._framesize if pos: ! self._ssnd_chunk.setpos(pos + 8) self._ssnd_seek_needed = 0 if nframes == 0: --- 405,409 ---- pos = self._soundpos * self._framesize if pos: ! self._ssnd_chunk.seek(pos + 8) self._ssnd_seek_needed = 0 if nframes == 0: From guido@cnri.reston.va.us Tue Mar 7 15:52:04 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Mar 2000 10:52:04 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_contains.py,1.1,1.2 Message-ID: <200003071552.KAA14191@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib/test In directory eric:/projects/python/develop/guido/src/Lib/test Modified Files: test_contains.py Log Message: Add tests for char in string -- including required exceptions for non-char in string. Index: test_contains.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_contains.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_contains.py 2000/03/06 21:00:29 1.1 --- test_contains.py 2000/03/07 15:52:01 1.2 *************** *** 40,41 **** --- 40,64 ---- except AttributeError: pass + + # Test char in string + + check('c' in 'abc', "'c' not in 'abc'") + check('d' not in 'abc', "'d' in 'abc'") + + try: + '' in 'abc' + check(0, "'' in 'abc' did not raise error") + except TypeError: + pass + + try: + 'ab' in 'abc' + check(0, "'ab' in 'abc' did not raise error") + except TypeError: + pass + + try: + None in 'abc' + check(0, "None in 'abc' did not raise error") + except TypeError: + pass From guido@cnri.reston.va.us Tue Mar 7 15:53:46 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Mar 2000 10:53:46 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.56,2.57 Message-ID: <200003071553.KAA14280@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/projects/python/develop/guido/src/Objects Modified Files: stringobject.c Log Message: Patch by Moshe Zadka: move the string special case from abstract.c here. [Patch modified by GvR to keep the original exception.] Index: stringobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/stringobject.c,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -r2.56 -r2.57 *** stringobject.c 2000/03/06 14:52:18 2.56 --- stringobject.c 2000/03/07 15:53:43 2.57 *************** *** 382,385 **** --- 382,406 ---- } + static int + string_contains(a, el) + PyObject *a, *el; + { + register char *s, *end; + register char c; + if (!PyString_Check(el) || PyString_Size(el) != 1) { + PyErr_SetString(PyExc_TypeError, + "string member test needs char left operand"); + return -1; + } + c = PyString_AsString(el)[0]; + s = PyString_AsString(a); + end = s + PyString_Size(a); + while (s < end) { + if (c == *s++) + return 1; + } + return 0; + } + static PyObject * string_item(a, i) *************** *** 517,520 **** --- 538,542 ---- 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ + (objobjproc)string_contains /*sq_contains*/ }; From guido@cnri.reston.va.us Tue Mar 7 15:54:47 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Mar 2000 10:54:47 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.31,2.32 Message-ID: <200003071554.KAA14303@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/projects/python/develop/guido/src/Objects Modified Files: abstract.c Log Message: Patch by Moshe Zadka: remove the string special case in PySequence_Contains() now that string objects have this code in their tp_contains. Index: abstract.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/abstract.c,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -r2.31 -r2.32 *** abstract.c 2000/02/28 15:01:46 2.31 --- abstract.c 2000/03/07 15:54:45 2.32 *************** *** 1122,1143 **** PySequenceMethods *sq; - /* Special case for char in string */ - if (PyString_Check(w)) { - register char *s, *end; - register char c; - if (!PyString_Check(v) || PyString_Size(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "string member test needs char left operand"); - return -1; - } - c = PyString_AsString(v)[0]; - s = PyString_AsString(w); - end = s + PyString_Size(w); - while (s < end) { - if (c == *s++) - return 1; - } - return 0; - } if(PyType_HasFeature(w->ob_type, Py_TPFLAGS_HAVE_SEQUENCE_IN)) { sq = w->ob_type->tp_as_sequence; --- 1122,1125 ---- From guido@cnri.reston.va.us Tue Mar 7 16:25:13 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Mar 2000 11:25:13 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle OutputWindow.py,1.3,1.4 Message-ID: <200003071625.LAA14564@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory eric:/projects/python/develop/guido/src/Tools/idle Modified Files: OutputWindow.py Log Message: Tweak the goto file/line command (in the right button menu in PyShell and output windows) so that it if it doesn't succeed with the line at the cursor, it tries the line before that. This is handy with tracebacks, where my natural tendency is to click in the displayed source line rather than in the file/line indicator just above it. Now I can indulge this tendency. I factored out a helper and changed the error handling so that a non-existing file is treated as if the line didn't match -- this is handy because some function calls (e.g. "foo.bar(1)") match the grep pattern. Index: OutputWindow.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/OutputWindow.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** OutputWindow.py 1999/04/22 22:28:42 1.3 --- OutputWindow.py 2000/03/07 16:25:11 1.4 *************** *** 68,71 **** --- 68,90 ---- # self.text.mark_set("insert", "@%d,%d" % (x, y)) line = self.text.get("insert linestart", "insert lineend") + result = self._file_line_helper(line) + if not result: + # Try the previous line. This is handy e.g. in tracebacks, + # where you tend to right-click on the displayed source line + line = self.text.get("insert -1line linestart", + "insert -1line lineend") + result = self._file_line_helper(line) + if not result: + tkMessageBox.showerror( + "No special line", + "The line you point at doesn't look like " + "a valid file name followed by a line number.", + master=self.text) + return + filename, lineno = result + edit = self.flist.open(filename) + edit.gotoline(lineno) + + def _file_line_helper(self, line): for prog in self.file_line_progs: m = prog.search(line) *************** *** 73,95 **** break else: ! tkMessageBox.showerror("No special line", ! "The line you point at doesn't look like " ! "a file name followed by a line number.", ! master=self.text) ! return filename, lineno = m.group(1, 2) try: f = open(filename, "r") f.close() ! except IOError, msg: ! self.text.bell() ! return ! edit = self.flist.open(filename) try: ! lineno = int(lineno) ! except ValueError, msg: ! self.text.bell() ! return ! edit.gotoline(lineno) # These classes are currently not used but might come in handy --- 92,106 ---- break else: ! return None filename, lineno = m.group(1, 2) try: f = open(filename, "r") f.close() ! except IOError: ! return None try: ! return filename, int(lineno) ! except TypeError: ! return None # These classes are currently not used but might come in handy From jhylton@cnri.reston.va.us Tue Mar 7 17:55:35 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Tue, 7 Mar 2000 12:55:35 -0500 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle ColorDelegator.py,1.9,1.10 IdleConf.py,1.4,1.5 ParenMatch.py,1.3,1.4 PyShell.py,1.26,1.27 config.txt,1.1,1.2 Message-ID: <200003071755.MAA00957@goon.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory goon.cnri.reston.va.us:/home/jhylton/python/src/Tools/idle Modified Files: ColorDelegator.py IdleConf.py ParenMatch.py PyShell.py config.txt Log Message: rename the global IdleConfParser object from IdleConf to idleconf standard usage is now from IdleConf import idleconf replace : with = in config.txt Index: ColorDelegator.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/ColorDelegator.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** ColorDelegator.py 2000/03/03 23:06:44 1.9 --- ColorDelegator.py 2000/03/07 17:55:32 1.10 *************** *** 5,9 **** from Tkinter import * from Delegator import Delegator ! from IdleConf import IdleConf #$ event <> --- 5,9 ---- from Tkinter import * from Delegator import Delegator ! from IdleConf import idleconf #$ event <> *************** *** 52,56 **** self.tag_raise('sel') ! cconf = IdleConf.getsection('Colors') tagdefs = { --- 52,56 ---- self.tag_raise('sel') ! cconf = idleconf.getsection('Colors') tagdefs = { Index: IdleConf.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/IdleConf.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** IdleConf.py 2000/03/06 14:43:20 1.4 --- IdleConf.py 2000/03/07 17:55:32 1.5 *************** *** 45,50 **** def reload(self): ! global IdleConf ! IdleConf = IdleConfParser() load(_dir) # _dir is a global holding the last directory loaded --- 45,50 ---- def reload(self): ! global idleconf ! idleconf = IdleConfParser() load(_dir) # _dir is a global holding the last directory loaded *************** *** 106,121 **** except KeyError: homedir = os.getcwd() ! ! for file in (os.path.join(dir, "config.txt"), ! genplatfile, ! platfile, ! os.path.join(homedir, ".idle"), ! ): ! try: ! f = open(file) ! except IOError: ! continue ! IdleConf.readfp(f) ! f.close() - IdleConf = IdleConfParser() --- 106,113 ---- except KeyError: homedir = os.getcwd() ! ! idleconf.read((os.path.join(dir, "config.txt"), genplatfile, platfile, ! os.path.join(homedir, ".idle"))) ! ! idleconf = IdleConfParser() Index: ParenMatch.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/ParenMatch.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** ParenMatch.py 2000/03/06 14:16:41 1.3 --- ParenMatch.py 2000/03/07 17:55:32 1.4 *************** *** 15,19 **** import PyParse from AutoIndent import AutoIndent, index2line ! from IdleConf import IdleConf class ParenMatch: --- 15,19 ---- import PyParse from AutoIndent import AutoIndent, index2line ! from IdleConf import idleconf class ParenMatch: *************** *** 57,62 **** unix_keydefs = {} ! iconf = IdleConf.getsection('ParenMatch') ! STYLE = iconf.get('style') FLASH_DELAY = iconf.getint('flash-delay') HILITE_CONFIG = iconf.getcolor('hilite') --- 57,62 ---- unix_keydefs = {} ! iconf = idleconf.getsection('ParenMatch') ! STYLE = iconf.getdef('style', 'default') FLASH_DELAY = iconf.getint('flash-delay') HILITE_CONFIG = iconf.getcolor('hilite') Index: PyShell.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/PyShell.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** PyShell.py 2000/03/07 15:05:50 1.26 --- PyShell.py 2000/03/07 17:55:32 1.27 *************** *** 17,21 **** from ColorDelegator import ColorDelegator from OutputWindow import OutputWindow ! from IdleConf import IdleConf import idlever --- 17,21 ---- from ColorDelegator import ColorDelegator from OutputWindow import OutputWindow ! from IdleConf import idleconf import idlever *************** *** 116,120 **** tagdefs = ColorDelegator.tagdefs.copy() ! cconf = IdleConf.getsection('Colors') tagdefs.update({ --- 116,120 ---- tagdefs = ColorDelegator.tagdefs.copy() ! cconf = idleconf.getsection('Colors') tagdefs.update({ Index: config.txt =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/config.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** config.txt 2000/03/03 22:57:42 1.1 --- config.txt 2000/03/07 17:55:32 1.2 *************** *** 19,44 **** [EditorWindow] ! width: 80 ! height: 24 # fonts defined in config-[win/unix].txt [Colors] ! normal-foreground: black ! normal-background: white ! # These color types are not explicitly defined: sync, todo, stdin ! keyword-foreground: #ff7700 ! comment-foreground: #dd0000 ! string-foreground: #00aa00 ! definition-foreground: #0000ff ! hilite-foreground: #000068 ! hilite-background: #006868 ! break-foreground: #ff7777 ! hit-foreground: #ffffff ! hit-background: #000000 ! stdout-foreground: blue ! stderr-foreground: red ! console-foreground: #770000 ! error-background: #ff7777 ! cursor-background: black [SearchBinding] --- 19,44 ---- [EditorWindow] ! width= 80 ! height= 24 # fonts defined in config-[win/unix].txt [Colors] ! normal-foreground= black ! normal-background= white ! # These color types are not explicitly defined= sync, todo, stdin ! keyword-foreground= #ff7700 ! comment-foreground= #dd0000 ! string-foreground= #00aa00 ! definition-foreground= #0000ff ! hilite-foreground= #000068 ! hilite-background= #006868 ! break-foreground= #ff7777 ! hit-foreground= #ffffff ! hit-background= #000000 ! stdout-foreground= blue ! stderr-foreground= red ! console-foreground= #770000 ! error-background= #ff7777 ! cursor-background= black [SearchBinding] *************** *** 57,64 **** [ParenMatch] ! enable: 0 ; ParenMatch conflicts with CallTips ! style: expression ! flash-delay: 500 ! bell: 1 ! hilite-foreground: black ! hilite-background: #43cd80 ; SeaGreen3 --- 57,64 ---- [ParenMatch] ! enable= 0 ! style= expression ! flash-delay= 500 ! bell= 1 ! hilite-foreground= black ! hilite-background= #43cd80 From jhylton@cnri.reston.va.us Tue Mar 7 17:56:30 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Tue, 7 Mar 2000 12:56:30 -0500 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle EditorWindow.py,1.31,1.32 Message-ID: <200003071756.MAA00980@goon.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory goon.cnri.reston.va.us:/home/jhylton/python/src/Tools/idle Modified Files: EditorWindow.py Log Message: rename the global IdleConfParser object from IdleConf to idleconf standard usage is now from IdleConf import idleconf Index: EditorWindow.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/EditorWindow.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** EditorWindow.py 2000/03/03 23:06:44 1.31 --- EditorWindow.py 2000/03/07 17:56:27 1.32 *************** *** 9,13 **** import idlever import WindowList ! from IdleConf import IdleConf # The default tab setting for a Text widget, in average-width characters. --- 9,13 ---- import idlever import WindowList ! from IdleConf import idleconf # The default tab setting for a Text widget, in average-width characters. *************** *** 95,100 **** def __init__(self, flist=None, filename=None, key=None, root=None): ! edconf = IdleConf.getsection('EditorWindow') ! coconf = IdleConf.getsection('Colors') self.flist = flist root = root or flist.root --- 95,100 ---- def __init__(self, flist=None, filename=None, key=None, root=None): ! edconf = idleconf.getsection('EditorWindow') ! coconf = idleconf.getsection('Colors') self.flist = flist root = root or flist.root *************** *** 531,535 **** def get_standard_extension_names(self): ! return IdleConf.getextensions() def load_extension(self, name): --- 531,535 ---- def get_standard_extension_names(self): ! return idleconf.getextensions() def load_extension(self, name): From jhylton@cnri.reston.va.us Tue Mar 7 17:56:50 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Tue, 7 Mar 2000 12:56:50 -0500 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle config-unix.txt,1.1,1.2 Message-ID: <200003071756.MAA01000@goon.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory goon.cnri.reston.va.us:/home/jhylton/python/src/Tools/idle Modified Files: config-unix.txt Log Message: replace : with = Index: config-unix.txt =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/config-unix.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** config-unix.txt 2000/03/03 22:57:42 1.1 --- config-unix.txt 2000/03/07 17:56:47 1.2 *************** *** 1,3 **** [EditorWindow] ! font-name: courier ! font-size: 10 --- 1,3 ---- [EditorWindow] ! font-name= courier ! font-size= 10 From guido@cnri.reston.va.us Tue Mar 7 18:51:51 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Mar 2000 13:51:51 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle PyShell.py,1.27,1.28 Message-ID: <200003071851.NAA15242@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory eric:/projects/python/develop/guido/src/Tools/idle Modified Files: PyShell.py Log Message: Override the Undo delegator to forbid any changes before the I/O mark. It beeps if you try to insert or delete before the "iomark" mark. This makes the shell less confusing for newbies. Index: PyShell.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/PyShell.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** PyShell.py 2000/03/07 17:55:32 1.27 --- PyShell.py 2000/03/07 18:51:49 1.28 *************** *** 16,19 **** --- 16,20 ---- from FileList import FileList from ColorDelegator import ColorDelegator + from UndoDelegator import UndoDelegator from OutputWindow import OutputWindow from IdleConf import idleconf *************** *** 128,131 **** --- 129,154 ---- + class ModifiedUndoDelegator(UndoDelegator): + + # Forbid insert/delete before the I/O mark + + def insert(self, index, chars, tags=None): + try: + if self.delegate.compare(index, "<", "iomark"): + self.delegate.bell() + return + except TclError: + pass + UndoDelegator.insert(self, index, chars, tags) + + def delete(self, index1, index2=None): + try: + if self.delegate.compare(index1, "<", "iomark"): + self.delegate.bell() + return + except TclError: + pass + UndoDelegator.delete(self, index1, index2) + class ModifiedInterpreter(InteractiveInterpreter): *************** *** 265,268 **** --- 288,292 ---- # Override classes ColorDelegator = ModifiedColorDelegator + UndoDelegator = ModifiedUndoDelegator # Override menu bar specs From bwarsaw@cnri.reston.va.us Wed Mar 8 15:18:37 2000 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 8 Mar 2000 10:18:37 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/i18n pygettext.py,1.7,1.8 Message-ID: <200003081518.KAA02300@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/i18n In directory anthem:/home/bwarsaw/projects/python/Tools/i18n Modified Files: pygettext.py Log Message: A bunch of changes, primarily to command line argument parsing (inspired by Detlef Lannert). Specifically, -k/--keyword no longer takes an optional argument to clear the default keywords. Instead, use -K/--no-default-keywords to clear them. -n/--add-location also no longer takes an optional argument to set the comment style. Instead, use -S/--style to set the comment style to GNU or Solaris. -o/--output can take `-' as the filename, meaning write to standard output. The inputfile name can also be `-' meaning read from standard in. A few other changes include Kludge to mark the file docstring as translatable. Since the marking is to place _() around the docstring, and because we actually have to define the _() function before we use it, this means that we have to manually assign to __doc__ the output of _(). This doesn't seem too bad because you'll only use this idiom when translating a script's docstring (you really don't need to translate most module docstrings). Convert everything to string methods and do not import the string module. Bump the version number to 1.1 Index: pygettext.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/i18n/pygettext.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** pygettext.py 2000/02/27 14:30:48 1.7 --- pygettext.py 2000/03/08 15:18:35 1.8 *************** *** 5,10 **** # by Peter Funk ! """pygettext -- Python equivalent of xgettext(1) Many systems (Solaris, Linux, Gnu) provide extensive tools that ease the internationalization of C programs. Most of these tools are independent of --- 5,18 ---- # by Peter Funk ! # for selftesting ! try: ! import fintl ! _ = fintl.gettext ! except ImportError: ! def _(s): return s ! + __doc__ = _("""pygettext -- Python equivalent of xgettext(1) + Many systems (Solaris, Linux, Gnu) provide extensive tools that ease the internationalization of C programs. Most of these tools are independent of *************** *** 40,46 **** NOTE: pygettext attempts to be option and feature compatible with GNU xgettext where ever possible. However some options are still missing or are not fully ! implemented. ! Usage: pygettext [options] filename ... Options: --- 48,56 ---- NOTE: pygettext attempts to be option and feature compatible with GNU xgettext where ever possible. However some options are still missing or are not fully ! implemented. Also, xgettext's use of command line switches with option ! arguments is broken, and in these cases, pygettext just defines additional ! switches. ! Usage: pygettext [options] inputfile ... Options: *************** *** 61,92 **** --help print this help message and exit - - -k [word] - --keyword[=word] - Additional keywords to look for. Without `word' means not to use the - default keywords. The default keywords, which are always looked for - if not explicitly disabled: _ ! The default keyword list is different than GNU xgettext. You can have ! multiple -k flags on the command line. --no-location ! Do not write filename/lineno location comments ! -n [style] ! --add-location[=style] Write filename/lineno location comments indicating where each extracted string is found in the source. These lines appear before ! each msgid. Two styles are supported: Solaris # File: filename, line: line-number ! Gnu #: filename:line ! If style is omitted, Gnu is used. The style name is case ! insensitive. By default, locations are included. -o filename --output=filename ! Rename the default output file from messages.pot to filename. -p dir --- 71,111 ---- --help print this help message and exit ! -k word ! --keyword=word ! Keywords to look for in addition to the default set, which are: ! %(DEFAULTKEYWORDS)s ! ! You can have multiple -k flags on the command line. ! ! -K ! --no-default-keywords ! Disable the default set of keywords (see above). Any keywords ! explicitly added with the -k/--keyword option are still recognized. --no-location ! Do not write filename/lineno location comments. ! -n ! --add-location Write filename/lineno location comments indicating where each extracted string is found in the source. These lines appear before ! each msgid. The style of comments is controlled by the -S/--style ! option. This is the default. ! ! -S stylename ! --style stylename ! Specify which style to use for location comments. Two styles are ! supported: Solaris # File: filename, line: line-number ! GNU #: filename:line ! The style name is case insensitive. GNU style is the default. -o filename --output=filename ! Rename the default output file from messages.pot to filename. If ! filename is `-' then the output is sent to standard out. -p dir *************** *** 112,136 **** appear on a line by itself in the file. ! """ import os import sys - import string import time import getopt import tokenize ! __version__ = '1.0' ! ! # for selftesting ! try: ! import fintl ! _ = fintl.gettext ! except ImportError: ! def _(s): return s # The normal pot-file header. msgmerge and EMACS' po-mode work better if # it's there. --- 131,153 ---- appear on a line by itself in the file. ! If `inputfile' is -, standard input is read. + """) + import os import sys import time import getopt import tokenize ! __version__ = '1.1' + default_keywords = ['_'] + DEFAULTKEYWORDS = ', '.join(default_keywords) ! EMPTYSTRING = '' + # The normal pot-file header. msgmerge and EMACS' po-mode work better if # it's there. *************** *** 190,194 **** for i in range(len(s)): s[i] = escapes[ord(s[i])] ! return string.join(s, '') --- 207,211 ---- for i in range(len(s)): s[i] = escapes[ord(s[i])] ! return EMPTYSTRING.join(s) *************** *** 201,205 **** # This converts the various Python string types into a format that is # appropriate for .po files, namely much closer to C style. ! lines = string.split(s, '\n') if len(lines) == 1: s = '"' + escape(s) + '"' --- 218,222 ---- # This converts the various Python string types into a format that is # appropriate for .po files, namely much closer to C style. ! lines = s.split('\n') if len(lines) == 1: s = '"' + escape(s) + '"' *************** *** 210,214 **** for i in range(len(lines)): lines[i] = escape(lines[i]) ! s = '""\n"' + string.join(lines, '\\n"\n"') + '"' return s --- 227,232 ---- for i in range(len(lines)): lines[i] = escape(lines[i]) ! lineterm = '\\n"\n"' ! s = '""\n"' + lineterm.join(lines) + '"' return s *************** *** 246,250 **** # were no strings inside _(), then just ignore this entry. if self.__data: ! msg = string.join(self.__data, '') if not msg in self.__options.toexclude: entry = (self.__curfile, self.__lineno) --- 264,268 ---- # were no strings inside _(), then just ignore this entry. if self.__data: ! msg = EMPTYSTRING.join(self.__data) if not msg in self.__options.toexclude: entry = (self.__curfile, self.__lineno) *************** *** 272,281 **** print pot_header % {'time': timestamp, 'version': __version__} for k, v in self.__messages.items(): # location comments are different b/w Solaris and GNU: ! if options.location == options.SOLARIS: for filename, lineno in v: d = {'filename': filename, 'lineno': lineno} print _('# File: %(filename)s, line: %(lineno)d') % d ! elif options.location == options.GNU: # fit as many locations on one line, as long as the # resulting line length doesn't exceeds 'options.width' --- 290,301 ---- print pot_header % {'time': timestamp, 'version': __version__} for k, v in self.__messages.items(): + if not options.writelocations: + pass # location comments are different b/w Solaris and GNU: ! elif options.locationstyle == options.SOLARIS: for filename, lineno in v: d = {'filename': filename, 'lineno': lineno} print _('# File: %(filename)s, line: %(lineno)d') % d ! elif options.locationstyle == options.GNU: # fit as many locations on one line, as long as the # resulting line length doesn't exceeds 'options.width' *************** *** 299,310 **** def main(): ! default_keywords = ['_'] try: opts, args = getopt.getopt( sys.argv[1:], ! 'ad:Ehk:n:o:p:Vvw:x:', ! ['extract-all', 'default-domain', 'escape', 'help', 'keyword', 'add-location', 'no-location', 'output=', 'output-dir=', ! 'verbose', 'version', 'width=', 'exclude-file=', ]) except getopt.error, msg: --- 319,331 ---- def main(): ! global default_keywords try: opts, args = getopt.getopt( sys.argv[1:], ! 'ad:Ehk:Kno:p:S:Vvw:x:', ! ['extract-all', 'default-domain', 'escape', 'help', ! 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', ! 'style=', 'verbose', 'version', 'width=', 'exclude-file=', ]) except getopt.error, msg: *************** *** 322,326 **** outpath = '' outfile = 'messages.pot' ! location = GNU verbose = 0 width = 78 --- 343,348 ---- outpath = '' outfile = 'messages.pot' ! writelocations = 1 ! locationstyle = GNU verbose = 0 width = 78 *************** *** 343,359 **** options.escape = 1 elif opt in ('-k', '--keyword'): - if arg is None: - default_keywords = [] options.keywords.append(arg) elif opt in ('-n', '--add-location'): ! if arg is None: ! arg = 'gnu' ! try: ! options.location = locations[string.lower(arg)] ! except KeyError: ! d = {'arg':arg} ! usage(1, _('Invalid value for --add-location: %(arg)s') % d) elif opt in ('--no-location',): ! options.location = 0 elif opt in ('-o', '--output'): options.outfile = arg --- 365,379 ---- options.escape = 1 elif opt in ('-k', '--keyword'): options.keywords.append(arg) + elif opt in ('-K', '--no-default-keywords'): + default_keywords = [] elif opt in ('-n', '--add-location'): ! options.writelocations = 1 elif opt in ('--no-location',): ! options.writelocations = 0 ! elif opt in ('-S', '--style'): ! options.locationstyle = locations.get(arg.lower()) ! if options.locationstyle is None: ! usage(1, _('Invalid value for --style: %s') % arg) elif opt in ('-o', '--output'): options.outfile = arg *************** *** 369,375 **** options.width = int(arg) except ValueError: ! d = {'arg':arg} ! usage(1, _('Invalid value for --width: %(arg)s, must be int') ! % d) elif opt in ('-x', '--exclude-file'): options.excludefilename = arg --- 389,393 ---- options.width = int(arg) except ValueError: ! usage(1, _('--width argument must be an integer: %s') % arg) elif opt in ('-x', '--exclude-file'): options.excludefilename = arg *************** *** 397,413 **** eater = TokenEater(options) for filename in args: ! if options.verbose: ! print _('Working on %(filename)s') % {'filename':filename} ! fp = open(filename) ! eater.set_filename(filename) ! tokenize.tokenize(fp.readline, eater) ! fp.close() ! ! if options.outpath: ! options.outfile = os.path.join(options.outpath, options.outfile) ! fp = open(options.outfile, 'w') ! eater.write(fp) ! fp.close() --- 415,449 ---- eater = TokenEater(options) for filename in args: ! if filename == '-': ! if options.verbose: ! print _('Reading standard input') ! fp = sys.stdin ! closep = 0 ! else: ! if options.verbose: ! print _('Working on %s') % filename ! fp = open(filename) ! closep = 1 ! try: ! eater.set_filename(filename) ! tokenize.tokenize(fp.readline, eater) ! finally: ! if closep: ! fp.close() + # write the output + if options.outfile == '-': + fp = sys.stdout + closep = 0 + else: + if options.outpath: + options.outfile = os.path.join(options.outpath, options.outfile) + fp = open(options.outfile, 'w') + closep = 1 + try: + eater.write(fp) + finally: + if closep: + fp.close() From fdrake@weyr.cnri.reston.va.us Wed Mar 8 16:56:10 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 8 Mar 2000 11:56:10 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/ext ext.tex,1.68.2.7,1.68.2.8 Message-ID: <200003081656.LAA25941@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/ext In directory weyr:/home/fdrake/projects/python/Doc-152p2/ext Modified Files: Tag: release152p1-patches ext.tex Log Message: Typo noted by Edward Welbourne : "programming interested in..." --> "programmer interested in..." Index: ext.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/ext/ext.tex,v retrieving revision 1.68.2.7 retrieving revision 1.68.2.8 diff -C2 -r1.68.2.7 -r1.68.2.8 *** ext.tex 2000/02/29 18:40:55 1.68.2.7 --- ext.tex 2000/03/08 16:56:07 1.68.2.8 *************** *** 1784,1788 **** detailed background information on how it works. The explanatory material is useful for both the Windows programmer learning to build ! Python extensions and the \UNIX{} programming interested in producing software which can be successfully built on both \UNIX{} and Windows. --- 1784,1788 ---- detailed background information on how it works. The explanatory material is useful for both the Windows programmer learning to build ! Python extensions and the \UNIX{} programmer interested in producing software which can be successfully built on both \UNIX{} and Windows. From jhylton@cnri.reston.va.us Thu Mar 9 19:56:54 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Thu, 9 Mar 2000 14:56:54 -0500 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle RemoteInterp.py,NONE,1.1 Message-ID: <200003091956.OAA06167@goon.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory goon.cnri.reston.va.us:/home/jhylton/python/src/Tools/idle Added Files: RemoteInterp.py Log Message: a simple client-server framework for executing code in a different process not yet connected with IDLE From fdrake@weyr.cnri.reston.va.us Fri Mar 10 15:24:09 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 10 Mar 2000 10:24:09 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libtime.tex,1.28.2.1,1.28.2.2 Message-ID: <200003101524.KAA07622@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libtime.tex Log Message: A variety of nice improvements from Peter Funk . Index: libtime.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.28.2.1 retrieving revision 1.28.2.2 diff -C2 -r1.28.2.1 -r1.28.2.2 *** libtime.tex 1999/12/07 15:13:30 1.28.2.1 --- libtime.tex 2000/03/10 15:24:05 1.28.2.2 *************** *** 1,11 **** \section{\module{time} --- Time access and conversions} - \declaremodule{builtin}{time} \modulesynopsis{Time access and conversions.} This module provides various time-related functions. ! It is always available. An explanation of some terminology and conventions is in order. --- 1,12 ---- \section{\module{time} --- Time access and conversions} + \declaremodule{builtin}{time} \modulesynopsis{Time access and conversions.} This module provides various time-related functions. ! It is always available, but not all functions are available ! on all platforms. An explanation of some terminology and conventions is in order. *************** *** 77,85 **** \function{localtime()}, and \function{strptime()}, and accepted by \function{asctime()}, \function{mktime()} and \function{strftime()}, ! is a tuple of 9 integers: year (e.g.\ 1993), month (1--12), day ! (1--31), hour (0--23), minute (0--61; see note \strong{(1)} after ! table in \function{strftime()} description), second (0--59), weekday ! (0--6, monday is 0), Julian day (1--366) and daylight savings flag ! (-1, 0 or 1). Note that unlike the C structure, the month value is a range of 1-12, not 0-11. A year value will be handled as descibed under ``Year 2000 (Y2K) issues'' above. A \code{-1} argument as --- 78,96 ---- \function{localtime()}, and \function{strptime()}, and accepted by \function{asctime()}, \function{mktime()} and \function{strftime()}, ! is a tuple of 9 integers: ! ! \begin{tableiii}{r|l|l}{textrm}{Index}{Field}{Comment} ! \lineiii{0}{year}{(e.g.\ 1993)} ! \lineiii{1}{month}{range [1,12]} ! \lineiii{2}{day}{range [1,31]} ! \lineiii{3}{hour}{range [0,23]} ! \lineiii{4}{minute}{range [0,59]} ! \lineiii{5}{second}{range [0,61]; see \strong{(1)} after table in \function{strftime()} description)} ! \lineiii{6}{weekday}{range [0,6], monday is 0} ! \lineiii{7}{Julian day}{range [1,366]} ! \lineiii{8}{daylight savings flag}{0, 1 or -1; see below} ! \end{tableiii} ! ! Note that unlike the C structure, the month value is a range of 1-12, not 0-11. A year value will be handled as descibed under ``Year 2000 (Y2K) issues'' above. A \code{-1} argument as *************** *** 227,232 **** the local \UNIX{} documentation for restrictions or additional supported directives. If \var{string} cannot be parsed according to ! \var{format}, \exception{ValueError} is raised. This function may not ! be defined on all platforms. \end{funcdesc} --- 238,244 ---- the local \UNIX{} documentation for restrictions or additional supported directives. If \var{string} cannot be parsed according to ! \var{format}, \exception{ValueError} is raised. ! ! Availability: Most modern \UNIX{} systems. \end{funcdesc} *************** *** 249,250 **** --- 261,269 ---- timezone is defined, the second string should not be used. \end{datadesc} + + + \begin{seealso} + \seemodule{locale}{Internationalization services. The locale + settings can affect the return values for some of + the functions in the \module{time} module.} + \end{seealso} From guido@cnri.reston.va.us Fri Mar 10 22:30:33 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:30:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.26,1.27 config.h.in,2.51,2.52 configure,1.108,1.109 configure.in,1.116,1.117 Message-ID: <200003102230.RAA00107@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/home/guido/hp/mal/py-patched Modified Files: acconfig.h config.h.in configure configure.in Log Message: Part of the Unicode checkin for Marc-Andre Lemburg. Some new configuration tests and a new option, --with-wctype-functions. Index: acconfig.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/acconfig.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** acconfig.h 1999/12/20 21:24:37 1.26 --- acconfig.h 2000/03/10 22:30:28 1.27 *************** *** 101,104 **** --- 101,116 ---- #undef WANT_SIGFPE_HANDLER + /* Define if the compiler provides a wchar.h header file. */ + #undef HAVE_WCHAR_H + + /* Define if you have a useable wchar_t type defined in wchar.h; useable + means wchar_t must be 16-bit unsigned type. (see + Include/unicodeobject.h). */ + #undef HAVE_USABLE_WCHAR_T + + /* Define if you want wctype.h functions to be used instead of the + one supplied by Python itself. (see Include/unicodectype.h). */ + #undef WANT_WCTYPE_FUNCTIONS + /* Define if you want to use SGI (IRIX 4) dynamic linking. This requires the "dl" library by Jack Jansen, Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -r2.51 -r2.52 *** config.h.in 1999/12/20 21:25:59 2.51 --- config.h.in 2000/03/10 22:30:29 2.52 *************** *** 26,29 **** --- 26,32 ---- #undef HAVE_TZNAME + /* Define as __inline if that's what the C compiler calls it. */ + #undef inline + /* Define if on MINIX. */ #undef _MINIX *************** *** 63,66 **** --- 66,73 ---- #undef uid_t + /* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ + #undef WORDS_BIGENDIAN + /* Define if your contains bad prototypes for exec*() (as it does on SGI IRIX 4.x) */ *************** *** 156,159 **** --- 163,178 ---- #undef WANT_SIGFPE_HANDLER + /* Define if the compiler provides a wchar.h header file. */ + #undef HAVE_WCHAR_H + + /* Define if you have a useable wchar_t type defined in wchar.h; useable + means wchar_t must be 16-bit unsigned type. (see + Include/unicodeobject.h). */ + #undef HAVE_USABLE_WCHAR_T + + /* Define if you want wctype.h functions to be used instead of the + one supplied by Python itself. (see Include/unicodectype.h). */ + #undef WANT_WCTYPE_FUNCTIONS + /* Define if you want to use SGI (IRIX 4) dynamic linking. This requires the "dl" library by Jack Jansen, *************** *** 201,204 **** --- 220,232 ---- #undef HAVE_DYNAMIC_LOADING + /* The number of bytes in a char. */ + #undef SIZEOF_CHAR + + /* The number of bytes in a double. */ + #undef SIZEOF_DOUBLE + + /* The number of bytes in a float. */ + #undef SIZEOF_FLOAT + /* The number of bytes in a int. */ #undef SIZEOF_INT *************** *** 209,212 **** --- 237,243 ---- /* The number of bytes in a long long. */ #undef SIZEOF_LONG_LONG + + /* The number of bytes in a short. */ + #undef SIZEOF_SHORT /* The number of bytes in a void *. */ Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -r1.108 -r1.109 *** configure 2000/02/25 19:26:30 1.108 --- configure 2000/03/10 22:30:29 1.109 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.116 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.117 [...3541 lines suppressed...] + # Check for --with-wctype-functions + echo $ac_n "checking for --with-wctype-functions""... $ac_c" 1>&6 + echo "configure:5187: checking for --with-wctype-functions" >&5 + # Check whether --with-wctype-functions or --without-wctype-functions was given. + if test "${with_wctype_functions+set}" = set; then + withval="$with_wctype_functions" + + if test "$withval" != no + then cat >> confdefs.h <<\EOF + #define WANT_WCTYPE_FUNCTIONS 1 + EOF + echo "$ac_t""yes" 1>&6 + else echo "$ac_t""no" 1>&6 + fi + else + echo "$ac_t""no" 1>&6 + fi + # generate output files Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -r1.116 -r1.117 *** configure.in 2000/02/25 19:26:31 1.116 --- configure.in 2000/03/10 22:30:29 1.117 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.116 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.117 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 374,377 **** --- 374,378 ---- EOF + # Type availability checks AC_TYPE_MODE_T AC_TYPE_OFF_T *************** *** 381,387 **** --- 382,393 ---- AC_TYPE_UID_T + # Sizes of various common basic types AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(void *) + AC_CHECK_SIZEOF(char) + AC_CHECK_SIZEOF(short) + AC_CHECK_SIZEOF(float) + AC_CHECK_SIZEOF(double) AC_MSG_CHECKING(for long long support) *************** *** 792,797 **** AC_C_CHAR_UNSIGNED - AC_C_CONST works=no --- 798,803 ---- AC_C_CHAR_UNSIGNED AC_C_CONST + AC_C_INLINE works=no *************** *** 943,947 **** then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) ! fi]) # check for --with-libm=... --- 949,954 ---- then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) ! fi], ! [AC_MSG_RESULT(no)]) # check for --with-libm=... *************** *** 1025,1028 **** --- 1032,1072 ---- AC_DEFINE(MALLOC_ZERO_RETURNS_NULL) fi + + # check for wchar.h + AC_CHECK_HEADER(wchar.h, + AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes", + wchar_h="no" + ) + + # check for usable wchar_t + usable_wchar_t="unkown" + AC_MSG_CHECKING(for usable wchar_t) + AC_TRY_RUN([ + #include "wchar.h" + #include "wctype.h" + main() { + wchar_t s; + if (sizeof(s) == 2) + exit(0); + else + exit(1); + } + ], + AC_DEFINE(HAVE_USABLE_WCHAR_T) usable_wchar_t="yes", + usable_wchar_t="no") + AC_MSG_RESULT($usable_wchar_t) + + # check for endianness + AC_C_BIGENDIAN + + # Check for --with-wctype-functions + AC_MSG_CHECKING(for --with-wctype-functions) + AC_ARG_WITH(wctype-functions, + [--with-wctype-functions use wctype.h functions], [ + if test "$withval" != no + then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes) + else AC_MSG_RESULT(no) + fi], + [AC_MSG_RESULT(no)]) # generate output files From guido@cnri.reston.va.us Fri Mar 10 22:32:26 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:32:26 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Include codecs.h,NONE,2.1 Message-ID: <200003102232.RAA00385@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Include In directory eric:/home/guido/hp/mal/py-patched/Include Added Files: codecs.h Log Message: Python Codec Registry and support functions, by Marc-Andre Lemburg. From guido@cnri.reston.va.us Fri Mar 10 22:33:08 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:33:08 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Include unicodeobject.h,NONE,2.1 Message-ID: <200003102233.RAA00488@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Include In directory eric:/home/guido/hp/mal/py-patched/Include Added Files: unicodeobject.h Log Message: Unicode implementation by Marc-Andre Lemburg based on original code by Fredrik Lundh. From guido@cnri.reston.va.us Fri Mar 10 22:33:35 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:33:35 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Include pyerrors.h,2.34,2.35 Message-ID: <200003102233.RAA00562@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Include In directory eric:/home/guido/hp/mal/py-patched/Include Modified Files: pyerrors.h Log Message: Marc-Andre Lemburg: add PyExc_UnicodeError Index: pyerrors.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Include/pyerrors.h,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -r2.34 -r2.35 *** pyerrors.h 2000/02/17 15:17:18 2.34 --- pyerrors.h 2000/03/10 22:33:32 2.35 *************** *** 80,83 **** --- 80,84 ---- extern DL_IMPORT(PyObject *) PyExc_TypeError; extern DL_IMPORT(PyObject *) PyExc_UnboundLocalError; + extern DL_IMPORT(PyObject *) PyExc_UnicodeError; extern DL_IMPORT(PyObject *) PyExc_ValueError; extern DL_IMPORT(PyObject *) PyExc_ZeroDivisionError; From guido@cnri.reston.va.us Fri Mar 10 22:34:02 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:34:02 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Include Python.h,2.13,2.14 Message-ID: <200003102234.RAA00634@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Include In directory eric:/home/guido/hp/mal/py-patched/Include Modified Files: Python.h Log Message: Marc-Andre Lemburg: include unicodeobject.h and codecs.h Index: Python.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Include/Python.h,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** Python.h 1999/01/03 12:40:22 2.13 --- Python.h 2000/03/10 22:34:00 2.14 *************** *** 93,97 **** --- 93,99 ---- #include "traceback.h" #include "sliceobject.h" + #include "unicodeobject.h" + #include "codecs.h" #include "pyerrors.h" #include "mymalloc.h" From guido@cnri.reston.va.us Fri Mar 10 22:35:09 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:35:09 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Include abstract.h,2.16,2.17 Message-ID: <200003102235.RAA00789@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Include In directory eric:/home/guido/hp/mal/py-patched/Include Modified Files: abstract.h Log Message: Marc-Andre Lemburg: added declarations for PyObject_AsCharBuffer, PyObject_AsReadBuffer, PyObject_AsWriteBuffer. Index: abstract.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Include/abstract.h,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -r2.16 -r2.17 *** abstract.h 1999/03/17 18:44:38 2.16 --- abstract.h 2000/03/10 22:35:06 2.17 *************** *** 437,440 **** --- 437,486 ---- */ + DL_IMPORT(int) PyObject_AsCharBuffer(PyObject *obj, + const char **buffer, + int *buffer_len); + + /* + Takes an arbitrary object which must support the (character, + single segment) buffer interface and returns a pointer to a + read-only memory location useable as character based input + for subsequent processing. + + 0 is returned on success. buffer and buffer_len are only + set in case no error occurrs. Otherwise, -1 is returned and + an exception set. + + */ + + DL_IMPORT(int) PyObject_AsReadBuffer(PyObject *obj, + const void **buffer, + int *buffer_len); + + /* + Same as PyObject_AsCharBuffer() except that this API expects + (readable, single segment) buffer interface and returns a + pointer to a read-only memory location which can contain + arbitrary data. + + 0 is returned on success. buffer and buffer_len are only + set in case no error occurrs. Otherwise, -1 is returned and + an exception set. + + */ + + DL_IMPORT(int) PyObject_AsWriteBuffer(PyObject *obj, + void **buffer, + int *buffer_len); + + /* + Takes an arbitrary object which must support the (writeable, + single segment) buffer interface and returns a pointer to a + writeable memory location in buffer of size buffer_len. + + 0 is returned on success. buffer and buffer_len are only + set in case no error occurrs. Otherwise, -1 is returned and + an exception set. + + */ /* Number Protocol:*/ From guido@cnri.reston.va.us Fri Mar 10 22:36:59 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:36:59 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/scripts gencodec.py,NONE,1.1 README,1.7,1.8 Message-ID: <200003102236.RAA01036@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/scripts In directory eric:/home/guido/hp/mal/py-patched/Tools/scripts Modified Files: README Added Files: gencodec.py Log Message: Marc-Andre Lemburg: added gencodec.py - Create Python codecs from Unicode mapping files Index: README =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/scripts/README,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** README 1998/10/07 19:52:35 1.7 --- README 2000/03/10 22:36:56 1.8 *************** *** 19,22 **** --- 19,23 ---- fixps.py Fix Python scripts' first line (if #!) ftpmirror.py FTP mirror script + gencodec.py Create Python codecs from Unicode mapping files h2py.py Translate #define's into Python assignments ifdef.py Remove #if(n)def groups from C sources From guido@cnri.reston.va.us Fri Mar 10 22:52:49 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:52:49 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects unicodectype.c,NONE,2.1 Message-ID: <200003102252.RAA02997@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/home/guido/hp/mal/py-patched/Objects Added Files: unicodectype.c Log Message: Unicode character type helpers, written by Marc-Andre Lemburg. From guido@cnri.reston.va.us Fri Mar 10 22:53:26 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:53:26 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,NONE,2.1 Message-ID: <200003102253.RAA03090@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/home/guido/hp/mal/py-patched/Objects Added Files: unicodeobject.c Log Message: Unicode implementation by Marc-Andre Lemburg based on original code by Fredrik Lundh. From guido@cnri.reston.va.us Fri Mar 10 22:55:22 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:55:22 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.32,2.33 fileobject.c,2.70,2.71 floatobject.c,2.54,2.55 intobject.c,2.38,2.39 object.c,2.62,2.63 stringobject.c,2.57,2.58 Message-ID: <200003102255.RAA03362@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/home/guido/hp/mal/py-patched/Objects Modified Files: abstract.c fileobject.c floatobject.c intobject.c object.c stringobject.c Log Message: Many changes for Unicode, by Marc-Andre Lemburg. Index: abstract.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/abstract.c,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -r2.32 -r2.33 *** abstract.c 2000/03/07 15:54:45 2.32 --- abstract.c 2000/03/10 22:55:18 2.33 *************** *** 200,203 **** --- 200,311 ---- } + int PyObject_AsCharBuffer(PyObject *obj, + const char **buffer, + int *buffer_len) + { + PyBufferProcs *pb; + const char *pp; + int len; + + if (obj == NULL || buffer == NULL || buffer_len == NULL) { + null_error(); + return -1; + } + pb = obj->ob_type->tp_as_buffer; + if ( pb == NULL || + pb->bf_getcharbuffer == NULL || + pb->bf_getsegcount == NULL ) { + PyErr_SetString(PyExc_TypeError, + "expected a character buffer object"); + goto onError; + } + if ( (*pb->bf_getsegcount)(obj,NULL) != 1 ) { + PyErr_SetString(PyExc_TypeError, + "expected a single-segment buffer object"); + goto onError; + } + len = (*pb->bf_getcharbuffer)(obj,0,&pp); + if (len < 0) + goto onError; + *buffer = pp; + *buffer_len = len; + return 0; + + onError: + return -1; + } + + int PyObject_AsReadBuffer(PyObject *obj, + const void **buffer, + int *buffer_len) + { + PyBufferProcs *pb; + void *pp; + int len; + + if (obj == NULL || buffer == NULL || buffer_len == NULL) { + null_error(); + return -1; + } + pb = obj->ob_type->tp_as_buffer; + if ( pb == NULL || + pb->bf_getreadbuffer == NULL || + pb->bf_getsegcount == NULL ) { + PyErr_SetString(PyExc_TypeError, + "expected a readable buffer object"); + goto onError; + } + if ( (*pb->bf_getsegcount)(obj,NULL) != 1 ) { + PyErr_SetString(PyExc_TypeError, + "expected a single-segment buffer object"); + goto onError; + } + len = (*pb->bf_getreadbuffer)(obj,0,&pp); + if (len < 0) + goto onError; + *buffer = pp; + *buffer_len = len; + return 0; + + onError: + return -1; + } + + int PyObject_AsWriteBuffer(PyObject *obj, + void **buffer, + int *buffer_len) + { + PyBufferProcs *pb; + void*pp; + int len; + + if (obj == NULL || buffer == NULL || buffer_len == NULL) { + null_error(); + return -1; + } + pb = obj->ob_type->tp_as_buffer; + if ( pb == NULL || + pb->bf_getwritebuffer == NULL || + pb->bf_getsegcount == NULL ) { + PyErr_SetString(PyExc_TypeError, + "expected a writeable buffer object"); + goto onError; + } + if ( (*pb->bf_getsegcount)(obj,NULL) != 1 ) { + PyErr_SetString(PyExc_TypeError, + "expected a single-segment buffer object"); + goto onError; + } + len = (*pb->bf_getwritebuffer)(obj,0,&pp); + if (len < 0) + goto onError; + *buffer = pp; + *buffer_len = len; + return 0; + + onError: + return -1; + } + /* Operations on numbers */ *************** *** 448,451 **** --- 556,561 ---- if (PyString_Check(v)) return PyString_Format(v, w); + else if (PyUnicode_Check(v)) + return PyUnicode_Format(v, w); BINOP(v, w, "__mod__", "__rmod__", PyNumber_Remainder); if (v->ob_type->tp_as_number != NULL) { *************** *** 622,625 **** --- 732,737 ---- { PyNumberMethods *m; + const char *buffer; + int buffer_len; if (o == NULL) *************** *** 630,633 **** --- 742,747 ---- if (m && m->nb_int) return m->nb_int(o); + if (!PyObject_AsCharBuffer(o, &buffer, &buffer_len)) + return PyInt_FromString((char*)buffer, NULL, 10); return type_error("object can't be converted to int"); *************** *** 656,670 **** */ static PyObject * ! long_from_string(v) ! PyObject *v; { ! char *s, *end; PyObject *x; char buffer[256]; /* For errors */ ! s = PyString_AS_STRING(v); while (*s && isspace(Py_CHARMASK(*s))) s++; ! x = PyLong_FromString(s, &end, 10); if (x == NULL) { if (PyErr_ExceptionMatches(PyExc_ValueError)) --- 770,786 ---- */ static PyObject * ! long_from_string(s, len) ! const char *s; ! int len; { ! const char *start; ! char *end; PyObject *x; char buffer[256]; /* For errors */ ! start = s; while (*s && isspace(Py_CHARMASK(*s))) s++; ! x = PyLong_FromString((char*)s, &end, 10); if (x == NULL) { if (PyErr_ExceptionMatches(PyExc_ValueError)) *************** *** 681,685 **** return NULL; } ! else if (end != PyString_AS_STRING(v) + PyString_GET_SIZE(v)) { PyErr_SetString(PyExc_ValueError, "null byte in argument for long()"); --- 797,801 ---- return NULL; } ! else if (end != start + len) { PyErr_SetString(PyExc_ValueError, "null byte in argument for long()"); *************** *** 694,697 **** --- 810,815 ---- { PyNumberMethods *m; + const char *buffer; + int buffer_len; if (o == NULL) *************** *** 702,709 **** * exception, not truncate the float. */ ! return long_from_string(o); m = o->ob_type->tp_as_number; if (m && m->nb_long) return m->nb_long(o); return type_error("object can't be converted to long"); --- 820,830 ---- * exception, not truncate the float. */ ! return long_from_string(PyString_AS_STRING(o), ! PyString_GET_SIZE(o)); m = o->ob_type->tp_as_number; if (m && m->nb_long) return m->nb_long(o); + if (!PyObject_AsCharBuffer(o, &buffer, &buffer_len)) + return long_from_string(buffer, buffer_len); return type_error("object can't be converted to long"); *************** *** 718,728 **** if (o == NULL) return null_error(); ! if (PyString_Check(o)) ! return PyFloat_FromString(o, NULL); ! m = o->ob_type->tp_as_number; ! if (m && m->nb_float) ! return m->nb_float(o); ! ! return type_error("object can't be converted to float"); } --- 839,848 ---- if (o == NULL) return null_error(); ! if (!PyString_Check(o)) { ! m = o->ob_type->tp_as_number; ! if (m && m->nb_float) ! return m->nb_float(o); ! } ! return PyFloat_FromString(o, NULL); } Index: fileobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/fileobject.c,v retrieving revision 2.70 retrieving revision 2.71 diff -C2 -r2.70 -r2.71 *** fileobject.c 2000/02/29 13:59:28 2.70 --- fileobject.c 2000/03/10 22:55:18 2.71 *************** *** 76,79 **** --- 76,81 ---- int (*f_close) Py_PROTO((FILE *)); int f_softspace; /* Flag used by 'print' command */ + int f_binary; /* Flag which indicates whether the file is open + open in binary (1) or test (0) mode */ } PyFileObject; *************** *** 113,116 **** --- 115,122 ---- f->f_close = close; f->f_softspace = 0; + if (strchr(mode,'b') != NULL) + f->f_binary = 1; + else + f->f_binary = 0; if (f->f_name == NULL || f->f_mode == NULL) { Py_DECREF(f); *************** *** 864,868 **** if (f->f_fp == NULL) return err_closed(); ! if (!PyArg_Parse(args, "s#", &s, &n)) return NULL; f->f_softspace = 0; --- 870,874 ---- if (f->f_fp == NULL) return err_closed(); ! if (!PyArg_Parse(args, f->f_binary ? "s#" : "t#", &s, &n)) return NULL; f->f_softspace = 0; Index: floatobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/floatobject.c,v retrieving revision 2.54 retrieving revision 2.55 diff -C2 -r2.54 -r2.55 *** floatobject.c 2000/01/20 22:32:54 2.54 --- floatobject.c 2000/03/10 22:55:18 2.55 *************** *** 156,168 **** { extern double strtod Py_PROTO((const char *, char **)); ! char *s, *last, *end; double x; char buffer[256]; /* For errors */ ! if (!PyString_Check(v)) return NULL; ! s = PyString_AS_STRING(v); ! last = s + PyString_GET_SIZE(v); while (*s && isspace(Py_CHARMASK(*s))) s++; --- 156,175 ---- { extern double strtod Py_PROTO((const char *, char **)); ! const char *s, *last, *end; double x; char buffer[256]; /* For errors */ + int len; ! if (PyString_Check(v)) { ! s = PyString_AS_STRING(v); ! len = PyString_GET_SIZE(v); ! } ! else if (PyObject_AsCharBuffer(v, &s, &len)) { ! PyErr_SetString(PyExc_TypeError, ! "float() needs a string argument"); return NULL; ! } ! last = s + len; while (*s && isspace(Py_CHARMASK(*s))) s++; *************** *** 173,177 **** errno = 0; PyFPE_START_PROTECT("PyFloat_FromString", return 0) ! x = strtod(s, &end); PyFPE_END_PROTECT(x) /* Believe it or not, Solaris 2.6 can move end *beyond* the null --- 180,184 ---- errno = 0; PyFPE_START_PROTECT("PyFloat_FromString", return 0) ! x = strtod((char *)s, (char **)&end); PyFPE_END_PROTECT(x) /* Believe it or not, Solaris 2.6 can move end *beyond* the null *************** *** 186,190 **** return NULL; } ! else if (end != PyString_AS_STRING(v) + PyString_GET_SIZE(v)) { PyErr_SetString(PyExc_ValueError, "null byte in argument for float()"); --- 193,197 ---- return NULL; } ! else if (end != last) { PyErr_SetString(PyExc_ValueError, "null byte in argument for float()"); *************** *** 197,201 **** } if (pend) ! *pend = end; return PyFloat_FromDouble(x); } --- 204,208 ---- } if (pend) ! *pend = (char *)end; return PyFloat_FromDouble(x); } *************** *** 786,790 **** fprintf(stderr, "# \n", ! p, p->ob_refcnt, buf); } } --- 793,797 ---- fprintf(stderr, "# \n", ! (long)p, p->ob_refcnt, buf); } } Index: intobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/intobject.c,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -r2.38 -r2.39 *** intobject.c 2000/02/15 14:51:46 2.38 --- intobject.c 2000/03/10 22:55:18 2.39 *************** *** 943,947 **** fprintf(stderr, "# \n", ! p, p->ob_refcnt, p->ob_ival); } list = list->next; --- 943,947 ---- fprintf(stderr, "# \n", ! (long)p, p->ob_refcnt, p->ob_ival); } list = list->next; Index: object.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/object.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -r2.62 -r2.63 *** object.c 2000/01/20 22:32:54 2.62 --- object.c 2000/03/10 22:55:18 2.63 *************** *** 190,198 **** if (s == NULL) ret = -1; - else if (!PyString_Check(s)) { - PyErr_SetString(PyExc_TypeError, - "repr not string"); - ret = -1; - } else { ret = PyObject_Print(s, fp, --- 190,193 ---- *************** *** 235,240 **** return PyString_FromString(buf); } ! else ! return (*v->ob_type->tp_repr)(v); } --- 230,247 ---- return PyString_FromString(buf); } ! else { ! PyObject *res; ! res = (*v->ob_type->tp_repr)(v); ! if (res == NULL) ! return NULL; ! if (!PyString_Check(res)) { ! PyErr_Format(PyExc_TypeError, ! "__repr__ returned non-string (type %s)", ! res->ob_type->tp_name); ! Py_DECREF(res); ! return NULL; ! } ! return res; ! } } *************** *** 243,246 **** --- 250,255 ---- PyObject *v; { + PyObject *res; + if (v == NULL) return PyString_FromString(""); *************** *** 250,257 **** } else if (v->ob_type->tp_str != NULL) ! return (*v->ob_type->tp_str)(v); else { PyObject *func; - PyObject *res; if (!PyInstance_Check(v) || (func = PyObject_GetAttrString(v, "__str__")) == NULL) { --- 259,265 ---- } else if (v->ob_type->tp_str != NULL) ! res = (*v->ob_type->tp_str)(v); else { PyObject *func; if (!PyInstance_Check(v) || (func = PyObject_GetAttrString(v, "__str__")) == NULL) { *************** *** 261,266 **** res = PyEval_CallObject(func, (PyObject *)NULL); Py_DECREF(func); - return res; } } --- 269,283 ---- res = PyEval_CallObject(func, (PyObject *)NULL); Py_DECREF(func); } + if (res == NULL) + return NULL; + if (!PyString_Check(res)) { + PyErr_Format(PyExc_TypeError, + "__str__ returned non-string (type %s)", + res->ob_type->tp_name); + Py_DECREF(res); + return NULL; + } + return res; } *************** *** 331,334 **** --- 348,353 ---- } } + else if (PyUnicode_Check(v) || PyUnicode_Check(w)) + return PyUnicode_Compare(v, w); else if (vtp->tp_as_number != NULL) vname = ""; *************** *** 653,657 **** { #ifdef SLOW_UNREF_CHECK ! register PyObject *p; #endif if (op->ob_refcnt < 0) --- 672,676 ---- { #ifdef SLOW_UNREF_CHECK ! register PyObject *p; #endif if (op->ob_refcnt < 0) Index: stringobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/stringobject.c,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -r2.57 -r2.58 *** stringobject.c 2000/03/07 15:53:43 2.57 --- stringobject.c 2000/03/10 22:55:18 2.58 *************** *** 292,295 **** --- 292,297 ---- register PyStringObject *op; if (!PyString_Check(bb)) { + if (PyUnicode_Check(bb)) + return PyUnicode_Concat((PyObject *)a, bb); PyErr_BadArgument(); return NULL; *************** *** 561,566 **** int maxsplit; [...1356 lines suppressed...] {"lstrip", (PyCFunction)string_lstrip, 1, lstrip__doc__}, {"replace", (PyCFunction)string_replace, 1, replace__doc__}, {"rfind", (PyCFunction)string_rfind, 1, rfind__doc__}, {"rindex", (PyCFunction)string_rindex, 1, rindex__doc__}, {"rstrip", (PyCFunction)string_rstrip, 1, rstrip__doc__}, {"startswith", (PyCFunction)string_startswith, 1, startswith__doc__}, {"strip", (PyCFunction)string_strip, 1, strip__doc__}, {"swapcase", (PyCFunction)string_swapcase, 1, swapcase__doc__}, ! {"translate", (PyCFunction)string_translate, 1, translate__doc__}, ! {"title", (PyCFunction)string_title, 1, title__doc__}, ! {"ljust", (PyCFunction)string_ljust, 1, ljust__doc__}, ! {"rjust", (PyCFunction)string_rjust, 1, rjust__doc__}, ! {"center", (PyCFunction)string_center, 1, center__doc__}, ! {"expandtabs", (PyCFunction)string_expandtabs, 1, expandtabs__doc__}, ! {"splitlines", (PyCFunction)string_splitlines, 1, splitlines__doc__}, ! #if 0 ! {"zfill", (PyCFunction)string_zfill, 1, zfill__doc__}, ! #endif {NULL, NULL} /* sentinel */ }; From guido@cnri.reston.va.us Fri Mar 10 22:55:42 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:55:42 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects Makefile.in,2.12,2.13 Message-ID: <200003102255.RAA03422@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/home/guido/hp/mal/py-patched/Objects Modified Files: Makefile.in Log Message: Marc-AAndre Lemburg: add new unicode files Index: Makefile.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/Makefile.in,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -r2.12 -r2.13 *** Makefile.in 1998/10/07 14:41:13 2.12 --- Makefile.in 2000/03/10 22:55:40 2.13 *************** *** 36,40 **** moduleobject.o object.o rangeobject.o \ sliceobject.o stringobject.o \ ! tupleobject.o typeobject.o SRCS= abstract.c bufferobject.c \ --- 36,41 ---- moduleobject.o object.o rangeobject.o \ sliceobject.o stringobject.o \ ! tupleobject.o typeobject.o \ ! unicodeobject.o unicodectype.o SRCS= abstract.c bufferobject.c \ *************** *** 45,49 **** moduleobject.c object.c rangeobject.c \ sliceobject.c stringobject.c \ ! tupleobject.c typeobject.c LIBRARY= ../libpython$(VERSION).a --- 46,51 ---- moduleobject.c object.c rangeobject.c \ sliceobject.c stringobject.c \ ! tupleobject.c typeobject.c \ ! unicodeobject.c unicodectype.c LIBRARY= ../libpython$(VERSION).a *************** *** 95,98 **** --- 97,102 ---- tupleobject.o: tupleobject.c typeobject.o: typeobject.c + unicodeobject.o: unicodeobject.c + unicodectype.o: unicodectype.c # DO NOT DELETE THIS LINE -- mkdep uses it. From guido@cnri.reston.va.us Fri Mar 10 22:56:56 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:56:56 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Parser tokenizer.c,2.37,2.38 Message-ID: <200003102256.RAA03594@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Parser In directory eric:/home/guido/hp/mal/py-patched/Parser Modified Files: tokenizer.c Log Message: Marc-Andre Lemburg: add new string token types u"..." and ur"..." (Unicode and raw Unicode). Index: tokenizer.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -r2.37 -r2.38 *** tokenizer.c 1998/12/04 18:51:01 2.37 --- tokenizer.c 2000/03/10 22:56:54 2.38 *************** *** 592,595 **** --- 592,596 ---- /* Identifier (most frequent token!) */ if (isalpha(c) || c == '_') { + /* Process r"", u"" and ur"" */ switch (c) { case 'r': *************** *** 598,601 **** --- 599,611 ---- if (c == '"' || c == '\'') goto letter_quote; + break; + case 'u': + case 'U': + c = tok_nextc(tok); + if (c == 'r' || c == 'R') + c = tok_nextc(tok); + if (c == '"' || c == '\'') + goto letter_quote; + break; } while (isalnum(c) || c == '_') { From guido@cnri.reston.va.us Fri Mar 10 22:57:29 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 17:57:29 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python codecs.c,NONE,2.1 Message-ID: <200003102257.RAA03682@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/home/guido/hp/mal/py-patched/Python Added Files: codecs.c Log Message: Python Codec Registry and support functions, written by Marc-Andre Lemburg. From guido@cnri.reston.va.us Fri Mar 10 23:00:55 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:00:55 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.149,2.150 Message-ID: <200003102300.SAA04124@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/home/guido/hp/mal/py-patched/Python Modified Files: bltinmodule.c Log Message: Marc-Andre Lemburg: added new builtin functions unicode() and unichr(); changed ord() to support Unicode strings; added new exception UnicodeError; fixed a typo in doc string for buffer(). Index: bltinmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.149 retrieving revision 2.150 diff -C2 -r2.149 -r2.150 *** bltinmodule.c 2000/02/29 13:59:29 2.149 --- bltinmodule.c 2000/03/10 23:00:52 2.150 *************** *** 153,157 **** static char buffer_doc[] = ! "buffer(object [, offset[, size]) -> object\n\ \n\ Creates a new buffer object which references the given object.\n\ --- 153,157 ---- static char buffer_doc[] = ! "buffer(object [, offset[, size]]) -> object\n\ \n\ Creates a new buffer object which references the given object.\n\ *************** *** 162,165 **** --- 162,189 ---- static PyObject * + builtin_unicode(self, args) + PyObject *self; + PyObject *args; + { + char *s; + int len; + char *encoding = NULL; + char *errors = NULL; + + if ( !PyArg_ParseTuple(args, "s#|ss:unicode", &s, &len, + &encoding, &errors) ) + return NULL; + return PyUnicode_Decode(s, len, encoding, errors); + } + + static char unicode_doc[] = + "unicode(string [, encoding[, errors]]) -> object\n\ + \n\ + Creates a new unicode object from the given encoded string.\n\ + encoding defaults to 'utf-8' and errors, defining the error handling,\n\ + to 'strict'."; + + + static PyObject * builtin_callable(self, args) PyObject *self; *************** *** 313,316 **** --- 337,365 ---- static PyObject * + builtin_unichr(self, args) + PyObject *self; + PyObject *args; + { + long x; + Py_UNICODE s[1]; + + if (!PyArg_ParseTuple(args, "l:unichr", &x)) + return NULL; + if (x < 0 || x >= 65536) { + PyErr_SetString(PyExc_ValueError, + "unichr() arg not in range(65536)"); + return NULL; + } + s[0] = (Py_UNICODE)x; + return PyUnicode_FromUnicode(s, 1); + } + + static char unichr_doc[] = + "unichr(i) -> unicode character\n\ + \n\ + Return a unicode string of one character with ordinal i; 0 <= i < 65536."; + + + static PyObject * builtin_cmp(self, args) PyObject *self; *************** *** 1542,1550 **** PyObject *args; { ! char c; ! if (!PyArg_ParseTuple(args, "c:ord", &c)) return NULL; ! return PyInt_FromLong((long)(c & 0xff)); } --- 1591,1611 ---- PyObject *args; { ! PyObject *obj; ! long ord; ! if (!PyArg_ParseTuple(args, "O:ord", &obj)) return NULL; ! ! if (PyString_Check(obj) && PyString_GET_SIZE(obj) == 1) ! ord = (long)((unsigned char)*PyString_AS_STRING(obj)); ! else if (PyUnicode_Check(obj) && PyUnicode_GET_SIZE(obj) == 1) ! ord = (long)*PyUnicode_AS_UNICODE(obj); ! else { ! PyErr_SetString(PyExc_TypeError, ! "expected a string or unicode character"); ! return NULL; ! } ! ! return PyInt_FromLong(ord); } *************** *** 1552,1556 **** "ord(c) -> integer\n\ \n\ ! Return the integer ordinal of a one character string."; --- 1613,1617 ---- "ord(c) -> integer\n\ \n\ ! Return the integer ordinal of a one character [unicode] string."; *************** *** 2228,2231 **** --- 2289,2294 ---- {"tuple", builtin_tuple, 1, tuple_doc}, {"type", builtin_type, 1, type_doc}, + {"unicode", builtin_unicode, 1, unicode_doc}, + {"unichr", builtin_unichr, 1, unichr_doc}, {"vars", builtin_vars, 1, vars_doc}, {"xrange", builtin_xrange, 1, xrange_doc}, *************** *** 2260,2263 **** --- 2323,2327 ---- PyObject *PyExc_SystemExit; PyObject *PyExc_UnboundLocalError; + PyObject *PyExc_UnicodeError; PyObject *PyExc_TypeError; PyObject *PyExc_ValueError; *************** *** 2305,2308 **** --- 2369,2373 ---- {"SystemExit", &PyExc_SystemExit, 1}, {"UnboundLocalError", &PyExc_UnboundLocalError, 1}, + {"UnicodeError", &PyExc_UnicodeError, 1}, {"TypeError", &PyExc_TypeError, 1}, {"ValueError", &PyExc_ValueError, 1}, *************** *** 2466,2469 **** --- 2531,2542 ---- if (PyDict_SetItemString(dict, "UnboundLocalError", PyExc_NameError) != 0) + Py_FatalError("Cannot create string-based exceptions"); + + /* Make UnicodeError an alias for ValueError */ + Py_INCREF(PyExc_ValueError); + Py_DECREF(PyExc_UnicodeError); + PyExc_UnicodeError = PyExc_ValueError; + if (PyDict_SetItemString(dict, "UnicodeError", + PyExc_ValueError) != 0) Py_FatalError("Cannot create string-based exceptions"); From guido@cnri.reston.va.us Fri Mar 10 23:01:39 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:01:39 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.99,2.100 Message-ID: <200003102301.SAA04232@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/home/guido/hp/mal/py-patched/Python Modified Files: compile.c Log Message: Marc-Andre Lemburg: support for Unicode string literals (u"...", ur"..."). Index: compile.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/compile.c,v retrieving revision 2.99 retrieving revision 2.100 diff -C2 -r2.99 -r2.100 *** compile.c 1999/12/20 20:40:12 2.99 --- compile.c 2000/03/10 23:01:36 2.100 *************** *** 876,881 **** int first = *s; int quote = first; ! if (isalpha(quote) || quote == '_') ! quote = *++s; if (quote != '\'' && quote != '\"') { PyErr_BadInternalCall(); --- 876,891 ---- int first = *s; int quote = first; ! int rawmode = 0; ! int unicode = 0; ! if (isalpha(quote) || quote == '_') { ! if (quote == 'u' || quote == 'U') { ! quote = *++s; ! unicode = 1; ! } ! if (quote == 'r' || quote == 'R') { ! quote = *++s; ! rawmode = 1; ! } ! } if (quote != '\'' && quote != '\"') { PyErr_BadInternalCall(); *************** *** 896,901 **** } } ! if (first != quote || strchr(s, '\\') == NULL) return PyString_FromStringAndSize(s, len); v = PyString_FromStringAndSize((char *)NULL, len); p = buf = PyString_AsString(v); --- 906,920 ---- } } ! if (unicode) { ! if (rawmode) ! return PyUnicode_DecodeRawUnicodeEscape( ! s, len, NULL); ! else ! return PyUnicode_DecodeUnicodeEscape( ! s, len, NULL); ! } ! else if (rawmode || strchr(s, '\\') == NULL) { return PyString_FromStringAndSize(s, len); + } v = PyString_FromStringAndSize((char *)NULL, len); p = buf = PyString_AsString(v); From guido@cnri.reston.va.us Fri Mar 10 23:02:20 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:02:20 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python getargs.c,2.25,2.26 Message-ID: <200003102302.SAA04335@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/home/guido/hp/mal/py-patched/Python Modified Files: getargs.c Log Message: Marc-Andre Lemburg: support for Unicode strings; 'U' expects a Unicode object. Index: getargs.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/getargs.c,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -r2.25 -r2.26 *** getargs.c 1999/02/17 23:16:43 2.25 --- getargs.c 2000/03/10 23:02:17 2.26 *************** *** 586,590 **** if (PyString_Check(arg)) ! *p = PyString_AsString(arg); else return "string"; --- 586,596 ---- if (PyString_Check(arg)) ! *p = PyString_AS_STRING(arg); ! else if (PyUnicode_Check(arg)) { ! arg = PyUnicode_AsUTF8String(arg); ! if (arg == NULL) ! return "unicode conversion error"; ! *p = PyString_AS_STRING(arg); ! } else return "string"; *************** *** 626,629 **** --- 632,641 ---- else if (PyString_Check(arg)) *p = PyString_AsString(arg); + else if (PyUnicode_Check(arg)) { + arg = PyUnicode_AsUTF8String(arg); + if (arg == NULL) + return "unicode conversion error"; + *p = PyString_AS_STRING(arg); + } else return "None or string"; *************** *** 650,653 **** --- 662,675 ---- else return "string"; + break; + } + + case 'U': /* Unicode object */ + { + PyObject **p = va_arg(*p_va, PyObject **); + if (PyUnicode_Check(arg)) + *p = arg; + else + return "unicode"; break; } From guido@cnri.reston.va.us Fri Mar 10 23:03:04 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:03:04 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python marshal.c,1.44,1.45 Message-ID: <200003102303.SAA04446@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/home/guido/hp/mal/py-patched/Python Modified Files: marshal.c Log Message: Marc-Andre Lemburg: support marshalling Unicode objects (code 'u'). Index: marshal.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/marshal.c,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -r1.44 -r1.45 *** marshal.c 1998/10/08 01:45:47 1.44 --- marshal.c 2000/03/10 23:03:02 1.45 *************** *** 53,56 **** --- 53,57 ---- #define TYPE_DICT '{' #define TYPE_CODE 'c' + #define TYPE_UNICODE 'u' #define TYPE_UNKNOWN '?' *************** *** 214,221 **** else if (PyString_Check(v)) { w_byte(TYPE_STRING, p); ! n = PyString_Size(v); w_long((long)n, p); ! w_string(PyString_AsString(v), n, p); } else if (PyTuple_Check(v)) { w_byte(TYPE_TUPLE, p); --- 215,235 ---- else if (PyString_Check(v)) { w_byte(TYPE_STRING, p); ! n = PyString_GET_SIZE(v); w_long((long)n, p); ! w_string(PyString_AS_STRING(v), n, p); } + else if (PyUnicode_Check(v)) { + PyObject *utf8; + utf8 = PyUnicode_AsUTF8String(v); + if (utf8 == NULL) { + p->error = 1; + return; + } + w_byte(TYPE_UNICODE, p); + n = PyString_GET_SIZE(utf8); + w_long((long)n, p); + w_string(PyString_AS_STRING(utf8), n, p); + Py_DECREF(utf8); + } else if (PyTuple_Check(v)) { w_byte(TYPE_TUPLE, p); *************** *** 228,235 **** else if (PyList_Check(v)) { w_byte(TYPE_LIST, p); ! n = PyList_Size(v); w_long((long)n, p); for (i = 0; i < n; i++) { ! w_object(PyList_GetItem(v, i), p); } } --- 242,249 ---- else if (PyList_Check(v)) { w_byte(TYPE_LIST, p); ! n = PyList_GET_SIZE(v); w_long((long)n, p); for (i = 0; i < n; i++) { ! w_object(PyList_GET_ITEM(v, i), p); } } *************** *** 483,487 **** v = PyString_FromStringAndSize((char *)NULL, n); if (v != NULL) { ! if (r_string(PyString_AsString(v), (int)n, p) != n) { Py_DECREF(v); v = NULL; --- 497,501 ---- v = PyString_FromStringAndSize((char *)NULL, n); if (v != NULL) { ! if (r_string(PyString_AS_STRING(v), (int)n, p) != n) { Py_DECREF(v); v = NULL; *************** *** 492,495 **** --- 506,532 ---- return v; + case TYPE_UNICODE: + { + char *buffer; + + n = r_long(p); + if (n < 0) { + PyErr_SetString(PyExc_ValueError, "bad marshal data"); + return NULL; + } + buffer = (char *)Py_Malloc(n); + if (buffer == NULL) + return NULL; + if (r_string(buffer, (int)n, p) != n) { + free(buffer); + PyErr_SetString(PyExc_EOFError, + "EOF read where object expected"); + return NULL; + } + v = PyUnicode_DecodeUTF8(buffer, n, NULL); + free(buffer); + return v; + } + case TYPE_TUPLE: n = r_long(p); From guido@cnri.reston.va.us Fri Mar 10 23:03:56 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:03:56 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.90,2.91 Message-ID: <200003102303.SAA04571@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/home/guido/hp/mal/py-patched/Python Modified Files: pythonrun.c Log Message: Marc-Andre Lemburg: add calls to initialize and finalize Unicode and Codec registry. Index: pythonrun.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/pythonrun.c,v retrieving revision 2.90 retrieving revision 2.91 diff -C2 -r2.90 -r2.91 *** pythonrun.c 2000/01/20 22:32:56 2.90 --- pythonrun.c 2000/03/10 23:03:54 2.91 *************** *** 77,80 **** --- 77,86 ---- #endif + extern void _PyUnicode_Init(); + extern void _PyUnicode_Fini(); + extern void _PyCodecRegistry_Init(); + extern void _PyCodecRegistry_Fini(); + + int Py_DebugFlag; /* Needed by parser.c */ int Py_VerboseFlag; /* Needed by import.c */ *************** *** 138,141 **** --- 144,153 ---- Py_FatalError("Py_Initialize: can't make modules dictionary"); + /* Init codec registry */ + _PyCodecRegistry_Init(); + + /* Init Unicode implementation; relies on the codec registry */ + _PyUnicode_Init(); + bimod = _PyBuiltin_Init_1(); if (bimod == NULL) *************** *** 206,209 **** --- 218,227 ---- /* Destroy PyExc_MemoryErrorInst */ _PyBuiltin_Fini_1(); + + /* Cleanup Unicode implementation */ + _PyUnicode_Fini(); + + /* Cleanup Codec registry */ + _PyCodecRegistry_Fini(); /* Destroy all modules */ From guido@cnri.reston.va.us Fri Mar 10 23:04:16 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:04:16 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python Makefile.in,2.22,2.23 Message-ID: <200003102304.SAA04629@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/home/guido/hp/mal/py-patched/Python Modified Files: Makefile.in Log Message: Marc-Andre Lemburg: add new unicode files Index: Makefile.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/Makefile.in,v retrieving revision 2.22 retrieving revision 2.23 diff -C2 -r2.22 -r2.23 *** Makefile.in 1999/12/20 21:24:09 2.22 --- Makefile.in 2000/03/10 23:04:14 2.23 *************** *** 38,42 **** AROBJS= \ bltinmodule.o \ ! ceval.o compile.o \ errors.o \ frozen.o frozenmain.o \ --- 38,42 ---- AROBJS= \ bltinmodule.o \ ! ceval.o compile.o codecs.o \ errors.o \ frozen.o frozenmain.o \ *************** *** 92,95 **** --- 92,96 ---- bltinmodule.o: bltinmodule.c ceval.o: ceval.c + codecs.o: codecs.c compile.o: compile.c dup2.o: dup2.c From guido@cnri.reston.va.us Fri Mar 10 23:08:07 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:08:07 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules unicodedatabase.c,NONE,2.1 unicodedatabase.h,NONE,2.1 Message-ID: <200003102308.SAA05127@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/home/guido/hp/mal/py-patched/Modules Added Files: unicodedatabase.c unicodedatabase.h Log Message: Marc-Andre-Lemburg: The Unicode Database. From guido@cnri.reston.va.us Fri Mar 10 23:09:25 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:09:25 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules _codecsmodule.c,NONE,2.1 Message-ID: <200003102309.SAA05301@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/home/guido/hp/mal/py-patched/Modules Added Files: _codecsmodule.c Log Message: Internal module _codecs -- Provides access to the codec registry and the builtin codecs. Written by Marc-Andre Lemburg. From guido@cnri.reston.va.us Fri Mar 10 23:10:24 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:10:24 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules unicodedata.c,NONE,2.1 Message-ID: <200003102310.SAA05453@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/home/guido/hp/mal/py-patched/Modules Added Files: unicodedata.c Log Message: Module unicodedata -- Provides access to the Unicode 3.0 data base. Written by Marc-Andre Lemburg. From guido@cnri.reston.va.us Fri Mar 10 23:11:43 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:11:43 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.38,2.39 Message-ID: <200003102311.SAA05632@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/home/guido/hp/mal/py-patched/Modules Modified Files: cPickle.c Log Message: Marc-Andre Lemburg: support pickling Unicode objects, both in text mode ('V') and in binary mode ('X'). Index: cPickle.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/cPickle.c,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -r2.38 -r2.39 *** cPickle.c 2000/02/29 13:59:22 2.38 --- cPickle.c 2000/03/10 23:11:40 2.39 *************** *** 90,93 **** --- 90,95 ---- #define BINSTRING 'T' #define SHORT_BINSTRING 'U' + #define UNICODE 'V' + #define BINUNICODE 'X' #define APPEND 'a' #define BUILD 'b' *************** *** 1161,1164 **** --- 1163,1239 ---- static int + save_unicode(Picklerobject *self, PyObject *args, int doput) { + int size, len; + PyObject *repr=0; + + if (!PyUnicode_Check(args)) + return -1; + + if (!self->bin) { + char *repr_str; + static char string = UNICODE; + + UNLESS (repr = PyUnicode_AsRawUnicodeEscapeString(args)) + return -1; + + if ((len = PyString_Size(repr)) < 0) + goto err; + repr_str = PyString_AS_STRING((PyStringObject *)repr); + + if ((*self->write_func)(self, &string, 1) < 0) + goto err; + + if ((*self->write_func)(self, repr_str, len) < 0) + goto err; + + if ((*self->write_func)(self, "\n", 1) < 0) + goto err; + + Py_XDECREF(repr); + } + else { + int i; + char c_str[5]; + + UNLESS (repr = PyUnicode_AsUTF8String(args)) + return -1; + + if ((size = PyString_Size(repr)) < 0) + goto err; + + c_str[0] = BINUNICODE; + for (i = 1; i < 5; i++) + c_str[i] = (int)(size >> ((i - 1) * 8)); + len = 5; + + if ((*self->write_func)(self, c_str, len) < 0) + goto err; + + if (size > 128 && Pdata_Check(self->file)) { + if (write_other(self, NULL, 0) < 0) + goto err; + PDATA_APPEND(self->file, repr, -1); + } + else { + if ((*self->write_func)(self, PyString_AS_STRING(repr), size) < 0) + goto err; + } + + Py_DECREF(repr); + } + + if (doput) + if (put(self, args) < 0) + return -1; + + return 0; + + err: + Py_XDECREF(repr); + return -1; + } + + + static int save_tuple(Picklerobject *self, PyObject *args) { PyObject *element = 0, *py_tuple_id = 0; *************** *** 1692,1695 **** --- 1767,1776 ---- goto finally; } + + case 'u': + if ((type == &PyUnicode_Type) && (PyString_GET_SIZE(args) < 2)) { + res = save_unicode(self, args, 0); + goto finally; + } } *************** *** 1723,1726 **** --- 1804,1814 ---- break; + case 'u': + if (type == &PyUnicode_Type) { + res = save_unicode(self, args, 1); + goto finally; + } + break; + case 't': if (type == &PyTuple_Type) { *************** *** 2668,2671 **** --- 2756,2800 ---- static int + load_unicode(Unpicklerobject *self) { + PyObject *str = 0; + int len, res = -1; + char *s; + + if ((len = (*self->readline_func)(self, &s)) < 0) return -1; + if (len < 2) return bad_readline(); + + UNLESS (str = PyUnicode_DecodeRawUnicodeEscape(s, len - 1, NULL)) + goto finally; + + PDATA_PUSH(self->stack, str, -1); + return 0; + + finally: + return res; + } + + + static int + load_binunicode(Unpicklerobject *self) { + PyObject *unicode; + long l; + char *s; + + if ((*self->read_func)(self, &s, 4) < 0) return -1; + + l = calc_binint(s, 4); + + if ((*self->read_func)(self, &s, l) < 0) + return -1; + + UNLESS (unicode = PyUnicode_DecodeUTF8(s, l, NULL)) + return -1; + + PDATA_PUSH(self->stack, unicode, -1); + return 0; + } + + + static int load_tuple(Unpicklerobject *self) { PyObject *tup; *************** *** 3413,3416 **** --- 3542,3555 ---- continue; + case UNICODE: + if (load_unicode(self) < 0) + break; + continue; + + case BINUNICODE: + if (load_binunicode(self) < 0) + break; + continue; + case EMPTY_TUPLE: if (load_empty_tuple(self) < 0) *************** *** 3690,3693 **** --- 3829,3842 ---- case STRING: if (load_string(self) < 0) + break; + continue; + + case UNICODE: + if (load_unicode(self) < 0) + break; + continue; + + case BINUNICODE: + if (load_binunicode(self) < 0) break; continue; From guido@cnri.reston.va.us Fri Mar 10 23:12:11 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:12:11 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules Setup.in,1.90,1.91 Message-ID: <200003102312.SAA05711@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/home/guido/hp/mal/py-patched/Modules Modified Files: Setup.in Log Message: Marc-Andre Lemburg: Add _codecs and unicodedata modules. Index: Setup.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/Setup.in,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -r1.90 -r1.91 *** Setup.in 2000/02/29 15:52:40 1.90 --- Setup.in 2000/03/10 23:12:08 1.91 *************** *** 135,138 **** --- 135,142 ---- time timemodule.c # -lm # time operations and variables operator operator.c # operator.add() and similar goodies + _codecs _codecsmodule.c # access to the builtin codecs and codec registry + + unicodedata unicodedata.c unicodedatabase.c + # static Unicode character database #_locale _localemodule.c # access to ISO C locale support From guido@cnri.reston.va.us Fri Mar 10 23:12:36 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:12:36 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules Makefile.pre.in,1.60,1.61 Message-ID: <200003102312.SAA05781@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/home/guido/hp/mal/py-patched/Modules Modified Files: Makefile.pre.in Log Message: Marc-Andre Lemburg: add new Unicode-related files. Index: Makefile.pre.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/Makefile.pre.in,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -r1.60 -r1.61 *** Makefile.pre.in 1999/12/16 17:52:08 1.60 --- Makefile.pre.in 2000/03/10 23:12:33 1.61 *************** *** 186,189 **** --- 186,190 ---- cgensupport.o: cgensupport.c clmodule.o: clmodule.c + _codecsmodule.o: _codecsmodule.c dbmmodule.o: dbmmodule.c errnomodule.o: errnomodule.c *************** *** 220,223 **** --- 221,226 ---- timemodule.o: timemodule.c timingmodule.o: timingmodule.c + unicodedata.o: unicodedata.c unicodedatabase.o + unicodedatabase.o: unicodedatabase.c unicodedatabase.h xxmodule.o: xxmodule.c yuvconvert.o: yuvconvert.c From guido@cnri.reston.va.us Fri Mar 10 23:14:14 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:14:14 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Misc unicode.txt,NONE,3.1 Message-ID: <200003102314.SAA06004@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Misc In directory eric:/home/guido/hp/mal/py-patched/Misc Added Files: unicode.txt Log Message: Marc-Andre Lemburg: Python Unicode integration proposal, version 1.2. From guido@cnri.reston.va.us Fri Mar 10 23:15:34 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:15:34 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib/encodings - New directory Message-ID: <200003102315.SAA06982@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib/encodings In directory eric:/home/guido/hp/mal/py-patched/Lib/encodings Log Message: Directory /projects/cvsroot/python/dist/src/Lib/encodings added to the repository From guido@cnri.reston.va.us Fri Mar 10 23:16:05 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:16:05 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib exceptions.py,1.17,1.18 Message-ID: <200003102316.SAA07805@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/home/guido/hp/mal/py-patched/Lib Modified Files: exceptions.py Log Message: Marc-Andre Lemburg: Add UnicodeError, derived from ValueError. Index: exceptions.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/exceptions.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** exceptions.py 2000/02/17 15:12:01 1.17 --- exceptions.py 2000/03/10 23:16:02 1.18 *************** *** 62,65 **** --- 62,68 ---- | +-- ValueError + | | + | +-- UnicodeError(*) + | +-- SystemError +-- MemoryError *************** *** 223,226 **** --- 226,233 ---- class UnboundLocalError(NameError): """Local name referenced but not bound to a value.""" + pass + + class UnicodeError(ValueError): + """Unicode related error.""" pass From guido@cnri.reston.va.us Fri Mar 10 23:17:39 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:17:39 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib/encodings __init__.py,NONE,1.1 aliases.py,NONE,1.1 ascii.py,NONE,1.1 charmap.py,NONE,1.1 cp037.py,NONE,1.1 cp1006.py,NONE,1.1 cp1026.py,NONE,1.1 cp1250.py,NONE,1.1 cp1251.py,NONE,1.1 cp1252.py,NONE,1.1 cp1253.py,NONE,1.1 cp1254.py,NONE,1.1 cp1255.py,NONE,1.1 cp1256.py,NONE,1.1 cp1257.py,NONE,1.1 cp1258.py,NONE,1.1 cp424.py,NONE,1.1 cp437.py,NONE,1.1 cp500.py,NONE,1.1 cp737.py,NONE,1.1 cp775.py,NONE,1.1 cp850.py,NONE,1.1 cp852.py,NONE,1.1 cp855.py,NONE,1.1 cp856.py,NONE,1.1 cp857.py,NONE,1.1 cp860.py,NONE,1.1 cp861.py,NONE,1.1 cp862.py,NONE,1.1 cp863.py,NONE,1.1 cp864.py,NONE,1.1 cp865.py,NONE,1.1 cp866.py,NONE,1.1 cp869.py,NONE,1.1 cp874.py,NONE,1.1 cp875.py,NONE,1.1 iso8859_1.py,NONE,1.1 iso8859_10.py,NONE,1.1 iso8859_13.py,NONE,1.1 iso8859_14.py,NONE,1.1 iso8859_15.py,NONE,1.1 iso8859_2.py,NONE,1.1 iso8859_3.py,NONE,1.1 iso8859_4.py,NONE,1.1 iso8859_5.py,NONE,1.1 iso8859_6.py,NONE,1.1 iso8859_7.py,NONE,1.1 iso8859_8.py,NONE,1.1 iso8859_9.p! y,NONE,1.1 koi8_r.py,NONE,1.1 latin_1.py,NONE,1.1 mac_cyrillic.py,NONE,1.1 mac_greek.py,NONE,1.1 mac_iceland.py,NONE,1.1 mac_latin2.py,NONE,1.1 mac_roman.py,NONE,1.1 mac_turkish.py,NONE,1.1 raw_unicode_escape.py,NONE,1.1 unicode_escape.py,NONE,1.1 unicode_internal.py,NONE,1.1 utf_16.py,NONE,1.1 utf_16_be.py,NONE,1.1 utf_16_le.py,NONE,1.1 utf_8.py,NONE,1.1 Message-ID: <200003102317.SAA09576@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib/encodings In directory eric:/home/guido/hp/mal/py-patched/Lib/encodings Added Files: __init__.py aliases.py ascii.py charmap.py cp037.py cp1006.py cp1026.py cp1250.py cp1251.py cp1252.py cp1253.py cp1254.py cp1255.py cp1256.py cp1257.py cp1258.py cp424.py cp437.py cp500.py cp737.py cp775.py cp850.py cp852.py cp855.py cp856.py cp857.py cp860.py cp861.py cp862.py cp863.py cp864.py cp865.py cp866.py cp869.py cp874.py cp875.py iso8859_1.py iso8859_10.py iso8859_13.py iso8859_14.py iso8859_15.py iso8859_2.py iso8859_3.py iso8859_4.py iso8859_5.py iso8859_6.py iso8859_7.py iso8859_8.py iso8859_9.py koi8_r.py latin_1.py mac_cyrillic.py mac_greek.py mac_iceland.py mac_latin2.py mac_roman.py mac_turkish.py raw_unicode_escape.py unicode_escape.py unicode_internal.py utf_16.py utf_16_be.py utf_16_le.py utf_8.py Log Message: Marc-Andre Lemburg: Unicode encodings. From guido@cnri.reston.va.us Fri Mar 10 23:18:14 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:18:14 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib types.py,1.13,1.14 Message-ID: <200003102318.SAA09744@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/home/guido/hp/mal/py-patched/Lib Modified Files: types.py Log Message: Marc-Andre Lemburg: add UnicodeType. Index: types.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/types.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** types.py 2000/02/04 15:28:41 1.13 --- types.py 2000/03/10 23:18:11 1.14 *************** *** 18,21 **** --- 18,22 ---- StringType = type('') + UnicodeType = type(u'') BufferType = type(buffer('')) From guido@cnri.reston.va.us Fri Mar 10 23:20:12 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:20:12 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib pickle.py,1.36,1.37 Message-ID: <200003102320.SAA10192@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/home/guido/hp/mal/py-patched/Lib Modified Files: pickle.py Log Message: Marc-Andre Lemburg: support pickling Unicode objects, both in text mode ('V') and in binary mode ('X'). Index: pickle.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/pickle.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** pickle.py 2000/02/04 15:10:33 1.36 --- pickle.py 2000/03/10 23:20:09 1.37 *************** *** 24,28 **** """ ! __version__ = "$Revision: 1.36 $" # Code version from types import * --- 24,28 ---- """ ! __version__ = "$Revision: 1.37 $" # Code version from types import * *************** *** 65,68 **** --- 65,70 ---- BINSTRING = 'T' SHORT_BINSTRING = 'U' + UNICODE = 'V' + BINUNICODE = 'X' APPEND = 'a' BUILD = 'b' *************** *** 276,279 **** --- 278,298 ---- dispatch[StringType] = save_string + def save_unicode(self, object): + d = id(object) + memo = self.memo + + if (self.bin): + encoding = object.encode('utf-8') + l = len(encoding) + s = mdumps(l)[1:] + self.write(BINUNICODE + s + encoding) + else: + self.write(UNICODE + object.encode('raw-unicode-escape') + '\n') + + memo_len = len(memo) + self.write(self.put(memo_len)) + memo[d] = (memo_len, object) + dispatch[UnicodeType] = save_unicode + def save_tuple(self, object): *************** *** 566,569 **** --- 585,597 ---- self.append(self.read(len)) dispatch[BINSTRING] = load_binstring + + def load_unicode(self): + self.append(unicode(self.readline()[:-1],'raw-unicode-escape')) + dispatch[UNICODE] = load_unicode + + def load_binunicode(self): + len = mloads('i' + self.read(4)) + self.append(unicode(self.read(len),'utf-8')) + dispatch[BINUNICODE] = load_binunicode def load_short_binstring(self): From guido@cnri.reston.va.us Fri Mar 10 23:20:45 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:20:45 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib codecs.py,NONE,1.1 Message-ID: <200003102320.SAA10304@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/home/guido/hp/mal/py-patched/Lib Added Files: codecs.py Log Message: Module codecs -- Python Codec Registry, API and helpers. Written by Marc-Andre Lemburg. From guido@cnri.reston.va.us Fri Mar 10 23:22:13 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:22:13 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib string.py,1.47,1.48 Message-ID: <200003102322.SAA10653@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/home/guido/hp/mal/py-patched/Lib Modified Files: string.py Log Message: Marc-Andre Lemburg: the maxsplit argument for split() and replace() now defaults to -1, not to 0. Passing an explicit zero doesn't split or replace at all. Index: string.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/string.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -r1.47 -r1.48 *** string.py 2000/02/10 16:21:11 1.47 --- string.py 2000/03/10 23:22:10 1.48 *************** *** 98,108 **** # Split a string into a list of space/tab-separated words # NB: split(s) is NOT the same as splitfields(s, ' ')! ! def split(s, sep=None, maxsplit=0): """split(s [,sep [,maxsplit]]) -> list of strings Return a list of the words in the string s, using sep as the ! delimiter string. If maxsplit is nonzero, splits into at most maxsplit words. If sep is not specified, any whitespace string ! is a separator. Maxsplit defaults to 0. (split and splitfields are synonymous) --- 98,108 ---- # Split a string into a list of space/tab-separated words # NB: split(s) is NOT the same as splitfields(s, ' ')! ! def split(s, sep=None, maxsplit=-1): """split(s [,sep [,maxsplit]]) -> list of strings Return a list of the words in the string s, using sep as the ! delimiter string. If maxsplit is given, splits into at most maxsplit words. If sep is not specified, any whitespace string ! is a separator. (split and splitfields are synonymous) *************** *** 397,401 **** # Substring replacement (global) ! def replace(s, old, new, maxsplit=0): """replace (str, old, new[, maxsplit]) -> string --- 397,401 ---- # Substring replacement (global) ! def replace(s, old, new, maxsplit=-1): """replace (str, old, new[, maxsplit]) -> string From guido@cnri.reston.va.us Fri Mar 10 23:23:23 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:23:23 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_unicode.py,NONE,1.1 test_string.py,1.5,1.6 Message-ID: <200003102323.SAA10829@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib/test In directory eric:/home/guido/hp/mal/py-patched/Lib/test Modified Files: test_string.py Added Files: test_unicode.py Log Message: Marc-Andre Lemburg: test script for Unicode implementation. Index: test_string.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_string.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** test_string.py 1999/06/15 16:49:11 1.5 --- test_string.py 2000/03/10 23:23:20 1.6 *************** *** 12,21 **** print 'string.%s%s =? %s... ' % (name, (input,) + args, output), try: try: - f = getattr(string, name) - value = apply(f, (input,) + args) - except AttributeError: f = getattr(input, name) value = apply(f, args) except: value = sys.exc_type --- 12,22 ---- print 'string.%s%s =? %s... ' % (name, (input,) + args, output), try: + # Prefer string methods over string module functions try: f = getattr(input, name) value = apply(f, args) + except AttributeError: + f = getattr(string, name) + value = apply(f, (input,) + args) except: value = sys.exc_type *************** *** 49,52 **** --- 50,97 ---- test('upper', 'HELLO', 'HELLO') + test('title', ' hello ', ' Hello ') + test('title', 'hello ', 'Hello ') + test('title', "fOrMaT thIs aS titLe String", 'Format This As Title String') + test('title', "fOrMaT,thIs-aS*titLe;String", 'Format,This-As*Title;String') + test('title', "getInt", 'Getint') + + test('expandtabs', 'abc\rab\tdef\ng\thi', 'abc\rab def\ng hi') + test('expandtabs', 'abc\rab\tdef\ng\thi', 'abc\rab def\ng hi', 8) + test('expandtabs', 'abc\rab\tdef\ng\thi', 'abc\rab def\ng hi', 4) + test('expandtabs', 'abc\r\nab\tdef\ng\thi', 'abc\r\nab def\ng hi', 4) + + test('islower', 'a', 1) + test('islower', 'A', 0) + test('islower', '\n', 0) + test('islower', 'abc', 1) + test('islower', 'aBc', 0) + test('islower', 'abc\n', 1) + + test('isupper', 'a', 0) + test('isupper', 'A', 1) + test('isupper', '\n', 0) + test('isupper', 'ABC', 1) + test('isupper', 'AbC', 0) + test('isupper', 'ABC\n', 1) + + test('istitle', 'a', 0) + test('istitle', 'A', 1) + test('istitle', '\n', 0) + test('istitle', 'A Titlecased Line', 1) + test('istitle', 'A\nTitlecased Line', 1) + test('istitle', 'A Titlecased, Line', 1) + test('istitle', 'Not a capitalized String', 0) + test('istitle', 'Not\ta Titlecase String', 0) + test('istitle', 'Not--a Titlecase String', 0) + + test('splitlines', "abc\ndef\n\rghi", ['abc', 'def', '', 'ghi']) + test('splitlines', "abc\ndef\n\r\nghi", ['abc', 'def', '', 'ghi']) + test('splitlines', "abc\ndef\r\nghi", ['abc', 'def', 'ghi']) + test('splitlines', "abc\ndef\r\nghi\n", ['abc', 'def', 'ghi']) + test('splitlines', "abc\ndef\r\nghi\n\r", ['abc', 'def', 'ghi', '']) + test('splitlines', "\nabc\ndef\r\nghi\n\r", ['', 'abc', 'def', 'ghi', '']) + test('splitlines', "\nabc\ndef\r\nghi\n\r", ['', 'abc\012def\015\012ghi\012\015'], 1) + test('splitlines', "\nabc\ndef\r\nghi\n\r", ['', 'abc', 'def\015\012ghi\012\015'], 2) + transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377' *************** *** 62,67 **** test('split', 'a b c d', ['a', 'b', 'c', 'd'], None, 3) test('split', 'a b c d', ['a', 'b', 'c', 'd'], None, 4) ! test('split', 'a b c d', ['a', 'b', 'c', 'd'], None, 0) test('split', 'a b c d', ['a', 'b', 'c d'], None, 2) # join now works with any sequence type --- 107,113 ---- test('split', 'a b c d', ['a', 'b', 'c', 'd'], None, 3) test('split', 'a b c d', ['a', 'b', 'c', 'd'], None, 4) ! test('split', 'a b c d', ['a b c d'], None, 0) test('split', 'a b c d', ['a', 'b', 'c d'], None, 2) + test('split', 'a b c d ', ['a', 'b', 'c', 'd']) # join now works with any sequence type *************** *** 76,86 **** test('join', 7, TypeError) - class BadStr: - def __str__(self): raise RuntimeError - class BadSeq(Sequence): ! def __init__(self): self.seq = [7, 'hello', BadStr()] ! test('join', BadSeq(), RuntimeError) # try a few long ones --- 122,129 ---- test('join', 7, TypeError) class BadSeq(Sequence): ! def __init__(self): self.seq = [7, 'hello', 123L] ! test('join', BadSeq(), TypeError) # try a few long ones *************** *** 104,108 **** test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 3) test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 4) ! test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 0) test('replace', 'one!two!three!', 'one@two@three@', '!', '@') test('replace', 'one!two!three!', 'one!two!three!', 'x', '@') --- 147,151 ---- test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 3) test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 4) ! test('replace', 'one!two!three!', 'one!two!three!', '!', '@', 0) test('replace', 'one!two!three!', 'one@two@three@', '!', '@') test('replace', 'one!two!three!', 'one!two!three!', 'x', '@') From guido@cnri.reston.va.us Fri Mar 10 23:23:24 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 18:23:24 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_unicode,NONE,1.1 Message-ID: <200003102323.SAA10836@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib/test/output In directory eric:/home/guido/hp/mal/py-patched/Lib/test/output Added Files: test_unicode Log Message: Marc-Andre Lemburg: test script for Unicode implementation. Return-Path: Delivered-To: python-checkins@python.org Received: from cnri.reston.va.us (ns.CNRI.Reston.VA.US [132.151.1.1]) by dinsdale.python.org (Postfix) with ESMTP id AC0F21CDEF for ; Fri, 10 Mar 2000 18:26:36 -0500 (EST) Received: from kaluha.cnri.reston.va.us (kaluha.cnri.reston.va.us [132.151.7.31]) by cnri.reston.va.us (8.9.1a/8.9.1) with ESMTP id SAA22658 for ; Fri, 10 Mar 2000 18:26:35 -0500 (EST) Received: from eric.cnri.reston.va.us (eric.cnri.reston.va.us [10.27.10.23]) by kaluha.cnri.reston.va.us (8.9.1b+Sun/8.9.1) with ESMTP id SAA05764 for ; Fri, 10 Mar 2000 18:28:35 -0500 (EST) Received: from CNRI.Reston.VA.US (localhost [127.0.0.1]) by eric.cnri.reston.va.us (8.9.3+Sun/8.9.1) with ESMTP id SAA11521 for ; Fri, 10 Mar 2000 18:28:34 -0500 (EST) Message-Id: <200003102328.SAA11521@eric.cnri.reston.va.us> To: python-checkins@python.org From: Guido van Rossum Date: Fri, 10 Mar 2000 18:28:34 -0500 Subject: [Python-checkins] Done checking in Unicode. Sender: python-checkins-admin@python.org Errors-To: python-checkins-admin@python.org X-BeenThere: python-checkins@python.org X-Mailman-Version: 1.2 (beta 1) Precedence: bulk List-Id: Check-in messages from the Python maintainers My apologies for the large amount of checkin mail. I should be done checking in the Unicode changes now, except for the documentation changes, which I'll pipe through Fred Drake first. --Guido van Rossum (home page: http://www.python.org/~guido/) From guido@cnri.reston.va.us Sat Mar 11 00:13:17 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 19:13:17 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/PCbuild python15.dsp,1.11,1.12 Message-ID: <200003110013.TAA16952@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/PCbuild In directory eric:/projects/python/develop/guido/src/PCbuild Modified Files: python15.dsp Log Message: VC++ project changes to add new Unicode files and modules. (I did this under VC++ 5.0 -- hope this doesn't break anything.) Index: python15.dsp =================================================================== RCS file: /projects/cvsroot/python/dist/src/PCbuild/python15.dsp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** python15.dsp 2000/02/03 17:19:35 1.11 --- python15.dsp 2000/03/11 00:13:14 1.12 *************** *** 1,4 **** # Microsoft Developer Studio Project File - Name="python15" - Package Owner=<4> ! # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** --- 1,4 ---- # Microsoft Developer Studio Project File - Name="python15" - Package Owner=<4> ! # Microsoft Developer Studio Generated Build File, Format Version 5.00 # ** DO NOT EDIT ** *************** *** 19,30 **** !MESSAGE Possible choices for configuration are: !MESSAGE ! !MESSAGE "python15 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "python15 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") ! !MESSAGE "python15 - Win32 Alpha Debug" (based on "Win32 (ALPHA) Dynamic-Link Library") ! !MESSAGE "python15 - Win32 Alpha Release" (based on "Win32 (ALPHA) Dynamic-Link Library") !MESSAGE # Begin Project - # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "python15" # PROP Scc_LocalPath ".." --- 19,32 ---- !MESSAGE Possible choices for configuration are: !MESSAGE ! !MESSAGE "python15 - Win32 Release" (based on\ ! "Win32 (x86) Dynamic-Link Library") !MESSAGE "python15 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") ! !MESSAGE "python15 - Win32 Alpha Debug" (based on\ ! "Win32 (ALPHA) Dynamic-Link Library") ! !MESSAGE "python15 - Win32 Alpha Release" (based on\ ! "Win32 (ALPHA) Dynamic-Link Library") !MESSAGE # Begin Project # PROP Scc_ProjName "python15" # PROP Scc_LocalPath ".." *************** *** 46,53 **** CPP=cl.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_DL_EXPORT" /YX /FD /c MTL=midl.exe ! # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 ! # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 RSC=rc.exe # ADD BASE RSC /l 0x409 /d "NDEBUG" --- 48,55 ---- CPP=cl.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_DL_EXPORT" /YX /FD /Zm200 /c MTL=midl.exe ! # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" ! # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" RSC=rc.exe # ADD BASE RSC /l 0x409 /d "NDEBUG" *************** *** 77,84 **** CPP=cl.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /D "_DEBUG" /D "USE_DL_EXPORT" /D "WIN32" /D "_WINDOWS" /YX /FD /c MTL=midl.exe ! # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 ! # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 RSC=rc.exe # ADD BASE RSC /l 0x409 /d "_DEBUG" --- 79,86 ---- CPP=cl.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /D "_DEBUG" /D "USE_DL_EXPORT" /D "WIN32" /D "_WINDOWS" /YX /FD /Zm200 /c MTL=midl.exe ! # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" ! # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" RSC=rc.exe # ADD BASE RSC /l 0x409 /d "_DEBUG" *************** *** 107,115 **** # PROP Target_Dir "" MTL=midl.exe ! # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 ! # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 CPP=cl.exe ! # ADD BASE CPP /nologo /MTd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "USE_DL_EXPORT" /YX /FD /c ! # ADD CPP /nologo /MDd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "USE_DL_EXPORT" /YX /FD /c RSC=rc.exe # ADD BASE RSC /l 0x409 /i "..\Include" /d "_DEBUG" --- 109,117 ---- # PROP Target_Dir "" MTL=midl.exe ! # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" ! # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" CPP=cl.exe ! # ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "USE_DL_EXPORT" /YX /FD /MTd /c ! # ADD CPP /nologo /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "USE_DL_EXPORT" /YX /FD /MDd /c RSC=rc.exe # ADD BASE RSC /l 0x409 /i "..\Include" /d "_DEBUG" *************** *** 139,144 **** # PROP Target_Dir "" MTL=midl.exe ! # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 ! # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 CPP=cl.exe # ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "USE_DL_EXPORT" /YX /FD /c --- 141,146 ---- # PROP Target_Dir "" MTL=midl.exe ! # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" ! # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" CPP=cl.exe # ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "USE_DL_EXPORT" /YX /FD /c *************** *** 166,169 **** --- 168,186 ---- # Begin Source File + SOURCE=..\Modules\_codecsmodule.c + + !IF "$(CFG)" == "python15 - Win32 Release" + + !ELSEIF "$(CFG)" == "python15 - Win32 Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Release" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=..\Modules\_localemodule.c *************** *** 361,364 **** --- 378,396 ---- # Begin Source File + SOURCE=..\Python\codecs.c + + !IF "$(CFG)" == "python15 - Win32 Release" + + !ELSEIF "$(CFG)" == "python15 - Win32 Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Release" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=..\Python\compile.c *************** *** 1257,1260 **** --- 1289,1303 ---- SOURCE=..\PC\python_nt.rc + + !IF "$(CFG)" == "python15 - Win32 Release" + + !ELSEIF "$(CFG)" == "python15 - Win32 Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Release" + + !ENDIF + # End Source File # Begin Source File *************** *** 1606,1609 **** --- 1649,1712 ---- SOURCE=..\Objects\typeobject.c + + !IF "$(CFG)" == "python15 - Win32 Release" + + !ELSEIF "$(CFG)" == "python15 - Win32 Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Release" + + !ENDIF + + # End Source File + # Begin Source File + + SOURCE=..\Objects\unicodectype.c + + !IF "$(CFG)" == "python15 - Win32 Release" + + !ELSEIF "$(CFG)" == "python15 - Win32 Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Release" + + !ENDIF + + # End Source File + # Begin Source File + + SOURCE=..\Modules\unicodedata.c + + !IF "$(CFG)" == "python15 - Win32 Release" + + !ELSEIF "$(CFG)" == "python15 - Win32 Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Release" + + !ENDIF + + # End Source File + # Begin Source File + + SOURCE=..\Modules\unicodedatabase.c + + !IF "$(CFG)" == "python15 - Win32 Release" + + !ELSEIF "$(CFG)" == "python15 - Win32 Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "python15 - Win32 Alpha Release" + + !ENDIF + + # End Source File + # Begin Source File + + SOURCE=..\Objects\unicodeobject.c !IF "$(CFG)" == "python15 - Win32 Release" From guido@cnri.reston.va.us Sat Mar 11 00:13:42 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Mar 2000 19:13:42 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/PC config.c,1.18,1.19 Message-ID: <200003110013.TAA17019@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/PC In directory eric:/projects/python/develop/guido/src/PC Modified Files: config.c Log Message: VC++ project changes to add new Unicode files and modules. (I did this under VC++ 5.0 -- hope this doesn't break anything.) Index: config.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/PC/config.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** config.c 1999/04/13 15:41:10 1.18 --- config.c 2000/03/11 00:13:09 1.19 *************** *** 68,71 **** --- 68,73 ---- extern void init_locale(); #endif + extern void init_codecs(); + extern void initunicodedata(); /* -- ADDMODULE MARKER 1 -- */ *************** *** 113,116 **** --- 115,121 ---- {"_locale", init_locale}, #endif + + {"_codecs", init_codecs}, + {"unicodedata", initunicodedata}, /* -- ADDMODULE MARKER 2 -- */ From guido@cnri.reston.va.us Mon Mar 13 14:50:26 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Mar 2000 09:50:26 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/idle PyParse.py,1.5,1.6 Message-ID: <200003131450.JAA19619@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/idle In directory eric:/projects/python/develop/guido/src/Tools/idle Modified Files: PyParse.py Log Message: Tim Peters writes: Fix bad auto-indent I recently introduced when replacing the regexp that could cause re to blow up: if or_any_other_block_opener: # one indenting comment line ^ cursor ended up at the caret (the bug) ^ but belongs here (the post-patch behavior) Index: PyParse.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/idle/PyParse.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** PyParse.py 2000/03/03 14:51:11 1.5 --- PyParse.py 2000/03/13 14:50:24 1.6 *************** *** 386,396 **** if m: # we skipped at least one boring char ! p = m.end() # back up over totally boring whitespace ! i = p-1 # index of last boring char ! while i >= 0 and str[i] in " \t\n": i = i-1 ! if i >= 0: lastch = str[i] if p >= q: break --- 386,397 ---- if m: # we skipped at least one boring char ! newp = m.end() # back up over totally boring whitespace ! i = newp - 1 # index of last boring char ! while i >= p and str[i] in " \t\n": i = i-1 ! if i >= p: lastch = str[i] + p = newp if p >= q: break From guido@cnri.reston.va.us Mon Mar 13 15:22:30 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Mar 2000 10:22:30 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src Makefile.in,1.83,1.84 Message-ID: <200003131522.KAA27730@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/home/guido/hp/mal/py-patched Modified Files: Makefile.in Log Message: Added encodings to the LIBSUBDIRS variable, so that they get installed. Noted by Michael Hudson. Index: Makefile.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Makefile.in,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -r1.83 -r1.84 *** Makefile.in 2000/02/28 19:52:53 1.83 --- Makefile.in 2000/03/13 15:22:27 1.84 *************** *** 290,294 **** PLATDIR= plat-$(MACHDEP) MACHDEPS= $(PLATDIR) ! LIBSUBDIRS= lib-old lib-tk test test/output $(MACHDEPS) libinstall: python $(srcdir)/Lib/$(PLATDIR) @for i in $(SCRIPTDIR) $(LIBDEST); \ --- 290,294 ---- PLATDIR= plat-$(MACHDEP) MACHDEPS= $(PLATDIR) ! LIBSUBDIRS= lib-old lib-tk test test/output encodings $(MACHDEPS) libinstall: python $(srcdir)/Lib/$(PLATDIR) @for i in $(SCRIPTDIR) $(LIBDEST); \ From fdrake@weyr.cnri.reston.va.us Mon Mar 13 15:41:24 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 13 Mar 2000 10:41:24 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libos.tex,1.33.2.2,1.33.2.3 Message-ID: <200003131541.KAA12351@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libos.tex Log Message: Add note that popen() is entirely unreliable on Windows. Index: libos.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.33.2.2 retrieving revision 1.33.2.3 diff -C2 -r1.33.2.2 -r1.33.2.3 *** libos.tex 1999/12/03 19:52:47 1.33.2.2 --- libos.tex 2000/03/13 15:41:21 1.33.2.3 *************** *** 245,249 **** available as the return value of the \method{close()} method of the file object, except that when the exit status is zero (termination without ! errors), \code{None} is returned. Availability: \UNIX{}, Windows. \end{funcdesc} --- 245,251 ---- available as the return value of the \method{close()} method of the file object, except that when the exit status is zero (termination without ! errors), \code{None} is returned. \strong{Note:} This function ! behaves unreliably under Windows due to the native implementation of ! \cfunction{popen()}. Availability: \UNIX{}, Windows. \end{funcdesc} From guido@cnri.reston.va.us Mon Mar 13 15:42:02 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Mar 2000 10:42:02 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects listobject.c,2.65,2.66 Message-ID: <200003131542.KAA00216@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/home/guido/hp/mal/py-patched/Objects Modified Files: listobject.c Log Message: Added Christian Tismer's patch to allow list.append(a,b,c) back -- with a twist: you have to define NO_STRICT_LIST_APPEND manually to enable multi-arg append(). Index: listobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/listobject.c,v retrieving revision 2.65 retrieving revision 2.66 diff -C2 -r2.65 -r2.66 *** listobject.c 2000/02/24 21:48:29 2.65 --- listobject.c 2000/03/13 15:41:59 2.66 *************** *** 563,566 **** --- 563,580 ---- } + /* Define NO_STRICT_LIST_APPEND to enable multi-argument append() */ + + #ifndef NO_STRICT_LIST_APPEND + #define PyArg_ParseTuple_Compat1 PyArg_ParseTuple + #else + #define PyArg_ParseTuple_Compat1(args, format, ret) \ + ( \ + PyTuple_GET_SIZE(args) > 1 ? (*ret = args, 1) : \ + PyTuple_GET_SIZE(args) == 1 ? (*ret = PyTuple_GET_ITEM(args, 0), 1) : \ + PyArg_ParseTuple(args, format, ret) \ + ) + #endif + + static PyObject * listappend(self, args) *************** *** 569,573 **** { PyObject *v; ! if (!PyArg_ParseTuple(args, "O:append", &v)) return NULL; return ins(self, (int) self->ob_size, v); --- 583,587 ---- { PyObject *v; ! if (!PyArg_ParseTuple_Compat1(args, "O:append", &v)) return NULL; return ins(self, (int) self->ob_size, v); *************** *** 1327,1331 **** PyObject *v; ! if (!PyArg_ParseTuple(args, "O:index", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { --- 1341,1345 ---- PyObject *v; ! if (!PyArg_ParseTuple_Compat1(args, "O:index", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { *************** *** 1348,1352 **** PyObject *v; ! if (!PyArg_ParseTuple(args, "O:count", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { --- 1362,1366 ---- PyObject *v; ! if (!PyArg_ParseTuple_Compat1(args, "O:count", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { *************** *** 1367,1371 **** PyObject *v; ! if (!PyArg_ParseTuple(args, "O:remove", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { --- 1381,1385 ---- PyObject *v; ! if (!PyArg_ParseTuple_Compat1(args, "O:remove", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { From guido@cnri.reston.va.us Mon Mar 13 15:55:12 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Mar 2000 10:55:12 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.1,2.2 Message-ID: <200003131555.KAA01921@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/home/guido/hp/mal/py-patched/Objects Modified Files: unicodeobject.c Log Message: Add sq_contains implementation. Index: unicodeobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** unicodeobject.c 2000/03/10 22:53:23 2.1 --- unicodeobject.c 2000/03/13 15:55:09 2.2 *************** *** 2738,2741 **** --- 2738,2784 ---- } + int PyUnicode_Contains(PyObject *container, + PyObject *element) + { + PyUnicodeObject *u = NULL, *v = NULL; + int result; + register const Py_UNICODE *p, *e; + register Py_UNICODE ch; + + /* Coerce the two arguments */ + u = (PyUnicodeObject *)PyUnicode_FromObject(container); + if (u == NULL) + goto onError; + v = (PyUnicodeObject *)PyUnicode_FromObject(element); + if (v == NULL) + goto onError; + + /* Check v in u */ + if (PyUnicode_GET_SIZE(v) != 1) { + PyErr_SetString(PyExc_TypeError, + "string member test needs char left operand"); + goto onError; + } + ch = *PyUnicode_AS_UNICODE(v); + p = PyUnicode_AS_UNICODE(u); + e = p + PyUnicode_GET_SIZE(u); + result = 0; + while (p < e) { + if (*p++ == ch) { + result = 1; + break; + } + } + + Py_DECREF(u); + Py_DECREF(v); + return result; + + onError: + Py_XDECREF(u); + Py_XDECREF(v); + return -1; + } + /* Concat to string or Unicode object giving a new Unicode object. */ *************** *** 3818,3821 **** --- 3861,3865 ---- 0, /* sq_ass_item */ 0, /* sq_ass_slice */ + (objobjproc)PyUnicode_Contains, /*sq_contains*/ }; From guido@cnri.reston.va.us Mon Mar 13 15:56:11 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Mar 2000 10:56:11 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.58,2.59 Message-ID: <200003131556.KAA02057@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/home/guido/hp/mal/py-patched/Objects Modified Files: stringobject.c Log Message: Fix typo in replace() detected by Mark Hammond and fixed by Marc-Andre. Index: stringobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/stringobject.c,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -r2.58 -r2.59 *** stringobject.c 2000/03/10 22:55:18 2.58 --- stringobject.c 2000/03/13 15:56:08 2.59 *************** *** 390,394 **** register char *s, *end; register char c; ! if (!PyString_Check(el) || PyString_Size(el) != 1) { PyErr_SetString(PyExc_TypeError, "string member test needs char left operand"); --- 390,396 ---- register char *s, *end; register char c; ! if (!PyString_Check(el)) ! return PyUnicode_Contains(a, el); ! if (PyString_Size(el) != 1) { PyErr_SetString(PyExc_TypeError, "string member test needs char left operand"); *************** *** 1576,1580 **** return NULL; ! if (repl_len <= 0) { PyErr_SetString(PyExc_ValueError, "empty replacement string"); return NULL; --- 1578,1582 ---- return NULL; ! if (sub_len <= 0) { PyErr_SetString(PyExc_ValueError, "empty replacement string"); return NULL; From guido@cnri.reston.va.us Mon Mar 13 16:01:32 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Mar 2000 11:01:32 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python traceback.c,2.24,2.25 Message-ID: <200003131601.LAA02829@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/home/guido/hp/mal/py-patched/Python Modified Files: traceback.c Log Message: Christian Tismer's "trashcan" patch: Added wrapping macros to dictobject.c, listobject.c, tupleobject.c, frameobject.c, traceback.c that safely prevends core dumps on stack overflow. Macros and functions in object.c, object.h. The method is an "elevator destructor" that turns cascading deletes into tail recursive behavior when some limit is hit. Index: traceback.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/traceback.c,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -r2.24 -r2.25 *** traceback.c 1999/09/18 20:49:39 2.24 --- traceback.c 2000/03/13 16:01:29 2.25 *************** *** 69,75 **** --- 69,77 ---- tracebackobject *tb; { + Py_TRASHCAN_SAFE_BEGIN(tb) Py_XDECREF(tb->tb_next); Py_XDECREF(tb->tb_frame); PyMem_DEL(tb); + Py_TRASHCAN_SAFE_END(tb) } From guido@cnri.reston.va.us Mon Mar 13 16:01:33 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Mar 2000 11:01:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.49,2.50 frameobject.c,2.37,2.38 listobject.c,2.66,2.67 object.c,2.63,2.64 tupleobject.c,2.29,2.30 Message-ID: <200003131601.LAA02846@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/home/guido/hp/mal/py-patched/Objects Modified Files: dictobject.c frameobject.c listobject.c object.c tupleobject.c Log Message: Christian Tismer's "trashcan" patch: Added wrapping macros to dictobject.c, listobject.c, tupleobject.c, frameobject.c, traceback.c that safely prevends core dumps on stack overflow. Macros and functions in object.c, object.h. The method is an "elevator destructor" that turns cascading deletes into tail recursive behavior when some limit is hit. Index: dictobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/dictobject.c,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -r2.49 -r2.50 *** dictobject.c 2000/02/23 15:47:16 2.49 --- dictobject.c 2000/03/13 16:01:29 2.50 *************** *** 480,483 **** --- 480,484 ---- register int i; register dictentry *ep; + Py_TRASHCAN_SAFE_BEGIN(mp) for (i = 0, ep = mp->ma_table; i < mp->ma_size; i++, ep++) { if (ep->me_key != NULL) { *************** *** 490,493 **** --- 491,495 ---- PyMem_XDEL(mp->ma_table); PyMem_DEL(mp); + Py_TRASHCAN_SAFE_END(mp) } Index: frameobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/frameobject.c,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -r2.37 -r2.38 *** frameobject.c 2000/01/20 22:32:54 2.37 --- frameobject.c 2000/03/13 16:01:29 2.38 *************** *** 104,107 **** --- 104,108 ---- PyObject **fastlocals; + Py_TRASHCAN_SAFE_BEGIN(f) /* Kill all local variables */ fastlocals = f->f_localsplus; *************** *** 121,124 **** --- 122,126 ---- f->f_back = free_list; free_list = f; + Py_TRASHCAN_SAFE_END(f) } Index: listobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/listobject.c,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -r2.66 -r2.67 *** listobject.c 2000/03/13 15:41:59 2.66 --- listobject.c 2000/03/13 16:01:29 2.67 *************** *** 216,219 **** --- 216,220 ---- { int i; + Py_TRASHCAN_SAFE_BEGIN(op) if (op->ob_item != NULL) { /* Do it backwards, for Christian Tismer. *************** *** 228,231 **** --- 229,233 ---- } free((ANY *)op); + Py_TRASHCAN_SAFE_END(op) } Index: object.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/object.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -r2.63 -r2.64 *** object.c 2000/03/10 22:55:18 2.63 --- object.c 2000/03/13 16:01:29 2.64 *************** *** 907,908 **** --- 907,953 ---- } } + + /* + trashcan + CT 2k0130 + non-recursively destroy nested objects + + CT 2k0223 + everything is now done in a macro. + + CT 2k0305 + modified to use functions, after Tim Peter's suggestion. + + CT 2k0309 + modified to restore a possible error. + */ + + int _PyTrash_delete_nesting = 0; + PyObject * _PyTrash_delete_later = NULL; + + void + _PyTrash_deposit_object(op) + PyObject *op; + { + PyObject *error_type, *error_value, *error_traceback; + PyErr_Fetch(&error_type, &error_value, &error_traceback); + + if (!_PyTrash_delete_later) + _PyTrash_delete_later = PyList_New(0); + if (_PyTrash_delete_later) + PyList_Append(_PyTrash_delete_later, (PyObject *)op); + + PyErr_Restore(error_type, error_value, error_traceback); + } + + void + _PyTrash_destroy_list() + { + while (_PyTrash_delete_later) { + PyObject *shredder = _PyTrash_delete_later; + _PyTrash_delete_later = NULL; + ++_PyTrash_delete_nesting; + Py_DECREF(shredder); + --_PyTrash_delete_nesting; + } + } Index: tupleobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -r2.29 -r2.30 *** tupleobject.c 2000/01/20 22:32:54 2.29 --- tupleobject.c 2000/03/13 16:01:29 2.30 *************** *** 173,176 **** --- 173,177 ---- register int i; + Py_TRASHCAN_SAFE_BEGIN(op) if (op->ob_size > 0) { i = op->ob_size; *************** *** 181,189 **** op->ob_item[0] = (PyObject *) free_tuples[op->ob_size]; free_tuples[op->ob_size] = op; ! return; } #endif } free((ANY *)op); } --- 182,192 ---- op->ob_item[0] = (PyObject *) free_tuples[op->ob_size]; free_tuples[op->ob_size] = op; ! goto done; /* return */ } #endif } free((ANY *)op); + done: + Py_TRASHCAN_SAFE_END(op) } From guido@cnri.reston.va.us Mon Mar 13 16:01:48 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Mar 2000 11:01:48 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Include object.h,2.50,2.51 Message-ID: <200003131601.LAA02887@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Include In directory eric:/home/guido/hp/mal/py-patched/Include Modified Files: object.h Log Message: Christian Tismer's "trashcan" patch: Added wrapping macros to dictobject.c, listobject.c, tupleobject.c, frameobject.c, traceback.c that safely prevends core dumps on stack overflow. Macros and functions in object.c, object.h. The method is an "elevator destructor" that turns cascading deletes into tail recursive behavior when some limit is hit. Index: object.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Include/object.h,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -r2.50 -r2.51 *** object.h 2000/03/01 15:06:53 2.50 --- object.h 2000/03/13 16:01:15 2.51 *************** *** 515,518 **** --- 515,565 ---- */ + /* + trashcan + CT 2k0130 + non-recursively destroy nested objects + + CT 2k0223 + redefinition for better locality and less overhead. + + Objects that want to be recursion safe need to use + the macroes + Py_TRASHCAN_SAFE_BEGIN(name) + and + Py_TRASHCAN_SAFE_END(name) + surrounding their actual deallocation code. + + It would be nice to do this using the thread state. + Also, we could do an exact stack measure then. + Unfortunately, deallocations also take place when + the thread state is undefined. + */ + + #define PyTrash_UNWIND_LEVEL 50 + + #define Py_TRASHCAN_SAFE_BEGIN(op) \ + { \ + ++_PyTrash_delete_nesting; \ + if (_PyTrash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ + + #define Py_TRASHCAN_SAFE_END(op) \ + ;} \ + else \ + _PyTrash_deposit_object((PyObject*)op);\ + --_PyTrash_delete_nesting; \ + if (_PyTrash_delete_later && _PyTrash_delete_nesting <= 0) \ + _PyTrash_destroy_list(); \ + } \ + + extern DL_IMPORT(void) _PyTrash_deposit_object Py_PROTO((PyObject*)); + extern DL_IMPORT(void) _PyTrash_destroy_list Py_PROTO(()); + + extern DL_IMPORT(int) _PyTrash_delete_nesting; + extern DL_IMPORT(PyObject *) _PyTrash_delete_later; + + /* swap the "xx" to check the speed loss */ + + #define xxPy_TRASHCAN_SAFE_BEGIN(op) + #define xxPy_TRASHCAN_SAFE_END(op) ; #ifdef __cplusplus } From guido@cnri.reston.va.us Mon Mar 13 16:27:10 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Mar 2000 11:27:10 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.71,2.72 Message-ID: <200003131627.LAA08422@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/projects/python/develop/guido/src/Objects Modified Files: fileobject.c Log Message: Checking in the new, improve file.writelines() code. This (1) avoids thread unsafety whereby another thread could zap the list while we were using it, and (2) now supports writing arbitrary sequences of strings. Index: fileobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/fileobject.c,v retrieving revision 2.71 retrieving revision 2.72 diff -C2 -r2.71 -r2.72 *** fileobject.c 2000/03/10 22:55:18 2.71 --- fileobject.c 2000/03/13 16:27:06 2.72 *************** *** 891,928 **** PyObject *args; { ! int i, n; if (f->f_fp == NULL) return err_closed(); ! if (args == NULL || !PyList_Check(args)) { PyErr_SetString(PyExc_TypeError, ! "writelines() requires list of strings"); return NULL; } ! n = PyList_Size(args); ! f->f_softspace = 0; ! Py_BEGIN_ALLOW_THREADS ! errno = 0; ! for (i = 0; i < n; i++) { ! PyObject *line = PyList_GetItem(args, i); ! int len; ! int nwritten; ! if (!PyString_Check(line)) { ! Py_BLOCK_THREADS ! PyErr_SetString(PyExc_TypeError, ! "writelines() requires list of strings"); return NULL; } ! len = PyString_Size(line); ! nwritten = fwrite(PyString_AsString(line), 1, len, f->f_fp); ! if (nwritten != len) { ! Py_BLOCK_THREADS ! PyErr_SetFromErrno(PyExc_IOError); ! clearerr(f->f_fp); ! return NULL; } } ! Py_END_ALLOW_THREADS Py_INCREF(Py_None); ! return Py_None; } --- 891,982 ---- PyObject *args; { ! #define CHUNKSIZE 1000 ! PyObject *list, *line; ! PyObject *result; ! int i, j, index, len, nwritten, islist; ! if (f->f_fp == NULL) return err_closed(); ! if (args == NULL || !PySequence_Check(args)) { PyErr_SetString(PyExc_TypeError, ! "writelines() requires sequence of strings"); return NULL; } ! islist = PyList_Check(args); ! ! /* Strategy: slurp CHUNKSIZE lines into a private list, ! checking that they are all strings, then write that list ! without holding the interpreter lock, then come back for more. */ ! index = 0; ! if (islist) ! list = NULL; ! else { ! list = PyList_New(CHUNKSIZE); ! if (list == NULL) return NULL; + } + result = NULL; + + for (;;) { + if (islist) { + Py_XDECREF(list); + list = PyList_GetSlice(args, index, index+CHUNKSIZE); + if (list == NULL) + return NULL; + j = PyList_GET_SIZE(list); } ! else { ! for (j = 0; j < CHUNKSIZE; j++) { ! line = PySequence_GetItem(args, index+j); ! if (line == NULL) { ! if (PyErr_ExceptionMatches( ! PyExc_IndexError)) ! { ! PyErr_Clear(); ! break; ! } ! /* Some other error occurred. ! XXX We may lose some output. */ ! goto error; ! } ! if (!PyString_Check(line)) { ! Py_DECREF(line); ! PyErr_SetString(PyExc_TypeError, ! "writelines() requires sequences of strings"); ! goto error; ! } ! PyList_SetItem(list, j, line); ! } ! } ! if (j == 0) ! break; ! ! Py_BEGIN_ALLOW_THREADS ! f->f_softspace = 0; ! errno = 0; ! for (i = 0; i < j; i++) { ! line = PyList_GET_ITEM(list, i); ! len = PyString_GET_SIZE(line); ! nwritten = fwrite(PyString_AS_STRING(line), ! 1, len, f->f_fp); ! if (nwritten != len) { ! Py_BLOCK_THREADS ! PyErr_SetFromErrno(PyExc_IOError); ! clearerr(f->f_fp); ! goto error; ! } } + Py_END_ALLOW_THREADS + + if (j < CHUNKSIZE) + break; + index += CHUNKSIZE; } ! Py_INCREF(Py_None); ! result = Py_None; ! error: ! Py_XDECREF(list); ! return result; } Return-Path: Delivered-To: python-checkins@python.org Received: from starship.skyport.net (starship.skyport.net [216.169.96.18]) by dinsdale.python.org (Postfix) with ESMTP id 80EA81CD0D for ; Mon, 13 Mar 2000 18:13:14 -0500 (EST) Received: from lemburg.com (p3E9EEA36.dip.t-dialin.net [62.158.234.54]) by starship.skyport.net (8.8.8/8.8.8) with ESMTP id SAA18611; Mon, 13 Mar 2000 18:13:37 -0500 Message-ID: <38CD76D6.EE398B6B@lemburg.com> Date: Tue, 14 Mar 2000 00:16:38 +0100 From: "M.-A. Lemburg" Reply-To: mal@lemburg.com Organization: IKDS M.-A. Lemburg -- http://www.lemburg.com/ X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.10 i586) X-Accept-Language: en MIME-Version: 1.0 To: python-checkins@python.org References: <20000313170038.D25391CD68@dinsdale.python.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: [Python-checkins] Re: Python-checkins digest, Vol 1 #390 - 10 msgs Sender: python-checkins-admin@python.org Errors-To: python-checkins-admin@python.org X-BeenThere: python-checkins@python.org X-Mailman-Version: 1.2 (beta 1) Precedence: bulk List-Id: Check-in messages from the Python maintainers > Today's Topics: > > 1. CVS: python/dist/src/Tools/idle PyParse.py,1.5,1.6 (Guido van Rossum) > 2. CVS: python/dist/src Makefile.in,1.83,1.84 (Guido van Rossum) > 3. CVS: python/dist/src/Doc/lib libos.tex,1.33.2.2,1.33.2.3 (Fred L. Drake) > 4. CVS: python/dist/src/Objects listobject.c,2.65,2.66 (Guido van Rossum) > 5. CVS: python/dist/src/Objects unicodeobject.c,2.1,2.2 (Guido van Rossum) The corresponding patches for Include/unicodeobject.h and Lib/test/test_unicode.py seem to be missing from this list. > 6. CVS: python/dist/src/Objects stringobject.c,2.58,2.59 (Guido van Rossum) > 7. CVS: python/dist/src/Python traceback.c,2.24,2.25 (Guido van Rossum) > 8. CVS: python/dist/src/Objects dictobject.c,2.49,2.50 frameobject.c,2.37,2.38 listobject.c,2.66,2.67 object.c,2.63,2.64 tupleobject.c,2.29,2.30 (Guido van Rossum) > 9. CVS: python/dist/src/Include object.h,2.50,2.51 (Guido van Rossum) > 10. CVS: python/dist/src/Objects fileobject.c,2.71,2.72 (Guido van Rossum) -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ Return-Path: Delivered-To: python-checkins@python.org Received: from starship.skyport.net (starship.skyport.net [216.169.96.18]) by dinsdale.python.org (Postfix) with ESMTP id 1D9F01CD82 for ; Mon, 13 Mar 2000 18:09:15 -0500 (EST) Received: from lemburg.com (p3E9EEA36.dip.t-dialin.net [62.158.234.54]) by starship.skyport.net (8.8.8/8.8.8) with ESMTP id SAA18495; Mon, 13 Mar 2000 18:09:42 -0500 Message-ID: <38CD75AE.726A85DC@lemburg.com> Date: Tue, 14 Mar 2000 00:11:42 +0100 From: "M.-A. Lemburg" Reply-To: mal@lemburg.com Organization: IKDS M.-A. Lemburg -- http://www.lemburg.com/ X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.10 i586) X-Accept-Language: en MIME-Version: 1.0 To: python-checkins@python.org References: <20000313170038.D25391CD68@dinsdale.python.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: [Python-checkins] Re: Python-checkins digest, Vol 1 #390 - 10 msgs Sender: python-checkins-admin@python.org Errors-To: python-checkins-admin@python.org X-BeenThere: python-checkins@python.org X-Mailman-Version: 1.2 (beta 1) Precedence: bulk List-Id: Check-in messages from the Python maintainers > *** stringobject.c 2000/03/10 22:55:18 2.58 > --- stringobject.c 2000/03/13 15:56:08 2.59 > *************** > *** 390,394 **** > register char *s, *end; > register char c; > ! if (!PyString_Check(el) || PyString_Size(el) != 1) { > PyErr_SetString(PyExc_TypeError, > "string member test needs char left operand"); > --- 390,396 ---- > register char *s, *end; > register char c; > ! if (!PyString_Check(el)) > ! return PyUnicode_Contains(a, el); > ! if (PyString_Size(el) != 1) { > PyErr_SetString(PyExc_TypeError, > "string member test needs char left operand"); > *************** > *** 1576,1580 **** > return NULL; > > ! if (repl_len <= 0) { > PyErr_SetString(PyExc_ValueError, "empty replacement string"); > return NULL; > --- 1578,1582 ---- > return NULL; > > ! if (sub_len <= 0) { > PyErr_SetString(PyExc_ValueError, "empty replacement string"); > return NULL; > It should read "empty pattern string". -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From guido@cnri.reston.va.us Mon Mar 13 23:21:50 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Mar 2000 18:21:50 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_unicode.py,1.1,1.2 Message-ID: <200003132321.SAA00388@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib/test In directory eric:/home/guido/hp/mal/py-patched/Lib/test Modified Files: test_unicode.py Log Message: Marc-Andre Lemburg: Add tests for mixed use of char in string. Index: test_unicode.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_unicode.py 2000/03/10 23:23:20 1.1 --- test_unicode.py 2000/03/13 23:21:48 1.2 *************** *** 220,223 **** --- 220,236 ---- test('translate', u"abababc", u'iiix', {ord('a'):None, ord('b'):ord('i'), ord('c'):u'x'}) + # Contains: + print 'Testing Unicode contains method...', + assert ('a' in 'abdb') == 1 + assert ('a' in 'bdab') == 1 + assert ('a' in 'bdaba') == 1 + assert ('a' in 'bdba') == 1 + assert ('a' in u'bdba') == 1 + assert (u'a' in u'bdba') == 1 + assert (u'a' in u'bdb') == 0 + assert (u'a' in 'bdb') == 0 + assert (u'a' in 'bdba') == 1 + print 'done.' + # Formatting: print 'Testing Unicode formatting strings...', From guido@cnri.reston.va.us Mon Mar 13 23:22:27 2000 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Mar 2000 18:22:27 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Include unicodeobject.h,2.1,2.2 Message-ID: <200003132322.SAA00482@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Include In directory eric:/home/guido/hp/mal/py-patched/Include Modified Files: unicodeobject.h Log Message: Marc-Andre Lemburg: add declaration for PyUnicode_Contains(). Index: unicodeobject.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Include/unicodeobject.h,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** unicodeobject.h 2000/03/10 22:33:05 2.1 --- unicodeobject.h 2000/03/13 23:22:24 2.2 *************** *** 684,687 **** --- 684,698 ---- ); + /* Checks whether element is contained in container and return 1/0 + accordingly. + + element has to coerce to an one element Unicode string. -1 is + returned in case of an error. */ + + extern DL_IMPORT(int) PyUnicode_Contains( + PyObject *container, /* Container string */ + PyObject *element /* Element string */ + ); + /* === Characters Type APIs =============================================== */ From fdrake@weyr.cnri.reston.va.us Tue Mar 14 18:00:22 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Mar 2000 13:00:22 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libmimetools.tex,1.15,1.15.4.1 Message-ID: <200003141800.NAA21916@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libmimetools.tex Log Message: Added a "See also" reference pointing to the rfc822 module. Index: libmimetools.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libmimetools.tex,v retrieving revision 1.15 retrieving revision 1.15.4.1 diff -C2 -r1.15 -r1.15.4.1 *** libmimetools.tex 1999/02/19 22:59:56 1.15 --- libmimetools.tex 2000/03/14 18:00:19 1.15.4.1 *************** *** 3,7 **** \declaremodule{standard}{mimetools} ! \modulesynopsis{Tools for parsing MIME style message bodies.} --- 3,7 ---- \declaremodule{standard}{mimetools} ! \modulesynopsis{Tools for parsing MIME-style message bodies.} *************** *** 39,43 **** \begin{funcdesc}{copyliteral}{input, output} ! Read lines until \EOF{} from open file \var{input} and write them to open file \var{output}. \end{funcdesc} --- 39,43 ---- \begin{funcdesc}{copyliteral}{input, output} ! Read lines from open file \var{input} until \EOF{} and write them to open file \var{output}. \end{funcdesc} *************** *** 47,50 **** --- 47,56 ---- open file \var{output}. The block size is currently fixed at 8192. \end{funcdesc} + + + \begin{seealso} + \seemodule{rfc822}{Provides the base class for for + \class{mimetools.Message}.} + \end{seealso} From fdrake@weyr.cnri.reston.va.us Tue Mar 14 18:01:18 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Mar 2000 13:01:18 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libmimetools.tex,1.15.4.1,1.15.4.2 Message-ID: <200003141801.NAA21937@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libmimetools.tex Log Message: Immediately spot typo after checkin.... Index: libmimetools.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libmimetools.tex,v retrieving revision 1.15.4.1 retrieving revision 1.15.4.2 diff -C2 -r1.15.4.1 -r1.15.4.2 *** libmimetools.tex 2000/03/14 18:00:19 1.15.4.1 --- libmimetools.tex 2000/03/14 18:01:16 1.15.4.2 *************** *** 50,54 **** \begin{seealso} ! \seemodule{rfc822}{Provides the base class for for \class{mimetools.Message}.} \end{seealso} --- 50,54 ---- \begin{seealso} ! \seemodule{rfc822}{Provides the base class for \class{mimetools.Message}.} \end{seealso} From fdrake@weyr.cnri.reston.va.us Tue Mar 14 18:45:25 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Mar 2000 13:45:25 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.65.2.6,1.65.2.7 Message-ID: <200003141845.NAA24209@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/perl In directory weyr:/home/fdrake/projects/python/Doc-152p2/perl Modified Files: Tag: release152p1-patches python.perl Log Message: Be even more careful about tables: explicitly translate the content of the table rather than letting the default processing take care of it. The problem was that when multiple tables on a single output page used different alignments, the specifier for the last table on the page was used for all tables. This is because LaTeX2HTML processes all the enironments before processing other macros; internal state is maintained for each table (column alignment!), which go overwritten as additional tables were processed. The saved state for the last table processed was then used for all the tables on the page. LaTeX2HTML is pain. Index: python.perl =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.65.2.6 retrieving revision 1.65.2.7 diff -C2 -r1.65.2.6 -r1.65.2.7 *** python.perl 2000/03/03 16:28:25 1.65.2.6 --- python.perl 2000/03/14 18:45:22 1.65.2.7 *************** *** 906,914 **** { $r = ' align="center"'; } elsif ($mark eq 'r') ! { $r = ' align="right" '; } elsif ($mark eq 'l') ! { $r = ' align="left" '; } elsif ($mark eq 'p') ! { $r = ' align="left" '; } return $r; } --- 906,914 ---- { $r = ' align="center"'; } elsif ($mark eq 'r') ! { $r = ' align="right"'; } elsif ($mark eq 'l') ! { $r = ' align="left"'; } elsif ($mark eq 'p') ! { $r = ' align="left"'; } return $r; } *************** *** 955,959 **** . "\n " . "\n " ! . $_ . "\n " . "\n"; --- 955,959 ---- . "\n " . "\n " ! . translate_commands($_) . "\n " . "\n"; *************** *** 994,998 **** . "\n " . "\n " ! . $_ . "\n " . "\n"; --- 994,998 ---- . "\n " . "\n " ! . translate_commands($_) . "\n " . "\n"; *************** *** 1037,1041 **** . "\n " . "\n " ! . $_ . "\n " . "\n"; --- 1037,1041 ---- . "\n " . "\n " ! . translate_commands($_) . "\n " . "\n"; From fdrake@weyr.cnri.reston.va.us Tue Mar 14 18:47:15 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Mar 2000 13:47:15 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libtime.tex,1.28.2.2,1.28.2.3 Message-ID: <200003141847.NAA24240@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libtime.tex Log Message: First table: change one column header to be more specific, shorten the content of one cell. Index: libtime.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.28.2.2 retrieving revision 1.28.2.3 diff -C2 -r1.28.2.2 -r1.28.2.3 *** libtime.tex 2000/03/10 15:24:05 1.28.2.2 --- libtime.tex 2000/03/14 18:47:13 1.28.2.3 *************** *** 80,84 **** is a tuple of 9 integers: ! \begin{tableiii}{r|l|l}{textrm}{Index}{Field}{Comment} \lineiii{0}{year}{(e.g.\ 1993)} \lineiii{1}{month}{range [1,12]} --- 80,84 ---- is a tuple of 9 integers: ! \begin{tableiii}{r|l|l}{textrm}{Index}{Field}{Values} \lineiii{0}{year}{(e.g.\ 1993)} \lineiii{1}{month}{range [1,12]} *************** *** 86,90 **** \lineiii{3}{hour}{range [0,23]} \lineiii{4}{minute}{range [0,59]} ! \lineiii{5}{second}{range [0,61]; see \strong{(1)} after table in \function{strftime()} description)} \lineiii{6}{weekday}{range [0,6], monday is 0} \lineiii{7}{Julian day}{range [1,366]} --- 86,90 ---- \lineiii{3}{hour}{range [0,23]} \lineiii{4}{minute}{range [0,59]} ! \lineiii{5}{second}{range [0,61]; see \strong{(1)} in \function{strftime()} description} \lineiii{6}{weekday}{range [0,6], monday is 0} \lineiii{7}{Julian day}{range [1,366]} From jhylton@cnri.reston.va.us Tue Mar 14 21:17:24 2000 From: jhylton@cnri.reston.va.us (Jeremy Hylton) Date: Tue, 14 Mar 2000 16:17:24 -0500 Subject: [Python-checkins] CVS: python/dist/src/Modules timemodule.c,2.79,2.80 Message-ID: <200003142117.QAA12536@goon.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory goon.cnri.reston.va.us:/home/jhylton/python/src/Modules Modified Files: timemodule.c Log Message: Fix bogus error reporting on strptime: let PyArg_ParseTuple set exception. Also, wrap long line. Index: timemodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/timemodule.c,v retrieving revision 2.79 retrieving revision 2.80 diff -C2 -r2.79 -r2.80 *** timemodule.c 2000/02/29 13:59:24 2.79 --- timemodule.c 2000/03/14 21:17:16 2.80 *************** *** 374,378 **** memset((ANY *) &buf, '\0', sizeof(buf)); ! if (!PyArg_ParseTuple(args, "sO:strftime", &fmt, &tup) || !gettmarg(tup, &buf)) return NULL; fmtlen = strlen(fmt); --- 374,379 ---- memset((ANY *) &buf, '\0', sizeof(buf)); ! if (!PyArg_ParseTuple(args, "sO:strftime", &fmt, &tup) ! || !gettmarg(tup, &buf)) return NULL; fmtlen = strlen(fmt); *************** *** 422,429 **** char *s; ! if (!PyArg_ParseTuple(args, "s|s:strptime", &buf, &fmt)) { ! PyErr_SetString(PyExc_ValueError, "invalid argument"); ! return NULL; ! } memset((ANY *) &tm, '\0', sizeof(tm)); s = strptime(buf, fmt, &tm); --- 423,428 ---- char *s; ! if (!PyArg_ParseTuple(args, "s|s:strptime", &buf, &fmt)) ! return NULL; memset((ANY *) &tm, '\0', sizeof(tm)); s = strptime(buf, fmt, &tm); From fdrake@weyr.cnri.reston.va.us Tue Mar 14 22:19:58 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Mar 2000 17:19:58 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.56.2.17,1.56.2.18 Message-ID: <200003142219.RAA28437@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/api In directory weyr:/home/fdrake/projects/python/Doc-152p2/api Modified Files: Tag: release152p1-patches api.tex Log Message: Tons and tons of mostly really small changes based on a really close reading of the document. More to come. Index: api.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/api/api.tex,v retrieving revision 1.56.2.17 retrieving revision 1.56.2.18 diff -C2 -r1.56.2.17 -r1.56.2.18 *** api.tex 2000/03/06 17:04:08 1.56.2.17 --- api.tex 2000/03/14 22:19:54 1.56.2.18 *************** *** 21,25 **** \noindent ! This manual documents the API used by C (or \Cpp{}) programmers who want to write extension modules or embed Python. It is a companion to \emph{Extending and Embedding the Python Interpreter}, which describes --- 21,25 ---- \noindent ! This manual documents the API used by C and \Cpp{} programmers who want to write extension modules or embed Python. It is a companion to [...1154 lines suppressed...] res = PyString_FromString(buf); PyMem_DEL(buf); /* allocated with PyMem_NEW */ return res; - } \end{verbatim} --- 3394,3406 ---- \begin{verbatim} PyObject *res; char *buf = PyMem_NEW(char, BUFSIZ); /* for I/O */ + if (buf == NULL) return PyErr_NoMemory(); ! /* ...Do some I/O operation involving buf... */ res = PyString_FromString(buf); PyMem_DEL(buf); /* allocated with PyMem_NEW */ return res; \end{verbatim} From fdrake@weyr.cnri.reston.va.us Wed Mar 15 14:58:02 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 09:58:02 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/tools anno-api.py,NONE,1.1 Message-ID: <200003151458.JAA02554@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/tools In directory weyr:/home/fdrake/projects/python/Doc/tools Added Files: anno-api.py Log Message: Script to annotate api.tex with reference count information. From fdrake@weyr.cnri.reston.va.us Wed Mar 15 15:01:29 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 10:01:29 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs python.sty,1.53.2.1,1.53.2.2 Message-ID: <200003151501.KAA02601@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/texinputs In directory weyr:/home/fdrake/projects/python/Doc-152p2/texinputs Modified Files: Tag: release152p1-patches python.sty Log Message: cfuncdesc environment: Support an optional parameter telling about the reference count treatment. This should *never* be entered by hand but added by the tools/anno-api.py script using data from the reference count database Skip contributed. Index: python.sty =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.53.2.1 retrieving revision 1.53.2.2 diff -C2 -r1.53.2.1 -r1.53.2.2 *** python.sty 2000/03/03 15:37:38 1.53.2.1 --- python.sty 2000/03/15 15:01:26 1.53.2.2 *************** *** 511,522 **** % \begin{funcdesc}{myfunc}{\optional{parm1\optional{, parm2}}} % \newcommand{\optional}[1]{% {\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}} % C functions ------------------------------------------------------------ ! % \begin{cfuncdesc}{type}{name}{arglist} ! \newenvironment{cfuncdesc}[3]{ \begin{fulllineitems} ! \item[\code{#1 \bfcode{#2}(\py@varvars{#3})}\index{#2@{\py@idxcode{#2()}}}] }{\end{fulllineitems}} --- 511,529 ---- % \begin{funcdesc}{myfunc}{\optional{parm1\optional{, parm2}}} % + \let\py@badkey=\@undefined + \newcommand{\optional}[1]{% {\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}} % C functions ------------------------------------------------------------ ! % \begin{cfuncdesc}[refcount]{type}{name}{arglist} ! % Note that the [refcount] slot should only be filled in by ! % tools/anno-api.py; it pulls the value from the refcounts database. ! \newenvironment{cfuncdesc}[4][\py@badkey]{ \begin{fulllineitems} ! \item[\code{#2 \bfcode{#3}(\py@varvars{#4})}\index{#3@{\py@idxcode{#3()}}}] ! \ifx#1\@undefined\else% ! \emph{Return value: \textbf{#1 reference}.}\\ ! \fi }{\end{fulllineitems}} *************** *** 530,535 **** % C data types ----------------------------------------------------------- % \begin{ctypedesc}[index name]{typedef name} - \let\py@classbadkey=\@undefined - \newenvironment{ctypedesc}[2][\py@badkey]{ \begin{fulllineitems} --- 537,540 ---- From fdrake@weyr.cnri.reston.va.us Wed Mar 15 15:03:28 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 10:03:28 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/paper-letter Makefile,1.12.4.1,1.12.4.2 Message-ID: <200003151503.KAA02636@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/paper-letter In directory weyr:/home/fdrake/projects/python/Doc-152p2/paper-letter Modified Files: Tag: release152p1-patches Makefile Log Message: Add rules to cause paper-*/api.tex to be generated from api/api.tex to add the reference count information. Index: Makefile =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/paper-letter/Makefile,v retrieving revision 1.12.4.1 retrieving revision 1.12.4.2 diff -C2 -r1.12.4.1 -r1.12.4.2 *** Makefile 2000/02/16 18:46:57 1.12.4.1 --- Makefile 2000/03/15 15:03:25 1.12.4.2 *************** *** 81,89 **** # Python/C API Reference Manual ! api.dvi: $(APIFILES) $(MKDVI) api ! api.pdf: $(APIFILES) $(MKPDF) api # Documenting Python --- 81,92 ---- # Python/C API Reference Manual ! api.dvi: api.tex $(APIFILES) $(MKDVI) api ! api.pdf: api.tex $(APIFILES) $(MKPDF) api + + api.tex: ../api/api.tex ../api/refcounts.dat ../tools/anno-api.py + $(PYTHON) ../tools/anno-api.py -o $@ ../api/api.tex # Documenting Python From fdrake@weyr.cnri.reston.va.us Wed Mar 15 15:03:49 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 10:03:49 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/paper-letter .cvsignore,1.7,1.7.4.1 Message-ID: <200003151503.KAA02665@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/paper-letter In directory weyr:/home/fdrake/projects/python/Doc-152p2/paper-letter Modified Files: Tag: release152p1-patches .cvsignore Log Message: Ignore the generated api.tex. Index: .cvsignore =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/paper-letter/.cvsignore,v retrieving revision 1.7 retrieving revision 1.7.4.1 diff -C2 -r1.7 -r1.7.4.1 *** .cvsignore 1999/03/16 16:14:50 1.7 --- .cvsignore 2000/03/15 15:03:47 1.7.4.1 *************** *** 14,15 **** --- 14,16 ---- *.how README + api.tex From fdrake@weyr.cnri.reston.va.us Wed Mar 15 15:05:56 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 10:05:56 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/tools mkdvi.sh,1.7,1.7.4.1 Message-ID: <200003151505.KAA02697@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/tools In directory weyr:/home/fdrake/projects/python/Doc-152p2/tools Modified Files: Tag: release152p1-patches mkdvi.sh Log Message: Make sure that the paper-*/ directory appears before the document directory in $TEXINPUTS. This is needed for the re-written api.tex to be used in preference to api/api.tex. Index: mkdvi.sh =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/tools/mkdvi.sh,v retrieving revision 1.7 retrieving revision 1.7.4.1 diff -C2 -r1.7 -r1.7.4.1 *** mkdvi.sh 1999/04/14 13:13:32 1.7 --- mkdvi.sh 2000/03/15 15:05:53 1.7.4.1 *************** *** 35,39 **** part=$1; shift 1 ! TEXINPUTS=$srcdir/$part:$TEXINPUTS export TEXINPUTS --- 35,39 ---- part=$1; shift 1 ! TEXINPUTS=.:$srcdir/$part:$TEXINPUTS export TEXINPUTS From fdrake@weyr.cnri.reston.va.us Wed Mar 15 15:07:04 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 10:07:04 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/paper-letter Makefile,1.12.4.2,1.12.4.3 Message-ID: <200003151507.KAA02722@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/paper-letter In directory weyr:/home/fdrake/projects/python/Doc-152p2/paper-letter Modified Files: Tag: release152p1-patches Makefile Log Message: Remember to clean up the generated api.tex for "make clean". Index: Makefile =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/paper-letter/Makefile,v retrieving revision 1.12.4.2 retrieving revision 1.12.4.3 diff -C2 -r1.12.4.2 -r1.12.4.3 *** Makefile 2000/03/15 15:03:25 1.12.4.2 --- Makefile 2000/03/15 15:07:01 1.12.4.3 *************** *** 134,138 **** clean: ! rm -f *~ *.aux *.idx *.ilg *.ind *.log *.toc *.bkm *.syn *.pla clobber: clean --- 134,138 ---- clean: ! rm -f *~ *.aux *.idx *.ilg *.ind *.log *.toc *.bkm *.syn *.pla api.tex clobber: clean From fdrake@weyr.cnri.reston.va.us Wed Mar 15 15:25:49 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 10:25:49 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libtelnetlib.tex,1.2.4.1,1.2.4.2 Message-ID: <200003151525.KAA03087@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libtelnetlib.tex Log Message: Changes from Peter Funk (mostly added an example use). Index: libtelnetlib.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libtelnetlib.tex,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -C2 -r1.2.4.1 -r1.2.4.2 *** libtelnetlib.tex 1999/10/28 19:43:35 1.2.4.1 --- libtelnetlib.tex 2000/03/15 15:25:46 1.2.4.2 *************** *** 2,11 **** Telnet client} - % LaTeX'ized from the comments in the module by Skip Montanaro - % . - \declaremodule{standard}{telnetlib} \modulesynopsis{Telnet client class.} ! The \module{telnetlib} module provides a \class{Telnet} class that --- 2,8 ---- Telnet client} \declaremodule{standard}{telnetlib} \modulesynopsis{Telnet client class.} ! \sectionauthor{Skip Montanaro}{skip@mojam.com} The \module{telnetlib} module provides a \class{Telnet} class that *************** *** 150,151 **** --- 147,177 ---- results are undeterministic, and may depend on the I/O timing. \end{methoddesc} + + + \subsection{Telnet Example \label{telnet-example}} + \sectionauthor{Peter Funk}{pf@artcom-gmbh.de} + + A simple example illustrating typical use: + + \begin{verbatim} + import getpass + import sys + import telnetlib + + HOST = "localhost" + user = raw_input("Enter your remote account: ") + password = getpass.getpass() + + tn = telnetlib.Telnet(HOST) + + tn.read_until("login: ") + tn.write(user + "\n") + if password: + tn.read_until("Password: ") + tn.write(password + "\n") + + tn.write("ls\n") + tn.write("exit\n") + + print tn.read_all() + \end{verbatim} From fdrake@weyr.cnri.reston.va.us Wed Mar 15 16:39:16 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 11:39:16 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.190.2.4,1.190.2.5 Message-ID: <200003151639.LAA03948@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc In directory weyr:/home/fdrake/projects/python/Doc-152p2 Modified Files: Tag: release152p1-patches Makefile Log Message: When building a ZIP archive, remove an existing version first so we don't accumulate files that are no longer used. Also, use the -q option so we don't fill up scrollback buffers with so much junk. Index: Makefile =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/Makefile,v retrieving revision 1.190.2.4 retrieving revision 1.190.2.5 diff -C2 -r1.190.2.4 -r1.190.2.5 *** Makefile 2000/02/28 21:04:53 1.190.2.4 --- Makefile 2000/03/15 16:39:13 1.190.2.5 *************** *** 220,223 **** --- 220,224 ---- latex-$(RELEASE).zip: + rm -f $@ $(TOOLSDIR)/mksourcepkg --zip $(RELEASE) *************** *** 229,233 **** pdf-$(PAPER)-$(RELEASE).zip: pdf ! (cd paper-$(PAPER); zip -9 ../$@ *.pdf) postscript-$(PAPER)-$(RELEASE).tar.bz2: ps --- 230,235 ---- pdf-$(PAPER)-$(RELEASE).zip: pdf ! rm -f $@ ! (cd paper-$(PAPER); zip -q -9 ../$@ *.pdf) postscript-$(PAPER)-$(RELEASE).tar.bz2: ps *************** *** 241,245 **** postscript-$(PAPER)-$(RELEASE).zip: ps (cd paper-$(PAPER); $(MAKE) README) ! (cd paper-$(PAPER); zip -9 ../$@ *.ps README) html-$(RELEASE).tgz: html --- 243,248 ---- postscript-$(PAPER)-$(RELEASE).zip: ps (cd paper-$(PAPER); $(MAKE) README) ! rm -f $@ ! (cd paper-$(PAPER); zip -q -9 ../$@ *.ps README) html-$(RELEASE).tgz: html *************** *** 254,259 **** html-$(RELEASE).zip: html (cd $(HTMLDIR); \ ! zip -9 ../$@ *index.html ???/*.css ???/*.html */*.gif) # convenience targets: --- 257,263 ---- html-$(RELEASE).zip: html + rm -f $@ (cd $(HTMLDIR); \ ! zip -q -9 ../$@ *index.html ???/*.css ???/*.html */*.gif) # convenience targets: From fdrake@weyr.cnri.reston.va.us Wed Mar 15 16:41:31 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 11:41:31 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/tools mksourcepkg,1.1,1.1.2.1 Message-ID: <200003151641.LAA03982@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/tools In directory weyr:/home/fdrake/projects/python/Doc-152p2/tools Modified Files: Tag: release152p1-patches mksourcepkg Log Message: When building a ZIP archive, remove an existing version first so we don't accumulate files that are no longer used. Also, use the -q option so we don't fill up scrollback buffers with so much junk. Index: mksourcepkg =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/tools/mksourcepkg,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -r1.1 -r1.1.2.1 *** mksourcepkg 1999/08/02 20:19:17 1.1 --- mksourcepkg 2000/03/15 16:41:28 1.1.2.1 *************** *** 17,21 **** # from the Makefile or someplace. ! __version__ = "$Revision: 1.1 $" import getopt --- 17,21 ---- # from the Makefile or someplace. ! __version__ = "$Revision: 1.1.2.1 $" import getopt *************** *** 106,110 **** % (release, archive)) elif format == "zip": ! run("zip -r9 %s.zip Python-%s" % (archive, release)) --- 106,112 ---- % (release, archive)) elif format == "zip": ! if os.path.exists(archive + ".zip"): ! os.unlink(archive + ".zip") ! run("zip -q -r9 %s.zip Python-%s" % (archive, release)) From fdrake@weyr.cnri.reston.va.us Wed Mar 15 17:04:17 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 12:04:17 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib liburllib.tex,1.20.4.3,1.20.4.4 Message-ID: <200003151704.MAA04325@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches liburllib.tex Log Message: Fixed a markup bug; symptoms noticed by Peter Funk . The classdesc for FancyURLopener didn't include *anything* for constructor parameters. Also moved URLopener method descriptions to a separate subsection to be more like other places in the manual. Index: liburllib.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.20.4.3 retrieving revision 1.20.4.4 diff -C2 -r1.20.4.3 -r1.20.4.4 *** liburllib.tex 2000/02/18 23:17:53 1.20.4.3 --- liburllib.tex 2000/03/15 17:04:14 1.20.4.4 *************** *** 195,234 **** \var{key_file} and \var{cert_file} are supported; both are needed to actually retrieve a resource at an \file{https:} URL. - - \begin{methoddesc}{open}{fullurl\optional{, data}} - Open \var{fullurl} using the appropriate protocol. This method sets - up cache and proxy information, then calls the appropriate open method with - its input arguments. If the scheme is not recognized, - \method{open_unknown()} is called. The \var{data} argument - has the same meaning as the \var{data} argument of \function{urlopen()}. - \end{methoddesc} - - \begin{methoddesc}{open_unknown}{fullurl\optional{, data}} - Overridable interface to open unknown URL types. - \end{methoddesc} - - \begin{methoddesc}{retrieve}{url\optional{, filename\optional{, reporthook}}} - Retrieves the contents of \var{url} and places it in \var{filename}. The - return value is a tuple consisting of a local filename and either a - \class{mimetools.Message} object containing the response headers (for remote - URLs) or None (for local URLs). The caller must then open and read the - contents of \var{filename}. If \var{filename} is not given and the URL - refers to a local file, the input filename is returned. If the URL is - non-local and \var{filename} is not given, the filename is the output of - \function{tempfile.mktemp()} with a suffix that matches the suffix of the last - path component of the input URL. If \var{reporthook} is given, it must be - a function accepting three numeric parameters. It will be called after each - chunk of data is read from the network. \var{reporthook} is ignored for - local URLs. - \end{methoddesc} - \end{classdesc} ! \begin{classdesc}{FancyURLopener} ! \class{FancyURLopener} subclasses \class{URLopener} providing default handling ! for the following HTTP response codes: 301, 302 or 401. For 301 and 302 ! response codes, the \code{location} header is used to fetch the actual URL. ! For 401 response codes (authentication required), basic HTTP authentication ! is performed. \end{classdesc} --- 195,209 ---- \var{key_file} and \var{cert_file} are supported; both are needed to actually retrieve a resource at an \file{https:} URL. \end{classdesc} + + \begin{classdesc}{FancyURLopener}{...} + \class{FancyURLopener} subclasses \class{URLopener} providing default + handling for the following HTTP response codes: 301, 302 or 401. For + 301 and 302 response codes, the \code{location} header is used to + fetch the actual URL. For 401 response codes (authentication + required), basic HTTP authentication is performed. ! The parameters to the constructor are the same as those for ! \class{URLopener}. \end{classdesc} *************** *** 281,284 **** --- 256,293 ---- \end{itemize} + + + \subsection{URLopener Objects \label{urlopener-objs}} + \sectionauthor{Skip Montanaro}{skip@mojam.com} + + \class{URLopener} and \class{FancyURLopener} objects have the + following methodsL + + \begin{methoddesc}{open}{fullurl\optional{, data}} + Open \var{fullurl} using the appropriate protocol. This method sets + up cache and proxy information, then calls the appropriate open method with + its input arguments. If the scheme is not recognized, + \method{open_unknown()} is called. The \var{data} argument + has the same meaning as the \var{data} argument of \function{urlopen()}. + \end{methoddesc} + + \begin{methoddesc}{open_unknown}{fullurl\optional{, data}} + Overridable interface to open unknown URL types. + \end{methoddesc} + + \begin{methoddesc}{retrieve}{url\optional{, filename\optional{, reporthook}}} + Retrieves the contents of \var{url} and places it in \var{filename}. The + return value is a tuple consisting of a local filename and either a + \class{mimetools.Message} object containing the response headers (for remote + URLs) or None (for local URLs). The caller must then open and read the + contents of \var{filename}. If \var{filename} is not given and the URL + refers to a local file, the input filename is returned. If the URL is + non-local and \var{filename} is not given, the filename is the output of + \function{tempfile.mktemp()} with a suffix that matches the suffix of the last + path component of the input URL. If \var{reporthook} is given, it must be + a function accepting three numeric parameters. It will be called after each + chunk of data is read from the network. \var{reporthook} is ignored for + local URLs. + \end{methoddesc} From fdrake@weyr.cnri.reston.va.us Wed Mar 15 17:12:36 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 12:12:36 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.20.2.5,1.20.2.6 Message-ID: <200003151712.MAA04385@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libstdtypes.tex Log Message: Elaborate the note about {}.keys() and {}.values() based on comments from Aahz Maruch and François Pinard . Index: libstdtypes.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.20.2.5 retrieving revision 1.20.2.6 diff -C2 -r1.20.2.5 -r1.20.2.6 *** libstdtypes.tex 2000/03/06 16:57:06 1.20.2.5 --- libstdtypes.tex 2000/03/15 17:12:33 1.20.2.6 *************** *** 591,595 **** in the map. ! \item[(2)] Keys and values are listed in random order. \item[(3)] \var{b} must be of the same type as \var{a}. --- 591,600 ---- in the map. ! \item[(2)] Keys and values are listed in random order. If ! \method{keys()} and \method{values()} are called with no intervening ! modifications to the dictionary, the two lists will directly ! correspond. This allows the creation of \code{(\var{value}, ! \var{key})} pairs using \function{map()}: \samp{pairs = map(None, ! \var{a}.values(), \var{a}.keys())}. \item[(3)] \var{b} must be of the same type as \var{a}. From fdrake@weyr.cnri.reston.va.us Wed Mar 15 18:03:06 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 13:03:06 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libcalendar.tex,1.6,1.6.4.1 Message-ID: <200003151803.NAA04506@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libcalendar.tex Log Message: Fix a couple of typos in the timegm() description. Index: libcalendar.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libcalendar.tex,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -r1.6 -r1.6.4.1 *** libcalendar.tex 1999/06/09 15:11:58 1.6 --- libcalendar.tex 2000/03/15 18:03:03 1.6.4.1 *************** *** 49,56 **** \begin{funcdesc}{timegm}{tuple} ! An unrelated but handy function that takes a time tuple such are returned by the \function{gmtime()} function in the \module{time} module, and returns the corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX encoding. In fact, ! \function{gmtime()} and \function{timegm()} are each others inverse. \end{funcdesc} --- 49,56 ---- \begin{funcdesc}{timegm}{tuple} ! An unrelated but handy function that takes a time tuple such as returned by the \function{gmtime()} function in the \module{time} module, and returns the corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX encoding. In fact, ! \function{gmtime()} and \function{timegm()} are each others' inverse. \end{funcdesc} From fdrake@weyr.cnri.reston.va.us Wed Mar 15 18:23:58 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Mar 2000 13:23:58 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libcalendar.tex,1.6.4.1,1.6.4.2 Message-ID: <200003151823.NAA04987@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib Modified Files: Tag: release152p1-patches libcalendar.tex Log Message: Ah, the cascade effect.... A number of individually minor improvements. Index: libcalendar.tex =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libcalendar.tex,v retrieving revision 1.6.4.1 retrieving revision 1.6.4.2 diff -C2 -r1.6.4.1 -r1.6.4.2 *** libcalendar.tex 2000/03/15 18:03:03 1.6.4.1 --- libcalendar.tex 2000/03/15 18:23:55 1.6.4.2 *************** *** 1,17 **** - % This section was contributed by Drew Csillag . - \section{\module{calendar} --- ! Functions that emulate the \UNIX{} \program{cal} program.} ! \declaremodule{standard}{calendar} ! ! \modulesynopsis{Functions that emulate the \UNIX{} \program{cal} ! program.} This module allows you to output calendars like the \UNIX{} ! \manpage{cal}{1} program. \begin{funcdesc}{isleap}{year} ! Returns \code{1} if \var{year} is a leap year. \end{funcdesc} --- 1,17 ---- \section{\module{calendar} --- ! General calendar-related functions} + \declaremodule{standard}{calendar} + \modulesynopsis{General functions for working with the calendar, + including some emulation of the \UNIX{} \program{cal} + program.} + \sectionauthor{Drew Csillag}{drew_csillag@geocities.com} This module allows you to output calendars like the \UNIX{} ! \program{cal} program, and provides additional useful functions ! related to the calendar. \begin{funcdesc}{isleap}{year} ! Returns true if \var{year} is a leap year. \end{funcdesc} *************** *** 50,56 **** \begin{funcdesc}{timegm}{tuple} An unrelated but handy function that takes a time tuple such as ! returned by the \function{gmtime()} function in the \module{time} module, and returns the corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX encoding. In fact, ! \function{gmtime()} and \function{timegm()} are each others' inverse. \end{funcdesc} --- 50,61 ---- \begin{funcdesc}{timegm}{tuple} An unrelated but handy function that takes a time tuple such as ! returned by the \function{gmtime()} function in the \refmodule{time} module, and returns the corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX encoding. In fact, ! \function{time.gmtime()} and \function{timegm()} are each others' inverse. \end{funcdesc} + + + \begin{seealso} + \seemodule{time}{Low-level time related functions.} + \end{seealso} From fdrake@weyr.cnri.reston.va.us Thu Mar 16 14:30:22 2000 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 16 Mar 2000 09:30:22 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/html index.html.in,1.4.4.2,1.4.4.3 Message-ID: <200003161430.JAA08010@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/html In directory weyr:/home/fdrake/projects/python/Doc-152p2/html Modified Files: Tag: release152p1-patches index.html.in Log Message: Make the version number appear properly in the page title; reported by a couple of people. Index: index.html.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Doc/html/index.html.in,v retrieving revision 1.4.4.2 retrieving revision 1.4.4.3 diff -C2 -r1.4.4.2 -r1.4.4.3 *** index.html.in 2000/02/28 20:39:12 1.4.4.2 --- index.html.in 2000/03/16 14:30:19 1.4.4.3 *************** *** 1,5 **** ! Python @VERSION@ Documentation