From gvanrossum@users.sourceforge.net Mon Apr 2 18:59:04 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 02 Apr 2001 10:59:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules linuxaudiodev.c,2.13,2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13825 Modified Files: linuxaudiodev.c Log Message: Applying SF patch #412553 by Christopher Lee: fix linuxaudiodev handling of EAGAIN. This may or may not fix the problem for me (Mandrake 7.2 on a Dell Optiplex GX110 desktop): I can't hear the output, but it does pass the test now. It doesn't fix the problem for Fred (Mandrake 7.2 on a Dell Inspiron 7500 which has the Maestro sound drivers). Fred suspects that it's the kernel version in combination with the driver. Index: linuxaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/linuxaudiodev.c,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** linuxaudiodev.c 2001/01/17 19:31:29 2.13 --- linuxaudiodev.c 2001/04/02 17:59:02 2.14 *************** *** 5,10 **** * Author : Peter Bosch * Created On : Thu Mar 2 21:10:33 2000 - * Last Modified By: Peter Bosch - * Last Modified On: Fri Mar 24 11:27:00 2000 * Status : Unknown, Use with caution! * --- 5,8 ---- *************** *** 175,190 **** char *cp; int rv, size; ! if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) return NULL; while (size > 0) { if ((rv = write(self->x_fd, cp, size)) == -1) { ! PyErr_SetFromErrno(LinuxAudioError); ! return NULL; ! } ! self->x_ocount += rv; ! size -= rv; ! cp += rv; } Py_INCREF(Py_None); --- 173,210 ---- char *cp; int rv, size; ! fd_set write_set_fds; ! struct timeval tv; ! int select_retval; ! if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) return NULL; + /* use select to wait for audio device to be available */ + FD_ZERO(&write_set_fds); + FD_SET(self->x_fd, &write_set_fds); + tv.tv_sec = 4; /* timeout values */ + tv.tv_usec = 0; + while (size > 0) { + select_retval = select(self->x_fd+1, NULL, &write_set_fds, NULL, &tv); + tv.tv_sec = 1; tv.tv_usec = 0; /* willing to wait this long next time*/ + if (select_retval) { if ((rv = write(self->x_fd, cp, size)) == -1) { ! if (errno != EAGAIN) { ! PyErr_SetFromErrno(LinuxAudioError); ! return NULL; ! } else { ! errno = 0; /* EAGAIN: buffer is full, try again */ ! } ! } else { ! self->x_ocount += rv; ! size -= rv; ! cp += rv; ! } ! } else { ! /* printf("Not able to write to linux audio device within %ld seconds\n", tv.tv_sec); */ ! PyErr_SetFromErrno(LinuxAudioError); ! return NULL; ! } } Py_INCREF(Py_None); From tim_one@users.sourceforge.net Mon Apr 2 21:15:59 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 02 Apr 2001 13:15:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib threading.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11514/python/dist/src/Lib Modified Files: threading.py Log Message: SF bug [#410708] Condition.wait() and KeyboardInterrupt. http://sourceforge.net/tracker/?func=detail&aid=410708&group_id=5470&atid=105470 Added try/finally around Condition.wait() guts, so that the lock state gets restored at the end no matter what happens. Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** threading.py 2001/01/15 03:26:36 1.11 --- threading.py 2001/04/02 20:15:57 1.12 *************** *** 186,214 **** self.__waiters.append(waiter) saved_state = self._release_save() ! if timeout is None: ! waiter.acquire() ! if __debug__: ! self._note("%s.wait(): got it", self) ! else: ! endtime = _time() + timeout ! delay = 0.000001 # 1 usec ! while 1: ! gotit = waiter.acquire(0) ! if gotit or _time() >= endtime: ! break ! _sleep(delay) ! if delay < 1.0: ! delay = delay * 2.0 ! if not gotit: if __debug__: ! self._note("%s.wait(%s): timed out", self, timeout) ! try: ! self.__waiters.remove(waiter) ! except ValueError: ! pass else: ! if __debug__: ! self._note("%s.wait(%s): got it", self, timeout) ! self._acquire_restore(saved_state) def notify(self, n=1): --- 186,216 ---- self.__waiters.append(waiter) saved_state = self._release_save() ! try: # restore state no matter what (e.g., KeyboardInterrupt) ! if timeout is None: ! waiter.acquire() if __debug__: ! self._note("%s.wait(): got it", self) else: ! endtime = _time() + timeout ! delay = 0.000001 # 1 usec ! while 1: ! gotit = waiter.acquire(0) ! if gotit or _time() >= endtime: ! break ! _sleep(delay) ! if delay < 1.0: ! delay = delay * 2.0 ! if not gotit: ! if __debug__: ! self._note("%s.wait(%s): timed out", self, timeout) ! try: ! self.__waiters.remove(waiter) ! except ValueError: ! pass ! else: ! if __debug__: ! self._note("%s.wait(%s): got it", self, timeout) ! finally: ! self._acquire_restore(saved_state) def notify(self, n=1): From fdrake@users.sourceforge.net Tue Apr 3 18:41:59 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 03 Apr 2001 10:41:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.130,1.131 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv1178/tut Modified Files: tut.tex Log Message: Make reference to the Library Reference in the "What Now?" chapter a hyperlink. Fix two English usage errors caught by Jan Wells: Changed "subsequence" to "sub-sequence" in two places, and avoid improper use of "hopefully" in the first paragraph of the "What Now?" chapter. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -r1.130 -r1.131 *** tut.tex 2001/03/13 17:56:08 1.130 --- tut.tex 2001/04/03 17:41:56 1.131 *************** *** 943,947 **** Of course, we can use Python for more complicated tasks than adding two and two together. For instance, we can write an initial ! subsequence of the \emph{Fibonacci} series as follows: \begin{verbatim} --- 943,947 ---- Of course, we can use Python for more complicated tasks than adding two and two together. For instance, we can write an initial ! sub-sequence of the \emph{Fibonacci} series as follows: \begin{verbatim} *************** *** 2033,2037 **** the lexicographical comparison is carried out recursively. If all items of two sequences compare equal, the sequences are considered ! equal. If one sequence is an initial subsequence of the other, the shorter sequence is the smaller one. Lexicographical ordering for strings uses the \ASCII{} ordering for individual characters. Some --- 2033,2037 ---- the lexicographical comparison is carried out recursively. If all items of two sequences compare equal, the sequences are considered ! equal. If one sequence is an initial sub-sequence of the other, the shorter sequence is the smaller one. Lexicographical ordering for strings uses the \ASCII{} ordering for individual characters. Some *************** *** 3911,3918 **** \chapter{What Now? \label{whatNow}} ! Hopefully reading this tutorial has reinforced your interest in using ! Python. Now what should you do? ! You should read, or at least page through, the Library Reference, which gives complete (though terse) reference material about types, functions, and modules that can save you a lot of time when writing --- 3911,3920 ---- \chapter{What Now? \label{whatNow}} ! Reading this tutorial has probably reinforced your interest in using ! Python --- you should be eager to apply Python to solve your ! real-world problems. Now what should you do? ! You should read, or at least page through, the ! \citetitle[../lib/lib.html]{Python Library Reference}, which gives complete (though terse) reference material about types, functions, and modules that can save you a lot of time when writing From fdrake@users.sourceforge.net Wed Apr 4 02:25:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 03 Apr 2001 18:25:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.113,1.114 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv26349/api Modified Files: api.tex Log Message: Document PySequence_Size(), and describe PySequence_Length() as simply an alternate name for the same function. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -r1.113 -r1.114 *** api.tex 2001/03/28 21:14:32 1.113 --- api.tex 2001/04/04 01:25:17 1.114 *************** *** 1877,1885 **** \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PySequence_Length}{PyObject *o} Returns the number of objects in sequence \var{o} on success, and \code{-1} on failure. For objects that do not provide sequence protocol, this is equivalent to the Python expression \samp{len(\var{o})}.\bifuncindex{len} \end{cfuncdesc} --- 1877,1889 ---- \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PySequence_Size}{PyObject *o} Returns the number of objects in sequence \var{o} on success, and \code{-1} on failure. For objects that do not provide sequence protocol, this is equivalent to the Python expression \samp{len(\var{o})}.\bifuncindex{len} + \end{cfuncdesc} + + \begin{cfuncdesc}{int}{PySequence_Length}{PyObject *o} + Alternate name for \cfunction{PySequence_Size()}. \end{cfuncdesc} From fdrake@users.sourceforge.net Wed Apr 4 15:09:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 04 Apr 2001 07:09:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/dom minidom.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory usw-pr-cvs1:/tmp/cvs-serv8483/xml/dom Modified Files: minidom.py Log Message: Add support for the CharacterData methods, CDATASection. Index: minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** minidom.py 2001/03/31 16:30:40 1.29 --- minidom.py 2001/04/04 14:09:46 1.30 *************** *** 614,623 **** writer.write("%s%s" % (indent,self.target, self.data, newl)) ! class Text(Node): ! nodeType = Node.TEXT_NODE ! nodeName = "#text" ! attributes = None ! childNodeTypes = () ! def __init__(self, data): if type(data) not in _StringTypes: --- 614,618 ---- writer.write("%s%s" % (indent,self.target, self.data, newl)) ! class CharacterData(Node): def __init__(self, data): if type(data) not in _StringTypes: *************** *** 626,629 **** --- 621,628 ---- self.data = self.nodeValue = data + def __getattr__(self, name): + if name == "length": + return len(self.data) + def __repr__(self): if len(self.data) > 10: *************** *** 631,635 **** else: dotdotdot = "" ! return "" % (self.data[0:10], dotdotdot) def splitText(self, offset): --- 630,687 ---- else: dotdotdot = "" ! return "" % ( ! self.__class__.__name__, self.data[0:10], dotdotdot) ! ! def substringData(self, offset, count): ! if offset < 0: ! raise xml.dom.IndexSizeErr("offset cannot be negative") ! if offset >= len(self.data): ! raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") ! if count < 0: ! raise xml.dom.IndexSizeErr("count cannot be negative") ! return self.data[offset:offset+count] ! ! def appendData(self, arg): ! self.data = self.data + arg ! self.nodeValue = self.data ! ! def insertData(self, offset, arg): ! if offset < 0: ! raise xml.dom.IndexSizeErr("offset cannot be negative") ! if offset >= len(self.data): ! raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") ! if arg: ! self.data = "%s%s%s" % ( ! self.data[:offset], arg, self.data[offset:]) ! self.nodeValue = self.data ! ! def deleteData(self, offset, count): ! if offset < 0: ! raise xml.dom.IndexSizeErr("offset cannot be negative") ! if offset >= len(self.data): ! raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") ! if count < 0: ! raise xml.dom.IndexSizeErr("count cannot be negative") ! if count: ! self.data = self.data[:offset] + self.data[offset+count:] ! self.nodeValue = self.data ! ! def replaceData(self, offset, count, arg): ! if offset < 0: ! raise xml.dom.IndexSizeErr("offset cannot be negative") ! if offset >= len(self.data): ! raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") ! if count < 0: ! raise xml.dom.IndexSizeErr("count cannot be negative") ! if count: ! self.data = "%s%s%s" % ( ! self.data[:offset], arg, self.data[offset+count:]) ! self.nodeValue = self.data ! ! class Text(CharacterData): ! nodeType = Node.TEXT_NODE ! nodeName = "#text" ! attributes = None ! childNodeTypes = () def splitText(self, offset): *************** *** 649,652 **** --- 701,713 ---- _write_data(writer, "%s%s%s"%(indent, self.data, newl)) + + class CDATASection(Text): + nodeType = Node.CDATA_SECTION_NODE + nodeName = "#cdata-section" + + def writexml(self, writer, indent="", addindent="", newl=""): + _write_data(writer, "" % self.data) + + def _nssplit(qualifiedName): fields = _string.split(qualifiedName, ':', 1) *************** *** 781,784 **** --- 842,850 ---- t.ownerDocument = self return t + + def createCDATASection(self, data): + c = CDATASection(data) + c.ownerDocument = self + return c def createComment(self, data): From fdrake@users.sourceforge.net Wed Apr 4 16:15:21 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 04 Apr 2001 08:15:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/dom minidom.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory usw-pr-cvs1:/tmp/cvs-serv23277/xml/dom Modified Files: minidom.py Log Message: CharacterData methods: Update self.length on changes instead of extended the __getattr__() handler. Text.splitText(): Update the length and nodeValue attributes. Index: minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** minidom.py 2001/04/04 14:09:46 1.30 --- minidom.py 2001/04/04 15:15:18 1.31 *************** *** 620,628 **** Node.__init__(self) self.data = self.nodeValue = data - def __getattr__(self, name): - if name == "length": - return len(self.data) - def __repr__(self): if len(self.data) > 10: --- 620,625 ---- Node.__init__(self) self.data = self.nodeValue = data + self.length = len(data) def __repr__(self): if len(self.data) > 10: *************** *** 645,648 **** --- 642,646 ---- self.data = self.data + arg self.nodeValue = self.data + self.length = len(self.data) def insertData(self, offset, arg): *************** *** 655,658 **** --- 653,657 ---- self.data[:offset], arg, self.data[offset:]) self.nodeValue = self.data + self.length = len(self.data) def deleteData(self, offset, count): *************** *** 666,669 **** --- 665,669 ---- self.data = self.data[:offset] + self.data[offset+count:] self.nodeValue = self.data + self.length = len(self.data) def replaceData(self, offset, count, arg): *************** *** 678,681 **** --- 678,682 ---- self.data[:offset], arg, self.data[offset+count:]) self.nodeValue = self.data + self.length = len(self.data) class Text(CharacterData): *************** *** 696,699 **** --- 697,702 ---- self.parentNode.insertBefore(newText, next) self.data = self.data[:offset] + self.nodeValue = self.data + self.length = len(self.data) return newText From fdrake@users.sourceforge.net Wed Apr 4 18:47:27 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 04 Apr 2001 10:47:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/webchecker webchecker.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/webchecker In directory usw-pr-cvs1:/tmp/cvs-serv23716 Modified Files: webchecker.py Log Message: A number of improvements based on a discussion with Chris McCafferty : Add javascript: and telnet: to the types of URLs we ignore. Add support for several additional URL-valued attributes on the BODY, FRAME, IFRAME, LINK, OBJECT, and SCRIPT elements. Index: webchecker.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/webchecker.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** webchecker.py 2000/03/28 20:10:39 1.22 --- webchecker.py 2001/04/04 17:47:25 1.23 *************** *** 482,487 **** return self.name_table[url] ! if url[:7] == 'mailto:' or url[:5] == 'news:': ! self.note(1, " Not checking mailto/news URL") return None isint = self.inroots(url) --- 482,488 ---- return self.name_table[url] ! scheme = urllib.splittype(url) ! if scheme in ('mailto', 'news', 'javascript', 'telnet'): ! self.note(1, " Not checking %s URL" % scheme) return None isint = self.inroots(url) *************** *** 793,800 **** --- 794,822 ---- self.link_attr(attributes, 'href') + def do_body(self, attributes): + self.link_attr(attributes, 'background') + def do_img(self, attributes): self.link_attr(attributes, 'src', 'lowsrc') def do_frame(self, attributes): + self.link_attr(attributes, 'src', 'longdesc') + + def do_iframe(self, attributes): + self.link_attr(attributes, 'src', 'longdesc') + + def do_link(self, attributes): + for name, value in attributes: + if name == "rel": + parts = string.split(string.lower(value)) + if ( parts == ["stylesheet"] + or parts == ["alternate", "stylesheet"]): + self.link_attr(attributes, "href") + break + + def do_object(self, attributes): + self.link_attr(attributes, 'data', 'usemap') + + def do_script(self, attributes): self.link_attr(attributes, 'src') From tim_one@users.sourceforge.net Wed Apr 4 19:35:22 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 04 Apr 2001 11:35:22 -0700 Subject: [Python-checkins] CVS: python/dist/src README,1.118,1.119 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv828/python/dist/src Modified Files: README Log Message: SF patch [ #413750 ] Cygwin entry for README file, from Jason Tishler. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -r1.118 -r1.119 *** README 2001/03/23 17:51:37 1.118 --- README 2001/04/04 18:35:19 1.119 *************** *** 400,403 **** --- 400,440 ---- filesystem (how to check for this on Mac OS X?). + Cygwin: Cygwin Python builds OOTB when configured as follows: + + configure --with-threads=no + + assuming Cygwin 1.1.8-2 and gcc 2.95.3-1 or later. At the time + of this writing, Cygwin pthread support is being significantly + enhanced. Hopefully, there will be a Cygwin Python with thread + support soon. + + Cygwin Python supports the building of shared extensions via the + traditional Misc/Makefile.pre.in and the newer distutils methods. + + On NT/2000, the following regression tests fail: + + test_poll (hang) + test_strftime + + Due to the test_poll hang on NT/2000, one should run the + regression test using the following: + + PYTHONPATH= ./python.exe -tt ./Lib/test/regrtest.py -l -x test_poll + + On 9X/Me, in addition the above NT/2000 failures, it has been + reported that the following regression tests also fail: + + test_pwd + test_select (hang) + test_socket + + Due to the test_poll and test_select hang on 9X/Me, one should + run the regression test using the following: + + PYTHONPATH= ./python.exe -tt ./Lib/test/regrtest.py -l -x test_poll -x test_select + + Help trying to track down the root causes for these known problems + will be greatly appreciated. + Configuring threads From tim_one@users.sourceforge.net Wed Apr 4 19:56:51 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 04 Apr 2001 11:56:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_zipfile.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5351/python/dist/src/Lib/test Modified Files: test_zipfile.py Log Message: Sf bug [ #412214 ] ZipFile constructor leaves files open. This applies the patch Fred Drake created to fix it. I'm checking it in since I had to apply the patch anyway in order to test its behavior on Windows. Index: test_zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zipfile.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** test_zipfile.py 2001/03/29 04:36:09 1.5 --- test_zipfile.py 2001/04/04 18:56:49 1.6 *************** *** 43,46 **** --- 43,62 ---- os.unlink(zipname) + + # This test checks that the ZipFile constructor closes the file object + # it opens if there's an error in the file. If it doesn't, the traceback + # holds a reference to the ZipFile object and, indirectly, the file object. + # On Windows, this causes the os.unlink() call to fail because the + # underlying file is still open. This is SF bug #412214. + # + fp = open(srcname, "w") + fp.write("this is not a legal zip file\n") + fp.close() + try: + zf = zipfile.ZipFile(srcname) + except zipfile.BadZipfile: + os.unlink(srcname) + + # make sure we don't raise an AttributeError when a partially-constructed # ZipFile instance is finalized; this tests for regression on SF tracker From tim_one@users.sourceforge.net Wed Apr 4 19:56:51 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 04 Apr 2001 11:56:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib zipfile.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5351/python/dist/src/Lib Modified Files: zipfile.py Log Message: Sf bug [ #412214 ] ZipFile constructor leaves files open. This applies the patch Fred Drake created to fix it. I'm checking it in since I had to apply the patch anyway in order to test its behavior on Windows. Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** zipfile.py 2001/03/29 04:36:08 1.10 --- zipfile.py 2001/04/04 18:56:49 1.11 *************** *** 187,193 **** --- 187,207 ---- fp.seek(0, 2) else: + if not self._filePassed: + self.fp.close() + self.fp = None raise RuntimeError, 'Mode must be "r", "w" or "a"' def _GetContents(self): + """Read the directory, making sure we close the file if the format + is bad.""" + try: + self._RealGetContents() + except BadZipfile: + if not self._filePassed: + self.fp.close() + self.fp = None + raise + + def _RealGetContents(self): """Read in the table of contents for the ZIP file.""" fp = self.fp From fdrake@users.sourceforge.net Wed Apr 4 22:19:29 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 04 Apr 2001 14:19:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv32739 Modified Files: termios.c Log Message: Add an #include of sys/ioctl.h to pick up a lot of the constants supported in the previous patch. This closes (again!) SF patch #410267. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -r2.20 -r2.21 *** termios.c 2001/03/26 17:14:02 2.20 --- termios.c 2001/04/04 21:19:26 2.21 *************** *** 6,9 **** --- 6,10 ---- #include + #include static char termios__doc__[] = "\ From fdrake@users.sourceforge.net Thu Apr 5 15:41:33 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 05 Apr 2001 07:41:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/dom minidom.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory usw-pr-cvs1:/tmp/cvs-serv9741 Modified Files: minidom.py Log Message: Corrected default value of the DocumentType.internalSubset attribute based on a clarification sent to the www-dom list. Index: minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** minidom.py 2001/04/04 15:15:18 1.31 --- minidom.py 2001/04/05 14:41:30 1.32 *************** *** 728,732 **** publicId = None systemId = None ! internalSubset = "" entities = None notations = None --- 728,732 ---- publicId = None systemId = None ! internalSubset = None entities = None notations = None From akuchling@users.sourceforge.net Thu Apr 5 15:50:43 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Thu, 05 Apr 2001 07:50:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc python.man,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv10475 Modified Files: python.man Log Message: Mention pydoc in the man page Index: python.man =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python.man,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** python.man 2000/12/19 03:21:54 1.17 --- python.man 2001/04/05 14:50:40 1.18 *************** *** 69,72 **** --- 69,77 ---- applications. See the internal documentation for hints. + .PP + Documentation for installed Python modules and packages can be + viewed by running the + .B pydoc + program. .SH COMMAND LINE OPTIONS .TP From akuchling@users.sourceforge.net Thu Apr 5 16:46:51 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Thu, 05 Apr 2001 08:46:51 -0700 Subject: [Python-checkins] CVS: distutils/distutils unixccompiler.py,1.32,1.33 Message-ID: Update of /cvsroot/python/distutils/distutils In directory usw-pr-cvs1:/tmp/cvs-serv18259 Modified Files: unixccompiler.py Log Message: Patch #413912 from Steve Majewski: Add .m to the list of extensions in order to support Objective-C. Index: unixccompiler.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/unixccompiler.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** unixccompiler.py 2000/09/27 02:08:14 1.32 --- unixccompiler.py 2001/04/05 15:46:48 1.33 *************** *** 68,72 **** # Unices! ! src_extensions = [".c",".C",".cc",".cxx",".cpp"] obj_extension = ".o" static_lib_extension = ".a" --- 68,72 ---- # Unices! ! src_extensions = [".c",".C",".cc",".cxx",".cpp",".m"] obj_extension = ".o" static_lib_extension = ".a" From akuchling@users.sourceforge.net Thu Apr 5 16:51:00 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Thu, 05 Apr 2001 08:51:00 -0700 Subject: [Python-checkins] CVS: distutils TODO,1.8,1.9 Message-ID: Update of /cvsroot/python/distutils In directory usw-pr-cvs1:/tmp/cvs-serv19004 Modified Files: TODO Log Message: Add section for 1.1 release plans Index: TODO =================================================================== RCS file: /cvsroot/python/distutils/TODO,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** TODO 2000/09/26 02:50:20 1.8 --- TODO 2001/04/05 15:50:58 1.9 *************** *** 1,2 **** --- 1,36 ---- + DISTUTILS 1.1 PLANS + ------------------- + + * binary packages should include the Python version in their + filename + + * all distutils packages should include a package release number + (like the RPM one) meaning that you can generate new package + versions without having to bump the software version number; + we could use a new setup() keyword "release" for this + + * Konrad's suggested fixes (allowing single directories in MANIFEST, etc.) + + * Additional install_ subcommands: for DTDs and SGML catalogs, for TeX files. + + * extend the install_* commands so that they write uninstall + information + + * implement an uninstall command using the information above + + * write a test suite for distutils (I've just read Martin Fowler's + refactoring book, so I know that tests are needed for refactoring) + + * refactor the build_ext methods, so that they are easier to + extend (maybe this will also unify the CCompiler classes) + + * fix the *_clib commands + + * implement test command: often requested (but low priority IMO) + + * docs, docs, docs (Thomas Heller promises to completely document the + windows installer, but nothing more) + + GENERAL ------- From akuchling@users.sourceforge.net Thu Apr 5 17:08:43 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Thu, 05 Apr 2001 09:08:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/curses __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/curses In directory usw-pr-cvs1:/tmp/cvs-serv20904 Modified Files: __init__.py Log Message: Bug #412086, reported by Peter Wilson: The _curses module doesn't define COLORS or COLOR_PAIRS until after start_color() is called, but they were never added to the curses module. Fixed by adding a wrapper around start_color(), similar to the wrapper around initscr(). Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/curses/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** __init__.py 2000/08/01 01:21:11 1.3 --- __init__.py 2001/04/05 16:08:41 1.4 *************** *** 33,36 **** --- 33,49 ---- return stdscr + # This is a similar wrapper for start_color(), which adds the COLORS and + # COLOR_PAIRS variables which are only available after start_color() is + # called. + + def start_color(): + import _curses, curses + retval = _curses.start_color() + if hasattr(_curses, 'COLORS'): + curses.COLORS = _curses.COLORS + if hasattr(_curses, 'COLOR_PAIRS'): + curses.COLOR_PAIRS = _curses.COLOR_PAIRS + return retval + # Import Python has_key() implementation if _curses doesn't contain has_key() From fdrake@users.sourceforge.net Thu Apr 5 19:14:53 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 05 Apr 2001 11:14:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/webchecker webchecker.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/webchecker In directory usw-pr-cvs1:/tmp/cvs-serv15291 Modified Files: webchecker.py Log Message: Added more link attributes based on additonal information from Chris McCafferty , and a bit of experimentation with Navigator 4.7. HTML-as-deployed is evil! Index: webchecker.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/webchecker.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** webchecker.py 2001/04/04 17:47:25 1.23 --- webchecker.py 2001/04/05 18:14:50 1.24 *************** *** 795,799 **** def do_body(self, attributes): ! self.link_attr(attributes, 'background') def do_img(self, attributes): --- 795,799 ---- def do_body(self, attributes): ! self.link_attr(attributes, 'background', 'bgsound') def do_img(self, attributes): *************** *** 820,823 **** --- 820,835 ---- def do_script(self, attributes): self.link_attr(attributes, 'src') + + def do_table(self, attributes): + self.link_attr(attributes, 'background') + + def do_td(self, attributes): + self.link_attr(attributes, 'background') + + def do_th(self, attributes): + self.link_attr(attributes, 'background') + + def do_tr(self, attributes): + self.link_attr(attributes, 'background') def link_attr(self, attributes, *args): From fdrake@users.sourceforge.net Thu Apr 5 19:26:33 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 05 Apr 2001 11:26:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.21,2.22 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17452 Modified Files: termios.c Log Message: Effectively revert the previous change: leave the new #include in, but comment it out with an explanation. This makes it easier for someone who wants the additional symbols to try re-enabling it for their platform. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -r2.21 -r2.22 *** termios.c 2001/04/04 21:19:26 2.21 --- termios.c 2001/04/05 18:26:31 2.22 *************** *** 6,10 **** --- 6,13 ---- #include + /* XXX Some systems need this to get all the symbols, while + this breaks for others. #include + */ static char termios__doc__[] = "\ From fdrake@users.sourceforge.net Thu Apr 5 19:30:06 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 05 Apr 2001 11:30:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib xmldom.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18315 Modified Files: xmldom.tex Log Message: Add some information about what to expect of the DocumentType's .internalSubset attribute based on a clarification from the www-dom list. Index: xmldom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldom.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** xmldom.tex 2001/02/23 19:15:56 1.12 --- xmldom.tex 2001/04/05 18:30:04 1.13 *************** *** 376,379 **** --- 376,381 ---- \begin{memberdesc}[DocumentType]{internalSubset} A string giving the complete internal subset from the document. + This does not include the brackets which enclose the subset. If the + document has no internal subset, this should be \code{None}. \end{memberdesc} From fdrake@users.sourceforge.net Thu Apr 5 19:31:29 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 05 Apr 2001 11:31:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libdoctest.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18689 Modified Files: libdoctest.tex Log Message: Change {\em ...} to \emph{...} for consistency with the rest of the Python documentation. Index: libdoctest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdoctest.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** libdoctest.tex 2001/02/22 23:15:05 1.5 --- libdoctest.tex 2001/04/05 18:31:27 1.6 *************** *** 208,212 **** By default, each time testmod finds a docstring to test, it uses a ! {\em copy} of \module{M}'s globals, so that running tests on a module doesn't change the module's real globals, and so that one test in \module{M} can't leave behind crumbs that accidentally allow another test --- 208,212 ---- By default, each time testmod finds a docstring to test, it uses a ! \emph{copy} of \module{M}'s globals, so that running tests on a module doesn't change the module's real globals, and so that one test in \module{M} can't leave behind crumbs that accidentally allow another test From tim_one@users.sourceforge.net Thu Apr 5 23:26:25 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 05 Apr 2001 15:26:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib asynchat.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22298/python/dist/src/Lib Modified Files: asynchat.py Log Message: One-liner critical fix from Jim Fulton: Eric's string-method crusade got the order backwards in a line (for .find()). Index: asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** asynchat.py 2001/02/09 20:06:00 1.11 --- asynchat.py 2001/04/05 22:26:23 1.12 *************** *** 120,124 **** # collect data terminator_len = len(terminator) ! index = terminator.find (self.ac_in_buffer) if index != -1: # we found the terminator --- 120,124 ---- # collect data terminator_len = len(terminator) ! index = ac_in_buffer.find (self.terminator) if index != -1: # we found the terminator From tim_one@users.sourceforge.net Thu Apr 5 23:38:34 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 05 Apr 2001 15:38:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib asynchat.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23665/python/dist/src/Lib Modified Files: asynchat.py Log Message: Fix the fix (my error -- hasty pasty). Index: asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** asynchat.py 2001/04/05 22:26:23 1.12 --- asynchat.py 2001/04/05 22:38:32 1.13 *************** *** 120,124 **** # collect data terminator_len = len(terminator) ! index = ac_in_buffer.find (self.terminator) if index != -1: # we found the terminator --- 120,124 ---- # collect data terminator_len = len(terminator) ! index = self.ac_in_buffer.find(terminator) if index != -1: # we found the terminator From gvanrossum@users.sourceforge.net Fri Apr 6 16:30:35 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 06 Apr 2001 08:30:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib asynchat.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22124 Modified Files: asynchat.py Log Message: Make the docstring a raw string, for pydoc. (How many opre of these will we need? :-( ) Index: asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** asynchat.py 2001/04/05 22:38:32 1.13 --- asynchat.py 2001/04/06 15:30:33 1.14 *************** *** 26,30 **** # ====================================================================== ! """A class supporting chat-style (command/response) protocols. This class adds support for 'chat' style protocols - where one side --- 26,30 ---- # ====================================================================== ! r"""A class supporting chat-style (command/response) protocols. This class adds support for 'chat' style protocols - where one side From gvanrossum@users.sourceforge.net Fri Apr 6 17:32:24 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 06 Apr 2001 09:32:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_asynchat.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4880 Added Files: test_asynchat.py Log Message: Add test for asynchat. This also tests asyncore. --- NEW FILE: test_asynchat.py --- # test asynchat -- requires threading import asyncore, asynchat, socket, threading HOST = "127.0.0.1" PORT = 54321 class echo_server(threading.Thread): def run(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind((HOST, PORT)) sock.listen(1) conn, client = sock.accept() buffer = "" while "\n" not in buffer: data = conn.recv(10) if not data: break buffer = buffer + data while buffer: n = conn.send(buffer) buffer = buffer[n:] conn.close() sock.close() class echo_client(asynchat.async_chat): def __init__(self): asynchat.async_chat.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect((HOST, PORT)) self.set_terminator("\n") self.buffer = "" self.send("hello ") self.send("world\n") def handle_connect(self): print "Connected" def collect_incoming_data(self, data): self.buffer = self.buffer + data def found_terminator(self): print "Received:", `self.buffer` self.buffer = "" self.close() def main(): s = echo_server() s.start() c = echo_client() asyncore.loop() main() From gvanrossum@users.sourceforge.net Fri Apr 6 17:32:24 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 06 Apr 2001 09:32:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_asynchat,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv4880/output Added Files: test_asynchat Log Message: Add test for asynchat. This also tests asyncore. --- NEW FILE: test_asynchat --- test_asynchat Connected Received: 'hello world' From gvanrossum@users.sourceforge.net Fri Apr 6 17:43:52 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 06 Apr 2001 09:43:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_asynchat.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7657 Modified Files: test_asynchat.py Log Message: After testing the test on Unix, several improvements: - Use push() instead of send(), and make these calls in main(). - Sleep a second to give the server thread time to initialize itself. Index: test_asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_asynchat.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_asynchat.py 2001/04/06 16:32:22 1.1 --- test_asynchat.py 2001/04/06 16:43:49 1.2 *************** *** 1,5 **** # test asynchat -- requires threading ! import asyncore, asynchat, socket, threading HOST = "127.0.0.1" --- 1,5 ---- # test asynchat -- requires threading ! import asyncore, asynchat, socket, threading, time HOST = "127.0.0.1" *************** *** 33,38 **** self.set_terminator("\n") self.buffer = "" - self.send("hello ") - self.send("world\n") def handle_connect(self): --- 33,36 ---- *************** *** 50,54 **** --- 48,55 ---- s = echo_server() s.start() + time.sleep(1) # Give server time to initialize c = echo_client() + c.push("hello ") + c.push("world\n") asyncore.loop() From tim_one@users.sourceforge.net Fri Apr 6 19:59:19 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 06 Apr 2001 11:59:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_sundry.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10647/python/dist/src/Lib/test Modified Files: test_sundry.py Log Message: Remove lines for asynchat & asyncore, as they've now got their own test. Index: test_sundry.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sundry.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_sundry.py 2001/01/23 09:50:30 1.3 --- test_sundry.py 2001/04/06 18:59:17 1.4 *************** *** 10,15 **** import aifc import anydbm - #import asynchat - import asyncore import audiodev import bdb --- 10,13 ---- From gvanrossum@users.sourceforge.net Fri Apr 6 20:39:13 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 06 Apr 2001 12:39:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib Cookie.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21451 Modified Files: Cookie.py Log Message: Since this module already uses doctest-style examples, I figured I'd add a self-test using doctest. Results: - The docstring needs to be a raw string because it uses \"...\". - The oreo example was broken: the Set-Cookie output doesn't add quotes around "doublestuff". - I had to change the example that prints the class of a Cookie.Cookie instance to avoid incorporating an arbitrary object address in the test output. Pretty good score for both doctest and the doc string, I'd say! Index: Cookie.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/Cookie.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Cookie.py 2001/02/20 22:11:24 1.7 --- Cookie.py 2001/04/06 19:39:11 1.8 *************** *** 40,44 **** #### ! """ Here's a sample session to show how to use this module. At the moment, this is the only documentation. --- 40,44 ---- #### ! r""" Here's a sample session to show how to use this module. At the moment, this is the only documentation. *************** *** 114,118 **** >>> C["oreo"]["path"] = "/" >>> print C ! Set-Cookie: oreo="doublestuff"; Path=/; Each dictionary element has a 'value' attribute, which gives you --- 114,118 ---- >>> C["oreo"]["path"] = "/" >>> print C ! Set-Cookie: oreo=doublestuff; Path=/; Each dictionary element has a 'value' attribute, which gives you *************** *** 204,209 **** >>> C = Cookie.Cookie() ! >>> C.__class__ ! --- 204,209 ---- >>> C = Cookie.Cookie() ! >>> print C.__class__.__name__ ! SmartCookie *************** *** 722,725 **** --- 722,731 ---- ########################################################### + def _test(): + import doctest, Cookie + return doctest.testmod(Cookie) + + if __name__ == "__main__": + _test() From tim_one@users.sourceforge.net Fri Apr 6 22:21:00 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 06 Apr 2001 14:21:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_cookie.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8844/python/dist/src/Lib/test Modified Files: test_cookie.py Log Message: Since Guido fiddled Cookie.py to work with doctest, it's a Good Thing to have the std test suite exercise the Cookie doctests too. Index: test_cookie.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cookie.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** test_cookie.py 2001/02/21 01:17:54 1.8 --- test_cookie.py 2001/04/06 21:20:58 1.9 *************** *** 4,7 **** --- 4,8 ---- import Cookie from test_support import verify, verbose + import doctest # Currently this only tests SimpleCookie *************** *** 42,43 **** --- 43,47 ---- verify(C['Customer']['version'] == '1') verify(C['Customer']['path'] == '/acme') + + print "If anything blows up after this line, it's from Cookie's doctest." + doctest.testmod(Cookie) From tim_one@users.sourceforge.net Fri Apr 6 22:21:00 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 06 Apr 2001 14:21:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_cookie,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv8844/python/dist/src/Lib/test/output Modified Files: test_cookie Log Message: Since Guido fiddled Cookie.py to work with doctest, it's a Good Thing to have the std test suite exercise the Cookie doctests too. Index: test_cookie =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_cookie,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** test_cookie 2001/02/21 01:17:54 1.5 --- test_cookie 2001/04/06 21:20:58 1.6 *************** *** 30,31 **** --- 30,32 ---- + If anything blows up after this line, it's from Cookie's doctest. From fdrake@users.sourceforge.net Sat Apr 7 06:41:41 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 06 Apr 2001 22:41:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libunittest.tex,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv28142/lib Added Files: libunittest.tex Log Message: Start of documentation for the unittest module. Some of this comes from Steve Purcell's documentation, and a lot of it is written based on using PyUnit and reading the implementation. There is more to come, but I want to get this check in before I have a disk crash or anything else bad happens. --- NEW FILE: libunittest.tex --- \section{\module{unittest} --- Unit testing framework} \declaremodule{standard}{unittest} \moduleauthor{Steve Purcell}{stephen\textunderscore{}purcell@yahoo.com} \sectionauthor{Steve Purcell}{stephen\textunderscore{}purcell@yahoo.com} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} The Python unit testing framework, often referred to as ``PyUnit,'' is a Python language version of JUnit, by Kent Beck and Erich Gamma. JUnit is, in turn, a Java version of Kent's Smalltalk testing framework. Each is the de facto standard unit testing framework for its respective language. PyUnit supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework. The \module{unittest} module provides classes that make it easy to support these qualities for a set of tests. To achieve this, PyUnit supports three major concepts: \begin{definitions} \term{test case} A \dfn{test case} is the smallest unit of testing. It checks for a specific response to a particular set of inputs. PyUnit provides a base class, \class{TestCase}, which may be used to create new test cases. \term{test suite} A \dfn{test suite} is a collection of test cases, test suites, or both. It is used to aggregate tests that should be executed together. \term{test runner} A \dfn{test runner} is a component which orchestrates the execution of tests and provides the outcome to the user. The runner may use a graphical interface, a textual interface, or return a special value to indicate the results of executing the tests. \end{definitions} \begin{seealso} \seetitle[http://pyunit.sourceforge.net/]{PyUnit Web Site}{The source for further information on PyUnit.} \seetitle[http://www.XProgramming.com/testfram.htm]{Simple Smalltalk Testing: With Patterns}{Kent Beck's original paper on testing frameworks using the pattern shared by \module{unittest}.} \end{seealso} \subsection{Mapping concepts to classes \label{test-concept-classes}} \subsection{Organizing test code \label{organizing-tests}} \subsection{Re-using old test code \label{legacy-unit-tests}} Some users will find that they have existing test code that they would like to run from PyUnit, without converting every old test function to a \class{TestCase} subclass. For this reason, PyUnit provides a \class{FunctionTestCase} class. This subclass of \class{TestCase} can be used to wrap an existing test function. Set-up and tear-down functions can also optionally be wrapped. Given the following test function: \begin{verbatim} def testSomething(): something = makeSomething() assert something.name is not None # ... \end{verbatim} one can create an equivalent test case instance as follows: \begin{verbatim} testcase = unittest.FunctionTestCase(testSomething) \end{verbatim} If there are additional set-up and tear-down methods that should be called as part of the test case's operation, they can also be provided: \begin{verbatim} testcase = unittest.FunctionTestCase(testSomething, setUp=makeSomethingDB, tearDown=deleteSomethingDB) \end{verbatim} \subsection{Classes and functions \label{unittest-contents}} \begin{classdesc}{TestCase}{} Instances of the \class{TestCase} class represent the smallest testable units in a set of tests. This class is intended to be used as a base class, with specific tests being implemented by concrete subclasses. This class implements the interface needed by the test runner to allow it to drive the test, and methods that the test code can use to check for and report various kinds of failures. \end{classdesc} \begin{classdesc}{FunctionTestCase}{testFunc\optional{, setup\optional{, tearDown\optional{, description}}}} This class implements the portion of the \class{TestCase} interface which allows the test runner to drive the test, but does not provide the methods which test code can use to check and report errors. This is used to create test cases using legacy test code, allowing it to be integrated into a \refmodule{unittest}-based test framework. \end{classdesc} \begin{classdesc}{TestSuite}{} This class represents an aggregation of individual tests cases and test suites. The class presents the interface needed by the test runner to allow it to be run as any other test case, but all the contained tests and test suites are executed. Additional methods are provided to add test cases and suites to the aggregation. \end{classdesc} \begin{classdesc}{TestLoader}{} \end{classdesc} \begin{classdesc}{TextTestRunner}{\optional{stream\optional{, descriptions\optional{, verbosity}}}} \end{classdesc} \begin{funcdesc}{main}{\optional{module\optional{, defaultTest\optional{, argv\optional{, testRunner\optional{, testRunner}}}}}} A command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. The simplest use for this function is: \begin{verbatim} if __name__ == '__main__': unittest.main() \end{verbatim} \end{funcdesc} \subsection{TestCase Objects \label{testcase-objects}} \subsection{TestSuite Objects \label{testsuite-objects}} \class{TestSuite} objects behave much like \class{TestCase} objects, except they do not actually implement a test. Instead, they are used to aggregate tests into groups that should be run together. Some additional methods are available to add tests to \class{TestSuite} instances: \begin{methoddesc}[TestSuite]{addTest}{test} Add a \class{TestCase} or \class{TestSuite} to the set of tests that make up the suite. \end{methoddesc} \begin{methoddesc}[TestSuite]{addTests}{tests} Add all the tests from a sequence of \class{TestCase} and \class{TestSuite} instances to this test suite. \end{methoddesc} \subsection{TestResult Objects \label{testresult-objects}} A \class{TestResult} object stores the results of a set of tests. The \class{TestCase} and \class{TestSuite} classes ensure that results are properly stored; test authors do not need to worry about recording the outcome of tests. Testing frameworks built on top of \refmodule{unittest} may want access to the \class{TestResult} object generated by running a set of tests for reporting purposes; a \class{TestResult} instance is returned by the \method{TestRunner.run()} method for this purpose. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of \code{(\var{testcase}, \var{exceptioninfo})}, where \var{exceptioninfo} is a tuple as returned by \function{sys.exc_info()}. \class{TestResult} instances have the following attributes that will be of interest when inspecting the results of running a set of tests: \begin{memberdesc}[TestResult]{errors} A list containing pairs of \class{TestCase} instances and the \function{sys.exc_info()} results for tests which raised exceptions other than \exception{AssertionError}. \end{memberdesc} \begin{memberdesc}[TestResult]{failures} A list containing pairs of \class{TestCase} instances and the \function{sys.exc_info()} results for tests which raised the \exception{AssertionError} exception. \end{memberdesc} \begin{memberdesc}[TestResult]{testsRun} The number of tests which have been started. \end{memberdesc} \begin{methoddesc}[TestResult]{wasSuccessful}{} Returns true if all tests run so far have passed, otherwise returns false. \end{methoddesc} The following methods of the \class{TestResult} class are used to maintain the internal data structures, and mmay be extended in subclasses to support additional reporting requirements. This is particularly useful in building GUI tools which support interactive reporting while tests are being run. \begin{methoddesc}[TestResult]{startTest}{test} Called when the test case \var{test} is about to be run. \end{methoddesc} \begin{methoddesc}[TestResult]{stopTest}{test} Called when the test case \var{test} has been executed, regardless of the outcome. \end{methoddesc} \begin{methoddesc}[TestResult]{addError}{test, err} Called when the test case \var{test} results in an exception other than \exception{AssertionError}. \var{err} is a tuple of the form returned by \function{sys.exc_info()}: \code{(\var{type}, \var{value}, \var{traceback})}. \end{methoddesc} \begin{methoddesc}[TestResult]{addFailure}{test, err} Called when the test case \var{test} results in an \exception{AssertionError} exception; the assumption is that the test raised the \exception{AssertionError} and not the implementation being tested. \var{err} is a tuple of the form returned by \function{sys.exc_info()}: \code{(\var{type}, \var{value}, \var{traceback})}. \end{methoddesc} \begin{methoddesc}[TestResult]{addSuccess}{test} This method is called for a test that does not fail; \var{test} is the test case object. \end{methoddesc} One additional method is available for \class{TestResult} objects: \begin{methoddesc}[TestResult]{stop}{} This method can be called to signal that the set of tests being run should be aborted. Once this has been called, the \class{TestRunner} object return to its caller without running any additional tests. This is used by the \class{TextTestRunner} class to stop the test framework when the user signals an interrupt from the keyboard. GUI tools which provide runners can use this in a similar manner. \end{methoddesc} From fdrake@users.sourceforge.net Sat Apr 7 06:42:16 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 06 Apr 2001 22:42:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile.deps,1.63,1.64 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv28266 Modified Files: Makefile.deps Log Message: Add entry for unittest documentation. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -r1.63 -r1.64 *** Makefile.deps 2001/03/29 22:23:18 1.63 --- Makefile.deps 2001/04/07 05:42:13 1.64 *************** *** 58,61 **** --- 58,62 ---- lib/libdifflib.tex \ lib/libdoctest.tex \ + lib/libunittest.tex \ lib/libtypes.tex \ lib/libtraceback.tex \ From fdrake@users.sourceforge.net Sat Apr 7 06:42:16 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 06 Apr 2001 22:42:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib lib.tex,1.184,1.185 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv28266/lib Modified Files: lib.tex Log Message: Add entry for unittest documentation. Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.184 retrieving revision 1.185 diff -C2 -r1.184 -r1.185 *** lib.tex 2001/03/29 22:23:19 1.184 --- lib.tex 2001/04/07 05:42:14 1.185 *************** *** 113,116 **** --- 113,117 ---- \input{libmisc} % Miscellaneous Services \input{libdoctest} + \input{libunittest} \input{libmath} \input{libcmath} From gstein@users.sourceforge.net Sat Apr 7 17:05:26 2001 From: gstein@users.sourceforge.net (Greg Stein) Date: Sat, 07 Apr 2001 09:05:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib imputil.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21285 Modified Files: imputil.py Log Message: Add an uninstall method to the ImportManager. This is the accepted portion of patch #402498. Index: imputil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imputil.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** imputil.py 2001/02/12 09:17:06 1.18 --- imputil.py 2001/04/07 16:05:24 1.19 *************** *** 29,37 **** namespace = vars(namespace) ! ### Note that we have no notion of "uninstall" or "chaining" namespace['__import__'] = self._import_hook ### fix this #namespace['reload'] = self._reload_hook def add_suffix(self, suffix, importFunc): --- 29,45 ---- namespace = vars(namespace) ! # Note: we have no notion of "chaining" + # Record the previous import hook, then install our own. + self.previous_importer = namespace['__import__'] + self.namespace = namespace namespace['__import__'] = self._import_hook + ### fix this #namespace['reload'] = self._reload_hook + + def uninstall(self): + "Restore the previous import mechanism." + self.namespace['__import__'] = self.previous_importer def add_suffix(self, suffix, importFunc): From gstein@users.sourceforge.net Sat Apr 7 17:14:52 2001 From: gstein@users.sourceforge.net (Greg Stein) Date: Sat, 07 Apr 2001 09:14:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.114,1.115 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv22649 Modified Files: api.tex Log Message: Correct the documentation for getreadbufferproc and getwritebufferproc. Fixes bug #233308 from Travis Oliphant. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -r1.114 -r1.115 *** api.tex 2001/04/04 01:25:17 1.114 --- api.tex 2001/04/07 16:14:49 1.115 *************** *** 4972,4984 **** \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} \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 --- 4972,4985 ---- \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, it returns the ! length of the buffer memory, and sets \code{*\var{ptrptr}} to a ! pointer to that memory. \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}}, ! and the length of that segment as the function return value. ! 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 From tim_one@users.sourceforge.net Sat Apr 7 21:34:51 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 07 Apr 2001 13:34:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.196,2.197 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv19312/python/dist/src/Python Modified Files: bltinmodule.c Log Message: SF patch #413552 - Premature decref on object Jeffery Collins pointed out that filterstring decrefs a character object before it's done using it. This works by accident today because another module always happens to have an active reference too at the time. The accident doesn't work after his Pippy modifications, and since it *is* an accident even in the mainline Python, it should work by design there too. The patch accomplishes that. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.196 retrieving revision 2.197 diff -C2 -r2.196 -r2.197 *** bltinmodule.c 2001/03/22 02:47:58 2.196 --- bltinmodule.c 2001/04/07 20:34:48 2.197 *************** *** 2292,2302 **** goto Fail_1; arg = Py_BuildValue("(O)", item); ! Py_DECREF(item); ! if (arg == NULL) goto Fail_1; good = PyEval_CallObject(func, arg); Py_DECREF(arg); ! if (good == NULL) goto Fail_1; ok = PyObject_IsTrue(good); Py_DECREF(good); --- 2292,2305 ---- goto Fail_1; arg = Py_BuildValue("(O)", item); ! if (arg == NULL) { ! Py_DECREF(item); goto Fail_1; + } good = PyEval_CallObject(func, arg); Py_DECREF(arg); ! if (good == NULL) { ! Py_DECREF(item); goto Fail_1; + } ok = PyObject_IsTrue(good); Py_DECREF(good); *************** *** 2304,2307 **** --- 2307,2311 ---- PyString_AS_STRING((PyStringObject *)result)[j++] = PyString_AS_STRING((PyStringObject *)item)[0]; + Py_DECREF(item); } From tim_one@users.sourceforge.net Sun Apr 8 01:38:44 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 07 Apr 2001 17:38:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib tabnanny.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv547/python/dist/src/Lib Modified Files: tabnanny.py Log Message: Get rid of useless string import, as reported by Neal Norwitz's PyChecker.py on c.l.py. Index: tabnanny.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tabnanny.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** tabnanny.py 2001/03/01 04:27:19 1.12 --- tabnanny.py 2001/04/08 00:38:42 1.13 *************** *** 13,17 **** import os import sys - import string import getopt import tokenize --- 13,16 ---- From tim_one@users.sourceforge.net Sun Apr 8 01:38:44 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 07 Apr 2001 17:38:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.88,1.89 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv547/python/dist/src/Misc Modified Files: ACKS Log Message: Get rid of useless string import, as reported by Neal Norwitz's PyChecker.py on c.l.py. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -r1.88 -r1.89 *** ACKS 2001/03/27 17:04:37 1.88 --- ACKS 2001/04/08 00:38:42 1.89 *************** *** 282,285 **** --- 282,286 ---- Bill Noon Stefan Norberg + Neal Norwitz Jeffrey Ollie Nigel O'Brian From tim_one@users.sourceforge.net Sun Apr 8 01:43:15 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 07 Apr 2001 17:43:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib codeop.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1011/python/dist/src/Lib Modified Files: codeop.py Log Message: Remove useless imports, as reported by PyChecker. Index: codeop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codeop.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** codeop.py 2001/02/09 08:55:14 1.3 --- codeop.py 2001/04/08 00:43:13 1.4 *************** *** 1,7 **** """Utility to compile possibly incomplete Python source code.""" - import sys - import traceback - __all__ = ["compile_command"] --- 1,4 ---- From tim_one@users.sourceforge.net Sun Apr 8 08:23:47 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 08 Apr 2001 00:23:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib asynchat.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17801/python/dist/src/Lib Modified Files: asynchat.py Log Message: Fix from the Madusa mailing list: http://groups.yahoo.com/group/medusa/message/333 It's clear that Medusa should not be checking for an empty buffer via "buf is ''". The patch merely changes "is" to "==". However, there's a mystery here all the same: Python attempts to store null strings uniquely, so it's unclear why "buf is ''" ever returned false when buf actually was empty. *Some* string operations produce non-unique null strings, e.g. >>> "abc"*0 is "abc"*0 0 >>> but they're rare, and I don't see any such operations in asynchat. Index: asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** asynchat.py 2001/04/06 15:30:33 1.14 --- asynchat.py 2001/04/08 07:23:44 1.15 *************** *** 166,170 **** # this is about twice as fast, though not as clear. return not ( ! (self.ac_out_buffer is '') and self.producer_fifo.is_empty() and self.connected --- 166,170 ---- # this is about twice as fast, though not as clear. return not ( ! (self.ac_out_buffer == '') and self.producer_fifo.is_empty() and self.connected From tim_one@users.sourceforge.net Sun Apr 8 08:44:10 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 08 Apr 2001 00:44:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_traceback.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19087/python/dist/src/Lib/test Modified Files: test_traceback.py Log Message: Whitespace normalization. Index: test_traceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_traceback.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_traceback.py 2001/03/21 20:33:04 1.1 --- test_traceback.py 2001/04/08 07:44:07 1.2 *************** *** 17,21 **** else: raise ValueError, "call did not raise exception" ! def syntax_error_with_caret(self): compile("def fact(x):\n\treturn x!\n", "?", "exec") --- 17,21 ---- else: raise ValueError, "call did not raise exception" ! def syntax_error_with_caret(self): compile("def fact(x):\n\treturn x!\n", "?", "exec") *************** *** 31,35 **** self.assert_("^" in err[2]) # third line has caret self.assert_(err[1].strip() == "return x!") ! def test_nocaret(self): err = self.get_exception_format(self.syntax_error_without_caret, --- 31,35 ---- self.assert_("^" in err[2]) # third line has caret self.assert_(err[1].strip() == "return x!") ! def test_nocaret(self): err = self.get_exception_format(self.syntax_error_without_caret, From gvanrossum@users.sourceforge.net Sun Apr 8 16:05:18 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 08 Apr 2001 08:05:18 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib bdb.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv6390 Modified Files: bdb.py Log Message: Make it clear that a bdb subclass must implement do_clear(). This was found by Neal Norwitz's PyChecker. Index: bdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bdb.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** bdb.py 2001/02/09 04:59:26 1.30 --- bdb.py 2001/04/08 15:05:16 1.31 *************** *** 114,117 **** --- 114,120 ---- return 0 + def do_clear(self, arg): + raise NotImplementedError, "subclass of bdb must implement do_clear()" + def break_anywhere(self, frame): return self.breaks.has_key( From tim_one@users.sourceforge.net Mon Apr 9 00:39:40 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 08 Apr 2001 16:39:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules structmodule.c,2.41,2.42 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2102/python/dist/src/Modules Modified Files: structmodule.c Log Message: Repair portability of sign extension when reading signed ints on boxes where sizeof(long)==8. This *was* broken on boxes where signed right shifts didn't sign-extend, but not elsewhere. Unfortunately, apart from the Cray T3E I don't know of such a box, and Guido has so far refused to buy me any Cray machines for home Python testing . More immediately interesting would be if someone could please test this on *any* sizeof(long)==8 box, to make sure I didn't break it. Index: structmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/structmodule.c,v retrieving revision 2.41 retrieving revision 2.42 diff -C2 -r2.41 -r2.42 *** structmodule.c 2000/09/26 05:46:01 2.41 --- structmodule.c 2001/04/08 23:39:38 2.42 *************** *** 654,662 **** x = (x<<8) | (*p++ & 0xFF); } while (--i > 0); ! i = 8*(sizeof(long) - f->size); ! if (i) { ! x <<= i; ! x >>= i; ! } return PyInt_FromLong(x); } --- 654,660 ---- x = (x<<8) | (*p++ & 0xFF); } while (--i > 0); ! /* Extend the sign bit. */ ! if (SIZEOF_LONG > f->size) ! x |= -(x & (1L << (8*f->size - 1))); return PyInt_FromLong(x); } *************** *** 768,776 **** x = (x<<8) | (p[--i] & 0xFF); } while (i > 0); ! i = 8*(sizeof(long) - f->size); ! if (i) { ! x <<= i; ! x >>= i; ! } return PyInt_FromLong(x); } --- 766,772 ---- x = (x<<8) | (p[--i] & 0xFF); } while (i > 0); ! /* Extend the sign bit. */ ! if (SIZEOF_LONG > f->size) ! x |= -(x & (1L << (8*f->size - 1))); return PyInt_FromLong(x); } From jhylton@users.sourceforge.net Mon Apr 9 05:23:58 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Sun, 08 Apr 2001 21:23:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv1338/compiler Modified Files: __init__.py Log Message: typo Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** __init__.py 2000/03/06 19:12:33 1.3 --- __init__.py 2001/04/09 04:23:55 1.4 *************** *** 5,9 **** parse(buf) -> AST ! Donverts a string containing Python source code to an abstract syntax tree (AST). The AST is defined in compiler.ast. --- 5,9 ---- parse(buf) -> AST ! Converts a string containing Python source code to an abstract syntax tree (AST). The AST is defined in compiler.ast. From jhylton@users.sourceforge.net Mon Apr 9 05:27:14 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Sun, 08 Apr 2001 21:27:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler transformer.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv1718/compiler Modified Files: transformer.py Log Message: Fix "import as" (has always skipping the as name) Fix com_NEWLINE() so that is accepts arguments, which occurs for lines like: stmt; # note trailing semicolon Add XXX about checking for assignment to list comps Index: transformer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/transformer.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** transformer.py 2000/11/06 16:03:52 1.19 --- transformer.py 2001/04/09 04:27:12 1.20 *************** *** 368,372 **** else: for i in range(3, len(nodelist), 2): ! names.append(self.com_import_as_name(nodelist[i][1])) n = From(self.com_dotted_name(nodelist[1]), names) n.lineno = nodelist[0][2] --- 368,372 ---- else: for i in range(3, len(nodelist), 2): ! names.append(self.com_import_as_name(nodelist[i])) n = From(self.com_dotted_name(nodelist[1]), names) n.lineno = nodelist[0][2] *************** *** 693,697 **** return self._dispatch[node[0]](node[1:]) ! def com_NEWLINE(self): # A ';' at the end of a line can make a NEWLINE token appear # here, Render it harmless. (genc discards ('discard', --- 693,697 ---- return self._dispatch[node[0]](node[1:]) ! def com_NEWLINE(self, *args): # A ';' at the end of a line can make a NEWLINE token appear # here, Render it harmless. (genc discards ('discard', *************** *** 785,796 **** def com_import_as_name(self, node): ! if node == '*': return '*', None ! if node[0] == token.NAME: ! return node[1], None ! assert len(node) == 4 ! assert node[2][1] == 'as' ! assert node[3][0] == token.NAME ! return node[1][1], node[3][1] def com_bases(self, node): --- 785,799 ---- def com_import_as_name(self, node): ! if node[0] == token.STAR: return '*', None ! assert node[0] == symbol.import_as_name ! node = node[1:] ! if len(node) == 1: ! assert node[0][0] == token.NAME ! return node[0][1], None ! ! assert node[1][1] == 'as', node ! assert node[2][0] == token.NAME ! return node[0][1], node[2][1] def com_bases(self, node): *************** *** 964,967 **** --- 967,973 ---- # list_for: 'for' exprlist 'in' testlist [list_iter] # list_if: 'if' test [list_iter] + + # XXX should raise SyntaxError for assignment + lineno = node[1][2] fors = [] From jhylton@users.sourceforge.net Mon Apr 9 05:28:50 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Sun, 08 Apr 2001 21:28:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler future.py,NONE,1.1 pycodegen.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv2185/compiler Modified Files: pycodegen.py Added Files: future.py Log Message: Add support for future statements --- NEW FILE: future.py --- """Parser for future statements """ from compiler import ast, walk def is_future(stmt): """Return true if statement is a well-formed future statement""" if not isinstance(stmt, ast.From): return 0 if stmt.modname == "__future__": return 1 else: return 0 class FutureParser: features = ("nested_scopes",) def __init__(self): self.found = {} # set def visitModule(self, node): if node.doc is None: off = 0 else: off = 1 stmt = node.node for s in stmt.nodes[off:]: if not self.check_stmt(s): break def check_stmt(self, stmt): if is_future(stmt): for name, asname in stmt.names: if name in self.features: self.found[name] = 1 else: raise SyntaxError, \ "future feature %s is not defined" % name stmt.valid_future = 1 return 1 return 0 def get_features(self): """Return list of features enabled by future statements""" return self.found.keys() class BadFutureParser: """Check for invalid future statements""" def visitFrom(self, node): if hasattr(node, 'valid_future'): return if node.modname != "__future__": return raise SyntaxError, "invalid future statement" def find_futures(node): p1 = FutureParser() p2 = BadFutureParser() walk(node, p1) walk(node, p2) return p1.get_features() if __name__ == "__main__": import sys from compiler import parseFile, walk for file in sys.argv[1:]: print file tree = parseFile(file) v = FutureParser() walk(tree, v) print v.found print Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** pycodegen.py 2000/11/06 03:43:11 1.27 --- pycodegen.py 2001/04/09 04:28:48 1.28 *************** *** 10,14 **** from compiler import ast, parse, walk ! from compiler import pyassem, misc from compiler.pyassem import CO_VARARGS, CO_VARKEYWORDS, CO_NEWLOCALS, TupleArg --- 10,14 ---- from compiler import ast, parse, walk ! from compiler import pyassem, misc, future from compiler.pyassem import CO_VARARGS, CO_VARKEYWORDS, CO_NEWLOCALS, TupleArg *************** *** 44,54 **** def compile(self, display=0): ! ast = parse(self.source) root, filename = os.path.split(self.filename) gen = ModuleCodeGenerator(filename) ! walk(ast, gen, 1) if display: import pprint ! print pprint.pprint(ast) self.code = gen.getCode() --- 44,54 ---- def compile(self, display=0): ! tree = parse(self.source) root, filename = os.path.split(self.filename) gen = ModuleCodeGenerator(filename) ! walk(tree, gen, 1) if display: import pprint ! print pprint.pprint(tree) self.code = gen.getCode() *************** *** 863,873 **** class ModuleCodeGenerator(CodeGenerator): ! super_init = CodeGenerator.__init__ def __init__(self, filename): # XXX is ? in compile.c self.graph = pyassem.PyFlowGraph("", filename) ! self.super_init(filename) class FunctionCodeGenerator(CodeGenerator): super_init = CodeGenerator.__init__ --- 863,885 ---- class ModuleCodeGenerator(CodeGenerator): ! __super_init = CodeGenerator.__init__ ! __super_visitModule = CodeGenerator.visitModule def __init__(self, filename): # XXX is ? in compile.c self.graph = pyassem.PyFlowGraph("", filename) ! self.__super_init(filename) ! self.symbols = None ! self.future = None + def visitModule(self, node): + self.future = future.find_futures(node) + self.symbols = self.parseSymbols(node) + self.__super_visitModule(node) + + def parseSymbols(self, node): + # XXX not implemented + return None + class FunctionCodeGenerator(CodeGenerator): super_init = CodeGenerator.__init__ *************** *** 965,968 **** --- 977,982 ---- for name in names: self.names.add(name) + + # XXX list comprehensions and for loops def getLocals(self): From jhylton@users.sourceforge.net Mon Apr 9 05:31:52 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Sun, 08 Apr 2001 21:31:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib ftplib.py,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2707/Lib Modified Files: ftplib.py Log Message: remove global decl about unused variable Index: ftplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ftplib.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -r1.52 -r1.53 *** ftplib.py 2001/02/28 21:46:37 1.52 --- ftplib.py 2001/04/09 04:31:50 1.53 *************** *** 246,250 **** def makeport(self): '''Create a new socket and send a PORT command for it.''' - global nextport sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(('', 0)) --- 246,249 ---- From jhylton@users.sourceforge.net Mon Apr 9 05:35:37 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Sun, 08 Apr 2001 21:35:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler symbols.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv3277/compiler Added Files: symbols.py Log Message: Add preliminary module symbol table constructor --- NEW FILE: symbols.py --- """Module symbol-table generator""" from compiler import ast module_scope = None class Scope: # XXX how much information do I need about each name? def __init__(self, name): self.name = name self.defs = {} self.uses = {} self.globals = {} self.params = {} def __repr__(self): return "<%s: %s>" % (self.__class__.__name__, self.name) def add_def(self, name): self.defs[name] = 1 def add_use(self, name): self.uses[name] = 1 def add_global(self, name): if self.uses.has_key(name) or self.defs.has_key(name): pass # XXX warn about global following def/use if self.params.has_key(name): raise SyntaxError, "%s in %s is global and parameter" % \ (name, self.name) self.globals[name] = 1 module_scope.add_def(name) def add_param(self, name): self.defs[name] = 1 self.params[name] = 1 def get_names(self): d = {} d.update(self.defs) d.update(self.uses) return d.keys() class ModuleScope(Scope): __super_init = Scope.__init__ def __init__(self): self.__super_init("global") global module_scope assert module_scope is None module_scope = self class LambdaScope(Scope): __super_init = Scope.__init__ __counter = 1 def __init__(self): i = self.__counter self.__counter += 1 self.__super_init("lambda.%d" % i) class FunctionScope(Scope): pass class ClassScope(Scope): pass class SymbolVisitor: def __init__(self): self.scopes = {} # node that define new scopes def visitModule(self, node): scope = self.scopes[node] = ModuleScope() self.visit(node.node, scope) def visitFunction(self, node, parent): parent.add_def(node.name) for n in node.defaults: self.visit(n, parent) scope = FunctionScope(node.name) self.scopes[node] = scope for name in node.argnames: scope.add_param(name) self.visit(node.code, scope) def visitLambda(self, node, parent): for n in node.defaults: self.visit(n, parent) scope = LambdaScope() self.scopes[node] = scope for name in node.argnames: scope.add_param(name) self.visit(node.code, scope) def visitClass(self, node, parent): parent.add_def(node.name) for n in node.bases: self.visit(n, parent) scope = ClassScope(node.name) self.scopes[node] = scope self.visit(node.code, scope) # name can be a def or a use # XXX a few calls and nodes expect a third "assign" arg that is # true if the name is being used as an assignment. only # expressions contained within statements may have the assign arg. def visitName(self, node, scope, assign=0): if assign: scope.add_def(node.name) else: scope.add_use(node.name) # operations that bind new names def visitFor(self, node, scope): self.visit(node.assign, scope, 1) self.visit(node.list, scope) self.visit(node.body, scope) if node.else_: self.visit(node.else_, scope) def visitFrom(self, node, scope): for name, asname in node.names: if name == "*": continue scope.add_def(asname or name) def visitImport(self, node, scope): for name, asname in node.names: i = name.find(".") if i > -1: name = name[:i] scope.add_def(asname or name) def visitAssName(self, node, scope, assign=1): scope.add_def(node.name) def visitAugAssign(self, node, scope): # basically, the node is referenced and defined by the same expr self.visit(node.node, scope) self.visit(node.node, scope, 1) self.visit(node.expr, scope) def visitAssign(self, node, scope): for n in node.nodes: self.visit(n, scope, 1) self.visit(node.expr, scope) def visitGlobal(self, node, scope): for name in node.names: scope.add_global(name) def sort(l): l = l[:] l.sort() return l def list_eq(l1, l2): return sort(l1) == sort(l2) if __name__ == "__main__": import sys from compiler import parseFile, walk import symtable for file in sys.argv[1:]: print file f = open(file) buf = f.read() f.close() syms = symtable.symtable(buf, file, "exec") mod_names = [s for s in [s.get_name() for s in syms.get_symbols()] if not s.startswith('_[')] tree = parseFile(file) s = SymbolVisitor() walk(tree, s) for node, scope in s.scopes.items(): print node.__class__.__name__, id(node) print scope print scope.get_names() names2 = s.scopes[tree].get_names() if not list_eq(mod_names, names2): print "oops", file print sort(mod_names) print sort(names2) sys.exit(-1) From jhylton@users.sourceforge.net Mon Apr 9 14:57:35 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 09 Apr 2001 06:57:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler symbols.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv628/compiler Modified Files: symbols.py Log Message: Add two arguments to Scope constructor, module scope and class name Add mangling support Add get_children() and add_child() methods to Scope Skip nodes when If test is a false constant Add test code that checks results against symtable module Index: symbols.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/symbols.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** symbols.py 2001/04/09 04:35:35 1.1 --- symbols.py 2001/04/09 13:57:32 1.2 *************** *** 2,27 **** from compiler import ast ! module_scope = None class Scope: # XXX how much information do I need about each name? ! def __init__(self, name): self.name = name self.defs = {} self.uses = {} self.globals = {} self.params = {} def __repr__(self): return "<%s: %s>" % (self.__class__.__name__, self.name) def add_def(self, name): ! self.defs[name] = 1 def add_use(self, name): ! self.uses[name] = 1 def add_global(self, name): if self.uses.has_key(name) or self.defs.has_key(name): pass # XXX warn about global following def/use --- 2,48 ---- from compiler import ast + import types ! MANGLE_LEN = 256 class Scope: # XXX how much information do I need about each name? ! def __init__(self, name, module, klass=None): self.name = name + self.module = module self.defs = {} self.uses = {} self.globals = {} self.params = {} + self.children = [] + self.klass = None + if klass is not None: + for i in range(len(klass)): + if klass[i] != '_': + self.klass = klass[i:] + break def __repr__(self): return "<%s: %s>" % (self.__class__.__name__, self.name) + def mangle(self, name): + if self.klass is None: + return name + if not name.startswith('__'): + return name + if len(name) + 2 >= MANGLE_LEN: + return name + if name.endswith('__'): + return name + return "_%s%s" % (self.klass, name) + def add_def(self, name): ! self.defs[self.mangle(name)] = 1 def add_use(self, name): ! self.uses[self.mangle(name)] = 1 def add_global(self, name): + name = self.mangle(name) if self.uses.has_key(name) or self.defs.has_key(name): pass # XXX warn about global following def/use *************** *** 30,36 **** (name, self.name) self.globals[name] = 1 ! module_scope.add_def(name) def add_param(self, name): self.defs[name] = 1 self.params[name] = 1 --- 51,58 ---- (name, self.name) self.globals[name] = 1 ! self.module.add_def(name) def add_param(self, name): + name = self.mangle(name) self.defs[name] = 1 self.params[name] = 1 *************** *** 42,53 **** return d.keys() class ModuleScope(Scope): __super_init = Scope.__init__ def __init__(self): ! self.__super_init("global") ! global module_scope ! assert module_scope is None ! module_scope = self class LambdaScope(Scope): --- 64,78 ---- return d.keys() + def add_child(self, child): + self.children.append(child) + + def get_children(self): + return self.children + class ModuleScope(Scope): __super_init = Scope.__init__ def __init__(self): ! self.__super_init("global", self) class LambdaScope(Scope): *************** *** 56,63 **** __counter = 1 ! def __init__(self): i = self.__counter self.__counter += 1 ! self.__super_init("lambda.%d" % i) class FunctionScope(Scope): --- 81,88 ---- __counter = 1 ! def __init__(self, module, klass=None): i = self.__counter self.__counter += 1 ! self.__super_init("lambda.%d" % i, module, klass) class FunctionScope(Scope): *************** *** 65,78 **** class ClassScope(Scope): ! pass class SymbolVisitor: def __init__(self): self.scopes = {} ! # node that define new scopes def visitModule(self, node): ! scope = self.scopes[node] = ModuleScope() self.visit(node.node, scope) --- 90,107 ---- class ClassScope(Scope): ! __super_init = Scope.__init__ + def __init__(self, name, module): + self.__super_init(name, module, name) + class SymbolVisitor: def __init__(self): self.scopes = {} ! self.klass = None ! # node that define new scopes def visitModule(self, node): ! scope = self.module = self.scopes[node] = ModuleScope() self.visit(node.node, scope) *************** *** 81,85 **** for n in node.defaults: self.visit(n, parent) ! scope = FunctionScope(node.name) self.scopes[node] = scope for name in node.argnames: --- 110,114 ---- for n in node.defaults: self.visit(n, parent) ! scope = FunctionScope(node.name, self.module, self.klass) self.scopes[node] = scope for name in node.argnames: *************** *** 90,94 **** for n in node.defaults: self.visit(n, parent) ! scope = LambdaScope() self.scopes[node] = scope for name in node.argnames: --- 119,123 ---- for n in node.defaults: self.visit(n, parent) ! scope = LambdaScope(self.module, self.klass) self.scopes[node] = scope for name in node.argnames: *************** *** 100,106 **** for n in node.bases: self.visit(n, parent) ! scope = ClassScope(node.name) self.scopes[node] = scope self.visit(node.code, scope) # name can be a def or a use --- 129,138 ---- for n in node.bases: self.visit(n, parent) ! scope = ClassScope(node.name, self.module) self.scopes[node] = scope + prev = self.klass + self.klass = node.name self.visit(node.code, scope) + self.klass = prev # name can be a def or a use *************** *** 156,159 **** --- 188,206 ---- scope.add_global(name) + # prune if statements if tests are false + + _const_types = types.StringType, types.IntType, types.FloatType + + def visitIf(self, node, scope): + for test, body in node.tests: + if isinstance(test, ast.Const): + if type(test.value) in self._const_types: + if not test.value: + continue + self.visit(test, scope) + self.visit(body, scope) + if node.else_: + self.visit(node.else_, scope) + def sort(l): l = l[:] *************** *** 169,172 **** --- 216,223 ---- import symtable + def get_names(syms): + return [s for s in [s.get_name() for s in syms.get_symbols()] + if not s.startswith('_[')] + for file in sys.argv[1:]: print file *************** *** 175,193 **** f.close() syms = symtable.symtable(buf, file, "exec") ! mod_names = [s for s in [s.get_name() ! for s in syms.get_symbols()] ! if not s.startswith('_[')] tree = parseFile(file) s = SymbolVisitor() walk(tree, s) - for node, scope in s.scopes.items(): - print node.__class__.__name__, id(node) - print scope - print scope.get_names() names2 = s.scopes[tree].get_names() if not list_eq(mod_names, names2): print "oops", file print sort(mod_names) print sort(names2) sys.exit(-1) --- 226,261 ---- f.close() syms = symtable.symtable(buf, file, "exec") ! mod_names = get_names(syms) tree = parseFile(file) s = SymbolVisitor() walk(tree, s) + # compare module-level symbols names2 = s.scopes[tree].get_names() + if not list_eq(mod_names, names2): + print print "oops", file print sort(mod_names) print sort(names2) sys.exit(-1) + + d = {} + d.update(s.scopes) + del d[tree] + scopes = d.values() + del d + + for s in syms.get_symbols(): + if s.is_namespace(): + l = [sc for sc in scopes + if sc.name == s.get_name()] + if len(l) > 1: + print "skipping", s.get_name() + else: + if not list_eq(get_names(s.get_namespace()), + l[0].get_names()): + print s.get_name() + print get_names(s.get_namespace()) + print l[0].get_names() + sys.exit(-1) From moshez@users.sourceforge.net Mon Apr 9 15:54:23 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Mon, 09 Apr 2001 07:54:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.124,1.125 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10958/Lib Modified Files: urllib.py Log Message: fixing 408085 - redirect from https becomes http Even though relative redirects are illegal, they are common urllib treated every relative redirect as though it was to http, even if the original was https:// As long as we're compensating for server bugs, might as well do it properly. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -r1.124 -r1.125 *** urllib.py 2001/03/13 19:47:16 1.124 --- urllib.py 2001/04/09 14:54:21 1.125 *************** *** 557,561 **** fp.close() # In case the server sent a relative URL, join with original: ! newurl = basejoin("http:" + url, newurl) if data is None: return self.open(newurl) --- 557,561 ---- fp.close() # In case the server sent a relative URL, join with original: ! newurl = basejoin(self.type + ":" + url, newurl) if data is None: return self.open(newurl) From moshez@users.sourceforge.net Mon Apr 9 16:23:55 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Mon, 09 Apr 2001 08:23:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.89,1.90 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv20471/Misc Modified Files: ACKS Log Message: Fixing Itamar's name, as per his request. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -r1.89 -r1.90 *** ACKS 2001/04/08 00:38:42 1.89 --- ACKS 2001/04/09 15:23:46 1.90 *************** *** 189,193 **** Jeremy Hylton John Interrante - S.T. Itamar Ben Jackson Paul Jackson --- 189,192 ---- *************** *** 349,352 **** --- 348,352 ---- John W. Shipman Joel Shprentz + Itamar Shtull-Trauring Eric Siegerman Paul Sijben From purcell@users.sourceforge.net Mon Apr 9 16:37:33 2001 From: purcell@users.sourceforge.net (Steve Purcell) Date: Mon, 09 Apr 2001 08:37:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib unittest.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23056 Modified Files: unittest.py Log Message: * Remove exc_info() kludge -- it actually messed up the Jython output * Fixed TestLoader.loadTestsFromName() for nested packages * Corrected the command-line usage summary Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** unittest.py 2001/03/29 04:36:08 1.3 --- unittest.py 2001/04/09 15:37:31 1.4 *************** *** 190,194 **** self.setUp() except: ! result.addError(self,self.__exc_info()) return --- 190,194 ---- self.setUp() except: ! result.addError(self,sys.exc_info()) return *************** *** 198,209 **** ok = 1 except AssertionError, e: ! result.addFailure(self,self.__exc_info()) except: ! result.addError(self,self.__exc_info()) try: self.tearDown() except: ! result.addError(self,self.__exc_info()) ok = 0 if ok: result.addSuccess(self) --- 198,209 ---- ok = 1 except AssertionError, e: ! result.addFailure(self,sys.exc_info()) except: ! result.addError(self,sys.exc_info()) try: self.tearDown() except: ! result.addError(self,sys.exc_info()) ok = 0 if ok: result.addSuccess(self) *************** *** 267,281 **** raise AssertionError, msg - def __exc_info(self): - """Return a version of sys.exc_info() with the traceback frame - minimised; usually the top level of the traceback frame is not - needed. - """ - exctype, excvalue, tb = sys.exc_info() - newtb = tb.tb_next - if newtb is None: - return (exctype, excvalue, tb) - return (exctype, excvalue, newtb) - class TestSuite: --- 267,270 ---- *************** *** 401,405 **** raise ValueError, "incomplete test name: %s" % name else: ! module = __import__(parts) parts = parts[1:] obj = module --- 390,401 ---- raise ValueError, "incomplete test name: %s" % name else: ! parts_copy = parts[:] ! while parts_copy: ! try: ! module = __import__(string.join(parts_copy,'.')) ! break ! except ImportError: ! del parts_copy[-1] ! if not parts_copy: raise parts = parts[1:] obj = module *************** *** 600,604 **** """ USAGE = """\ ! Usage: %(progName)s [options] [test[:(casename|prefix-)]] [...] Options: --- 596,600 ---- """ USAGE = """\ ! Usage: %(progName)s [options] [test] [...] Options: From fdrake@users.sourceforge.net Mon Apr 9 16:42:58 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 09 Apr 2001 08:42:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib librfc822.tex,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv24275/lib Modified Files: librfc822.tex Log Message: Fix a number of bugs and omissions in the AddressList documentation, most noted by Steve Holden. This closes SF bug #413876. Index: librfc822.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** librfc822.tex 2001/01/27 10:56:14 1.30 --- librfc822.tex 2001/04/09 15:42:56 1.31 *************** *** 239,262 **** An \class{AddressList} instance has the following methods: ! \begin{methoddesc}{__len__}{name} Return the number of addresses in the address list. \end{methoddesc} ! \begin{methoddesc}{__str__}{name} Return a canonicalized string representation of the address list. Addresses are rendered in "name" form, comma-separated. \end{methoddesc} ! \begin{methoddesc}{__add__}{name} ! Return an \class{AddressList} instance that contains all addresses in ! both \class{AddressList} operands, with duplicates removed (set union). \end{methoddesc} ! \begin{methoddesc}{__sub__}{name} ! Return an \class{AddressList} instance that contains every address in the ! left-hand \class{AddressList} operand that is not present in the right-hand ! address operand (set difference). \end{methoddesc} Finally, \class{AddressList} instances have one public instance variable: --- 239,274 ---- An \class{AddressList} instance has the following methods: ! \begin{methoddesc}{__len__}{} Return the number of addresses in the address list. \end{methoddesc} ! \begin{methoddesc}{__str__}{} Return a canonicalized string representation of the address list. Addresses are rendered in "name" form, comma-separated. \end{methoddesc} ! \begin{methoddesc}{__add__}{alist} ! Return a new \class{AddressList} instance that contains all addresses ! in both \class{AddressList} operands, with duplicates removed (set ! union). \end{methoddesc} ! \begin{methoddesc}{__iadd__}{alist} ! In-place version of \method{__add__()}; turns this \class{AddressList} ! instance into the union of itself and the right-hand instance, ! \var{alist}. \end{methoddesc} + \begin{methoddesc}{__sub__}{alist} + Return a new \class{AddressList} instance that contains every address + in the left-hand \class{AddressList} operand that is not present in + the right-hand address operand (set difference). + \end{methoddesc} + + \begin{methoddesc}{__isub__}{alist} + In-place version of \method{__sub__()}, removing addresses in this + list which are also in \var{alist}. + \end{methoddesc} + Finally, \class{AddressList} instances have one public instance variable: *************** *** 265,268 **** A list of tuple string pairs, one per address. In each member, the first is the canonicalized name part, the second is the ! actual route-address (@-separated username-host.domain pair). \end{memberdesc} --- 277,281 ---- A list of tuple string pairs, one per address. In each member, the first is the canonicalized name part, the second is the ! actual route-address (\character{@}-separated username-host.domain ! pair). \end{memberdesc} From fdrake@users.sourceforge.net Mon Apr 9 16:57:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 09 Apr 2001 08:57:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libasyncore.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv28403 Modified Files: libasyncore.tex Log Message: Fix typo in example (\b should be \n in string literal). This closes SF bug #414279. Index: libasyncore.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasyncore.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** libasyncore.tex 2000/11/01 03:12:34 1.6 --- libasyncore.tex 2001/04/09 15:57:06 1.7 *************** *** 179,183 **** self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect( (host, 80) ) ! self.buffer = 'GET %s HTTP/1.0\r\b\r\n' % self.path def handle_connect(self): --- 179,183 ---- self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect( (host, 80) ) ! self.buffer = 'GET %s HTTP/1.0\r\n\r\n' % self.path def handle_connect(self): From jhylton@users.sourceforge.net Mon Apr 9 17:08:02 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 09 Apr 2001 09:08:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.194,2.195 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv32618/Python Modified Files: compile.c Log Message: Warn when assigning to __debug__ instead of raising an error. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.194 retrieving revision 2.195 diff -C2 -r2.194 -r2.195 *** compile.c 2001/03/23 14:08:38 2.194 --- compile.c 2001/04/09 16:07:59 2.195 *************** *** 5186,5196 **** goto loop; } else if (TYPE(tmp) == NAME) { ! if (strcmp(STR(tmp), "__debug__") == 0) { ! PyErr_SetString(PyExc_SyntaxError, ! ASSIGN_DEBUG); ! PyErr_SyntaxLocation(st->st_filename, ! n->n_lineno); ! st->st_errors++; ! } symtable_add_def(st, STR(tmp), DEF_LOCAL | flag); } --- 5186,5191 ---- goto loop; } else if (TYPE(tmp) == NAME) { ! if (strcmp(STR(tmp), "__debug__") == 0) ! symtable_warn(st, ASSIGN_DEBUG); symtable_add_def(st, STR(tmp), DEF_LOCAL | flag); } From tim_one@users.sourceforge.net Mon Apr 9 18:16:34 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 09 Apr 2001 10:16:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test pickletester.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19236/python/dist/src/Lib/test Modified Files: pickletester.py Log Message: No functional change -- just added whitespace in places so I could follow the logic better. Will be adding some additional tests later today. Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** pickletester.py 2001/01/22 22:43:35 1.2 --- pickletester.py 2001/04/09 17:16:31 1.3 *************** *** 58,86 **** r = [] r.append(r) print "dumps()" s = pickle.dumps(x) print "loads()" x2 = pickle.loads(s) ! if x2 == x: print "ok" ! else: print "bad" print "loads() DATA" x2 = pickle.loads(DATA) ! if x2 == x: print "ok" ! else: print "bad" print "dumps() binary" s = pickle.dumps(x, 1) print "loads() binary" x2 = pickle.loads(s) ! if x2 == x: print "ok" ! else: print "bad" print "loads() BINDATA" x2 = pickle.loads(BINDATA) ! if x2 == x: print "ok" ! else: print "bad" ! s = pickle.dumps(r) print "dumps() RECURSIVE" x2 = pickle.loads(s) ! if x2 == r: print "ok" ! else: print "bad" # don't create cyclic garbage del x2[0] --- 58,104 ---- r = [] r.append(r) + print "dumps()" s = pickle.dumps(x) + print "loads()" x2 = pickle.loads(s) ! if x2 == x: ! print "ok" ! else: ! print "bad" ! print "loads() DATA" x2 = pickle.loads(DATA) ! if x2 == x: ! print "ok" ! else: ! print "bad" ! print "dumps() binary" s = pickle.dumps(x, 1) + print "loads() binary" x2 = pickle.loads(s) ! if x2 == x: ! print "ok" ! else: ! print "bad" ! print "loads() BINDATA" x2 = pickle.loads(BINDATA) ! if x2 == x: ! print "ok" ! else: ! print "bad" ! print "dumps() RECURSIVE" + s = pickle.dumps(r) x2 = pickle.loads(s) ! if x2 == r: ! print "ok" ! else: ! print "bad" ! # don't create cyclic garbage del x2[0] *************** *** 98,101 **** --- 116,120 ---- else: print "dump to closed file should raise ValueError" + f = open(fn, "r") f.close() From theller@users.sourceforge.net Mon Apr 9 19:03:14 2001 From: theller@users.sourceforge.net (Thomas Heller) Date: Mon, 09 Apr 2001 11:03:14 -0700 Subject: [Python-checkins] CVS: distutils/misc install.c,1.10,1.11 Message-ID: Update of /cvsroot/python/distutils/misc In directory usw-pr-cvs1:/tmp/cvs-serv31286 Modified Files: install.c Log Message: Python 2.1 changed the repr of strings. This did break the installer (which did inplace conversion of these strings). Index: install.c =================================================================== RCS file: /cvsroot/python/distutils/misc/install.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** install.c 2001/03/16 20:42:49 1.10 --- install.c 2001/04/09 18:03:11 1.11 *************** *** 118,147 **** static BOOL notify (int code, char *fmt, ...); ! static void unescape (char *str) { - char *dst = str; - char *src = str; char *eon; char ch; ! while (src && *src) { if (*src == '\\') { switch (*++src) { case 'n': ! *dst++ = '\n'; *dst++ = '\r'; break; case 'r': *dst++ = '\r'; break; case '0': case '1': case '2': case '3': ch = (char)strtol (src, &eon, 8); ! if (ch == '\n') *dst++ = '\r'; *dst++ = ch; src = eon; } ! } else *dst++ = *src++; } *dst = '\0'; --- 118,154 ---- static BOOL notify (int code, char *fmt, ...); ! static void unescape (char *dst, char *src, unsigned size) { char *eon; char ch; ! while (src && *src && (size > 2)) { if (*src == '\\') { switch (*++src) { case 'n': ! ++src; *dst++ = '\r'; + *dst++ = '\n'; + size -= 2; break; case 'r': + ++src; *dst++ = '\r'; + --size; break; case '0': case '1': case '2': case '3': ch = (char)strtol (src, &eon, 8); ! if (ch == '\n') { *dst++ = '\r'; + --size; + } *dst++ = ch; + --size; src = eon; } ! } else { *dst++ = *src++; + --size; + } } *dst = '\0'; *************** *** 1047,1058 **** int DoInstall(void) { /* Read installation information */ ! GetPrivateProfileString ("Setup", "title", "", title, ! sizeof (title), ini_file); ! unescape (title); ! ! GetPrivateProfileString ("Setup", "info", "", info, ! sizeof (info), ini_file); ! unescape (info); GetPrivateProfileString ("Setup", "build_info", "", build_info, --- 1054,1067 ---- int DoInstall(void) { + char ini_buffer[4096]; + /* Read installation information */ ! GetPrivateProfileString ("Setup", "title", "", ini_buffer, ! sizeof (ini_buffer), ini_file); ! unescape (title, ini_buffer, sizeof(title)); ! ! GetPrivateProfileString ("Setup", "info", "", ini_buffer, ! sizeof (ini_buffer), ini_file); ! unescape (info, ini_buffer, sizeof(info)); GetPrivateProfileString ("Setup", "build_info", "", build_info, From fdrake@users.sourceforge.net Mon Apr 9 20:32:55 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 09 Apr 2001 12:32:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.22,2.23 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv23875/Modules Modified Files: termios.c Log Message: Michael Hudson : Update the docstrings to no longer refer to the obsolete TERMIOS module. This is a partial acceptance of SF patch #413419. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.22 retrieving revision 2.23 diff -C2 -r2.22 -r2.23 *** termios.c 2001/04/05 18:26:31 2.22 --- termios.c 2001/04/09 19:32:52 2.23 *************** *** 20,27 **** All functions in this module take a file descriptor fd as their first\n\ argument. This must be an integer file descriptor, such as returned by\n\ ! sys.stdin.fileno().\n\ ! \n\ ! This module should be used in conjunction with the TERMIOS module,\n\ ! which defines the relevant symbolic constants."; --- 20,24 ---- All functions in this module take a file descriptor fd as their first\n\ argument. This must be an integer file descriptor, such as returned by\n\ ! sys.stdin.fileno()."; *************** *** 48,52 **** defined). The interpretation of the flags and the speeds as well as the\n\ indexing in the cc array must be done using the symbolic constants defined\n\ ! in the TERMIOS module."; static PyObject * --- 45,49 ---- defined). The interpretation of the flags and the speeds as well as the\n\ indexing in the cc array must be done using the symbolic constants defined\n\ ! in this module."; static PyObject * *************** *** 123,129 **** The attributes to be set are taken from the attributes argument, which\n\ is a list like the one returned by tcgetattr(). The when argument\n\ ! determines when the attributes are changed: TERMIOS.TCSANOW to\n\ ! change immediately, TERMIOS.TCSADRAIN to change after transmitting all\n\ ! queued output, or TERMIOS.TCSAFLUSH to change after transmitting all\n\ queued output and discarding all queued input. "; --- 120,126 ---- The attributes to be set are taken from the attributes argument, which\n\ is a list like the one returned by tcgetattr(). The when argument\n\ ! determines when the attributes are changed: termios.TCSANOW to\n\ ! change immediately, termios.TCSADRAIN to change after transmitting all\n\ ! queued output, or termios.TCSAFLUSH to change after transmitting all\n\ queued output and discarding all queued input. "; *************** *** 238,243 **** tcflush(fd, queue) -> None\n\ Discard queued data on file descriptor fd.\n\ ! The queue selector specifies which queue: TERMIOS.TCIFLUSH for the input\n\ ! queue, TERMIOS.TCOFLUSH for the output queue, or TERMIOS.TCIOFLUSH for\n\ both queues. "; --- 235,240 ---- tcflush(fd, queue) -> None\n\ Discard queued data on file descriptor fd.\n\ ! The queue selector specifies which queue: termios.TCIFLUSH for the input\n\ ! queue, termios.TCOFLUSH for the output queue, or termios.TCIOFLUSH for\n\ both queues. "; *************** *** 263,269 **** tcflow(fd, action) -> None\n\ Suspend or resume input or output on file descriptor fd.\n\ ! The action argument can be TERMIOS.TCOOFF to suspend output,\n\ ! TERMIOS.TCOON to restart output, TERMIOS.TCIOFF to suspend input,\n\ ! or TERMIOS.TCION to restart input. "; static PyObject * --- 260,266 ---- tcflow(fd, action) -> None\n\ Suspend or resume input or output on file descriptor fd.\n\ ! The action argument can be termios.TCOOFF to suspend output,\n\ ! termios.TCOON to restart output, termios.TCIOFF to suspend input,\n\ ! or termios.TCION to restart input."; static PyObject * From tim_one@users.sourceforge.net Mon Apr 9 21:07:08 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 09 Apr 2001 13:07:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test pickletester.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1479/python/dist/src/Lib/test Modified Files: pickletester.py Log Message: Pickles have a number of storage formats for various sizes and kinds of integers, but the std tests don't exercise most of them. Repair that. CAUTION: I expect this to fail on boxes with sizeof(long)==8, in the part of test_cpickle (but not test_pickle) trying to do a binary mode (not text mode) load of the embedded BINDATA pickle string. Once that hypothesized failure is confirmed, I'll fix cPickle.c. Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** pickletester.py 2001/04/09 17:16:31 1.3 --- pickletester.py 2001/04/09 20:07:05 1.4 *************** *** 2,25 **** # break into multiple strings to please font-lock-mode ! DATA = """(lp0 I0 aL1L ! aF2.0 ac__builtin__ complex ! p1 ! """ \ ! """(F3.0 ! F0.0 ! tp2 ! Rp3 ! a(S'abc' p4 g4 ! """ \ ! """(i__main__ C p5 ! """ \ """(dp6 S'foo' --- 2,36 ---- # break into multiple strings to please font-lock-mode ! DATA = """(lp1 I0 aL1L ! aF2 ac__builtin__ complex ! p2 ! """ + \ ! """(F3 ! F0 ! tRp3 ! aI1 ! aI-1 ! aI255 ! aI-255 ! aI-256 ! aI65535 ! aI-65535 ! aI-65536 ! aI2147483647 ! aI-2147483647 ! aI-2147483648 ! a""" + \ ! """(S'abc' p4 g4 ! """ + \ ! """(ipickletester C p5 ! """ + \ """(dp6 S'foo' *************** *** 36,40 **** """ ! BINDATA = ']q\000(K\000L1L\012G@\000\000\000\000\000\000\000c__builtin__\012complex\012q\001(G@\010\000\000\000\000\000\000G\000\000\000\000\000\000\000\000tq\002Rq\003(U\003abcq\004h\004(c__main__\012C\012q\005oq\006}q\007(U\003fooq\010K\001U\003barq\011K\002ubh\006tq\012h\012K\005e.' class C: --- 47,58 ---- """ ! BINDATA = ']q\x01(K\x00L1L\nG@\x00\x00\x00\x00\x00\x00\x00' + \ ! 'c__builtin__\ncomplex\nq\x02(G@\x08\x00\x00\x00\x00\x00' + \ ! '\x00G\x00\x00\x00\x00\x00\x00\x00\x00tRq\x03K\x01J\xff\xff' + \ ! '\xff\xffK\xffJ\x01\xff\xff\xffJ\x00\xff\xff\xffM\xff\xff' + \ ! 'J\x01\x00\xff\xffJ\x00\x00\xff\xffJ\xff\xff\xff\x7fJ\x01\x00' + \ ! '\x00\x80J\x00\x00\x00\x80(U\x03abcq\x04h\x04(cpickletester\n' + \ ! 'C\nq\x05oq\x06}q\x07(U\x03fooq\x08K\x01U\x03barq\tK\x02ubh' + \ ! '\x06tq\nh\nK\x05e.' class C: *************** *** 52,55 **** --- 70,82 ---- c.bar = 2 x = [0, 1L, 2.0, 3.0+0j] + # Append some integer test cases at cPickle.c's internal size + # cutoffs. + uint1max = 0xff + uint2max = 0xffff + int4max = 0x7fffffff + x.extend([1, -1, + uint1max, -uint1max, -uint1max-1, + uint2max, -uint2max, -uint2max-1, + int4max, -int4max, -int4max-1]) y = ('abc', 'abc', c, c) x.append(y) From jhylton@users.sourceforge.net Mon Apr 9 21:12:01 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 09 Apr 2001 13:12:01 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler symbols.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv4852/compiler Modified Files: symbols.py Log Message: Add globals to list of names returned by get_names(). Fix func arg processing to handle args in tuples. In test code, skip names beginning with '.'. Index: symbols.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/symbols.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** symbols.py 2001/04/09 13:57:32 1.2 --- symbols.py 2001/04/09 20:11:59 1.3 *************** *** 62,65 **** --- 62,66 ---- d.update(self.defs) d.update(self.uses) + d.update(self.globals) return d.keys() *************** *** 112,117 **** scope = FunctionScope(node.name, self.module, self.klass) self.scopes[node] = scope ! for name in node.argnames: ! scope.add_param(name) self.visit(node.code, scope) --- 113,117 ---- scope = FunctionScope(node.name, self.module, self.klass) self.scopes[node] = scope ! self._do_args(scope, node.argnames) self.visit(node.code, scope) *************** *** 121,128 **** scope = LambdaScope(self.module, self.klass) self.scopes[node] = scope ! for name in node.argnames: ! scope.add_param(name) self.visit(node.code, scope) def visitClass(self, node, parent): parent.add_def(node.name) --- 121,134 ---- scope = LambdaScope(self.module, self.klass) self.scopes[node] = scope ! self._do_args(scope, node.argnames) self.visit(node.code, scope) + def _do_args(self, scope, args): + for name in args: + if type(name) == types.TupleType: + self._do_args(scope, name) + else: + scope.add_param(name) + def visitClass(self, node, parent): parent.add_def(node.name) *************** *** 218,222 **** def get_names(syms): return [s for s in [s.get_name() for s in syms.get_symbols()] ! if not s.startswith('_[')] for file in sys.argv[1:]: --- 224,228 ---- def get_names(syms): return [s for s in [s.get_name() for s in syms.get_symbols()] ! if not (s.startswith('_[') or s.startswith('.'))] for file in sys.argv[1:]: *************** *** 257,261 **** l[0].get_names()): print s.get_name() ! print get_names(s.get_namespace()) ! print l[0].get_names() sys.exit(-1) --- 263,267 ---- l[0].get_names()): print s.get_name() ! print sort(get_names(s.get_namespace())) ! print sort(l[0].get_names()) sys.exit(-1) From gvanrossum@users.sourceforge.net Mon Apr 9 23:23:24 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 09 Apr 2001 15:23:24 -0700 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv5460 Modified Files: Makefile.pre.in Log Message: Make on Alpha Tru64 5.1 (as installed on the SF compile farm) doesn't think that a command starting with '#' is a comment, so move the one comment in such a position (in the rule for building $(LIBRARY)) to a harmless position. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** Makefile.pre.in 2001/03/22 00:32:32 1.31 --- Makefile.pre.in 2001/04/09 22:23:22 1.32 *************** *** 298,304 **** # Build static library $(LIBRARY): $(LIBRARY_OBJS) -rm -f $@ - # avoid long command lines, same as LIBRARY_OBJS $(AR) cr $@ Modules/getbuildinfo.o $(AR) cr $@ $(PARSER_OBJS) --- 298,304 ---- # Build static library + # avoid long command lines, same as LIBRARY_OBJS $(LIBRARY): $(LIBRARY_OBJS) -rm -f $@ $(AR) cr $@ Modules/getbuildinfo.o $(AR) cr $@ $(PARSER_OBJS) From tim_one@users.sourceforge.net Tue Apr 10 02:54:45 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 09 Apr 2001 18:54:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.56,2.57 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv7758/python/dist/src/Modules Modified Files: cPickle.c Log Message: Critical fix: if cPickle on a sizeof(long)==8 box is used to read a binary pickle, and the latter contains a pickle of a negative Python int i written on a sizeof(long)==4 box (and whether by cPickle or pickle.py), it's read incorrectly as i + 2**32. The patch repairs that, and allows test_cpickle.py (to which I added a relevant test case earlier today) to work again on sizeof(long)==8 boxes. There's another (at least one) sizeof(long)==8 binary pickle bug, but in pickle.py instead. That bug is still there, and test_pickle.py doesn't catch it yet (try pickling and unpickling, e.g., 1 << 46). Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -r2.56 -r2.57 *** cPickle.c 2001/03/22 17:52:17 2.56 --- cPickle.c 2001/04/10 01:54:42 2.57 *************** *** 2529,2533 **** l |= (long)c << (i * 8); } ! return l; } --- 2529,2540 ---- l |= (long)c << (i * 8); } ! #if SIZEOF_LONG > 4 ! /* Unlike BININT1 and BININT2, BININT (more accurately BININT4) ! * is signed, so on a box with longs bigger than 4 bytes we need ! * to extend a BININT's sign bit to the full width. ! */ ! if (x == 4 && l & (1L << 31)) ! l |= (~0L) << 32; ! #endif return l; } From tim_one@users.sourceforge.net Tue Apr 10 03:12:25 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 09 Apr 2001 19:12:25 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0226.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv10907/python/nondist/peps Modified Files: pep-0226.txt Log Message: Update release schedule to reflect 2.1b2 release, and planned 2.1c1 & 2.1 release dates. Index: pep-0226.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0226.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** pep-0226.txt 2001/03/16 05:43:56 1.7 --- pep-0226.txt 2001/04/10 02:12:22 1.8 *************** *** 22,30 **** Tentative future release dates ! 23-Mar-2001: Python 2.1 beta 2 release ! 13-Apr-2001: 2.1 final release Past release dates: 02-Mar-2001: First 2.1 beta release 02-Feb-2001: Python 2.1 alpha 2 release --- 22,31 ---- Tentative future release dates ! 13-Apr-2001: 2.1 release candidate 1 ! 16-Apr-2001: 2.1 final release Past release dates: + 23-Mar-2001: Python 2.1 beta 2 release 02-Mar-2001: First 2.1 beta release 02-Feb-2001: Python 2.1 alpha 2 release From tim_one@users.sourceforge.net Tue Apr 10 03:48:55 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 09 Apr 2001 19:48:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pickle.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15580/python/dist/src/Lib Modified Files: pickle.py Log Message: Mechanical fiddling for easier reading: every "if" test was enclosed in parens, but no "while" test. Removed the former. Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -r1.46 -r1.47 *** pickle.py 2001/02/18 03:10:09 1.46 --- pickle.py 2001/04/10 02:48:53 1.47 *************** *** 111,117 **** def put(self, i): ! if (self.bin): s = mdumps(i)[1:] ! if (i < 256): return BINPUT + s[0] --- 111,117 ---- def put(self, i): ! if self.bin: s = mdumps(i)[1:] ! if i < 256: return BINPUT + s[0] *************** *** 121,128 **** def get(self, i): ! if (self.bin): s = mdumps(i)[1:] ! if (i < 256): return BINGET + s[0] --- 121,128 ---- def get(self, i): ! if self.bin: s = mdumps(i)[1:] ! if i < 256: return BINGET + s[0] *************** *** 134,140 **** memo = self.memo ! if (not pers_save): pid = self.persistent_id(object) ! if (pid is not None): self.save_pers(pid) return --- 134,140 ---- memo = self.memo ! if not pers_save: pid = self.persistent_id(object) ! if pid is not None: self.save_pers(pid) return *************** *** 144,149 **** t = type(object) ! if ((t is TupleType) and (len(object) == 0)): ! if (self.bin): self.save_empty_tuple(object) else: --- 144,149 ---- t = type(object) ! if (t is TupleType) and (len(object) == 0): ! if self.bin: self.save_empty_tuple(object) else: *************** *** 181,185 **** return ! if (type(tup) is not TupleType): raise PicklingError, "Value returned by %s must be a " \ "tuple" % reduce --- 181,185 ---- return ! if type(tup) is not TupleType: raise PicklingError, "Value returned by %s must be a " \ "tuple" % reduce *************** *** 187,191 **** l = len(tup) ! if ((l != 2) and (l != 3)): raise PicklingError, "tuple returned by %s must contain " \ "only two or three elements" % reduce --- 187,191 ---- l = len(tup) ! if (l != 2) and (l != 3): raise PicklingError, "tuple returned by %s must contain " \ "only two or three elements" % reduce *************** *** 194,198 **** arg_tup = tup[1] ! if (l > 2): state = tup[2] else: --- 194,198 ---- arg_tup = tup[1] ! if l > 2: state = tup[2] else: *************** *** 218,222 **** def save_pers(self, pid): ! if (not self.bin): self.write(PERSID + str(pid) + '\n') else: --- 218,222 ---- def save_pers(self, pid): ! if not self.bin: self.write(PERSID + str(pid) + '\n') else: *************** *** 232,236 **** write(REDUCE) ! if (state is not None): save(state) write(BUILD) --- 232,236 ---- write(REDUCE) ! if state is not None: save(state) write(BUILD) *************** *** 243,250 **** def save_int(self, object): ! if (self.bin): i = mdumps(object)[1:] ! if (i[-2:] == '\000\000'): ! if (i[-3] == '\000'): self.write(BININT1 + i[:-3]) return --- 243,250 ---- def save_int(self, object): ! if self.bin: i = mdumps(object)[1:] ! if i[-2:] == '\000\000': ! if i[-3] == '\000': self.write(BININT1 + i[:-3]) return *************** *** 273,280 **** memo = self.memo ! if (self.bin): l = len(object) s = mdumps(l)[1:] ! if (l < 256): self.write(SHORT_BINSTRING + s[0] + object) else: --- 273,280 ---- memo = self.memo ! if self.bin: l = len(object) s = mdumps(l)[1:] ! if l < 256: self.write(SHORT_BINSTRING + s[0] + object) else: *************** *** 292,296 **** memo = self.memo ! if (self.bin): encoding = object.encode('utf-8') l = len(encoding) --- 292,296 ---- memo = self.memo ! if self.bin: encoding = object.encode('utf-8') l = len(encoding) *************** *** 314,323 **** unicode = object.isunicode() ! if (self.bin): if unicode: object = object.encode("utf-8") l = len(object) s = mdumps(l)[1:] ! if (l < 256 and not unicode): self.write(SHORT_BINSTRING + s[0] + object) else: --- 314,323 ---- unicode = object.isunicode() ! if self.bin: if unicode: object = object.encode("utf-8") l = len(object) s = mdumps(l)[1:] ! if l < 256 and not unicode: self.write(SHORT_BINSTRING + s[0] + object) else: *************** *** 353,358 **** save(element) ! if (len(object) and memo.has_key(d)): ! if (self.bin): write(POP_MARK + self.get(memo[d][0])) return --- 353,358 ---- save(element) ! if len(object) and memo.has_key(d): ! if self.bin: write(POP_MARK + self.get(memo[d][0])) return *************** *** 376,380 **** memo = self.memo ! if (self.bin): write(EMPTY_LIST) else: --- 376,380 ---- memo = self.memo ! if self.bin: write(EMPTY_LIST) else: *************** *** 387,391 **** using_appends = (self.bin and (len(object) > 1)) ! if (using_appends): write(MARK) --- 387,391 ---- using_appends = (self.bin and (len(object) > 1)) ! if using_appends: write(MARK) *************** *** 393,400 **** save(element) ! if (not using_appends): write(APPEND) ! if (using_appends): write(APPENDS) dispatch[ListType] = save_list --- 393,400 ---- save(element) ! if not using_appends: write(APPEND) ! if using_appends: write(APPENDS) dispatch[ListType] = save_list *************** *** 407,411 **** memo = self.memo ! if (self.bin): write(EMPTY_DICT) else: --- 407,411 ---- memo = self.memo ! if self.bin: write(EMPTY_DICT) else: *************** *** 418,422 **** using_setitems = (self.bin and (len(object) > 1)) ! if (using_setitems): write(MARK) --- 418,422 ---- using_setitems = (self.bin and (len(object) > 1)) ! if using_setitems: write(MARK) *************** *** 426,433 **** save(value) ! if (not using_setitems): write(SETITEM) ! if (using_setitems): write(SETITEMS) --- 426,433 ---- save(value) ! if not using_setitems: write(SETITEM) ! if using_setitems: write(SETITEMS) *************** *** 453,457 **** write(MARK) ! if (self.bin): save(cls) --- 453,457 ---- write(MARK) ! if self.bin: save(cls) *************** *** 460,464 **** memo_len = len(memo) ! if (self.bin): write(OBJ + self.put(memo_len)) else: --- 460,464 ---- memo_len = len(memo) ! if self.bin: write(OBJ + self.put(memo_len)) else: *************** *** 483,487 **** memo = self.memo ! if (name is None): name = object.__name__ --- 483,487 ---- memo = self.memo ! if name is None: name = object.__name__ *************** *** 800,804 **** safe = None ! if (not safe): raise UnpicklingError, "%s is not safe for " \ "unpickling" % callable --- 800,804 ---- safe = None ! if not safe: raise UnpicklingError, "%s is not safe for " \ "unpickling" % callable From gvanrossum@users.sourceforge.net Tue Apr 10 04:31:29 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 09 Apr 2001 20:31:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/scripts logmerge.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv21220 Modified Files: logmerge.py Log Message: Append the revision number for each file to the output. (Yes, this is a new feature right before the 2.1 release. No, I can't imagine this would seriously break anybody's code. In fact, most users of this script are probably *happy* to see this addition.) Index: logmerge.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/logmerge.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** logmerge.py 2001/01/17 08:48:39 1.6 --- logmerge.py 2001/04/10 03:31:27 1.7 *************** *** 127,131 **** print sep2, for (p_date, p_working_file, p_rev, p_author) in prev: ! print p_date, p_author, p_working_file sys.stdout.writelines(prevtext) prev = [] --- 127,131 ---- print sep2, for (p_date, p_working_file, p_rev, p_author) in prev: ! print p_date, p_author, p_working_file, p_rev sys.stdout.writelines(prevtext) prev = [] From gvanrossum@users.sourceforge.net Tue Apr 10 04:37:33 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 09 Apr 2001 20:37:33 -0700 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv22135 Modified Files: LICENSE Log Message: Correct the header over the string of licenses -- it's "PYTHON", not "Python 1.6.1". Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** LICENSE 2001/03/22 16:03:53 1.11 --- LICENSE 2001/04/10 03:37:31 1.12 *************** *** 36,41 **** ! B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING Python 1.6.1 ! ===================================================================== B.1. BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0 --- 36,41 ---- ! B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON ! =============================================================== B.1. BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0 From tim_one@users.sourceforge.net Tue Apr 10 04:41:43 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 09 Apr 2001 20:41:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test pickletester.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21796/python/dist/src/Lib/test Modified Files: pickletester.py Log Message: Test full range of native ints. This exposes two more binary pickle bugs on sizeof(long)==8 machines. pickle.py has no idea what it's doing with very large ints, and variously gets things right by accident, computes nonsense, or generates corrupt pickles. cPickle fails on cases 2**31 <= i < 2**32: since it *thinks* those are 4-byte ints (the "high 4 bytes" are all zeroes), it stores them in the (signed!) BININT format, so they get unpickled as negative values. Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** pickletester.py 2001/04/09 20:07:05 1.4 --- pickletester.py 2001/04/10 03:41:41 1.5 *************** *** 1,4 **** --- 1,7 ---- # test_pickle and test_cpickle both use this. + from test_support import TestFailed + import sys + # break into multiple strings to please font-lock-mode DATA = """(lp1 *************** *** 198,199 **** --- 201,218 ---- if u2 != u: print "Endcase failure: %s => %s" % (`u`, `u2`) + + # Test the full range of Python ints. + n = sys.maxint + while n: + for expected in (-n, n): + for binary_mode in (0, 1): + s = pickle.dumps(expected, binary_mode) + got = pickle.loads(s) + if expected != got: + raise TestFailed("for %s-mode pickle of %d, pickle " + "string is %s, loaded back as %s" % ( + binary_mode and "binary" or "text", + expected, + repr(s), + got)) + n = n >> 1 From tim_one@users.sourceforge.net Tue Apr 10 05:22:02 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 09 Apr 2001 21:22:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.57,2.58 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv27374/python/dist/src/Modules Modified Files: cPickle.c Log Message: On a sizeof(long)==8 machine, ints in range(2**31, 2**32) were getting pickled into the signed(!) 4-byte BININT format, so were getting unpickled again as negative ints. Repaired that. Added some minimal docs at the top about what I've learned about the pickle format codes (little of which was obvious from staring at the code, although that's partly because all the size-related bugs greatly obscured the true intent of the code). Happy side effect: because save_int() needed to grow a *proper* range check in order to fix this bug, it can now use the more-efficient BININT1, BININT2 and BININT formats when the long's value is small enough to fit in a signed 4-byte int (before this, on a sizeof(long)==8 box it always used the general INT format for negative ints). test_cpickle works again on sizeof(long)==8 machines. test_pickle is still busted big-time. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -r2.57 -r2.58 *** cPickle.c 2001/04/10 01:54:42 2.57 --- cPickle.c 2001/04/10 04:22:00 2.58 *************** *** 69,72 **** --- 69,86 ---- #define WRITE_BUF_SIZE 256 + /* -------------------------------------------------------------------------- + NOTES on format codes. + XXX much more is needed here + + Integer types + BININT1 8-bit unsigned integer; followed by 1 byte. + BININT2 16-bit unsigned integer; followed by 2 bytes, little-endian. + BININT 32-bit signed integer; followed by 4 bytes, little-endian. + INT Integer; natural decimal string conversion, then newline. + CAUTION: INT-reading code can't assume that what follows + fits in a Python int, because the size of Python ints varies + across platforms. + LONG Long (unbounded) integer; repr(i), then newline. + -------------------------------------------------------------------------- */ #define MARK '(' *************** *** 905,914 **** if (!self->bin #if SIZEOF_LONG > 4 ! || (l >> 32) #endif ! ) { ! /* Save extra-long ints in non-binary mode, so that ! we can use python long parsing code to restore, ! if necessary. */ c_str[0] = INT; sprintf(c_str + 1, "%ld\n", l); --- 919,929 ---- if (!self->bin #if SIZEOF_LONG > 4 ! || l > 0x7fffffffL ! || l < -0x80000000L #endif ! ) { ! /* Text-mode pickle, or long too big to fit in the 4-byte ! * signed BININT format: store as a string. ! */ c_str[0] = INT; sprintf(c_str + 1, "%ld\n", l); *************** *** 917,920 **** --- 932,936 ---- } else { + /* Binary pickle and l fits in a signed 4-byte int. */ c_str[1] = (int)( l & 0xff); c_str[2] = (int)((l >> 8) & 0xff); From tim_one@users.sourceforge.net Tue Apr 10 05:35:30 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 09 Apr 2001 21:35:30 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.58,2.59 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30336/python/dist/src/Modules Modified Files: cPickle.c Log Message: Ack -- this module mixes tabs and spaces, and what appears to be a mix of 2-space and 4-space indents. Whatever, when I saw the checkin diff it was clear that what my editor thinks a tab means didn't match this module's belief. Removed all the tabs from the lines I added and changed, left everything else alone. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -r2.58 -r2.59 *** cPickle.c 2001/04/10 04:22:00 2.58 --- cPickle.c 2001/04/10 04:35:28 2.59 *************** *** 74,85 **** Integer types ! BININT1 8-bit unsigned integer; followed by 1 byte. BININT2 16-bit unsigned integer; followed by 2 bytes, little-endian. ! BININT 32-bit signed integer; followed by 4 bytes, little-endian. ! INT Integer; natural decimal string conversion, then newline. CAUTION: INT-reading code can't assume that what follows fits in a Python int, because the size of Python ints varies across platforms. ! LONG Long (unbounded) integer; repr(i), then newline. -------------------------------------------------------------------------- */ --- 74,85 ---- Integer types ! BININT1 8-bit unsigned integer; followed by 1 byte. BININT2 16-bit unsigned integer; followed by 2 bytes, little-endian. ! BININT 32-bit signed integer; followed by 4 bytes, little-endian. ! INT Integer; natural decimal string conversion, then newline. CAUTION: INT-reading code can't assume that what follows fits in a Python int, because the size of Python ints varies across platforms. ! LONG Long (unbounded) integer; repr(i), then newline. -------------------------------------------------------------------------- */ *************** *** 932,936 **** } else { ! /* Binary pickle and l fits in a signed 4-byte int. */ c_str[1] = (int)( l & 0xff); c_str[2] = (int)((l >> 8) & 0xff); --- 932,936 ---- } else { ! /* Binary pickle and l fits in a signed 4-byte int. */ c_str[1] = (int)( l & 0xff); c_str[2] = (int)((l >> 8) & 0xff); From tim_one@users.sourceforge.net Tue Apr 10 06:02:54 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 09 Apr 2001 22:02:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pickle.py,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1600/python/dist/src/Lib Modified Files: pickle.py Log Message: test_pickle works on sizeof(long)==8 boxes again. pickle.py The code implicitly assumed that all ints fit in 4 bytes, causing all sorts of mischief (from nonsense results to corrupted pickles). Repaired that. marshal.c The int marshaling code assumed that right shifts of signed longs sign-extend. Repaired that. Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -r1.47 -r1.48 *** pickle.py 2001/04/10 02:48:53 1.47 --- pickle.py 2001/04/10 05:02:52 1.48 *************** *** 244,259 **** def save_int(self, object): if self.bin: ! i = mdumps(object)[1:] ! if i[-2:] == '\000\000': ! if i[-3] == '\000': ! self.write(BININT1 + i[:-3]) ! return ! ! self.write(BININT2 + i[:-2]) return ! ! self.write(BININT + i) ! else: ! self.write(INT + `object` + '\n') dispatch[IntType] = save_int --- 244,266 ---- def save_int(self, object): if self.bin: ! # If the int is small enough to fit in a signed 4-byte 2's-comp ! # format, we can store it more efficiently than the general ! # case. ! high_bits = object >> 31 # note that Python shift sign-extends ! if high_bits == 0 or high_bits == -1: ! # All high bits are copies of bit 2**31, so the value ! # fits in a 4-byte signed int. ! i = mdumps(object)[1:] ! assert len(i) == 4 ! if i[-2:] == '\000\000': # fits in 2-byte unsigned int ! if i[-3] == '\000': # fits in 1-byte unsigned int ! self.write(BININT1 + i[0]) ! else: ! self.write(BININT2 + i[:2]) ! else: ! self.write(BININT + i) return ! # Text pickle, or int too big to fit in signed 4-byte format. ! self.write(INT + `object` + '\n') dispatch[IntType] = save_int From tim_one@users.sourceforge.net Tue Apr 10 06:02:54 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 09 Apr 2001 22:02:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python marshal.c,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv1600/python/dist/src/Python Modified Files: marshal.c Log Message: test_pickle works on sizeof(long)==8 boxes again. pickle.py The code implicitly assumed that all ints fit in 4 bytes, causing all sorts of mischief (from nonsense results to corrupted pickles). Repaired that. marshal.c The int marshaling code assumed that right shifts of signed longs sign-extend. Repaired that. Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -r1.61 -r1.62 *** marshal.c 2001/01/28 00:27:39 1.61 --- marshal.c 2001/04/10 05:02:52 1.62 *************** *** 127,131 **** long x = PyInt_AS_LONG((PyIntObject *)v); #if SIZEOF_LONG > 4 ! long y = x>>31; if (y && y != -1) { w_byte(TYPE_INT64, p); --- 127,131 ---- long x = PyInt_AS_LONG((PyIntObject *)v); #if SIZEOF_LONG > 4 ! long y = Py_ARITHMETIC_RIGHT_SHIFT(long, x, 31); if (y && y != -1) { w_byte(TYPE_INT64, p); From fdrake@users.sourceforge.net Tue Apr 10 06:26:31 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 09 Apr 2001 22:26:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs copyright.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv4936/texinputs Modified Files: copyright.tex Log Message: In the typeset versions, the legal notices had grown past the one-page size. This constrains them to fit in one page again. Index: copyright.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/copyright.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** copyright.tex 2001/03/22 17:00:05 1.10 --- copyright.tex 2001/04/10 05:26:29 1.11 *************** *** 1,2 **** --- 1,3 ---- + \begin{small} Copyright \copyright{} 2001 Python Software Foundation. All rights reserved. *************** *** 11,14 **** --- 12,18 ---- All rights reserved. + %%begin{latexonly} + \vskip 4mm + %%end{latexonly} \centerline{\strong{BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0}} *************** *** 102,103 **** --- 106,108 ---- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + \end{small} From ping@users.sourceforge.net Tue Apr 10 12:43:02 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Tue, 10 Apr 2001 04:43:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3100 Modified Files: inspect.py Log Message: Add getmodulename() and getmoduleinfo() routines to inspect filenames. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** inspect.py 2001/03/23 15:29:59 1.11 --- inspect.py 2001/04/10 11:43:00 1.12 *************** *** 193,196 **** --- 193,211 ---- 'function, traceback, frame, or code object' + def getmoduleinfo(path): + """Get the module name, suffix, mode, and module type for a given file.""" + filename = os.path.basename(path) + suffixes = map(lambda (suffix, mode, mtype): + (-len(suffix), suffix, mode, mtype), imp.get_suffixes()) + suffixes.sort() # try longest suffixes first, in case they overlap + for neglen, suffix, mode, mtype in suffixes: + if filename[neglen:] == suffix: + return filename[:neglen], suffix, mode, mtype + + def getmodulename(path): + """Return the module name for a given file, or None.""" + info = getmoduleinfo(path) + if info: return info[0] + def getsourcefile(object): """Return the Python source file an object was defined in, if it exists.""" From ping@users.sourceforge.net Tue Apr 10 12:46:04 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Tue, 10 Apr 2001 04:46:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3267 Modified Files: pydoc.py Log Message: Fix synopsis() so it can handle binary module files. Avoid ever using popen on Windows, since it's broken there. Factor out the business of getting the summary line into splitdoc(). Use the modulename() routine in inspect. Show all members of modules and classes rather than filtering on leading '_'. Small typo and formtating fixes. Don't show warnings when running "pydoc -k". Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** pydoc.py 2001/03/27 08:13:42 1.21 --- pydoc.py 2001/04/10 11:46:02 1.22 *************** *** 38,43 **** # Note: this module is designed to deploy instantly and run under any # version of Python from 1.5 and up. That's why it's a single file and ! # some 2.0 features (like string methods) are conspicuously avoided. import sys, imp, os, stat, re, types, inspect from repr import Repr --- 38,51 ---- # Note: this module is designed to deploy instantly and run under any # version of Python from 1.5 and up. That's why it's a single file and ! # some 2.0 features (like string methods) are conspicuously absent. + # Known bugs that can't be fixed here: + # - imp.load_module() cannot be prevented from clobbering existing + # loaded modules, so calling synopsis() on a binary module file + # changes the contents of any existing module with the same name. + # - If the __file__ attribute on a module is a relative path and + # the current directory is changed with os.chdir(), an incorrect + # path will be displayed. + import sys, imp, os, stat, re, types, inspect from repr import Repr *************** *** 50,70 **** mtime = os.stat(filename)[stat.ST_MTIME] lastupdate, result = cache.get(filename, (0, None)) - # XXX what if ext is 'rb' type in imp_getsuffixes? if lastupdate < mtime: file = open(filename) ! line = file.readline() ! while line[:1] == '#' or strip(line) == '': line = file.readline() ! if not line: break ! if line[-2:] == '\\\n': ! line = line[:-2] + file.readline() ! line = strip(line) ! if line[:3] == '"""': ! line = line[3:] ! while strip(line) == '': line = file.readline() if not line: break ! result = strip(split(line, '"""')[0]) ! else: result = None file.close() cache[filename] = (mtime, result) --- 58,83 ---- mtime = os.stat(filename)[stat.ST_MTIME] lastupdate, result = cache.get(filename, (0, None)) if lastupdate < mtime: + info = inspect.getmoduleinfo(filename) file = open(filename) ! if info and 'b' in info[2]: # binary modules have to be imported ! try: module = imp.load_module(info[0], file, filename, info[1:]) ! except: return None ! result = split(module.__doc__ or '', '\n')[0] ! else: # text modules can be directly examined line = file.readline() ! while line[:1] == '#' or strip(line) == '': line = file.readline() if not line: break ! line = strip(line) ! if line[:4] == 'r"""': line = line[1:] ! if line[:3] == '"""': ! line = line[3:] ! if line[-1:] == '\\': line = line[:-1] ! while not strip(line): ! line = file.readline() ! if not line: break ! result = strip(split(line, '"""')[0]) ! else: result = None file.close() cache[filename] = (mtime, result) *************** *** 88,91 **** --- 101,113 ---- return result and re.sub('^ *\n', '', rstrip(result)) or '' + def splitdoc(doc): + """Split a doc string into a synopsis line (if any) and the rest.""" + lines = split(strip(doc), '\n') + if len(lines) == 1: + return lines[0], '' + elif len(lines) >= 2 and not rstrip(lines[1]): + return lines[0], join(lines[2:], '\n') + return '', join(lines, '\n') + def classname(object, modname): """Get a class name and qualify it with a module name if necessary.""" *************** *** 118,122 **** def stripid(text): """Remove the hexadecimal id from a Python object representation.""" ! # The behaviour of %p is implementation-dependent, so we need an example. for pattern in [' at 0x[0-9a-f]{6,}>$', ' at [0-9A-F]{8,}>$']: if re.search(pattern, repr(Exception)): --- 140,144 ---- def stripid(text): """Remove the hexadecimal id from a Python object representation.""" ! # The behaviour of %p is implementation-dependent; we check two cases. for pattern in [' at 0x[0-9a-f]{6,}>$', ' at [0-9A-F]{8,}>$']: if re.search(pattern, repr(Exception)): *************** *** 124,138 **** return text - def modulename(path): - """Return the Python module name for a given path, or None.""" - filename = os.path.basename(path) - suffixes = map(lambda (suffix, mode, kind): (len(suffix), suffix), - imp.get_suffixes()) - suffixes.sort() - suffixes.reverse() # try longest suffixes first, in case they overlap - for length, suffix in suffixes: - if len(filename) > length and filename[-length:] == suffix: - return filename[:-length] - def allmethods(cl): methods = {} --- 146,149 ---- *************** *** 233,237 **** # needed to make any special characters, so show a raw string. return 'r' + testrepr[0] + self.escape(test) + testrepr[0] ! return re.sub(r'((\\[\\abfnrtv\'"]|\\x..|\\u....)+)', r'\1', self.escape(testrepr)) --- 244,248 ---- # needed to make any special characters, so show a raw string. return 'r' + testrepr[0] + self.escape(test) + testrepr[0] ! return re.sub(r'((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)', r'\1', self.escape(testrepr)) *************** *** 276,284 **** ''' % (bgcol, fgcol, title, fgcol, extras or ' ') ! def section(self, title, fgcol, bgcol, contents, width=20, prelude='', marginalia=None, gap='  '): """Format a section with a heading.""" if marginalia is None: ! marginalia = ' ' * width result = '''

--- 287,295 ---- ''' % (bgcol, fgcol, title, fgcol, extras or ' ') ! def section(self, title, fgcol, bgcol, contents, width=10, prelude='', marginalia=None, gap='  '): """Format a section with a heading.""" if marginalia is None: ! marginalia = '' + ' ' * width + '' result = '''

*************** *** 296,300 **** ''' % (bgcol, marginalia, gap) ! return result + '
%s%s%s
' % contents def bigsection(self, title, *args): --- 307,311 ---- %s%s''' % (bgcol, marginalia, gap) ! return result + '\n%s' % contents def bigsection(self, title, *args): *************** *** 446,458 **** modules = inspect.getmembers(object, inspect.ismodule) - if 0 and hasattr(object, '__all__'): # disabled for now - visible = lambda key, all=object.__all__: key in all - else: - visible = lambda key: key[:1] != '_' - classes, cdict = [], {} for key, value in inspect.getmembers(object, inspect.isclass): ! if visible(key) and ( ! inspect.getmodule(value) or object) is object: classes.append((key, value)) cdict[key] = cdict[value] = '#' + key --- 457,463 ---- modules = inspect.getmembers(object, inspect.ismodule) classes, cdict = [], {} for key, value in inspect.getmembers(object, inspect.isclass): ! if (inspect.getmodule(value) or object) is object: classes.append((key, value)) cdict[key] = cdict[value] = '#' + key *************** *** 467,472 **** funcs, fdict = [], {} for key, value in inspect.getmembers(object, inspect.isroutine): ! if visible(key) and (inspect.isbuiltin(value) or ! inspect.getmodule(value) is object): funcs.append((key, value)) fdict[key] = '#-' + key --- 472,476 ---- funcs, fdict = [], {} for key, value in inspect.getmembers(object, inspect.isroutine): ! if inspect.isbuiltin(value) or inspect.getmodule(value) is object: funcs.append((key, value)) fdict[key] = '#-' + key *************** *** 474,479 **** constants = [] for key, value in inspect.getmembers(object, isconstant): ! if visible(key): ! constants.append((key, value)) doc = self.markup(getdoc(object), self.preformat, fdict, cdict) --- 478,482 ---- constants = [] for key, value in inspect.getmembers(object, isconstant): ! constants.append((key, value)) doc = self.markup(getdoc(object), self.preformat, fdict, cdict) *************** *** 485,496 **** modnames = [] for file in os.listdir(object.__path__[0]): ! if file[:1] != '_': ! path = os.path.join(object.__path__[0], file) ! modname = modulename(file) ! if modname and modname not in modnames: ! modpkgs.append((modname, name, 0, 0)) ! modnames.append(modname) ! elif ispackage(path): ! modpkgs.append((file, name, 1, 0)) modpkgs.sort() contents = self.multicolumn(modpkgs, self.modpkglink) --- 488,498 ---- modnames = [] for file in os.listdir(object.__path__[0]): ! path = os.path.join(object.__path__[0], file) ! modname = inspect.getmodulename(file) ! if modname and modname not in modnames: ! modpkgs.append((modname, name, 0, 0)) ! modnames.append(modname) ! elif ispackage(path): ! modpkgs.append((file, name, 1, 0)) modpkgs.sort() contents = self.multicolumn(modpkgs, self.modpkglink) *************** *** 564,569 **** doc = self.markup( getdoc(object), self.preformat, funcs, classes, mdict) ! doc = self.small(doc and '%s
 
' % doc or ' ') ! return self.section(title, '#000000', '#ffc8d8', contents, 10, doc) def formatvalue(self, object): --- 566,572 ---- doc = self.markup( getdoc(object), self.preformat, funcs, classes, mdict) ! doc = self.small(doc and '%s
 
' % doc or ! self.small(' ')) ! return self.section(title, '#000000', '#ffc8d8', contents, 5, doc) def formatvalue(self, object): *************** *** 626,631 **** doc = self.markup( getdoc(object), self.preformat, funcs, classes, methods) ! doc = doc and '%s' % doc ! return '

%s
%s
\n' % (decl, self.small(doc)) def docother(self, object, name=None): --- 629,634 ---- doc = self.markup( getdoc(object), self.preformat, funcs, classes, methods) ! doc = doc and '
' + self.small('%s' % doc) ! return '
%s%s
\n' % (decl, doc) def docother(self, object, name=None): *************** *** 653,658 **** for file in files: path = os.path.join(dir, file) ! if file[:1] != '_' and os.path.isfile(path): ! modname = modulename(file) if modname: found(modname, 0) --- 656,661 ---- for file in files: path = os.path.join(dir, file) ! if os.path.isfile(path): ! modname = inspect.getmodulename(file) if modname: found(modname, 0) *************** *** 737,749 **** """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name ! namesec = name ! lines = split(strip(getdoc(object)), '\n') ! if len(lines) == 1: ! if lines[0]: namesec = namesec + ' - ' + lines[0] ! lines = [] ! elif len(lines) >= 2 and not rstrip(lines[1]): ! if lines[0]: namesec = namesec + ' - ' + lines[0] ! lines = lines[2:] ! result = self.section('NAME', namesec) try: --- 740,745 ---- """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name ! synop, desc = splitdoc(getdoc(object)) ! result = self.section('NAME', name + (synop and ' - ' + synop)) try: *************** *** 752,757 **** file = '(built-in)' result = result + self.section('FILE', file) ! if lines: ! result = result + self.section('DESCRIPTION', join(lines, '\n')) classes = [] --- 748,753 ---- file = '(built-in)' result = result + self.section('FILE', file) ! if desc: ! result = result + self.section('DESCRIPTION', desc) classes = [] *************** *** 765,781 **** constants = [] for key, value in inspect.getmembers(object, isconstant): ! if key[:1] != '_': ! constants.append((key, value)) if hasattr(object, '__path__'): modpkgs = [] for file in os.listdir(object.__path__[0]): ! if file[:1] != '_': ! path = os.path.join(object.__path__[0], file) ! modname = modulename(file) ! if modname and modname not in modpkgs: ! modpkgs.append(modname) ! elif ispackage(path): ! modpkgs.append(file + ' (package)') modpkgs.sort() result = result + self.section( --- 761,775 ---- constants = [] for key, value in inspect.getmembers(object, isconstant): ! constants.append((key, value)) if hasattr(object, '__path__'): modpkgs = [] for file in os.listdir(object.__path__[0]): ! path = os.path.join(object.__path__[0], file) ! modname = inspect.getmodulename(file) ! if modname and modname not in modpkgs: ! modpkgs.append(modname) ! elif ispackage(path): ! modpkgs.append(file + ' (package)') modpkgs.sort() result = result + self.section( *************** *** 915,919 **** return plainpager if os.environ.has_key('PAGER'): ! return lambda a: pipepager(a, os.environ['PAGER']) if sys.platform == 'win32': return lambda a: tempfilepager(a, 'more <') --- 909,916 ---- return plainpager if os.environ.has_key('PAGER'): ! if sys.platform == 'win32': # pipes completely broken in Windows ! return lambda a: tempfilepager(a, os.environ['PAGER']) ! else: ! return lambda a: pipepager(a, os.environ['PAGER']) if sys.platform == 'win32': return lambda a: tempfilepager(a, 'more <') *************** *** 1073,1077 **** else: # Some other error occurred before executing the module. ! raise DocImportError(filename, sys.exc_info()) try: x = module --- 1070,1074 ---- else: # Some other error occurred before executing the module. ! raise ErrorDuringImport(filename, sys.exc_info()) try: x = module *************** *** 1119,1123 **** else: if object: ! page = html.page('Python: ' + describe(object), html.document(object, object.__name__)) file = open(key + '.html', 'w') --- 1116,1120 ---- else: if object: ! page = html.page(describe(object), html.document(object, object.__name__)) file = open(key + '.html', 'w') *************** *** 1135,1139 **** writedocs(path, pkgpath + file + '.') elif os.path.isfile(path): ! modname = modulename(path) if modname: modname = pkgpath + modname --- 1132,1136 ---- writedocs(path, pkgpath + file + '.') elif os.path.isfile(path): ! modname = inspect.getmodulename(path) if modname: modname = pkgpath + modname *************** *** 1228,1232 **** if not node: break path, package = node ! modname = modulename(path) if os.path.isfile(path) and modname: modname = package + (package and '.') + modname --- 1225,1229 ---- if not node: break path, package = node ! modname = inspect.getmodulename(path) if os.path.isfile(path) and modname: modname = package + (package and '.') + modname *************** *** 1243,1247 **** if modname[-9:] == '.__init__': modname = modname[:-9] + ' (package)' ! print modname, '-', desc or '(no description)' ModuleScanner().run(key, callback) --- 1240,1247 ---- if modname[-9:] == '.__init__': modname = modname[:-9] + ' (package)' ! print modname, desc and '- ' + desc ! try: import warnings ! except ImportError: pass ! else: warnings.filterwarnings('ignore') # ignore problems during import ModuleScanner().run(key, callback) *************** *** 1423,1430 **** os.system('start "%s"' % url) elif sys.platform == 'mac': ! try: ! import ic ! ic.launchurl(url) except ImportError: pass else: rc = os.system('netscape -remote "openURL(%s)" &' % url) --- 1423,1429 ---- os.system('start "%s"' % url) elif sys.platform == 'mac': ! try: import ic except ImportError: pass + else: ic.launchurl(url) else: rc = os.system('netscape -remote "openURL(%s)" &' % url) *************** *** 1584,1592 **** %s -g ! Pop up a graphical interface for serving and finding documentation. %s -w ... Write out the HTML documentation for a module to a file in the current ! directory. If contains a '%s', it is treated as a filename. """ % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep) --- 1583,1592 ---- %s -g ! Pop up a graphical interface for finding and serving documentation. %s -w ... Write out the HTML documentation for a module to a file in the current ! directory. If contains a '%s', it is treated as a filename; if ! it names a directory, documentation is written for all the contents. """ % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep) From ping@users.sourceforge.net Tue Apr 10 13:22:03 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Tue, 10 Apr 2001 05:22:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9486 Modified Files: pydoc.py Log Message: Fix typo in instantiation of ErrorDuringImport. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** pydoc.py 2001/04/10 11:46:02 1.22 --- pydoc.py 2001/04/10 12:22:01 1.23 *************** *** 1070,1074 **** else: # Some other error occurred before executing the module. ! raise ErrorDuringImport(filename, sys.exc_info()) try: x = module --- 1070,1074 ---- else: # Some other error occurred before executing the module. ! raise ErrorDuringImport(path, sys.exc_info()) try: x = module From gvanrossum@users.sourceforge.net Tue Apr 10 15:46:42 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 07:46:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_zipfile.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10722 Modified Files: test_zipfile.py Log Message: When zlib can't be imported, zipfile raises RuntimeError, which causes the test to be marked as failing rather than skipped. Add an explicit "import zlib" to prevent this. Index: test_zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zipfile.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** test_zipfile.py 2001/04/04 18:56:49 1.6 --- test_zipfile.py 2001/04/10 14:46:39 1.7 *************** *** 1,2 **** --- 1,3 ---- + import zlib # implied prerequisite import zipfile, os, StringIO, tempfile from test_support import TestFailed From gvanrossum@users.sourceforge.net Tue Apr 10 15:50:54 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 07:50:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_largefile.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11789 Modified Files: test_largefile.py Log Message: When doing the quick test to see whether large files are supported, catch IOError as well as OverflowError. I found that on Tru64 Unix this was raised; probably because the OS (or libc) doesn't support large files but the architecture is 64 bits! Index: test_largefile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_largefile.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_largefile.py 2000/10/23 17:22:07 1.3 --- test_largefile.py 2001/04/10 14:50:51 1.4 *************** *** 17,21 **** # 2**31 == 2147483648 f.seek(2147483649L) ! except OverflowError: f.close() os.unlink(test_support.TESTFN) --- 17,21 ---- # 2**31 == 2147483648 f.seek(2147483649L) ! except (IOError, OverflowError): f.close() os.unlink(test_support.TESTFN) From gvanrossum@users.sourceforge.net Tue Apr 10 16:01:22 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 08:01:22 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mailbox.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14359 Modified Files: test_mailbox.py Log Message: Some other tests, when failing, don't always remove their TESTFN file. Try to do it for them, so our mkdir() operation doesn't fail. Index: test_mailbox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mailbox.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_mailbox.py 2001/03/02 05:46:17 1.2 --- test_mailbox.py 2001/04/10 15:01:20 1.3 *************** *** 3,6 **** --- 3,12 ---- import test_support + # cleanup + try: + os.unlink(test_support.TESTFN) + except os.error: + pass + # create a new maildir mailbox to work with: curdir = os.path.join(test_support.TESTFN, "cur") From fdrake@users.sourceforge.net Tue Apr 10 16:12:36 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 08:12:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libinspect.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv16599/lib Modified Files: libinspect.tex Log Message: Add documentation for getmoduleinfo() and getmodulename(). Index: libinspect.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** libinspect.tex 2001/02/28 23:01:38 1.2 --- libinspect.tex 2001/04/10 15:12:34 1.3 *************** *** 94,97 **** --- 94,120 ---- \end{funcdesc} + \begin{funcdesc}{getmoduleinfo}{path} + Return a tuple of values that describe how Python will interpret the + file identified by \var{path} if it is a module, or \code{None} if + it would not be identified as a module. The return tuple is + \code{(\var{name}, \var{suffix}, \var{mode}, \var{mtype})}, where + \var{name} is the name of the module without the name of any + enclosing package, \var{suffix} is the trailing part of the file + name (which may not be a dot-delimited extension), \var{mode} is the + \function{open()} mode that would be used (\code{'r'} or + \code{'rb'}), and \var{mtype} is an integer giving the type of the + module. \var{mtype} will have a value which can be compared to the + constants defined in the \refmodule{imp} module; see the + documentation for that module for more information on module types. + \end{funcdesc} + + \begin{funcdesc}{getmodulename}{path} + Return the name of the module named by the file \var{path}, without + including the names of enclosing packages. This uses the same + algortihm as the interpreter uses when searching for modules. If + the name cannot be matched according to the interpreter's rules, + \code{None} is returned. + \end{funcdesc} + \begin{funcdesc}{ismodule}{object} Return true if the object is a module. From gvanrossum@users.sourceforge.net Tue Apr 10 16:37:14 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 08:37:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib zipfile.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21739 Modified Files: zipfile.py Log Message: Try an except: after an import into "except ImportError". This came out of SF bug #411881. Note that there's another unqualified except: still. Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** zipfile.py 2001/04/04 18:56:49 1.11 --- zipfile.py 2001/04/10 15:37:12 1.12 *************** *** 8,12 **** try: import zlib # We may need its compression method ! except: zlib = None --- 8,12 ---- try: import zlib # We may need its compression method ! except ImportError: zlib = None From gvanrossum@users.sourceforge.net Tue Apr 10 16:42:04 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 08:42:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib mimify.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22931 Modified Files: mimify.py Log Message: Fix an unqualified except:. This came out of SF bug #411881. Index: mimify.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mimify.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** mimify.py 2001/02/10 00:14:18 1.19 --- mimify.py 2001/04/10 15:42:02 1.20 *************** *** 449,453 **** try: MAXLEN = int(a) ! except: print usage sys.exit(1) --- 449,453 ---- try: MAXLEN = int(a) ! except (ValueError, OverflowError): print usage sys.exit(1) From gvanrossum@users.sourceforge.net Tue Apr 10 16:44:35 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 08:44:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib posixfile.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23609 Modified Files: posixfile.py Log Message: Fix two unqualified except: clauses. This came out of SF bug #411881. Index: posixfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixfile.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** posixfile.py 2001/02/18 03:30:53 1.19 --- posixfile.py 2001/04/10 15:44:33 1.20 *************** *** 93,98 **** import posix ! try: ignore = posix.fdopen ! except: raise AttributeError, 'dup() method unavailable' return posix.fdopen(posix.dup(self._file_.fileno()), self._file_.mode) --- 93,98 ---- import posix ! if not hasattr(posix, 'fdopen'): ! raise AttributeError, 'dup() method unavailable' return posix.fdopen(posix.dup(self._file_.fileno()), self._file_.mode) *************** *** 101,106 **** import posix ! try: ignore = posix.fdopen ! except: raise AttributeError, 'dup() method unavailable' posix.dup2(self._file_.fileno(), fd) --- 101,106 ---- import posix ! if not hasattr(posix, 'fdopen'): ! raise AttributeError, 'dup() method unavailable' posix.dup2(self._file_.fileno(), fd) From fdrake@users.sourceforge.net Tue Apr 10 16:53:09 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 08:53:09 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs python.sty,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv25968/texinputs Modified Files: python.sty Log Message: Import the alltt package and wrap that environment in a similar way to the way we handle verbatim, so that it picks up the same indentation and minipage behavior. Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -r1.72 -r1.73 *** python.sty 2001/03/02 18:57:05 1.72 --- python.sty 2001/04/10 15:53:06 1.73 *************** *** 186,189 **** --- 186,210 ---- } + % This does a similar thing for the {alltt} environment: + \RequirePackage{alltt} + \let\py@OldAllTT=\alltt + \let\py@OldEndAllTT=\endalltt + + \renewcommand{\alltt}{% + \setlength{\parindent}{1cm}% + % Calculate the text width for the minipage: + \setlength{\py@codewidth}{\linewidth}% + \addtolength{\py@codewidth}{-\parindent}% + % + \par\indent% + \begin{minipage}[t]{\py@codewidth}% + \small% + \py@OldAllTT% + } + \renewcommand{\endalltt}{% + \py@OldEndAllTT% + \end{minipage}% + } + \newcommand{\py@modulebadkey}{{--just-some-junk--}} From fdrake@users.sourceforge.net Tue Apr 10 18:13:41 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 10:13:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl howto.perl,1.5,1.6 manual.perl,1.5,1.6 python.perl,1.96,1.97 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv12471 Modified Files: howto.perl manual.perl python.perl Log Message: Add corresponding support for the alltt environment to the HTML generator. Index: howto.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/howto.perl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** howto.perl 1999/04/13 22:17:54 1.5 --- howto.perl 2001/04/10 17:13:39 1.6 *************** *** 7,11 **** do_require_package("article"); ! #do_require_package("verbatim"); do_require_package("python"); --- 7,11 ---- do_require_package("article"); ! do_require_package("alltt"); do_require_package("python"); Index: manual.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/manual.perl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** manual.perl 1999/04/13 22:17:55 1.5 --- manual.perl 2001/04/10 17:13:39 1.6 *************** *** 10,14 **** do_require_package("report"); ! #do_require_package("verbatim"); do_require_package("python"); --- 10,14 ---- do_require_package("report"); ! do_require_package("alltt"); do_require_package("python"); Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -r1.96 -r1.97 *** python.perl 2001/03/29 18:24:08 1.96 --- python.perl 2001/04/10 17:13:39 1.97 *************** *** 1594,1596 **** --- 1594,1642 ---- + $alltt_start = '
';
+ $alltt_end = '
'; + + sub do_env_alltt { + local ($_) = @_; + local($closures,$reopens,@open_block_tags); + + # get the tag-strings for all open tags + local(@keep_open_tags) = @$open_tags_R; + ($closures,$reopens) = &preserve_open_tags() if (@$open_tags_R); + + # get the tags for text-level tags only + $open_tags_R = [ @keep_open_tags ]; + local($local_closures, $local_reopens); + ($local_closures, $local_reopens,@open_block_tags) + = &preserve_open_block_tags + if (@$open_tags_R); + + $open_tags_R = [ @open_block_tags ]; + + do { + local($open_tags_R) = [ @open_block_tags ]; + local(@save_open_tags) = (); + + local($cnt) = ++$global{'max_id'}; + $_ = join('',"$O$cnt$C\\tt$O", ++$global{'max_id'}, $C + , $_ , $O, $global{'max_id'}, "$C$O$cnt$C"); + + $_ = &translate_environments($_); + $_ = &translate_commands($_) if (/\\/); + + # preserve space-runs, using   + while (s/(\S) ( +)/$1$2;SPMnbsp;/g){}; + s/(
) /$1;SPMnbsp;/g; + + $_ = join('', $closures, $alltt_start, $local_reopens + , $_ + , &balance_tags() #, $local_closures + , $alltt_end, $reopens); + undef $open_tags_R; undef @save_open_tags; + }; + $open_tags_R = [ @keep_open_tags ]; + $_; + } + + 1; # This must be the last line From fdrake@users.sourceforge.net Tue Apr 10 19:41:18 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 11:41:18 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libdifflib.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv1600/lib Modified Files: libdifflib.tex Log Message: Add reference to the DDJ article discussing a similar algorithm. Index: libdifflib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdifflib.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** libdifflib.tex 2001/02/23 19:13:07 1.3 --- libdifflib.tex 2001/04/10 18:41:16 1.4 *************** *** 59,62 **** --- 59,71 ---- + \begin{seealso} + \seetitle{Pattern Matching: The Gestalt Approach}{Discussion of a + similar algorithm by John W. Ratcliff and D. E. Metzener. + This was published in + \citetitle[http://www.ddj.com/]{Dr. Dobb's Journal} in + July, 1988.} + \end{seealso} + + \subsection{SequenceMatcher Objects \label{sequence-matcher}} From fdrake@users.sourceforge.net Tue Apr 10 19:49:11 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 11:49:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libcurses.tex,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv3538/lib Modified Files: libcurses.tex Log Message: Normalize tabs to spaces. Update the attribution for the "Curses Programming with Python" How-To. Change the way the reference to the Demo/curses/ directory is marked up. Index: libcurses.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcurses.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** libcurses.tex 2001/01/29 06:39:33 1.30 --- libcurses.tex 2001/04/10 18:49:09 1.31 *************** *** 28,32 **** curses windows.} \seemodule{curses.textpad}{Editable text widget for curses supporting ! \program{Emacs}-like bindings.} \seemodule{curses.wrapper}{Convenience function to ensure proper terminal setup and resetting on --- 28,32 ---- curses windows.} \seemodule{curses.textpad}{Editable text widget for curses supporting ! \program{Emacs}-like bindings.} \seemodule{curses.wrapper}{Convenience function to ensure proper terminal setup and resetting on *************** *** 34,40 **** \seetitle[http://www.python.org/doc/howto/curses/curses.html]{Curses Programming with Python}{Tutorial material on using curses ! with Python, by Andrew Kuchling, is available on the ! Python Web site.} ! \seetitle[Demo/curses]{}{Some example programs.} \end{seealso} --- 34,42 ---- \seetitle[http://www.python.org/doc/howto/curses/curses.html]{Curses Programming with Python}{Tutorial material on using curses ! with Python, by Andrew Kuchling and Eric Raymond, is ! available on the Python Web site.} ! \seetext{The \file{Demo/curses/} directory in the Python source ! distribution contains some example programs using the ! curses bindings provided by this module.} \end{seealso} From theller@users.sourceforge.net Tue Apr 10 19:55:09 2001 From: theller@users.sourceforge.net (Thomas Heller) Date: Tue, 10 Apr 2001 11:55:09 -0700 Subject: [Python-checkins] CVS: distutils/misc install.rc,1.5,1.6 wininst.exe,1.8,1.9 Message-ID: Update of /cvsroot/python/distutils/misc In directory usw-pr-cvs1:/tmp/cvs-serv4885 Modified Files: install.rc wininst.exe Log Message: install.rc: Made the edit-box displaying the description approximately characters wide wininst.exe: Recompiled to reflect the source changes. Index: install.rc =================================================================== RCS file: /cvsroot/python/distutils/misc/install.rc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** install.rc 2001/02/19 09:19:07 1.5 --- install.rc 2001/04/10 18:55:07 1.6 *************** *** 84,88 **** // ! IDD_INTRO DIALOGEX 0, 0, 317, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" --- 84,88 ---- // ! IDD_INTRO DIALOGEX 0, 0, 379, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" *************** *** 90,102 **** BEGIN LTEXT "This Wizard will install %s on your computer. Click Next to continue or Cancel to exit the Setup Wizard.", ! IDC_TITLE,125,10,179,31,NOT WS_GROUP ! EDITTEXT IDC_INTRO_TEXT,125,41,179,120,ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, 104,163,WS_EX_CLIENTEDGE ! LTEXT "",IDC_BUILD_INFO,125,163,179,8 END ! IDD_SELECTPYTHON DIALOGEX 0, 0, 317, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" --- 90,102 ---- BEGIN LTEXT "This Wizard will install %s on your computer. Click Next to continue or Cancel to exit the Setup Wizard.", ! IDC_TITLE,125,10,247,20,NOT WS_GROUP ! EDITTEXT IDC_INTRO_TEXT,125,31,247,131,ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, 104,163,WS_EX_CLIENTEDGE ! LTEXT "",IDC_BUILD_INFO,125,163,247,8 END ! IDD_SELECTPYTHON DIALOGEX 0, 0, 379, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" *************** *** 104,111 **** BEGIN LTEXT "Select python installation to use:",IDC_TITLE,125,10, ! 179,31,NOT WS_GROUP ! EDITTEXT IDC_PATH,195,157,109,14,ES_AUTOHSCROLL | ES_READONLY LTEXT "Installation Directory:",IDC_STATIC,125,158,66,8 ! LISTBOX IDC_VERSIONS_LIST,125,41,179,100,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, --- 104,111 ---- BEGIN LTEXT "Select python installation to use:",IDC_TITLE,125,10, ! 247,31,NOT WS_GROUP ! EDITTEXT IDC_PATH,191,157,181,14,ES_AUTOHSCROLL | ES_READONLY LTEXT "Installation Directory:",IDC_STATIC,125,158,66,8 ! LISTBOX IDC_VERSIONS_LIST,125,41,247,100,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, *************** *** 113,117 **** END ! IDD_INSTALLFILES DIALOGEX 0, 0, 317, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" --- 113,117 ---- END ! IDD_INSTALLFILES DIALOGEX 0, 0, 379, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" *************** *** 119,131 **** BEGIN LTEXT "Click Next to begin the installation. If you want to review or change any of your installation settings, click Back. Click Cancel to exit the Wizard.", ! IDC_TITLE,125,10,179,31,NOT WS_GROUP CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER, ! 125,157,179,14 ! CTEXT "Installation progress:",IDC_INFO,125,137,179,8 CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, 104,163,WS_EX_CLIENTEDGE END ! IDD_FINISHED DIALOGEX 0, 0, 317, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" --- 119,131 ---- BEGIN LTEXT "Click Next to begin the installation. If you want to review or change any of your installation settings, click Back. Click Cancel to exit the Wizard.", ! IDC_TITLE,125,10,246,31,NOT WS_GROUP CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER, ! 125,157,246,14 ! CTEXT "Installation progress:",IDC_INFO,125,137,246,8 CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, 104,163,WS_EX_CLIENTEDGE END ! IDD_FINISHED DIALOGEX 0, 0, 379, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" *************** *** 133,141 **** BEGIN LTEXT "Click the Finish button to exit the Setup wizard.", ! IDC_TITLE,125,10,179,31,NOT WS_GROUP CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, 104,163,WS_EX_CLIENTEDGE LTEXT "Installation completed successfully.",IDC_INFO,125,41, ! 179,130 END --- 133,141 ---- BEGIN LTEXT "Click the Finish button to exit the Setup wizard.", ! IDC_TITLE,125,10,247,31,NOT WS_GROUP CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, 104,163,WS_EX_CLIENTEDGE LTEXT "Installation completed successfully.",IDC_INFO,125,41, ! 247,130 END *************** *** 152,162 **** BEGIN LEFTMARGIN, 7 ! RIGHTMARGIN, 310 VERTGUIDE, 125 ! VERTGUIDE, 304 TOPMARGIN, 7 BOTTOMMARGIN, 171 HORZGUIDE, 8 ! HORZGUIDE, 41 END --- 152,162 ---- BEGIN LEFTMARGIN, 7 ! RIGHTMARGIN, 372 VERTGUIDE, 125 ! VERTGUIDE, 372 TOPMARGIN, 7 BOTTOMMARGIN, 171 HORZGUIDE, 8 ! HORZGUIDE, 31 END *************** *** 164,170 **** BEGIN LEFTMARGIN, 7 ! RIGHTMARGIN, 310 VERTGUIDE, 125 ! VERTGUIDE, 304 TOPMARGIN, 7 BOTTOMMARGIN, 171 --- 164,170 ---- BEGIN LEFTMARGIN, 7 ! RIGHTMARGIN, 372 VERTGUIDE, 125 ! VERTGUIDE, 372 TOPMARGIN, 7 BOTTOMMARGIN, 171 *************** *** 176,182 **** BEGIN LEFTMARGIN, 7 ! RIGHTMARGIN, 310 VERTGUIDE, 125 ! VERTGUIDE, 304 TOPMARGIN, 7 BOTTOMMARGIN, 171 --- 176,182 ---- BEGIN LEFTMARGIN, 7 ! RIGHTMARGIN, 372 VERTGUIDE, 125 ! VERTGUIDE, 371 TOPMARGIN, 7 BOTTOMMARGIN, 171 *************** *** 188,194 **** BEGIN LEFTMARGIN, 6 ! RIGHTMARGIN, 310 VERTGUIDE, 125 ! VERTGUIDE, 304 TOPMARGIN, 7 BOTTOMMARGIN, 171 --- 188,194 ---- BEGIN LEFTMARGIN, 6 ! RIGHTMARGIN, 372 VERTGUIDE, 125 ! VERTGUIDE, 372 TOPMARGIN, 7 BOTTOMMARGIN, 171 Index: wininst.exe =================================================================== RCS file: /cvsroot/python/distutils/misc/wininst.exe,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 Binary files /tmp/cvsQi45sq and /tmp/cvsaM08OG differ From theller@users.sourceforge.net Tue Apr 10 19:57:09 2001 From: theller@users.sourceforge.net (Thomas Heller) Date: Tue, 10 Apr 2001 11:57:09 -0700 Subject: [Python-checkins] CVS: distutils/distutils/command bdist_wininst.py,1.20,1.21 Message-ID: Update of /cvsroot/python/distutils/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv5570 Modified Files: bdist_wininst.py Log Message: Since bdist_wininst.py contains the installer executable, it had to be rebuild. Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/command/bdist_wininst.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** bdist_wininst.py 2001/03/16 20:57:37 1.20 --- bdist_wininst.py 2001/04/10 18:57:07 1.21 *************** *** 238,242 **** ZGUuDQ0KJAAAAAAAAABwv7aMNN7Y3zTe2N803tjfT8LU3zXe2N+3wtbfNt7Y39zB3N823tjfVsHL 3zze2N803tnfSN7Y3zTe2N853tjf3MHS3zne2N+M2N7fNd7Y31JpY2g03tjfAAAAAAAAAABQRQAA ! TAEDAE55sjoAAAAAAAAAAOAADwELAQYAAEAAAAAQAAAAoAAAsOwAAACwAAAA8AAAAABAAAAQAAAA AgAABAAAAAAAAAAEAAAAAAAAAAAAAQAABAAAAAAAAAIAAAAAABAAABAAAAAAEAAAEAAAAAAAABAA AAAAAAAAAAAAADDxAABsAQAAAPAAADABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --- 238,242 ---- ZGUuDQ0KJAAAAAAAAABwv7aMNN7Y3zTe2N803tjfT8LU3zXe2N+3wtbfNt7Y39zB3N823tjfVsHL 3zze2N803tnfSN7Y3zTe2N853tjf3MHS3zne2N+M2N7fNd7Y31JpY2g03tjfAAAAAAAAAABQRQAA ! TAEDABAF0joAAAAAAAAAAOAADwELAQYAAEAAAAAQAAAAoAAA8OwAAACwAAAA8AAAAABAAAAQAAAA AgAABAAAAAAAAAAEAAAAAAAAAAAAAQAABAAAAAAAAAIAAAAAABAAABAAAAAAEAAAEAAAAAAAABAA AAAAAAAAAAAAADDxAABsAQAAAPAAADABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA *************** *** 251,255 **** IHBhY2tlZCB3aXRoIHRoZSBVUFggZXhlY3V0YWJsZSBwYWNrZXIgaHR0cDovL3VweC50c3gub3Jn ICQKACRJZDogVVBYIDEuMDEgQ29weXJpZ2h0IChDKSAxOTk2LTIwMDAgdGhlIFVQWCBUZWFtLiBB ! bGwgUmlnaHRzIFJlc2VydmVkLiAkCgBVUFghDAkCCoh1qAd/HPj7S8gAAKg8AAAAsAAAJgEATP/b //9TVVaLdCQUhfZXdH2LbCQci3wMgD4AdHBqXFb/5vZv/xU0YUAAi/BZHVl0X4AmAFcRvGD9v/n+ 2IP7/3Unag+4hcB1E4XtdA9XaBBw/d/+vw1qBf/Vg8QM6wdXagEJWVn2wxB1HGi3ABOyna0ALbQp --- 251,255 ---- IHBhY2tlZCB3aXRoIHRoZSBVUFggZXhlY3V0YWJsZSBwYWNrZXIgaHR0cDovL3VweC50c3gub3Jn ICQKACRJZDogVVBYIDEuMDEgQ29weXJpZ2h0IChDKSAxOTk2LTIwMDAgdGhlIFVQWCBUZWFtLiBB ! bGwgUmlnaHRzIFJlc2VydmVkLiAkCgBVUFghDAkCCtCN63fHS7mJS8gAAOo8AAAAsAAAJgEAbP/b //9TVVaLdCQUhfZXdH2LbCQci3wMgD4AdHBqXFb/5vZv/xU0YUAAi/BZHVl0X4AmAFcRvGD9v/n+ 2IP7/3Unag+4hcB1E4XtdA9XaBBw/d/+vw1qBf/Vg8QM6wdXagEJWVn2wxB1HGi3ABOyna0ALbQp *************** *** 259,274 **** A41F9G4GAgx7n4UYQqh9/BIDvO7NNEjMNBR1CQvIlgbTfTN/DlZqBFYQxBD7GlyEyHyJfg9hOIKz 3drmPOsmpSsCUyqs+b5tW1OnCCWLBDvGdRcnEMKGNuEoco4KM8BsC+3/5FvJOIN9EAhTi10IaUOS ! druwffI4k8jdUOjISZJFsnzb3AwvUMgIFEBqAcz+c7ftGF4G2CVoqFEq8VCJXdS/sLDtLSA81xw7 ! dGn/dChQaO72+b6QmBlLBCFcjnQTGnOd+5YNfIsEyYr2IR8byFn3H+w6Lh9kQ+2w0VoDxUUSPsgP ! 3ea+U5eMGY1e8NAUxtHd8GHOgewY4YtNENAM/3/D30RUC/qNRAvquCtIDCvKg+kWA9GBOFBLBeP/ 3fYGiU307mUsg2UMAGaDeAoAD45OHdv//+0GPfSLVRCLRBoqjTQajTwIA/uBPjEBY7lttgIuNoE/ CwMEKou23Zq/D79OIIPCLokwA9ME8BHNW7f7Vh4DygUcAxHRCE8cicG/3LYvVxoD0BP0jRoe7I2F ! 6P7dsxEalGKkC2iw81BmC7Z8254QH96Uzb1t742EBQ02+EZHGlAbJexkZvcDtXXwHkRhSwRoV9y9 ! 1AaYRsq8BecPXHRG4WDdd0xmi0YMUAQOQfd2TlB2hZIJ6S0AjbtrOPe6Hie0Pht2FFENbTTbb+xL AfodGDkqFO5Nd2wbGBNAUItyv0AKUEJf69zGagZVFLQS/xoVOcbh5HYGjLR51ppw/3934ev3USQE RBGKCITJdAuA+S91A8YAXLlbOeNAde+HQDR0F4AjNRkmtlUWYV8F19gbrVkRJsBXUBTUlt9sBcfY jOIM0GoKmVn39222/PkzyWjocFEAHmi8AgAN0SyZhkVAPzBQbramtjLXGiEUFUi+oI5oS0fYBFYv WVBCDwFwct3dOR04GP/TaDbk+9qBNQdgIwoBFdOpM2e61xhfPJ+edm+tmcD08fbCEADauACare7b ! BgA9rOFOO5SBu8P92AkQQIWsDKd9CFchbdjVvgYzoTiiPH90FJdoctO5B94iaAEEAGmgVQbodHz4 X1Aqf8cEJECg/QDwPfSZ3GfhGuQ12AUg3f5dmhpN6ANB1mgAjxZo/W8jm4MMwKEABF+sXusnutbu TeGBeAg49XUZS35wNfO95x3RdFzgKWwbrvDVg0unCkIIOKBr0Pp1Oa1GKaQ3/vbGMaEdQItQCo1I --- 259,274 ---- A41F9G4GAgx7n4UYQqh9/BIDvO7NNEjMNBR1CQvIlgbTfTN/DlZqBFYQxBD7GlyEyHyJfg9hOIKz 3drmPOsmpSsCUyqs+b5tW1OnCCWLBDvGdRcnEMKGNuEoco4KM8BsC+3/5FvJOIN9EAhTi10IaUOS ! druwffI4k8jdUOjISeJFsnzb3AwvUMgIFEBqAcz+c7ftGF4G2CVoqFEq8VCJXdS/sLDtLSCM1xw7 ! dGn/dChQaO72+b6QmBlLBCGsjnQTGnOd+5YNfIsEyYr2IR8byFn3IDw6Lh9kQ+2w0VoDxUUSPsgP ! 3ea+U5fcGY1e8NAUxtHd8GHOgewY4YtNENAM/3/D30RUC/qNRAvquCtIDCvKg+kWA9GBOFBLBeP/ 3fYGiU307mUsg2UMAGaDeAoAD45OHdv//+0GPfSLVRCLRBoqjTQajTwIA/uBPjEBY7lttgIuNoE/ CwMEKou23Zq/D79OIIPCLokwA9ME8BHNW7f7Vh4DygUcAxHRCE8cicG/3LYvVxoD0BP0jRoe7I2F ! 6P7dsxEalGL0C2iw81BmC7Z82+4QH96Uzb1t742EBQ02+EZHGlAbJexkZvcDtXXwHkRhSwRoV9y9 ! 1AboRsq8BecPXHRG4WDdd0xmi0YMUAQOQfd2TlB2hZIJ6S0AjbtrOPe6Hie0Pht2FFENbTTbb+xL AfodGDkqFO5Nd2wbGBNAUItyv0AKUEJf69zGagZVFLQS/xoVOcbh5HYGjLR51ppw/3934ev3USQE RBGKCITJdAuA+S91A8YAXLlbOeNAde+HQDR0F4AjNRkmtlUWYV8F19gbrVkRJsBXUBTUlt9sBcfY jOIM0GoKmVn39222/PkzyWjocFEAHmi8AgAN0SyZhkVAPzBQbramtjLXGiEUFUi+oI5oS0fYBFYv WVBCDwFwct3dOR04GP/TaDbk+9qBNQdgIwoBFdOpM2e61xhfPJ+edm+tmcD08fbCEADauACare7b ! BgA9/OFOO5SBu8P92AkQQIWsDKd9CFchbdjVvgYzoTiiPH90FJdoctO5B94iaAEEAGmgVQbodHz4 X1Aqf8cEJECg/QDwPfSZ3GfhGuQ12AUg3f5dmhpN6ANB1mgAjxZo/W8jm4MMwKEABF+sXusnutbu TeGBeAg49XUZS35wNfO95x3RdFzgKWwbrvDVg0unCkIIOKBr0Pp1Oa1GKaQ3/vbGMaEdQItQCo1I *************** *** 278,535 **** CRr+kblnhRsuFjPtVVVoi+CgdGcV0zvFFl/BzRYuOUhVroYUWnfhBaHBQYk8gw+CNd0SAIgllpQV Nmi5OEMoKD1G2PC+WI1xaO/yFRXkFsuxDKAzdgognxJYzBS75WvYb7AbqxhomW29PlBVNUy2bIPW ! VVopivgstIIhyVjoWeYgY5vyVFVGiWiQNpbdBpGiBHBxVRvca+83Z4bNAnUf/zUeBR/cjJgZYKnc ! I23Zu+stUAnrEGjexY9fHEbD60XEIMQ42TNMehjh/1dXK2idVkeMbRc2M3UEL+sC8FfvVsnkImHj ! iL28fMPQOIGa0Zz4UzPbteXeLpoZAAxTaNySe/w3tDGOGhhgFwcwQQpyUzXzm2gA2FNQjUWYxzlL ! kWVzcCf4HO/1s4nXON3K0bhhgdmNVkXt0TvDL17ia720OBj9jU2Yt9XiXOrM9ow2nFNQ7Uj/tBfp ! 2bRx1uMQZNnWSVusAazX2ugpttKS5vj+iCNi7MnabHbHIKrG2drbbDXs8P1OABbwNntjZgwIEB8b ! DLBhd83oWTfoaJp09+AeWBcY/PKEG6ASDl6sUhJGEqvAF0tgF2ToNP0k0xm4lF4t8QKbPZcXXNeO ! Y2pl7gIEAOsDbAMRZnLIgmjsEDK4nTnYThBzYYydsg5XYR3PATXr2SZLyCHOFiBoBCYHBFhEclIb ! +JKtdGwxPYtAs9Dj7gg9Mex0KT2ATdNgLITAA0k1U4fBn0b7vlWJPSSiZoDsxUbduJ8RXIUNFhSx ! M1jjnt8coBQ8R/f3ELVZu4pZaDCmU1GP8H1aKI4UHUAAnwWE3VToYOECyUc+OTVsRXjvNjajNGx0 ! EmgUN8KGvLv9Igw3WR6UoBkTaPhxMLGbFU8aBRMoztxgUjMDqQBUjQntT9pXdQEM4Gg4cw+UxCQd ! 3jXQIsFw16Z/+4f4hVUFg8j/62ZTCZhgCTl6H7gzlBQH4pGdobMJCLYK9HLRHkya9OQQmMetxa7y ! eYkweyTTVl7dGhg+pOOjfxL0V5fKIxsZnF5bX8VQAa3g4C2hqgsGQ6GjFlsaEC+QBrTEofB/BEHr ! 9g+3wcHgED79MBvjseK7LhJTxNYl+9EdvX1WVRBBFL0DNxu/UYX2uZGLhCTmIQMX/vfYG8CD4BjA ! Y5dFYytXdzb/BY2WK3NJBvfWJQ8oCpQkdC+SNttyHYkEJgd0KjSGNibsaEwsLKcDh27ZBMwN6GeI ! LHBvHwlti3YElHWEi1LvpN4GVIHE/R4A1C00SwvQW+wQADr/Vof3XhsVbTE2ZGcuuZF3hAEG6QC5 ! Ldtnm3R7Al4hD4X+PAFOuqEkoOGZDbhzXoZW+A7VTl7b3ia9cBhW4s5jS3bqzqbWLlfQEKgOdbNd ! OQ83k4vUrJodKzv3D2UZajAbTyedUBEatEq80HOdfY1gitCGnCBkAG6sJ7JqLuFgDdxJ4P3YR2iY ! H1x1Nh83fsH+aDzrln0N+VmH6xuuEzJhV4SLw8ZhmMFGDQjmk/sYR+B4G4kGaVmJRgQDlpYwRiJe ! fCZWL/xKpR3xCnQ1gk0IUFBZaI5RvAWDEaQ7hLMjjJgIbXCxHTDWPZAYBogdVzszCSiUnSvwJjiL ! 7D4SVjTgYCNqh7PwFjnQuWkgMQnXGnKFGqF+bHK7BK+wdEmrFTd0QwSZpl9oAddqI2iUdJj8lQps ! gzfWGAYwNHj//r8GBw+VwUmD4QJBi8GjQuvHxwUHadcOGLHd7F3DagzpyUxv4DxoQOgGXh2eJk7o ! QPMcB9wzZqMSrialAOQz17mG1mwfCsTIGwkAjZOZxCLr2yodaKCc6xxBv67PBoazS4gn+eTE2c5g ! kXUNwEmEWTLBoaPTdixoBsy+9x2AaA/TBbqkc4O5LTgFYylU9gyzQ/oXTUYshrlGrIUaMBFqbC4W ! eEgvRD9EIkYGHqi0wBUY77DJLBkVcDXILGazGPlh/5gn3tIkZLnBFGtnhU1g/FBeXFAAjGZnTwxc ! AF0bE5GyVgnARF+CfashhInwAXUcPYBGws6MNMIzYUJoZhggjyRWw04GLGgYQImZ5TtGhRh1avwU ! Lnn2hmQUafh0VwNhA8Fizuh0sMBsLsnkdFR8HEa2GZQ4zs147DvMRpYfdEA1/gPvA9jWiXSlHEC+ ! qBdlRzZgqlamVqLKZIFheV4M7+QwGoNWPDX8bEhGNmIFPNj0K9YyXhE2RFx9pwvduyS0XnTqylkD ! Sg6IZyiUJCVCWTx1Za6D5C5xgDSEswh2uyGAKSEQj9mHxBFyBF3VdLvE201UagtZEY19xCzzqwaH ! lm509IkFq6sAaMATb9vYDKsakBOMG78ACBcUWnMjWcAwiS8v7VaCRiwLHNyL67e2tQPEG4gVBwbM ! a84E2wcn1h/wKytk7M50Emwg4hZAGfSXnDy5bXka+G7NsJ0nlCOfiY5ctDnozow0fJjBBZT77ZbN ! LAWsjH+QIJt1tALyFbdlvKgPpAQqKHjDRYTZEzU1LKKvPpYuJGy9+7tdhnt4q2rrU76AVXgELR6d ! /dXX+hYWWS1owbFZ4QlWU1IfDbYTvGUjQWogZL0Wg00VAQ4P3aEzs4RUE6OXGEQHfCglkWoKSJ5b ! QrZHNF1AoCwOPJj5oyCiflCjdMWQyiZAFA01VenqNSyhN+KFBuMZoLakE2AHDI/HC8sLhUj/WYgF ! ovCyVU+A+Vx1RMTy9vaKSAFACDB86AQzfhZuwbL9N8pyddnGBg1G69MFCvRPOljC1RdRvHw8CtC/ ! ud91BB+IBlIfrYgORkDrp4eMVWtRhQgoUwsfhUObg2VW6NjD0vCRA9yGFEC95OBf6Kkrx39u44n8 ! 8DThMvBaWhl7TGoYHsNC2LvACS2o2QrQ7aYl9GbCPJg2pRfcJpSmjsFADDPY7+xpMxzIiHZWZozQ ! IolCLNBdEelKYWvWXAQLLQNTpukKvaDs8Z4K+HDCip0GAGKRYAKAebZipRKkBO2MbG1KU3V4pH6w ! B5HNoP0Md8gR7BvrZAiEamTt/Nmu9+xUGDu/8BD0m72NZBES1OAQRaxnINgdJQdm5iu+cGpEJahe ! VlNwkmtupAJaGtSeThzbbPeqUHm3U1NEKlPbGbiFZk3YPmZDj6Ry3QFfDPEf1moPis52onbsCjYN ! ZPu2kS2dYOwsyAjWLBzCO5sTXDUjU0u9Pl0JNGpbldzYS/fLQqnbSkNqXVMN+P+Qq9IvPIAnAEcF ! JiFLlI7GA4DUZgjBg4DEU2IBId3kue8EYAhpXUfJIUM9LQg9YiMlLTri3YVeQkF1AhOhjA5GBeaB ! /4M4AX4QD74GavOUanXnvrgRiw2QCRWLCYqQ2Ek7tj8Ir9BWnV5P5CkyEHx0FNjYoJGObwjAV5cb ! ZVve+AL0CV388Ao2dNsEiAlT75x44z2LUq26pgGYCf9cO1jhGUsehB72G3eLfsYIrFk7w1mFdRYf ! R4JJTWhTaZkdTt5vZ8RqKBz4KPt1C2hYIh04I+0ZHAiL7FuPvpo0iyxms19QOInZKFsf1FkMgnt5 ! iAQDFYQ16xoICbMhBxYaDeB9f2NATuvEgKQ1SwBSBr9wstqLTQcEj0E7TUFk+4a3CXwbgwqDwyhT ! V7MwQGY2xySNxq1cwWDihVVuM1wkL7pAk3SxVy3YVIzoWphMmM5qCS3XKEj+GCY0cMVmaT+xq/ZZ ! crsYhk+OHw9z3LjrWuICB/jxXx7/MFNgx56MJoTrADOLGNA7h2uMtvRD3Go7x4fSh991RS4Zo7sb ! //NzJAEch7p+2GzZWgQooH8vUpiymc2VFwiPMfx2QA4sXuB0GngzciAHyBBTgRzYy6L060MptEAO ! 7M8IGH/rICGghUJ75AfpWYPqS6XWGJELa/P+flifGNDedwVkFBGzTRnY2Ejs/NcgCsBSP5pfRXX0 ! K3d8M/eA+hTrGxYfHChvEB6WsUD0FBak2gWDakVdF1tYSldw0eqZBQyI1aUTnlnDV74q2DjwPgBW ! NP83nwNOfIScHipZo6OQfWbaoA4IeUu063to4xchHvrMwh6iYMG7ILGjLLAQFQLrYW2RDrGmIPgH ! OSRA07H2DDAOfRnzBz/2DwkO0AQfQHQcagaLFYZ0uGe1bFlgFJ4avc0FkRLEGR1qxRxRojUBiKIb ! MyFiUeeuCID33FWmNuKD/ysKrvaq0tSAmPsMG3WAVccEGRtVCtJVvATRiYVKXbsMhMUIRqPcDwM3 ! i1UIGgv1VrR/TALqVytBEAI4IoE5N9TGTdCNNBAIw1s+elZqbjLbNBILtziMrwBOi/5vUfLBDYvW ! K1YEK9GJFaC1sa26K0YIKLtX/gx2hlm/gIkBK34EmCOxdHed0Z0lUfybiFZShK1ZyerSFtpEP+Ya ! 6OyEGzY2dsgiFQhStfJUCBCs2r1IDHQuF1dQuVuNEF+Q0GzrRyQOxsJwRaJGzMzb3/4/SDPSO8JW ! dDOLSEvKdCyJUBQCCP1C/y8Yi3EM994b9lKD5rWJMYtAHIUDsLsgFFE/Jbzgr+wzwEbkuFkIkAD6 ! BRMw7Qn2dDqLRtuahabuMxckLD0UDbll16IK0T8z3Aget3RbvBooUFHkJA3HAAASfAQwVOJWwAPY ! mq8p94oBDRbY/rWwOsF/5zl8JBg4CtwYsXdwgsA793UKP07QW9O3ZCCJfhjPCmAgYEXO3BrfvH4o ! OX4khA4kgIHNAbjGahhhhLMn+E/StYmGPvxMJBCJeBSLVv373V8Xz4l6DH0MtPfZx0AMAXj5CHxZ ! rf3XvQQPf1QfuBHT4IlKEFLXT9v/hVE32hvSUPfSgeIwRGVSfib+1wG4PBnoQU9WOXoUdQ/hW/YA ! k24OnJjhyWbdC1YbyV+4+mmeJywZEHFTVRA7lBtVfAQEdgoKm213+QOhPgAI8ItUI/cd9CaC+gS/ ! +zWVw0u9BcHg20P74/uJXBmJCMgND4fEtsLDG9ckjYA1GQS2PYhtR9toSR6JDd9Biy83vo1vBYsO ! ihEcBDUWEASDub9R6uEPQp4uFnQVxwANVe6SecHdbBiceXLroiIDu3H7i1AQwekowQhddhgka20D ! k4jwIZ4XBb12hZvnBBFIM8mOZghAPW5N33aLXhyJSwaJvR8D/xJvsROJdkMEwWYDwff1hdJ0uph7 ! 7yHHA1aU0d1fcOY2Pnlo9sEgJYFjKTliw84HJhzYVXD9aHHaJuxfpFAI9r1i/XUYowJV82sbFMxa ! LFwCkiIutdltAU9pAnOgM41IORdpq4JSHhJEvtnWsVQM+QvYDDnjCAvmzEstAmPk7a7x1tzhStzB ! 4RhIC6olW3vkSTQJY+2G5jQzg0hCiQY6HP7WFQoUkIFIN+IQA8qJSCK5ZMA5Cr6SS4bkCAuEw425 ! 2TY/OUg0Es0QYZk26+UzAnIgmFnpWH7INhCkaAJ1CYvHnFu2g0vCCKdncjIL7eBqY6QWUOEBdmdH ! bscBAzkWSE8wHG4JN4oKnVPkyFkhLD5WAgTCZJIDDtIgCSPsEIkosyHtQkJIH3hOMPPLSPaaBrj4 ! O2lZwTANLEhwAG2FZbMlagD9DLdkS/JDASn9BrndfjE4C7cxTC4yAyQ0s22aZl6d2CQ1F6WyaZpt ! EjMDR4G7XDUgCbzMaFt/cLi9eNNX8no8iUNsbQEodEgEDwQFG7zRWky+60coUqZXsOutA8p1BnUN ! PldR3XhHNuo9fCjH8gFGNNaCwLYCMA447lEIXTiAzyB0DnGy0EjWdmsfYEcwwMPfuVbwFfxtahpk ! Jb4o0WMgvkn22Ch0IQfBB08ouTjgWuBJDRpfK10wFNmXelcojJDkHmMw6sNyQAfNYVuZUCgoH58a ! OHc6K1EeLqKXqkHCNgLiA9iJ2cJbHoleLLw4yASXvVgMPaoAg61F96HslThTbzhV+9YaWwMpQ7Jr ! Ekgu4luh2kv/MRAwVjvIW/5d27BUChVEcwUrwUjrBSwH5/IFXB6MA4P4CRkMGOp/8IWcQ0DYGIP9 ! A3M8b4bryQVdlg3G5L//b/tIig/HFEyUi9GLzdPig8UIYwvy7b3rukcxiTiJL3LO6wQ3r1ML/FaZ ! B4vI0ei1AXIscNN9iUsYd5FjxIPtAxkBNr3/9s0cB8HuA9PuK+k/sycuFeqoDkFIN1IXE7vbRleN ! DTBRDjhSzh29ruFEjCRcITT42lEfKPF2DyxSEN4QNYyc+Qp0FImute9cYDEz9lhxBmEUusMbcgP4 ! /VgUOLcu3s4gcyyp+vqgBp7LFmg/TCxP9nxAcaHN4CcA8tSKi84LvCs1guEHcuoQM9Gvot3a2384 ! 7YvBO8X6BIlsXEsmAS0x7CCLiQPpTNLDJjq3F7wqxxwFhZ0W1Q3ftXwaRDvWdSO/i3soCt813osZ ! i9c7sRVzByvCSFfrjm0XZCvyc4k1dWe0TEE6uFChSAT3UzQYRLovtlYHRzBq1qNM0Ta8zToxK8pJ ! /0ssBxn5bs8EPlV1IGL31rbJzQfyTovOwovIpF4ahgl3sAsFhu4NFsl2ncI7wQXBPl+i0JoURDAk ! gQLzpYvD4xe6yi0c3wMr0POk2lwbbXu7JUQDUg1LXRXwGTrTtSsMFol4HCmMVZtb/mj9Qxh5BwN5 ! jCEqlg5zOJAxrpIyDpLSFpuj+yX/PyXIIJgfhx0LfcsdBtbQPOAIgdYU3Nz6oAUT8gUuBX2cg77B ! H0aNhAgC93dn4yzdA0go+VBhDOLEG8+NBQ5IDsdDbqaxt2nwBOsIrnFTknSh0Y0IEQqDYi1zaEwl ! v/NZMr40BgN0RFqYLAhOsYv92BRL/BCSSwzFBJG5QmuwYQgIA4Zq3g+7h2dymDC4E6HIcyE8Cu+1 ! yTTHMWk1oEvb6eY3IHLfcBokb0PO0GDpEI1TUVI0V/ECcDZt41BRPZz2kG0zu/CFIfsI5gXDh6+w ! T2XQNOIfN068nQU1Al0Pg3vS3o9H31k76HMz40o7BevNvdfW+vlKmPb0+R1rbggH+i75zYv2Dv4u ! yfiMuRQjxuZUwQGN5rfVoLk0drRVEJdwre12NHMbySvq0QxFhG2Ha1gSinFApDcs8CN4fKHfErnN ! dAMz8oPoEs2/5C7xWSsk+AsfwAs76XO6BfKwO5ngBB8w9mjkwJ3pyex8NfrduXdViwyNqSPOJrzX ! au0OFGLUkBu5jHBq1xUc4YwK17v10x4D0Dsqh6l1040SS7kqORDpmeZi7kLwgpMVDdodvr1U+Ir8 ! 6wIAqAxBSJmP/HX1OJDQHneJXnqChYFue5mYFUAkJlFQx2bM9ECN3wksJFES4K/hWlI8Njs/UUIF ! kY0CJilrzxQd5lkDZQkHQAYPQqTpcZb8JB8VTGYfTe4kChkIJTTPvqcB13c9nzwgKxxzxxDYeVCk ! ToRXBIBtIcsEBilItBYWeA9zXms8MJfrVhdb2ATQK504A1ZWc/DiTOjOTe6jU1+D51HMSbESzTxb ! e0B0Vl1cvDi7tlQAHScMEoUHTT4NIxhNHArOsSnMIRjM10ogidIAwVySDSwAoZ239drGz4smaJqW ! 2umV0Jp7bUxRd4XaF7DdDrkkkKEzBjDDaePQhuBRXGH9y3OzxpszGBh6P1VR8oP98Nvk12r9K9HD ! A+pQTktsT3YlTI0xi2k5URE217DQKwFmkuovWQLZbhVSUTpDhWWnvrUyasdBGPg9S+Z+rLVGQEhI ! UYl5BEZEHDjCEBgRSyDoCK7RJrOs8oSnsDcIs4QVUsjGwMV7JFTKxNCJz2cAzjlBBJMzuLegitH3 ! A+6DUU8wJRDc0Vi4hAVDS0UTn8+eCiEQPmr8UJR53mEkG5DUeYzPQAokFCuOGCibvZGd/XUGW6XB ! FtnDT1GoOiNCso7XImiUFHwqY4QtnrsOXNa1kVLdUAaXkGYQNc+42lbIJLj+gf06F4IhXyRMEg7Y ! QhDsGFKE2COUBT4JO5WSN1JcSFBSeL3es6YHDECmZiwndHfnQVBWU3RLU0Kbe4/RdDehe+ggN6XK ! 3z4uiVYEf1Ar1YtuCOMg30q2bn0+Zgi2ImMcGDFDf8catFr4TFZVxWNDL4U02UtWmTuAdAhJnZig ! wBDChJcNGNWEIJORU09hr7H2sP5FQ0gqQ2y2G0//RDcUPTgDsNs5y+VyuYo6cTvAPWdCzs2yWzYS ! Q6gnxjcoqVxSzIA+G+8MAFtAA6IM61e4UhTgGEdYaVEuwFPdi1hGKA5wfq8YDRgIV2M1FtgB6U+3 ! gBsxSLvv3XUKd7FAz+zCDMBc+dsPhvi947vvEVWB+7AVmcNyBbgIK9i04o+7gg+Moa3owe3bLgrx ! W2EQihaDxhushxxy9lbxA/kI8vP0HHLIIfX293LIIYf4+frIIYcc+/z9g+0ccv7/A028zhGVYGSf ! yRVupd62FhJGE0h19LENufFt923s8vfxTL8IizX39+sQW3eri/WHEzFdF1sxCQ5v718LwQifEMom ! +JUIUG5LRlBpIAe0nXRJUo2OdwTDDx8coTdXqLFbhSKKT6NFbwTecYhQEFoMiEgRdQAAHAbcQQ9I ! GMPfFKGFVzx/IHbOA0ZBY8GEkvBWyMLmoi3abgzBDDTBp2nC1X7FvBDCKNAH20YsB4kzTTo5fsUN ! 3/4GbFhNg0eghQ4cGp3OEAoHI2dtCpJsKEZ62MrV8iyJfjuMKSu1rZYWInut+YWJBlsjWipl3FUv ! lFYM2LCjUiJNEU9VEHeS2T11RezqyKN+HLjgOtO1SJ0oDUCuNJCxVlajMDeI/2typXQTSffZG8mD ! g8Gf+8VW701hNg1mYxDFUq1EuBK2RYfVW2OyRVj4c0RAXBfPxYoEug617fcCvGIwALKOz9Pg0Ps5 ! 9yUAxwgLyDZ54CxBP76z0V0KLHK8roX4IwjGluogCFbISRiN8OhXEhTT6LhuwbwFl35FK/hAigHF ! FotJmGm2SI+VCAavlehu9KgQdLvgD66Lr9skXawFIh8CQK9FHLRBdcOob+MnpHNDzh8HgtpC2Huf ! ORqvSNx50EfyDQvn2Ai+e9/MyYsETLlNBAPIzq1mutZakbDUcgPXmitQbdP+9UVySDAYzGVelgMJ ! SxhFRGSGA9IwDEQEhfBSIQg3C2UMjQzBiEEMAfIA2AIMGMghhwwFAYcCFG9+A/VuwLFrFdV1A8Ir ! N9pzpiZA1h/tI6MaXiGWsVoBzX2qxPOFlywtjnUhqUFpsz4wO8ERVC1he3BSKQz7COsPNuLUEX9n ! hhRSZKRJlIVyYjwNJENmDG1iITfYyV1jYSJej0LcEtlintsBkO7vkzBC8wmISv8RQUg7UHjuI3II ! pgdODMHA5uhmSWHPKDewAgU2pADj3ifjo+BNCogKQkhEgCvCwL32z6NbBp4UiysK4sdDH2sGChwr ! zRMXEarpThIh9BTDSgmAgKubMBjg2GIgPwIvUGVq/SvNU7a5wtxWUEnI67SYyoMsVIqJA/y9H8o+ ! g/8HdhU/PIPvCJ3hvRKRTIlMN1CqQ2EJtouyY8dc0Opis04gOivgL2V6bW48+VMr/YtrGmGF3mTv ! iQtb/pFMJDwSQQEvkolsO/6QJFkuu4VGdOEDvEdASP42y+WydEmSSmdM351LEeSrEeIE+QwoHnpk ! IFFTbCAg0elYtBN2EGejY9XN2Nt1CaFbWXXXAPDjHLJWVcmNumsBN1BT6yBSVaMBmegXpROFPkyi ! v0RbbdP+NxpbU1LHRxiX4kSuLLxXNF1e2yh+e0we+3QGg31VDB8s5qKmCL7CMCl/T1gsz4Hs8KKM ! JPQfxK5yBvy0JPDtmqZboFfPRANITFBpmqZpVFhcYGSmaZqmaGxwdHjYIBfwfImsJG8yAdLbL5Tv ! flyERI1EA0NKibp8dRfo7TkIdR9xGIGUFwv6r27AiSmJKvqP6ouxhRqcF7kRjfjCBnqYO0M5KD1B ! g8AETxt0AyZ283b5zXPHvhuPBppiug8rtHg5Lu3iRv91CEqD7gQ71QU7+qUsdr/xb7MlVPq+UYk7 ! 0+avcxKNXIxtsHv7RCszeCVTwwTREXLyb5UVboYIo4UcDESNM+oFugMr8bpAeRARDb7uZKIDzuWI ! LAv23839rUqHM9sDTBxISeWMHBd1V4xFuO/dPYu0uDUy0M3/HBWMhGNdwHYcPShyjA2JGgqPt1x4 ! QokREnscCN3uiG9DO9lyxVeL3/dCjBRwmo2MNZSJIV36nmkoA3EkHmHH2+mcI8UAEsQdPBQaH/EP ! j4ECMzRlh17goUgNuQo7SYXSt80t8OwrPiD9O00PjixysL0HYBQ41iz/C5bcLfhsujgD3yvTRUv0 ! TPQDzzvX8CYa1ycBHXUcIEnLuI2WaKb/fQE7x3Yng8//9xotxxYWcBtuGEEErn2+xRTt7hZt4B8H ! K8cScu2X7diyhyS/O+eLsXwD+DM2ctSB/4jY7yaw99OHICsswi+NlITYNqkbB3qJOIu5P3Q4Q19E ! 2PWITKC0hCzWy3qJJraIBTG9xteLSvzhWy3874v108FDK/CJFDt7T3djdJ/rCUoYKODwEbpiwwaP ! /1qMbp9ue8OK0AkcKtOIPTGLCAyR29jAG39yB8YOwOufNyn/6LuiDJPxcxSB/skb0oPi1ZXdhaD2 ! YIhx6yAgFA7IfUej5gKKFDEMKdwW79aAwks0MSGxBPYjC1+0DockR7riLWxia7y0OxVzHrfFxm/R ! VAgwd4k5jTzVpIRuZzhxBIYdcubVFHpfcGVijcIxgYXCdAi0FuH2M9DR6Ad1+FhKDtFGaDgoYIwc ! jQXvCu2DMSRPI/rLOl8Yg+gEF+xHuU+IJivfOTOMceJYCCN13HUVyKmhDk9KICvSwhynj4+HUpBA ! 68GaML2NVx5OkRtCsnRX39c79XQXkSwBdE37uIC1FgEMCoTAsAgkD18eywOto2E4aBJ3BpAGZBgL ! XzRwOIFmNFVkGPBWj5M0UtPYaBBj2EHuAqCQYgQVVVIvFvUScIX2EDs2WCzigzgAQEwoSLcT7Uw4 ! exZMCGQDe6M7UVYeqFJRS8Dvrd91JCeDOhYIgf1qdxN4SwAMPx2rAWmWE+RPUdgIHPJhHvt1H7zj ! yAePbCP8dAKYMBhZbC8jSwYT2Bl0QlRFkgSzBCMPDeLwBd8NAHtAGQDKXQDeoQQKnIkCEPCw7W6U ! xwEIEccCOEDIUQ3YOB3tDGNr105tNYB7wHb9wXqjbT93dgMVLBF77zvo1uEK6FjopzIg9yX+SMMI ! 6iBWFCvFA9XmL8FCbTBWljhwDotLATcqxDxVBTZDPDGpHjcSzYv3pKZfuVQfWcqmA8UXS1a1neMs ! A/2iCnV+QUROt+jcKA2RdR9zNOpyhS3smivunxCEV4McyHJHV1ZHxRZqrDB8zV74hCjYe617guSM ! ii4YTr1hWihUiVFgCV+pcjUYXhuHXrwfzFn5i6iFC7dpnFEgO3EwNzjqH47dHTvuUUEcOXMJK/VO ! 1VJdLuTOSTHN6SaUe4E2tA4czSW+pCwgg/g8IotJ2OqoE0ERi6XI3u5LlBphCAvWRx1y4lj4G7zF ! olcwI8rIihzOjTTO3pmqjSyE5TJOAdPqOghcAQRnNzngBwvQBL4jawyd5MBuH2BeBDYDyzhVdMH+ ! AXTHg+MPK8M0MU4kW/sKDavLI6QPljSTTA8gNBFyZMqcMQUBALyZspTPO8NzKwc0F/ZZGIP559Ul ! vmo/h9dBJpdyB2vUlrM8WU76z3DBXFE2R+7H9UhwIQgF15S8SSjYv4NvETv3cheL90WKDkaITf8G ! rBENPoPrAusB6yetFfh2cSwfO992E4sdHDODnf0ARUZPdfYYKBBLnn5uS7brGb8GBBlwRUnYEQV6 ! gWEScjpd0dWPDnIz+UbrPK8KtXWcEEkEE3QL9TbHK/M+rPCyrTuTdy7i8w+CBy1JR4t0e7tAc9nF ! ZcHrHtlzAt6xeoEeOCv5M40UzZqXYIyNwsQc+hZTRggKhXcQ6s+JPitnVjg1q+QNVulzFSnAXmIg ! dFZXIBc2m89a2+CMfK8dcj8QZv71bWelmohoAytBS2zQrVhAizFBOXdf6Z0O3olBZ5r9Zp8jW6O4 ! /yU4fQU8QKA3IyNITMzMUT2+hR04aC0IcofpCy23Lo79BIUBF3PsmMQMi+GR7aYSYM9Qw8w9UA++ ! VJhcRWr/aIBTvaW+y4BbZKGhUHQlB2q8FGwYaMuJZei+oFJ0Cf1qAluzuYqbCoMNPHwGQNhRlKJK ! tA1oX0NkAHhiYQ1ksaK/I6H8GgCjRHVzW5D7S205HUAYNG5sTpuoP3MAYRhYaAxhCHBqoN5nJ1Kh ! YD+wlNlubokdXAwJnFADkDqipaKgXAj1BLsADPkyAE6hDHvf/Q3qMIKAPiJ1OkYIigY6w3T2gHzb ! BDwN8hIEIHby1FvcNdvQTqSwpvZF0DMRP29vVaTU6w4rIHbY6/VqYqlo0QpYletougb1pIodZ04z ! HEegN/xrRexUCYlNiMtMWY3oBRcKLv91iArRyNgIYygFFBDM195YmAMELC+CJaxQoFaSAIR97rkv ! +GDsBQ8AAIgqGwQVIE3znP//EBESTdM03QgDBwkGCgU0TdM0CwQMAw2DNE3XAj8OAQ8g2//b/2lu ! ZmxhdGUgMS4BMyBDb3B5cmlnaHQPOTf7/+45NS0EOCBNYXJrIEFkbGVyIEtX3nvvvWNve4N/e033 ! vfd3a1+nE7MXGzRN0zQfIyszO9M0TdNDU2Nzg4TwNE2jw+MBJQzJkF0BAwIDkAzJkAQFki07zQBw ! X0f3vSXML3/38xk/TdM0TSExQWGBwTTNrjtAgQMBAgME0zRN0wYIDBAYFdY0TSAwQGDnCUc2stfH ! BqcSJiRhq6+zMsgg3wMLDA2toy4IbiofPgNsVFUGgAbynwCoQ3JlYXRlRGn/f+L/Y3RvcnkgKCVz ! KZhNYXBWaWV3T2ZGaWzevVmwZRUrEB1waW5nz4BZyhcQAkVuC+b+22QgGXR1cm5zICVkUxcUgf1g ! CRNJbml0Mhg3C/CAPs9cb2Z0f9v923dhHFxNaWNyb3MNXFc3ZG93c1xDv/x/ay8XbnRWZXJzaW9u ! XFVuc3RhbGyt3X77AFRpbWVIUm9tYW4LaGkKMRbstrV6QpB3pWwgJGd2u721FjQgeW9EIGMpcHWH ! ucK//XIuIENsZWsgTmV4dCARF1srtK1dLnW0HBlLY7qt295lbBUcaR1oFVOxcFp7gMFbLtt5FjKN ! bO3WwAEuZGEPUCAL2OuCoNku9dMg7OYONgZDbxGVXEmgdlvZ9lBhFABDtShms2FraIZdmDJn3HS4 ! 5gyJbClTo9/63b6Gh7Nmp3PELqtvLmaRI6wAG2OJ7kJ4yxwUIWKBe20Ih24MVrSlixQOF1yoTUlm ! X3YfHN0rOiyudlVMY2givK1tEmczBHkqg9pu4cJAc1p0dnMsKghDaMdvQmEEnYntbQkDd4P3X09w ! O4Vua7RtEZRMZw9SLZgrbNtfUxBwwFMrVCM0PNfaRghsIwvHUD5m229aZ3JhbU4CZUOTaZhw+Pch ! D0xvYWQE323u3UYaAN8lY29Y0HQGrOHRGl9FJTsLLn7YNs0HGnInMCenMTAwDE1tIQRkEnY6JU5u ! gwkvcAAyF0WtMdghNRhF31toGydzHxtPdgZ3w1hzbtaqINnpFidC4ZBsHhlNt2u/wh4/ABtzPwoK ! /AZt//BC+FlFU1NBTFdBWQlv/449hC4sCnAtTk8sTkVWRTj2p7JSK0NBTkNFTFxTS9two2DnSwdk ! det5LpcMcWgD9/q3Nw1CksmwIhVSZW32yu9wZ1VleGUiIC0UAt/CscIt+iwubMAi53et8JC1YgMu ! ADA0PxDWsJVulURCR1V1PVsZG+0J210CPX4ARLUdYTBpUoR5/TerDnuSzWQ7MktleTkKBBZumzd1 ! bCBub/pjAVLBvXYgax1Lkr/pZy23bCPbqCFTpTYIHexjvyoAI3dtSxj2CnJKd1kvJUM8999tL4BI ! OiVNICen+5syl7L1E0dmHriwFLZzaEgrYWtbm2SrO/4WZBVm69ad9ABuCgCRZxZfdn+wIE02D29j ! D2B5C8bo82J1aV8rvGdq2W8bBUPeGh6GReAAMAdcAFObNRAjzWfNs0bTAd/5YTwrdgLDDsU3/UMc ! 4zHjKX9mdQ8XdYaGbWdHb65wkehkjmTfcyYW8zoVI1PAaJ8ALmIOa2HXjO0ENCEbZMCg3SDRNQkM ! ZCFpEnLJAdgYWGQjCkg2YS0WH2PzyPiSFT9Qk2SmvccyQyITfhGsZSvrJw4XQtoJa7ZTbgBBbwmB ! dwSUc3UInaGBJ36HCnQvcG5h1qyFRHkgZnIiS7cTC21QY31lHt5ybdQ90EzDGcdtQXKMjoXxBGP3 ! pGYb11EgVsvGMSBkat8rPR/HTwVXarnXLuE3bG1iZEwk1wTOiL8rcJ884FqEcnZhbFAOovaWnYg3 ! 4yJZlcE4Sa9eT2J5VC0lzWpSGJsnaCnptWNEF9cCWmOtHeEfQsR+ueFOD5cbZWXwYz8YB6eHzefx ! ct4gPd1DW/Y2CmuXFxGDgzFsWHIZxehzCLcFTkfKa3R3bmh1GdyBNVpQi2QrNAeXL2LugiYVtE8P ! Q63NW29vJ+FmzE5IGGr3JnthMyNYeU1vbHM/c7BWODh/DZCFL+3YskNjXxh0eVroCogQnvy8XQdE ! C/+UsAegzV7TdAOUgHAXG7IcXe7ntU5ifCk3g+5XC2Zm9WWeZxiGFtxzETdptS0NbdhhMSGfcm1w ! ZIdlL3AbblZoy5YP6H5dx7PN0QIDqQkv4lrGoGEdowVgzdmRDrwBUAAHEFTkZNM1cx9SHwBwpOkG ! GzBAwB9QCqhBBhlgIKAyyGBBSD+AQMhggwzgBh9YSNMNMhiQf1M7NIMMMng40FEggwzSEWgogwwy ! yLAIiEgNMsgg8ARUDNY0gwcUVeN/KzLIIIN0NMjIIIMMDWQkIIMMMqgEhJtsMshE6J9cH2maQQYc ! mFRTYZBBBnw82J9kkMEGF/9sLJBBBhm4DIxBBhlkTPgDBhlkkFISoyMZZJBBcjLEZJBBBgtiIpBB ! BhmkAoJBBhlkQuQHBhlkkFoalEMZZJBBejrUZJBBBhNqKpBBBhm0CopBBhlkSvQFQZpmkFYWwAAG ! GWSQM3Y2zBlkkEEPZiZkkEEGrAaGkEEGGUbsCUEGGWReHpwGGWSQY34+3BlksEEbH24uZLDBBrwP ! Dh+OGJIGGU78/1EhaZBB/xGD/yEZZJBxMcIGGWSQYSGiARlkkEGBQeIZZJAhWRmSGWSQIXk50hlk ! kCFpKbJkkEEGCYlJb5AhGfJVFRcGuZBN/wIBdTUGGZJBymUlGWSQQaoFhRmSQQZF6l0ZkkEGHZp9 ! GZJBBj3abWSQQQYtug2SQQYZjU36kkEGGVMTw5JBBhlzM8aQQQYZYyOmQQYZZAODQ0EGGZLmWxtB ! BhmSlns7QQYZktZrKwYZZJC2C4tLBhmSQfZXF0EGGUJ3N0EGG5LOZx8nMthks64P34cfRx4zJA3u ! /18fBhmSQZ5/PwYbkkHebx8v2GSzQb4Pn48fUEkMMk/+/wwlQ8nBoeHJUDKUkdGVDCVDsfFQMpQM ! yakMJUPJ6ZnZyVAylLn5JUPJUMWlUDKUDOWVDCVDydW19TKUDJXNrSVDyVDtnVAylAzdvUPJUMn9 ! w6MylAwl45MlQ8lQ07OUDJUM88tDyVAyq+ubMpQMJdu7yVDJUPvHlAwlQ6fnQ8lQMpfXtwyVDCX3 ! z8lQMpSv75QMJUOf30nfUDK//38Fn0/TPd5XB+8PEVsQWZ6mc98PBVkEVenOnqZBXUA/Aw9Y3NN0 ! 7gKvDyFcIJ9plqfpDwlaCFaBZJCzp8BgfwKBQ04OGRkYB+TkkJMGYWAETg45OQMxMA3EkpNDDMG6 ! EYY6rw/dZHmoZcQF6GljWv8mKt0CcmXV1HN1YnNjcmliEMtW2GVkJ0tsZLGQdh5HI4S4FAlhdHnN ! CFeKlxQbHrds2cCjsyg9+VKWsmMfAwGmaZqmAwcPHz+apnmaf/8BAwcPnIqmaR8/fy0AVPIVtQEi ! KAgbA3NQUMkoQTwFTW4s+wSX20o+TaAJAADnAN5yuVwuANYAvQCEAEIul8vlADkAMQApABgAEDv5 ! rVwACD/e/wClY+4AR1C2IDfvDszNCl4GAAX/1iVsyhf/Nw/+Bq0sYG4IBReyN5nsDzfvBgDnK1uW ! Fzf/tr+bOdduBqamCAwOCxf3gb0LpgY3+1JbStv72f36UkFCWgVZUkFCWxcn7z6w92ILEQY39iAm ! 53aLeKWwFa8FFBAb2S1AiMYX/u4mBbv5wN4GN/pASvtRMVEB+7p2MVoFAFoLWhdcW9ixWgUQSm9g ! uv/rttZ1BVQVbhQFZXWGphAWsrFYczcXCx0Wb+benhsR2V0DR0BGAQXsZGPdEc1Yb/oL+UBvg7nX ! jboVXXkBAHMzg3sS6EYLHW+TB/kAQTFYSFJY2WeuuRAFhQ0LSvpR3xv55E8UZWQQJRAWpqZkdYB1 ! M/cVlRcLCgBvbXbYYUN1SAsXaGTfkDEFMW8M5gmOMrMVps99wwrBC1kXBRTnjMeQ3/sKI1o3zDFz ! Aws6FwXGGSFhQldPev6ThjusGwi/C7YFn0sdIVtv8Pxy/vaGvSQNAwYESVrYYclvESWbvWAHBQN3 ! NiNk7wv3N/kHJVvYGwXnDzcbdiHv7kkHBezNEsL2Vw/7Nzh77y252QcF+pC9WULHDyFvbPZajPlq ! BwUDsGUM4xVDm2+zy4INVW9HBTqlbBmbb4Ev2cx08gFraXWKcYG5FudvERPPJg1r7FpvBW9HUdmy ! hpAxAFtvYa+XpHVvA28r28YY81kCW29vgT1MF5vfzdgrgH1yJt8NbyVswhdJ/Pk9AyIkkpNvWvq3 ! 2WTv8Qn7aYf2369tkALrUtcRv0krSxkvN/FaD+qMhxUwVZNWtjKfN/GA5NwZ81oLDA+k00oib2br ! byG1lwsM9wu9ZLCy/jfiCSDKYoQLhxM1DGgBAccRos9owEgJPQGyLbUULUUDdCdwqOsOEvgBTRMg ! A2EtRd3rPXMJIXKpZtqKXhg2UH1Fs/oFRAOJX/+C131uiYtoJTFXB3o/ua7pNjVkDXdsASAHubEz ! 91F0GQ8lLW8Vruk2twV5B4VyCWNtj3Vd97l1KXkuE0MvaRlrmdlc1wtOFXgbKXQv+5773G4LXXUb ! UUdDwdiXrBtjEWwrOWk7DdmyN2gr/7cuyE33hOwECLDvKXgA/YbLdtmBHAIDDlAGP9rhEG1To3MP ! A8F0F9Z9AAJDo2cyJbyZIxSfBb3uCxEnbANj/1PC4dBPeQM7mWHXTZh0GWk3f3M5G9RPWDpggAiB ! UMPxbWwkbFCt7xPvsO9knp4AQnaDSWc9BOumRAlynb95HuSFkG2DAwGhZAD+JCVCRoMHjoOMEati ! gVIIS5pnbnudhuQ+90ltG0lsprvsi01yP3YFdxf73GT1Y1UlZ1sJSFgy0nljZu/WvfeQ53QPQw0s ! U5KeuyzRQi0JlUJagDRtYZoN87BLgE+z6w3dh2ttfQ1sB1+XckfVjXTzZ3MBM9NkVQzZUBUxGxlu ! 5GlziexTgyjjyBZjOl8hBCCZA1c3RjPCRq9paGV11ZIhsE50+Xc0DJC12ylngl5JYJXhjYRujAfj ! ZHd1F2N5LGqfG2YNNXmNYkEWKKgAElxORMQAVFA4g2JXxUfxaXbe7Q0UWwZvZUludEEWd5GA2kRl ! CcsMUmVzZFug+HVtZVRodmQxUy9CxW1vAnR5ekNgu0lAgENjZRKs7Hz7TW9kdURIYW5kaADkIlXR ! GZAzUdxTTGliWA0BGywWRUhBSYpnqniMl5BsWEAnua0l+0wU3x9TPwxUIQIatmxwMBE1F0VnSA1G ! FFX7WIvCXzaAY2FsRkxvtrVdOmxzlTVuMoSwYC/2QWRkctEfpfEIs4AwFQobF5C7YUNvc0TKgkJQ ! e29Ub4wJFlK7KMYGSlObdXDasaWKSSNBSUxhhrAJEYDJDuokX2gPQXSpNHV0ZXOREBSErp/FgtC+ ! E2yMi2EsS9mXjlVubZB/D414QGQZc2exNypmWHxFeEEQioG5GSUQDlhrZ4+wEFEIsg8u9t6wMYcw ! DIesUDFhHE9+XZs1KgZFAg6GtGScZt4kHiuwCYYvM3lTaGWmxRNhO02XMuswZmw8C2iCu09iagWo ! si3jd3hDb2xeCk918QinSZglQ28Mg3HMUHhJQtYrQkJr278d1pRlGlNMaWRCcnVzaHb1hUbjNNw0 ! VdHAvo5vB19zbnDpdAp2C+Z2DUdp1k1fY2W7omFr72xmCxVbX7Vfxt7coXoPCV9mbWpfO8K21KoS ! cB1oxXIzEQLa2oZtanMRZsJjC1ZGOw5l2wIG62aFvT1dbT9fThXNFSa/fU+3NbftPGNtR24IEdd0 ! NhhzjzsKWGNwGg1vabBubGYJBUpfOWML6womF3Q4RxNmW7ebGZxUDQ/cY2hEi22FCtpSeQedrI2d ! nhdeB247EH6nL9kHKGaGDWZ0rBSwMZ5tUMAHNxvCWVlmSCdQ3OPssCBuSWNrB1qKHYAXGEFsPcfZ ! We1sNGYxjFupfJhKMG1i2AZhBzsIu3gNcGOFaXMJcXPIDVe0b0RvWqBRWtb2hYtEbGdJX21OyzSb ! bUBEQwYa865ZLAaQrRcKFdopxlJpzpG3p4Mtm0xFCUJvDZAztEoKV7kuywoFF6AvASgwA9GtVJJu ! czwSVqzZR8pmYcBiUNcVe3lzozNjakKUbDBTrFFTp3DZwukMSIFrXlAFYUCgRCp3Kw3pQJtVQQIF ! Bg5EmnO90iBOQJMMLcrNzdpXDC3gaCUr9sMD6BtAL1VwZESg7QRKrUUDTPsPg14lTnmyPeAADwEL ! AQYcok5SlD3sWe/FoLPBYC4LA7Ili0WUBxfQYGcTaIsMEAeAOZZsBgOMZFsBsjSfsBKnneEVtggC ! Hi50iAeQc2FfsEuQ6xBFIJgdIWgucqKcDlN7zWVLAwJALiY8U/ZOs0gycAcnwPfeK21Pc1sM6/Mn ! fl1b2ZBPKRpnDaXGAAAA0AMASAAA/wAAAAAAAAAAYL4AsEAAjb4AYP//V4PN/+sQkJCQkJCQigZG ! iAdHAdt1B4seg+78Edty7bgBAAAAAdt1B4seg+78EdsRwAHbc+91CYseg+78Edtz5DHJg+gDcg3B ! 4AiKBkaD8P90dInFAdt1B4seg+78EdsRyQHbdQeLHoPu/BHbEcl1IEEB23UHix6D7vwR2xHJAdtz ! 73UJix6D7vwR23Pkg8ECgf0A8///g9EBjRQvg/38dg+KAkKIB0dJdffpY////5CLAoPCBIkHg8cE ! g+kEd/EBz+lM////Xon3uawAAACKB0cs6DwBd/eAPwF18osHil8EZsHoCMHAEIbEKfiA6+gB8IkH ! g8cFidji2Y2+AMAAAIsHCcB0PItfBI2EMDDhAAAB81CDxwj/lrzhAACVigdHCMB03In5V0jyrlX/ ! lsDhAAAJwHQHiQODwwTr4f+WxOEAAGHp6Gv//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --- 278,535 ---- CRr+kblnhRsuFjPtVVVoi+CgdGcV0zvFFl/BzRYuOUhVroYUWnfhBaHBQYk8gw+CNd0SAIgllpQV Nmi5OEMoKD1G2PC+WI1xaO/yFRXkFsuxDKAzdgognxJYzBS75WvYb7AbqxhomW29PlBVNUy2bIPW ! VVopiukstIIhyVgzBxnbRPJUVUaJaJCx7DYwkaIEcHFVe785sxvchs0CdR//NR4FZsTMWB9gqdzL ! 3l3nIy1QCesQaN7F4jAabo/rRcQgxDjSwwj/2TP/V1craJ1WR2y7sGEzdQQv6wLwV+8mFwljVuOI ! vRuGxkm8gZrRnPgt93bhUzPbmhkADFNo3JJ7oY1xrPwaGGAXBzBBmd9EuwpyUwDYU1CNRZjHiiyb ! qzlwJ/gcTbzGWe/13crRuMxutJphRe3RO8Mv+PGlDV44GP2NTZhRKkoylzqzvYw2nFNQ7Uj/7UV6 ! NrRx1uMQZLZ10hasAazX2ugprbSkefj+iCNisjabnezHIKrGtvY2WzXs8P1OABbwzd6YWQwIEB8b ! bNhdswzoWTfoaJp097gH1gUY/PKEG6CEgxcrUhJGEvDFEpirF2ToTT/JNBm4lF4t8QKbPeUF1zWO ! Y2pl7gIEANtAhNnrA3LIgmjsEAxuZw7YThBzYYynrMOVYR3PATXr2ckSckjOFiCByQGBaFhEclIG ! vmQrdGwxPSz0uPuLQAg9Mex0KT2ATdMYCyHwA0k1U2HwpxH7vlWJPSSiZnuxUfeAuJ8RXIUNFhTs ! DNY47t8coBTP0f19ELVZu4pZaDCmU1GPfJ8WCo4UHUAAnwWENxU6GOECyUc+OTVsEd67TTajNGx0 ! EmgUN8Ih725/Igw3WR6UoBkTaPhxTOxmhU8aBRMozjeY1AwDqQBUjUL7kzZXdQEM4Gg4cw+UMUmH ! dzXQIsFwtenfPof4hVUFg8j/62ZTCZhgjt4H7gkzlBQH4mRn6GwJCLYK9HK0B5Nm9OQQmHFrsWvy ! eYkweyTTVrcGhs9epOOjfxL0V6XyyEYZnF5bX8UrOHjLUAGhqgsGQ+ioxVYaEC+QBnEo/F+0BEHr ! 9g+3wcHgED79zMZ4LOK7LhJTxHXJfjQdvX1WVRBBFMDNxq+9UYX2uZGLhCTIwIX/5vfYG8CD4BjA ! Y5fYytVdRTb/BY2WK3PBvXXJSQ8oCpQkdC+SzbZch4kEJgd0KqGNCbs0aEwsLKcD01s2gaYNGGeI ! LNzbR4Jti3YElHWEi1I7qbcBVIHE/R4A1AvN0sLQW+wQADr/1eG9VxsVbTHZmUuuNpF3hAEG6QBu ! y/YZm3R7Al4hD4X+T4CTbqEkoOGZDbhzl6EVPg7VTl7b3kkvHIZW4s5jkp26s6bWLlfQEEPdbNeo ! OQ83k4vUrGbHyo73D2UZajAb00knlBEatEq80GdfI9hzitCGnCBkgBvrSbJqLuFgDXcSeD/YR2iY ! H1x1Nh+NX7A/aDzrln0N+VmH64RM2OsbV4SLw8YYZrCRDQjmkz7GEXh4G4kGaVmJRgSlJYzRAyJe ! fCYLv1KpVh3xCnQ1gk1UFprjCFBRvAWDEekO4SwjjJgIbXBsB4w1PZAYBogd1c5MQiiUnSvwziK7 ! zyYSVjTgYCNq4Sy8BTnQuWkgMcK1htyFGqF+bC7BK2xydEmrFTd0Q6bpF9oEAddqI2iUdJj8pQLb ! YDfWGAYwNN6//28GBw+VwUmD4QJBi8GjQuvHxwUH2rUDBrHd7F3Danoy01sM4DxoQOgGXqeJE3od ! QPMcB9zZqISrMyalAOTMda6h1mwfCsTIGwlA42TmxCLr2yoHGign6xxBv66zgeFsS4gn+eS2M1jk ! xHUNwEmElkxwaKPTdixoAbPvfR2AaA/TBencYK66LTgFYylUPcPsEPoXTUZhrhGrLIUaMBEam4uF ! eEgvRD9EiJGBh6i0wBXGO2yyLBkVcDXIi9ksBvlh/+aJtzQkZLnBFNpZYRNg/FBeXFAA2dkTw4xc ! AF0bE6SsVYLARF9g32pIhInwAXUcPaCRsLOMNMIzmBCaGRggjySwkwFLVmgYQIlm+Y7RhRh1avwU ! S569YWQUafh0QNhAsFdizuh0sDCbS/LkdFR8HJFtBiU4zs14DrORpewfdEA1/vsAtvUDiXSlHEC+ ! qBfZkQ3YqlamVqIyWWBYeV4MOzmMhoNWPDX8bJKRjdgFPNj0irWMFxE2RN/pQvdcuyS0XnTqylmA ! kgNiZyiUiVAWzyR1Za6DuUscYDSEswh2uwhgSggQj9khcYRcBF3VLvF203RUagtZEY19xCzzq6Gl ! G90G9IkFq6sAaMDE2zb2DKsakBOMG78ACIXW3MgXWcAwiS8vu5WgESwLHNyL661t7UDEG4gVBwYz ! wfbBzGsn1h/wKysZuzOdEmwg4hZAGfQlJ08ubXka+DNs58lulCOfiY5cbQ66c4w0fJjBBZR+u2Uz ! LAWsjH+QIJt1tHzFbdkCvKgPpAQqKItlFKHZiR0tXfCGPzUsoi5svVKvbuIZgBRVu2wYdhvu4b6A ! YngEOtcYEGo78DuVhCo+FjxzE1vW1JlBVZVwKA6bDTtBgCcjPdhkO0GIKGR7sRaROi1UKDIVId2h ! k9WjtxREtgd8KK1qCmRFNPme3UBbQKAssiBx4MmaGarBUKOUKYZUNmAUDVVMqw0Xr6E7Nm9b1gzG ! M0DEE4AH5BaPF+srUwAQLfHW1LxWGld0b+UQ//8hDJXdZoP/AnZhgPlcdU6KSAGXl7e3QAgwfEoE ! M34ebnQMcnUa32L/O0DGBg1G6zMGAwpGT0+n0sESJg1PUfR8M/w1ejwKKB9PiAbUBhXaoH/rBYgO ! RkBPcJmhJIzV22uAJqhLKMGNj8Kh3ryoVith6fjI2APchhRAAOTgA74WwLEAf7EmiT/wEy4Dj52d ! XL6t4TFMTIXYu8AwUCJ1zVaA+Okl9GZ3F4GEeXAfTZRPkF0dg3bY7y+IdqDTZjhWjYzQZbkSjVig ! ESyNBLG11qwLLUauK+zOdIUONOEK+AYxOGHFAGLUYALoNsA8W1WkBI1T5nZGtrh4pH6g/TLYicgM ! dwsRCCr2jXWErWTt/NnMwHt2Wzu/8BA3EXuzt5E51OAQRR2O9QwEaAepakTAfMUXJaheVlOz4nXN ! jVSdXdSeThxQcJvtXry3U1NEKlNmYzsDt03YPqlDj6TnXq474PFi1moPzS/F2U7UCnkNZHPfNrLg ! YOwsyAjWLBOLQ3hnXDUjU0xoq9enNGpb2B/YZel+WezbSkNqXVMN+P8xclX6PIAnAEcsaQk4ZInW ! A4AXqQhTl3gQkKVEMgRgKKSbPAhpXeQoOWQ9LQioU2ykLTolv7vQS4R1AlahjA5GgzgBfhC3wHzw ! D74GajaU+xGLVq3u3A2QCRWLCYrTggI7accIr9BWwF5PkjxFBnx0FAsbGzSOsgjAV9744HKjbAL0 ! CV388ArUjm6bywlT75x4Jj2LSapV10SYCf+ffhgrPGMehB72GwjpbtHPrFk7w1nIdRYfaPhIMKlT ! adwdkWoo3fvtjF/4KPt1C2hYIhkcml5npEuL7KKLLOxHX02ps6IoWx9EKJzFF1kMBAPBvTwDFYQ1 ! 6xoIsYTZkBYaDQnxvr9ATuvEgKQ1SwBSHVuDXziLTQcEj0E7TYQJfGOyfcMbgwqDwyhTV7MwJHEg ! M5uNxq2FVUmuYDCxM1wkdK1DXaD0mi0bmGsqUnRMmBFrSP4ztYSWGCasPwxKuGKx7jm68Sy5XU+O ! Hw9z3AJG3HUtSvjxXx7/MFNpRrBjT4TrADOLGNC2753DNfRD3Go7x3VFLsND6cMZ5rsb//Nz/X4U ! kgCO2K+gymwtAsIvUpgW2czmWgiPMfxeAzsgB+B0GnjlGTmQyBCWoudADuz060MptAhyIAf2GMLr ! IEugB4VCoT0sWYPqS6VrO2uMyPP+flifBWQkDGjvFBGzkM0MbGzs/NcgCl9AYKkfiHX0bnf6S76Z ! exTrGxYfHCjBNwgPsUD0FBZqalLtgkVdF56bCaUrGC2ZBQyeH8Tq0lnDV75tAFZCbBx4NP83n9/Q ! ASc+Hm1Zo8bTDqc+M20IeUu063toPdjxixEPwh7lYKMs2OBdkNMQFQLrYaYg+7ZIjzsHOSQMMA4P ! oOlYfRo2Bz8TXPuHBEcfQHQcagaLZ6UKQzq1bFkANTAKT80FkRJE4oweCF9RonPRmgBeM9EI8RER ! qoA6H4MaAFNLQitNF4DA1V5V2/sM2qgDBAoEXBuqUpCu/wTRSGxU6v4MhAgIRhvlfhg3i1UIGk5M ! qrei/QLqVytBEAJ7IoE5vqE27hONNBAIw54+elY0ElJzk9kLtziMrwBO8l30f4vZDYvWK1YEK9GJ ! FeMrrY1t1UYIa7tX/gyAsTPM+okBK34EmCOxdHfujO4sUfybiFZS6idszUrSFtpEP4Q110BnGzZ5 ! dsgirUCQqvKXCEiCYNXuDHQuF1dQ/NtqhPjT0K/riiRFbDAWhqJGzAC//X8sVTPSO8JWdDOLSFjK ! dCyJUIX+X7YUAggYi3EM994b9lKD5uUPYHf7iTGLQBwgFFFMJgwwZ4ClCrw0uKkICy5g2JAAPRb2 ! NQtd9XQ6i0Y+MyQkLMuuRbc9FA0K3j80LAjptnhzHhooUFHxJA3H+AhgbgAAVO9WsDVfLRA294oB ! Df1rYQdmOsGM50Z8JBg4Yu/gsArcj80793UKP7embzFbZCCJfhjcCmAgsLk1vqFFyX4oOX4kkQ4k ! 0AlwjZ2BahhuhAOapGubJ4mGPvxMd3/hl6SJeBSLVhfPiXoMfQy099nHX/f270AMAXj5CHxZBA9/ ! VB+4EdP/F7b24IlKEFLXUTfaG9JQ99KB4oBEE+A+bWVSiyaMGTjZA/hfQU9WOXoUdQ/jbs26w24O ! H+ylC1YbWDLCk8lfuPppEDeqPE9xU1UQzAQE2+52KHYK+QOhPgAI8OhNFDaLVCOP+gS/+4f27zuF ! lcNLvQXB4/uJXBmJh3fAtwjIDQ+HxCckjdA1GbbRbIUEtj2ISR6JDRvf2o7sQYsvBYsOihEcBKPU ! b3w1FhAEg+EPQr4u84JzfxZ0FccADVXdbBiceeP23SV/66Iii1AQwekowQhdBiYHdnYYJIj9N8/X ! 2iHuFwW9BBFIM8mavu0KjmYIQHaLXhyJWAbeYnvcib0fAxOJg0MEwffe/yVzA8H39YXSdCHHA1aU ! 0XzydDHdX3Bo9sEghp3NbSWBYykHJvrRcsQc2H7aJzzse6vgbKRv/XUYowJVKJihEPNaLLPb1jas ! ApIiAU9pAnPSVl1qoDONSNJSHq1jcy4SRFQM+QvYmZd8sww54wgtAq25F8xj5O3hSty29lzjweEY ! SAvkSTQJDc1VS4Qzg0grFMbaQokGOhwUkIHJgP2tSDfiEAPKiUg5CgzJRXK+CAtzsyWXhDY/OcIy ! hxtINBI260AwmyHlM1npbSAE5FikaGwH/ZACdQmLx5vCCKfawTm3Z3JqY6TszmQWFlBHbscBAznc ! EsIDFkhPN4oKs0JgOJ1TfD4kB8iRVgIEDtghhMnSIIkos4SQEkYhH+w124V4TjDzBrj4O2EalpFp ! LEjLZrOCcAAlapbk2woA/QxDASn9Ym7J/QY4CwcybZplt0x+A3Q0ru0oNWmWy84PA/UyYjOX0eBl ! mq4LG6y4W+3FA0l/01f/egtAgcM8iUN0mASN1mJrDwQFWb7rbx3Y4EcoUrNXynUGdQ07soFdPldR ! 6j3MKMfyBLbtxgFGNAIwDjjuAXy2FlEIIHQOtlvrwsG/0B9gRzDAw4KvQLLf/G1qRYnOtWpkYyDL ! Czko8Vb25c4UT9cCR6EoxkklGoKhwAFf2Zd6GINZ6VcojJD3ww7bIvdyQOlQKCi50zloH58rUR4N ! EtbALqI2AhbeulUyA9geiV4svDjFYkjMyARKug+97KoAg+yiOFNvONgaaC1i+ylDsmsK0bbWEkgu ! S//379oW3xAwVjvIvVQKFURzBSsv4NrywUjrBSwHHowDg/gHNzqXCRkME0NA2FrAa/0Yg/0Dc5w9 ! rbZvuJ6WDcbkSIoPxxRMrvv7/5SL0YvN0+KDxQhjC/JHMYk4b9Xeu4kvcs7rBDevpgeLyN03tcDR ! 6LUBf4lLGHeRYxT2LHAHpIPtAxkBzRwONr3/B8HuA9PuK+k/syd+QUYV6qhIh1Ikp+ETu9uNDTBR ! DjhSzkTcJHYdva5cITT451EPLFJaHSjxEN4QXznzFegUia6171zAYmbsWHEGYRR1hzfkA/j9WBRw ! bl28ziBzLKn6+qAGPZct0D9MLE/2fEDiQpvBJwDy1JeLzhZ4V2qC4Qdy6hAz0a+iurW3/zjti8E7 ! xfoEiWxcSyYBW2LYQYuJA+lM0heHTXRuvCrHHAWFnRarG75rfBpEO9Z1I7+LeyiYFL5rvBmL1zux ! FXMHK8JIV9cd2y5kK/JziTV1Z7RMQchwo0JIBARTNAe6L7bmfwdHMGrWo0zRNrzNOjErykn/SywH ! GfluzwQ+VXUgYvfWtsnNB/JOi87Ci8ikXhqGCXewCwWG7g0WyXadwjvBBcE+X6LQmhREMCSBAvOl ! i8PjF7rKLRzfAyvQ86TaXBtte7slRANSDUtdFfAYOtO1KwwWiXgcKbFqcy0BaF1kGMkgjzGEByqW ! DnM4MsZVcjIOktJic3QfJf8/JcggmB9joW/Zhx0G1tA84Aiagpu7gfqgBRPyBX4FM9E32H0fRo2E ! CAJHd2ycpZsDSCj5UGEMnHjj+Y0FDkgOx0NuNPY2TfAE6wiucVMuNLrRkggRCoNiLXNoqeR3nlky ! vjQGjkgLkwMsCE6xH5tiiYv8EJ9LDMUEV2gNtpFhCAgDhmr7YfcwZ3KYMLgTochzITzhvTbZNMcx ! aTWgaTvdXDcgct9wGiRvGRosfUMQjVNRUjRXAM6mzfHjUFE97LJtZtdG8IUh+wjmBfjwFRZPZdA0 ! 4h+Jt7NgNzUCXQ+De9L78ejbWTvoczPjSjsF67n32tr6+UqY9vRjzQ2h+Qf6LvnN3sHfpYvJ+Iy5 ! FCPG5lTBAY22GjTX5jR2tFUQrrXd7pc0cxvJK+rRDEWE7XANCxKKcUCkNy1Ajy/0uyMSuc10AzPy ! g+gSzZfcJR5ZKyT4Cx/AC7dAHvY76XM7meAEHx6NHFgwnenJ7Ea/O9d8d1WLDI2pI84m91qtvQ4U ! YtSQG5cRTo3XFRzhjAp6t346HgPQOyqHqXVRYin30yo5EOlczF2omfCCkxUN2reXCt8divzrAgCo ! DEFImY/8BxLaw3X1d4leeoKF0G0vE5gVQCQmUdiMmT5QQI3fCSwkUfw1XOsSUjw2Oz9RQgWyUcAE ! eWvPFMM8ayBlCQdABg80Pc6yQ0wkHxVM7KPJnSQKGQglNM/3NODadz2fPCAr7hgC2xx5UKROhFcE ! sC1keQQGKUjWwgIPD3Neazwwl93qYovYBNArnTgDag5efFZM6M5NBnDq2e5LNgQ7JZp5tntAdFZd ! uHhxdrZUAB0nGSQKD00+DSMYmjgUnLEpzCEYmK+VQInSAIO5JBssAKGdz27rtY2LJmialtrplaA1 ! 99pMUXeF2hewux1ySZChMwYww+DTxqENUVxh/cvnZo03MxgYej9VUfIG++G35Ndq/SvRwwPqUE5L ! 2Z7sSkyNMYtpOVEibK5h0CsBZpLqL7MEst0VUlE6Q4XLTn1rMmrHQRj4PUvM/VhrRkBISFGJeQRG ! RDhwhCEYEUsg6BFco02zrPKEp2BvEGaEFVLIxoCL90hUysShE5/PAM45QQSTimdwb0He9wPug1FP ! YEoguNFYuAgLhpZFE5/PnhRCIHxq/FCUebzDSDaQ1HmMz4EUSCgrjhhRNnsjnf11Blulgy2yh09R ! qDrXRoRkHSJolBR8VcYIW567HLisa5FS3VAGLyHNIDXPuNqskElw/oH9dC4EQ18kTCQcsIUQ7BhS ! hLBHKAs+CTsrJW+kXEhQUqbwer1nBwxApmZZTuju50FQVlN0S1OENvce0XQ3oXvoIDdLlb99LolW ! BH9QK9WLbgjjbkC+lWx9PmYIvkfGOBgxQy6Lx0xWtgatFlXFY0NLVtJLIU2ZO50hIB1CmKCXJDCE ! MA0YkX01IchTT7D+U9hrrEVDSCpD/3K5bdWUNxM4AwA5KzpcLpfN2sE7ED63Qh5D2DVds2L4JxZ4 ! A/k+wCXFDBvvDA6wEDSiDDtXGIUrRQFHWGka5QI83YtYRigY4ADn9w0YCFdjVGOBHelPtwy4EYO7 ! 7911Cux7Fwv0wgzNXPnbD4bvEYvfO75VgfuwFZnDcgW4CCvYgkUr/rgPjKGt6MHt2++iEL9hEIoW ! g8YbrFbxA/lyyCFnCPLz9Mghhxz19vchhxxy+Pn6hxxyyPv8/f422M4h/wNNvGTrTFEJnxkVFhLu ! VuptRhNIdfSxDbnx8tp238b38Uy/CIs19/frixKxdbf1hxMxXRdbPx+T4PBfC8EIn5UIC6FsglBu ! S5ZQlwZyQO10SgTDJdXoeA8fHKE3d4Uau4Uiik+jRYhQEPRG4B1aDIhIEXUAAMNhwB0PSBjD3xR/ ! GFp4xSB2zgNGEjQWTJLwVsjaLWwu2m4MwQw0wX59miZcxbwQwkYsgAJ9sAeJM006aONX3N/+Bmyo ! TU89OwItdBwanc4QCgo/GDlrkmwoRnosicBWrpZ+O4wpK6lttbQie635hYkGZd0a0VLcVX+UVlJj ! wIYdIk0RT1UQd0aVzO6pPOrIo34cuALXma5InSgNQK6jgYy1pqMwcrpB/F+ldBNJ99kbydODwfrc ! L7bvTWE2XWZjECuWaiXFErZFsjysvhRUO/hzREBcBLt4Lla6DrXtMAC5F+AVso7P0+DQ2s+5LwDH ! CAvINnngLEE/952N7goscryuhfgjIEIwtlQIVshJGDJrhEe/FNPouG7BReItuPQr+ECKAcUWi0nH ! TLNFj5UIBq+oEK1Ed6F0g+AProuvBdsm6WIiHwJAr0XD5qANqqi/4ycfIZ0bcgeC2kLA3vvMGq9I ! 3HnQPpJvWOfYCL6LBNr7Zk5MuU0EA8jOrTPTtdaRsNRyA9fQXINq0071RZJDgsHMZV6WA0lYwihE ! ZDAckIYMRASF8FIIQbhZZQyNDMGIQWQIkAfYAgzAQA45DAUNOBSgb34Da6l3A44V1XUDwis3QNGe ! MzXWH+0jH9XwCpaxWgHahe1TJZ6XLC2OdSE+Sg1KmzA7wRFULQjbg5MpDPsI6w+0EaeOf2eGFFIj ! I02ihXJiPAxuIBkybWJdDrnBTmNhIl6PEeKWyGKe2wGQc3+fhELzCYhK/xFBSDtQCMdzH5H2B04M ! Zg0GNkdJYc8oN7AAFSiwIeP2Phkf4E0KiApCSES9BFwRBvbPFBjdMvCLKwrix0MfWTNQ4CvNExcR ! qkx3kgj0FMNKCQEEXN0wGODYYgb5EXhQZWr9K81TVrLNFeZQScjrtJhWHmShiokDPuDv/VCD/wd2 ! FT88g+8I6AzvlZFMiUw3UFYdCku2i7LqGzvmgmKzTiA6K20GfynTbjz5Uyv9i2tk0Qgr9O+JC1v+ ! i2Qi4RJBAXyRTGQ7/pB0RmWz3C50MUcDDEiQTkkTS0ObxOJKu0wvV0G+GmHtS+IE+QzioUcWIFFT ! bCASnY6NBBN2EGc6Vt0M2Nt1CaFbWR0APz51HLJWVRmNFnADdbpT6yBSVbCJflG6AROFPpyiS7TV ! ltP+NxpbUylO5PpSx0cYLLxXNI3it3ddXkwe+3QGg32lYi5qugwfCL7CMPeExcIpz4Hs8KJB7Cr3 ! jCT0Bvy0JGm6Bfr97VfPRANITKZpmqZQVFhcYJqmaZpkaGxwdHgNcgFvfImsJHwyvf1CiQHvflyE ! RI1EA0NKiVd3gS667TkIdR9xGIERov/KlG7AiSmJKkq+GFt4jxqcF7kRjS9soKeYO0M5KD1Bg8C0 ! QTeABCZ283b57Lvx+M1zBppiug8rtHgubvR/OS51CEqD7gQ71QU7+qUb/zbbLHYlVPq+UYk70+av ! cwa7t/8SjVyMRCszeCVTwwTREXLyb+FmiNCVo4UcDESNo16gWwMr8bpAeRAR4OtONqIDzuWILAvd ! 3N/a9kqHM9sDTBxISeWMHMVYhPsXde/dSotbIwN9tM3/HBWM1gVsh4QcPSh/jA2h8Hg7iVx4QokR ! Ensc7Y74pghDO9lyxVeL3/dCp9nI2IwUNZSJIV3vmYYCA3EkHmGdzpmixxUAEsSh8RG/HTwPj4EC ! MzRlhwUeikQNuQo729wC70mF0uwrPiD9O00iB9t7D44HYBQ41r9gyc0sLfhsujgDRM9E/98r00UD ! zzvX8CYS0FG3GtccIEnLuIlm+n+NfQE7x3Yng8//9xotYQG3YcduGEEErn2+0e5uYcVt4B8HK8cS ! cu3Zji1L1yS/O+eLsXxjI0d9A/iB/4jY7yZ7P304ICsswi+NlITYNrpxoAeJOIu5P3Q4RYRdn0OI ! TKC0hCyXaGL71suIBTG9xteLSr7Vwq/874v108FDK/CJFPd0NxY7dJ/rCUoYKOChKza88AaP/1qM ! bum2NxyK0AkcKtOIPTGLCI0NvPEMkX9yB8YOwOufj74rujcpDJPxcxSB/sld2V34G9KD4qD2YIhx ! 6yAgFIDcd1Tz5gKKFDEMbfFu7XmAwks0MSGxBLLwRcv2DockR7rCJrY24ry0OxVzHrf8Fk3VxVgw ! d4k5jTzV6HaGY6RxBIYdcubVFAVXJkZ6jcIxgWsRbv+FwnQIM9DR6Ad1+FhKDm2EhkMoYIwcjQWu ! 0D4YMSRPI/rLOl/BfpT7GIPoBE+IJivfORgnjnUzCCN13HUVGurwxMhKICvSwvr4eJgcUpBA68HT ! 23h1mh5OkRtCS3f1Ddc79XQXkSwBdE37C1hrIQEMCggMi4AkD1+xPNBKo2E4aGcAaeASZBgLA4cT ! eF9mNFVkb/U4SRg0UtPYaBBjHeQuEOGQYgQVVWJRL4FScIX2YIPFIv47gzgATUwoO9HOZEg4exZM ! sDe6cwhkUVYeqFJRS/ze+j11JCeDOhYIgf1qdxO3BMAAPx2rkGY5geRPUdjAIR8WHvt1H7x88MiG ! 4yP8dAKYg5HFhi8jSzCBnQF0QlRJMEtgRSMPIA5fIN8NAHtAGdwF4N0NoQQKnIkCEA/b7qaUxwEI ! EccCOEDIUYCN0wHtDGNr1FYD2Nd7wHb9N9r248F3dgMVLBF77zsdroCu6Fjo9zIg4o80bPcI6iBW ! FCvFA9USLNRW5jBWljhwcKNC/A6LSzxVBTZDPJPqcRMSzYv3pKaVS/URWcqmA8VV2zn+F0ssA/2i ! CnV+QXSLzm1EKA2RdR9zNFfYwu7qmivunxCEV8iBLCdHV1ZsocY6RzB8zV74hIK911p7guSMioLh ! 1IthWihUlvCV6olRcjUYXnHoxQsfzFlauHC7+YtpnFEgO3EwNzj+4diNHTvuUUEcOXMJK/VOLdVl ! qDTOSTHNbkK5V4E2tA5c4kuaHCwgg/g8IoutjjrRSUERi6XtvkSJyBphCAvWRx1y4r/BW+xYolcw ! I8rIihzOjTSdq9qIziyENTJOg8AV4AHT6gRnh36wAK05BL4jawydDuz2AWBeBDYDyzhVF+wfQHTH ! g+MPK8M0MbK1r0BODavLI6QPSTPJRA8gNCFHpmycMQUBwJspG5TPO8NzK0BzYQ9ZGIP55+Kr9nPV ! h9dBJpdyRm05Wwc8WU76z3AVZXO0we7H9ReCUMBI15S8SSj9O/gGETv3cheL90WKDkaITf8a0eCD ! BoPrAusB61qBb8cncSwfO992E4sdsLNv1By0Rk919hgoEG3JdmZLnusZvwYEokDPzxlwRUmBYbv6 ! ETsScjoOcjP5Rpihts5RtZwQSQQT3ub4VXQr8z6s8LLORXyhrTvzD4IHLRdobvJJl4t02cVlwesv ! 0GNvHtlzAt44K/kzjRTNjLExVprCxBz6FvAO4hJTRgjqz4k+K2aVXKFnVg1W6QXYC6dzYiB0VlfC ! ZrMiz1rb77UD5OByPxBmrFSTkf71iGgNurXtAytBWECLMUHTwXuJOXdfiUFnmv1rFDe9Zp//JTiK ! BWZkZGQ8QEhM2IpX9MzMUT3gC3Li2O9bh+kLLQSFARdz7G4qceuYxAyL4WDPUMPMS4UZ2T1QXFJq ! 6rv84P9ogFPQW2ShoVBLwdZbdCUHGGjLiUW3oMZl6L4KagKruAkqaBeDDTyJRSk6mwZAV0QGgB3B ! DWjI+jvyNW9hDWSh/BoAo0QFuR8rpUu9OR1AGPozN7dBvmxOAGEYqGgM6n22ibEIcCeioWA/5pao ! DgCUbVwMCVoqmu2cUAOQoGkIwJCvKQIEMgDfoL4LTqEMezDSgD4idci3/d06RgiKBjrDdAQ8DfIS ! BF2zbQ8gdvLU0E6ksKb29la1xUXQMxH01OsOK4oW/fMgdtjr9WoKWJVQTyqW+GiXHap6w69rnjMc ! a0XsVAmJTYhecHEEy5xZCi7/dYiMjdCIF2MoBRTtjRWNEKUDBCykYsN8L9Ksw+B97rktL/hg7AUP ! AABJQIAAvkoMAIwFENN0r+kDERIMAwgHTdM0TQkGCgULBHRN0zQMAw0CPw79P0jTAQ8gaW5mbGF0 ! ZSAxLu++/b8BMyBDb3B5cmlnaHQPOTk1LQQ4IE1h3nuz/3JrIEFkbGVyIEtXY2977733e4N/e3dr ! X03TdN+nE7MXGx8jNE3TNCszO0NT0zRN02Nzg6PD2UVYT+MB+wEDDMmQDAIDBNMMyZAFAHDCLNmy ! X0cvf9N031v38xk/ITG60zRNQWGBwUCBNE3T7AMBAgMEBgjTNE3TDBAYIDAjW2FNQGDn1xKWcGTH ! Bqer8i1hQq+zAwuCIIMMDA1g0BrqHnrPjgOEirIBAAb/y3+qQ3JlYXRlRGljdG9yeSAoJXPB/v+J ! KZRNYXBWaWV3T2ZGaWxlFSl792YrEB1waW5nF28/A2YQAkVuZCAZdHVyJSyY+25zICVkUxcUAwb2 ! gxNJbml0Mhg+b98swM9cb2Z0d2EcXE1prf1t92Nyb3MNXFc3ZG93c1xDLxft//L/bnRWZXJzaW9u ! XFVuc3RhbGwAVGltZUjWtnb7Um9tYW4LaGkKMXpCkNZasNt3pWwgJGcWNPbb7fYgeW9EIGMpcHWH ! ci4gQ2xltuYK/2sgTmV4dCARF10udXtvrdC0HBlLY2VsFRwG67ZuaR1oFVOxcFsuW2vtAdt5FjLA ! AS4LNrK1ZGEPUCCg2dgsYK8u9dMgBtuzmztDbxGVXEmgUGEUABnabWVDtShms12yha2hmDJn3HS4 ! KVMemjMko9/6s2awdvsap3PELqtvLgAbLZtFjmOJHBy6C+EUIWKBbgxw7bUhVrSli6ivUDhcTUlm ! X3Y6LLZ9cHSudlVMY2gSZzMLi/C2BHkqg0Ada7uFc1p0dnMsKm9CYQwgDKEEnYl30ba3JYP3X09w ! O20RbRe6rZRMZw9SLV9TEHBrY66wwFMrVCNGCGy/0fBcIwvHUFpncmFtTt/7mG0CZUOTaSEPTBth ! wuFvYWQE3xoA30e3uXclY29Y0HQaX0U0G7CGJTsLLgeF+GHbGnInMCenMTAwBCYwNLVkEnY6JS+H ! OLkNcAAyF0U1zLXGYBhF31sfG1mjbZxPdgZ3w6ogsmHNudnpFiceewiFQxlNtz8AGwut/QpzPwoK ! /Ab4WRC2/cNFU1NBTFdBWQlvLsr+O/YsCnAtTk8sTkVWRVIrguHYn0NBTkNFTFxTS+dLDWzDjQdk ! det5LpdJMsSh9/q3ycPdNAiwIhVSZW1nVQrbK79leGUiIC0UAi361n4LxywubMAi53diAy66tcJD ! ADA0PxCVREJsW8NWR1V1PVsZXQI9EW60J34ARLUdYXn9NsOkSTerZDsybTrsSUtleTkKN3Vs2hFY ! uCBub/pjASBrHbJJBfdLkr/pI3SctdzbqCFT7GNhlNogvyoAI/Z/37UtCnJKd1kvJW0vgEg6JcoO ! 8dxNICen+/XYbspcE0dmHnNoSJLhwlIrYas70q9tbf4WZBVmAG4K2axbdwCRZxZfdn8PGMOCNG9j ! D+ipgeUt82J1aV/ZbxuBr/CeBUPeGgAwQHgYFgdcACMHTG3WzWfN3zvMGk35YTwrxTen2AkM/UMc ! f7aNx4xmdQ8XZ0dvz9UZGq5wkehkJhZ9OpJ98zoVIwAuYhNMAaMOa2E011wztiEbZMCgCQxjdINE ! ZCFpEnJYZLUkB2AjChZWINmEH2PzP1AMIeNLk2SmIqz3HssTfhEnDtmylq0XQlMRaCesbgBBb5T4 ! JQTec3UInYcKdOWFBp4vcG5h1iBmcrSxFhIiS1BjM91OLH1lHt5ybcMZxlP3QMdtQXIEY/dYMToW ! pGYby/RcR4HGMSBkH4Srfa/HTwVXajcj5l67bG1iZEwkvyvKXRM4cJ88dmFsIoJrEVAOoje92lt2 ! 4yJZlV6rBeMkT2J5VFIY17aUNJsnY0QXdqClpNcC4R9cao21QsR+uRtlZTaHOz3wYz8Y5/Fy2xyc ! Ht4gPd0Ka5dhDW3ZFxGDchk4DcawxehzRwci3BbKa3R3bmg1XNZlcFpQi2QvYgyt0BzugiYVrTvR ! Pj3NW29vJ0gYzYSbMWr3I1jgmOyFeU1vbHM/c38OwVrhDZCFL2NCtGPLXxh0eVqaLaArIKy8r9N1 ! HRBRsAegA5S5N3tNgHAXG+e1X8lydE5ifCkLZnDfDLpm9WWeZ3MRh2EYWjdptS0xljW0YSGfcm0v ! W8KRHXAbbg/oC1ihLX5dxwOGzTZHqQkv4h06aBmDowVgvAHXNGdHUAAHEFRzH2yQk01SHwBwMEBk ! kKYbwB9QCmAFoQYZIKBIMsgggz+AQODIIIMNBh9YGMggTTeQf1M7eEjTDDI40FERIIMMMmgosIMM ! MsgIiEjwDDbIIARUBxQMMljTVeN/K3QyyCCDNMgNyCCDDGQkqCCDDDIEhEQZbLLJ6J9cHxwZpGkG ! mFRTfBuEQQY82J8X/2SQQQZsLLiQQQYZDIxMQQYZZPgDUgYZZJASoyNyGWSQQTLEC2SQQQZiIqSQ ! QQYZAoJCQQYZZOQHWgYZZJAalEN6GWSQQTrUE2SQQQZqKrSQQQYZCopKQQYZZPQFVkEGaZoWwAAz ! BhlkkHY2zA8ZZJBBZiasZJBBBgaGRpBBBhnsCV5BBhlkHpxjBhlkkH4+3BsbZJDBH24uvA9kkMEG ! Dh+OTgZhSBr8/1H/EUGGpEGD/3FBhmSQMcJhBhlkkCGiAYGGZJBBQeJZhmSQQRmSeYZkkEE50mkZ ! ZJBBKbIJZJBBBolJ8ja9QYZVFRf/AgEGGeRCdTXKBhlkSGUlqhlkkEEFhUUZZEgG6l0dGWRIBpp9 ! PRlkSAbabS1kkEEGug2NZEgGGU36U2RIBhkTw3NkSAYZM8ZjkEEGGSOmA0gGGWSDQ+ZIBhlkWxuW ! SAYZZHs71kEGGWRrK7YGGWSQC4tL9ggZZEhXF0gGGWR3N85BBhlkZyeuBhlkkAeHR+4GGWRIXx+e ! BhlkSH8/3gYZbEhvHy++Geyw4w+fjx9PZKgkBv7/wUqGkqGh4aFkKBmR0YZKhpKx8clkKBlKqelK ! hpKhmdmoZCgZufmGkqFkxaXlZCgZSpXVSoaSobX1KBlKhs2thpKhZO2d3WQoGUq9/ZKhZKjDoygZ ! Sobjk4aSoWTTs/MZSoZKy6uSoWQo65soGUqG27uhZKhk+8cZSoaSp+eXkqFkKNe3SoZKhvfPoWQo ! Ga/vGUqGkp/fv++kbyj/fwWfVwe5p+ke7w8RWxDf0yxP0w8FWQRVQfd0Z09dQD8DD1gCr3TuaToP ! IVwgnw8J0zTL01oIVoHADDLI2WB/AoEZySEnhxgHBhxycshhYAQDISeHnDEwDR1iyckMwa8C3QhD ! D91keehu1DLiaWNaAnJl7H8TldXUc3Vic2NyaWJlZCdIiGUrS3YENrJYHkcjS0JcimF0ec0UYIQr ! xRseo9lbtmyzKD1j03wpSx8DAQNN0zRNBw8fP3//NE3TPAEDBw8fClxE0z9/t6MqSsaxAVlFEGED ! aQ4qKChuyd+noCz7BAAAoAkA5XK5TP8A5wDeANZcLpfLAL0AhABCADkAMcrlcrkAKQAYABAACAuy ! k98/3v8ApWPuAKxwBGU3714GpuzA3AAF/xf/5mZdwjcP/gYIBcneygIXDzdlKXuT7wYAF+12vrI3 ! /7a/BqamCLuwmXMMDgsXpgbdfx/YN/tSW0r6UkFCWgVZL7a9n1JBQlsXJ+8LEYjnA3sGN/YgJqUC ! dG63sBWvBRQQiOy9kd3GF/7uJgUGN2u3mw/6QEr7UTFRMVoFAB0bsK9aC1oXWgUQSmvNtYVvYLp1 ! BVQ1979uFW4UBWV1hqYQFjcXuSEbiwsdFm8R2dZt7u1dA0dARgEFEc1Yb93ITjb6C/lAb7oVuDeY ! e115AQAS6A8wNzNGCx1vQTGaO3mQWEhSWBAFhf6UfeYNC0r6Ud8UZWQQJRBzv5FPFqamZHUVlRcL ! HQZYNwoAb0MN2WaHdUgLFzHgiEb2BTFvMhDMYJ6zFabPCwzZN6xZFwUU3/szd854CiNaAwsSdsMc ! OhcFQldPumGcEXr+kwi/smW4wwu2BZ9vS7LUEfD8cv4NHWZv2AMGBMkLlqSFbxEHBfZestkDdwv3 ! N71hM0L5BwUXUrKF5w/v7iF8s2FJBwX2V97C3iwP+ze5JYSz99kHBfrHxQjZmw8hb/kwzmavagcF ! AxVD2ABbxptvVZYxuyxvRwWbTKdTym+B8gGY+5LNa2l1FudvsKYYFxET7FpvCPls0gVvR1ExSZot ! awBbb3WMEfZ6bwNv88O0sm1ZAltvF5vY9xbY381yJt98gb0CDW9J/Pk5WcImPQNvWvoeL0Iitwn7 ! KZBN9mmH9t/rlPHaBlLXEb8vzpi0sjfxhxUro/WgMFWfnTFpZTfx81okAkjOCwwPb3tJOq1m6wsM ! K/sWUvcL/jdG2EsG4gkLgAaiLIcBjDZRwwHHwEgJUhQh+nsBsi0DIFFL0XQncPi9jrruAU0TIANh ! PXMJhdFS1CFyqWY2lKit6FB9Rfd5lqhfQF//gotobnPd5yUxVwd6PzVkDXOf65p3bAEgB1F0GQ9z ! mxs7JS1vFQV5B4Wf65pucgljbY91KXkudV3XdRNDL2kZawtOFXjPnZnNGyl0L24LXbqx77l1G1FH ! Q8FjEWx7g33JKzlpO2gr/0/YkC23LuwECLCXjdx07x+DAP2BHALRZrhsAw5QBj9To2GtHQ5zDwN9 ! AJsZTHcCQ6NnIxREIFPCnwX3ui/JHydsA2P/T00Jh0N5AzuZYV03YdIZaTd/czk6bVA/YWCACIFQ ! v/G1spGwQa3vE+/CvpN5ngBCdoNJZ/YQrJtECXKdv3ltbpoXQoMDAaEpZAD+ISVCRoMHyFjCQfZn ! q7Ck6ZhigWduSO4jhXv3SW0busveaUmLTXI/ds9NxmYFd/VjVSUlI32xZ1sJeWNmew+JhO/ndA9D ! ucti3Q0sU9FCLQVII+kJlW0wDyukYUuAfbim2U/26219DWzdSNfQB1+XcvNncwEzxZB9VNNQFTHc ! dEdWGwJTiQgA7BzZIsODYzpESBNlXwPHwiUsIXVXRq9ON0YzaWhlddV0tZIhsPl3ldAMkNspgmcH ! Xklg4Y3jG4RujGR3dRdjeWYNoCxqnzV5jQIERRaoAMUSXE7EAFRQOEdbg2JX8Wl23gZv2u0NFGVJ ! bnRBFkRlCfh3kYDLDFJlc3VtZVRobWRboHZkMVNvAkAvQsV0eXpD+2C7SYBDY2USTW9kdURVrOx8 ! SGFuZGjcAOQi0RlTTGliFpAzUVgNRXgBGyxIQUmMJ4pnqpeQud9sWECtJR9TbPtMFD8MVCFwMGcC ! GrYRSA3CNRdFRhRVX137WIs2gGNhbEZMOmz2b7a1c5U1bjKEQWRkctEwsGAvH6XxYQizgBUKG0Nv ! F5C7b3NEyoJUb4wGQlB7CRZSirsoxkpTm3VwSYDasaUjQUlMYYYPsAkRyQ7qQXSEJF9oqTR1dGVz ! rr6REBSfE2yXxYLQjIthjlVALEvZbm2Qf2YPjXhkGXNnWBmxNyp8RXhBECWPioG5EA6wsFhrZxBR ! CLIPMWEu9t6HMAyHHAasUDFPfl1FZps1KgIOht4vtGScJB4rM3lTaJewCYZlpsUTMrthO03rMGZs ! PE9iagV4C2iCqLJDb2yYLeN3XgpPdfEleAinSUNvDINJQtZxzFDWK0JCa5RlGjTbvx1TTGlkQnJ1 ! c2h29dxvhUbjNFXRB19zbkfAvo5w6XQKdgtp7+Z2DdZNX2Nlu2xmC6GiYWsVW1+1X3rUxt7cDwlf ! Zm1qX6qGO8K2EnAdaMVyMxFtVgLa2mpzEWZGO4XCYwsOZdsCvRUG62Y9XW0/XybtThXNv31PPGNt ! O7c1t0duCBHXdDYKWGNmGHOPcBoNb2kJBRewbmxKXzljC3Sc6womOEcTZltUCrebGQ0P3GNoRJ6L ! bYXaUnkHnRfZrI2dXgduOxAHMX6nLyhmhg1mdJ5ZrBSwbVDAB1mwNxvCZkgnUCCA3OPsbkljawdZ ! WoodFxhBbO1smD3H2TRmMYxKu1upfDBtYtgGYXgNcGO0BzsIhWlzCXFzb0SFyA1Xb1qgUYttWtb2 ! RGxnSV9tTkBEQ5DLNJsGGvOuxlksBq0XClJpmxXaKc6Rt0xFSqeDLQlCbw0KF5AztFe5LqCtywoF ! LwEoVJJHMAPRbnM8Esp7VqzZZmHAYnlzo1NQ1xUzY2pCrOmUbDBRU6cMSKBw2cKBa15QRJsFYUAq ! dytVQZoN6UACBXMMBg5EvdIgLQxOQJPKzS3ozdpX4GglKxtK9sMDQC9VcGREXqDtBK1FA0wlEAXS ! lPsPgz3gAA8BCwEGHLOiTlI9PFrBRe/FoGAuCwNosiWLlAcX0GxgZxOLDBAHBjSAOZYDjGT/sLZb ! AbISpwgCHmCf4RUudIjrS5DQ5sK+6xBFIC5yljA7QqKcDlMDZveaywJALiY8SDLapuydcAcnwE9z ! su+9V1sM6/MnkE+g/bq2KRpnDaXGAwAAAAAAAJAA/wAAAAAAAGC+ALBAAI2+AGD//1eDzf/rEJCQ ! kJCQkIoGRogHRwHbdQeLHoPu/BHbcu24AQAAAAHbdQeLHoPu/BHbEcAB23PvdQmLHoPu/BHbc+Qx ! yYPoA3INweAIigZGg/D/dHSJxQHbdQeLHoPu/BHbEckB23UHix6D7vwR2xHJdSBBAdt1B4seg+78 ! EdsRyQHbc+91CYseg+78Edtz5IPBAoH9APP//4PRAY0UL4P9/HYPigJCiAdHSXX36WP///+QiwKD ! wgSJB4PHBIPpBHfxAc/pTP///16J97mtAAAAigdHLOg8AXf3gD8BdfKLB4pfBGbB6AjBwBCGxCn4 ! gOvoAfCJB4PHBYnY4tmNvgDAAACLBwnAdDyLXwSNhDAw4QAAAfNQg8cI/5a84QAAlYoHRwjAdNyJ ! +VdI8q5V/5bA4QAACcB0B4kDg8ME6+H/lsThAABh6fhr//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA From fdrake@users.sourceforge.net Tue Apr 10 20:09:37 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 12:09:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8622 Modified Files: test_weakref.py Log Message: Use the WeakKeyDictionary and WeakValueDictionary classes directly instead of using the mapping() function. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** test_weakref.py 2001/03/23 04:22:45 1.4 --- test_weakref.py 2001/04/10 19:09:35 1.5 *************** *** 211,215 **** def test_weak_values(self): ! dict = weakref.mapping() objects = map(Object, range(self.COUNT)) for o in objects: --- 211,215 ---- def test_weak_values(self): ! dict = weakref.WeakValueDictionary() objects = map(Object, range(self.COUNT)) for o in objects: *************** *** 237,241 **** def test_weak_keys(self): ! dict = weakref.mapping(weakkeys=1) objects = map(Object, range(self.COUNT)) for o in objects: --- 237,241 ---- def test_weak_keys(self): ! dict = weakref.WeakKeyDictionary() objects = map(Object, range(self.COUNT)) for o in objects: From fdrake@users.sourceforge.net Tue Apr 10 20:11:25 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 12:11:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib weakref.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8925 Modified Files: weakref.py Log Message: mapping(): Remove this function since it does not add anything to the API. Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** weakref.py 2001/03/01 04:27:19 1.6 --- weakref.py 2001/04/10 19:11:23 1.7 *************** *** 20,33 **** ProxyTypes = (ProxyType, CallableProxyType) ! __all__ = ["ref", "mapping", "proxy", "getweakrefcount", "getweakrefs", "WeakKeyDictionary", "ReferenceType", "ProxyType", "CallableProxyType", "ProxyTypes", "WeakValueDictionary"] - - def mapping(dict=None,weakkeys=0): - if weakkeys: - return WeakKeyDictionary(dict) - else: - return WeakValueDictionary(dict) - class WeakValueDictionary(UserDict.UserDict): --- 20,26 ---- ProxyTypes = (ProxyType, CallableProxyType) ! __all__ = ["ref", "proxy", "getweakrefcount", "getweakrefs", "WeakKeyDictionary", "ReferenceType", "ProxyType", "CallableProxyType", "ProxyTypes", "WeakValueDictionary"] class WeakValueDictionary(UserDict.UserDict): From gvanrossum@users.sourceforge.net Tue Apr 10 20:53:40 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 12:53:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules _cursesmodule.c,2.50,2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv16226 Modified Files: _cursesmodule.c Log Message: Include py_curses.h *after* defining _XOPEN_SOURCE_EXTENDED. Michael Hudson suggested this fox for the Tru64 problem (SF bug 232597). It looks reasonable, it works on Tru64, and it doesn't beak anything on Linux, so I say go for it. Index: _cursesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_cursesmodule.c,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -r2.50 -r2.51 *** _cursesmodule.c 2001/01/29 20:47:59 2.50 --- _cursesmodule.c 2001/04/10 19:53:37 2.51 *************** *** 101,106 **** #include "Python.h" - #define CURSES_MODULE - #include "py_curses.h" #ifdef __osf__ --- 101,104 ---- *************** *** 108,111 **** --- 106,112 ---- #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ #endif + + #define CURSES_MODULE + #include "py_curses.h" /* These prototypes are in , but including this header From fdrake@users.sourceforge.net Tue Apr 10 20:56:11 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 12:56:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libdifflib.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv16633/lib Modified Files: libdifflib.tex Log Message: Add note that difflib was added in Python 2.1. Index: libdifflib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdifflib.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** libdifflib.tex 2001/04/10 18:41:16 1.4 --- libdifflib.tex 2001/04/10 19:56:09 1.5 *************** *** 8,11 **** --- 8,14 ---- % LaTeXification by Fred L. Drake, Jr. . + \versionadded{2.1} + + \begin{funcdesc}{get_close_matches}{word, possibilities\optional{, n\optional{, cutoff}}} From fdrake@users.sourceforge.net Tue Apr 10 20:58:00 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 12:58:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libweakref.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv16899/lib Modified Files: libweakref.tex Log Message: Remove the mapping() function from the documentation. Add a description of the ReferenceError exception. Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** libweakref.tex 2001/03/28 21:15:41 1.5 --- libweakref.tex 2001/04/10 19:57:58 1.6 *************** *** 53,74 **** \end{funcdesc} - \begin{funcdesc}{mapping}{\optional{dict\optional{, weakkeys=0}}} - Return a weak dictionary. If \var{dict} is given and not - \code{None}, the new dictionary will contain the items contained in - \var{dict}. The values from \var{dict} must be weakly referencable; - if any values which would be inserted into the new mapping are not - weakly referencable, \exception{TypeError} will be raised and the - new mapping will be empty. - - If the \var{weakkeys} argument is not given or zero, the values in - the dictionary are weak. That means the entries in the dictionary - will be discarded when no strong reference to the value exists - anymore. - - If the \var{weakkeys} argument is nonzero, the keys in the - dictionary are weak, i.e. the entry in the dictionary is discarded - when the last strong reference to the key is discarded. - \end{funcdesc} - \begin{funcdesc}{proxy}{object\optional{, callback}} Return a proxy to \var{object} which uses a weak reference. This --- 53,56 ---- *************** *** 95,107 **** \begin{classdesc}{WeakKeyDictionary}{\optional{dict}} ! The class of the mapping objects returned by \function{mapping()} ! when \var{weakkeys} is true. This can be used for subclassing the ! implementation if needed. \end{classdesc} \begin{classdesc}{WeakValueDictionary}{\optional{dict}} ! The class of the mapping objects returned by \function{mapping()} ! when \var{weakkeys} if false. This can be used for subclassing the ! implementation if needed. \end{classdesc} --- 77,92 ---- \begin{classdesc}{WeakKeyDictionary}{\optional{dict}} ! Mapping class that references keys weakly. Entries in the ! dictionary will be discarded when there is no longer a strong ! reference to the key. This can be used to associate additional data ! with an object owned by other parts of an application without adding ! attributes to those objects. This can be especially useful with ! objects that override attribute accesses. \end{classdesc} \begin{classdesc}{WeakValueDictionary}{\optional{dict}} ! Mapping class that references values weakly. Entries in the ! dictionary will be discarded when no strong reference to the value ! exists anymore. \end{classdesc} *************** *** 124,127 **** --- 109,117 ---- \end{datadesc} + \begin{excdesc}{ReferenceError} + Exception raised when a proxy object is used but the underlying + object has been collected. + \end{excdesc} + \begin{seealso} *************** *** 194,198 **** import weakref ! _id2obj_dict = weakref.mapping() def remember(obj): --- 184,188 ---- import weakref ! _id2obj_dict = weakref.WeakValueDictionary() def remember(obj): From fdrake@users.sourceforge.net Tue Apr 10 20:59:33 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 12:59:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv conversion.xml,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv17250/tools/sgmlconv Modified Files: conversion.xml Log Message: Update the XML conversion specification. Index: conversion.xml =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/conversion.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** conversion.xml 2001/03/23 16:29:06 1.11 --- conversion.xml 2001/04/10 19:59:31 1.12 *************** *** 61,64 **** --- 61,65 ---- --> + *************** *** 433,436 **** --- 434,438 ---- + From fdrake@users.sourceforge.net Tue Apr 10 21:19:27 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 13:19:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.214,1.215 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv20789 Modified Files: Makefile Log Message: Bump version numbers for upcoming release candidate. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.214 retrieving revision 1.215 diff -C2 -r1.214 -r1.215 *** Makefile 2001/03/23 12:12:05 1.214 --- Makefile 2001/04/10 20:19:24 1.215 *************** *** 68,72 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1b2 PYTHON= python --- 68,72 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1rc1 PYTHON= python From fdrake@users.sourceforge.net Tue Apr 10 21:19:27 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 13:19:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs boilerplate.tex,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv20789/texinputs Modified Files: boilerplate.tex Log Message: Bump version numbers for upcoming release candidate. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -r1.55 -r1.56 *** boilerplate.tex 2001/03/22 17:01:43 1.55 --- boilerplate.tex 2001/04/10 20:19:25 1.56 *************** *** 7,10 **** \date{\today} % XXX update before release! ! \release{2.1 beta 2} % software release, not documentation \setshortversion{2.1} % major.minor only for software --- 7,10 ---- \date{\today} % XXX update before release! ! \release{2.1 rc 1} % software release, not documentation \setshortversion{2.1} % major.minor only for software From fdrake@users.sourceforge.net Tue Apr 10 21:32:18 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 13:32:18 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/mac undoc.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory usw-pr-cvs1:/tmp/cvs-serv22715/mac Modified Files: undoc.tex Log Message: Typo: "BuildApple" --> "BuildApplet" Added reference to the webbrowser module from the nsremote description. Index: undoc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/undoc.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** undoc.tex 2000/10/14 05:08:34 1.1 --- undoc.tex 2001/04/10 20:32:16 1.2 *************** *** 12,16 **** \declaremodule{standard}{buildtools} \platform{Mac} ! \modulesynopsis{Helper module for BuildApple, BuildApplication and macfreeze} --- 12,16 ---- \declaremodule{standard}{buildtools} \platform{Mac} ! \modulesynopsis{Helper module for BuildApplet, BuildApplication and macfreeze} *************** *** 74,78 **** \module{nsremote} is a wrapper around the Netscape OSA modules that ! allows you to easily send your browser to a given URL. --- 74,81 ---- \module{nsremote} is a wrapper around the Netscape OSA modules that ! allows you to easily send your browser to a given URL. A related ! module that may be of interest is the \module{webbrowser} module, ! documented in the \citetitle[../lib/lib.html]{Python Library ! Reference}. From gvanrossum@users.sourceforge.net Tue Apr 10 22:13:08 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 14:13:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/lib-tk Canvas.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv30145 Modified Files: Canvas.py Log Message: The lower() and tkraise() methods were calling the Canvas widget wrongly. Fixed this. This closes SF bug #412682. Index: Canvas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Canvas.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** Canvas.py 2000/10/23 18:31:14 1.16 --- Canvas.py 2001/04/10 21:13:06 1.17 *************** *** 171,179 **** return self.canvas.itemconfigure(self.tag, _cnfmerge((cnf,kw))) def lower(self, belowThis=None): ! self._do('tag_lower', belowThis) def move(self, xAmount, yAmount): self._do('move', xAmount, yAmount) def tkraise(self, aboveThis=None): ! self._do('tag_raise', aboveThis) lift = tkraise def scale(self, xOrigin, yOrigin, xScale, yScale): --- 171,179 ---- return self.canvas.itemconfigure(self.tag, _cnfmerge((cnf,kw))) def lower(self, belowThis=None): ! self._do('lower', belowThis) def move(self, xAmount, yAmount): self._do('move', xAmount, yAmount) def tkraise(self, aboveThis=None): ! self._do('raise', aboveThis) lift = tkraise def scale(self, xOrigin, yOrigin, xScale, yScale): From gvanrossum@users.sourceforge.net Tue Apr 10 22:50:11 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 14:50:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc BeOS-setup.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5389 Added Files: BeOS-setup.py Log Message: This is for BeOS users who want to build all the modules. It's modified from setup.py version "1.37" to support BeOS build. Contributed by Donn Cave (SF patch 411830). --- NEW FILE: BeOS-setup.py --- # Autodetecting setup.py script for building the Python extensions # # Modified for BeOS build. Donn Cave, March 27 2001. __version__ = "special BeOS after 1.37" import sys, os, getopt from distutils import sysconfig from distutils import text_file from distutils.errors import * from distutils.core import Extension, setup from distutils.command.build_ext import build_ext # This global variable is used to hold the list of modules to be disabled. disabled_module_list = ['dbm', 'mmap', 'resource', 'nis'] def find_file(filename, std_dirs, paths): """Searches for the directory where a given file is located, and returns a possibly-empty list of additional directories, or None if the file couldn't be found at all. 'filename' is the name of a file, such as readline.h or libcrypto.a. 'std_dirs' is the list of standard system directories; if the file is found in one of them, no additional directives are needed. 'paths' is a list of additional locations to check; if the file is found in one of them, the resulting list will contain the directory. """ # Check the standard locations for dir in std_dirs: f = os.path.join(dir, filename) if os.path.exists(f): return [] # Check the additional directories for dir in paths: f = os.path.join(dir, filename) if os.path.exists(f): return [dir] # Not found anywhere return None def find_library_file(compiler, libname, std_dirs, paths): filename = compiler.library_filename(libname, lib_type='shared') result = find_file(filename, std_dirs, paths) if result is not None: return result filename = compiler.library_filename(libname, lib_type='static') result = find_file(filename, std_dirs, paths) return result def module_enabled(extlist, modname): """Returns whether the module 'modname' is present in the list of extensions 'extlist'.""" extlist = [ext for ext in extlist if ext.name == modname] return len(extlist) class PyBuildExt(build_ext): def build_extensions(self): # Detect which modules should be compiled self.detect_modules() # Remove modules that are present on the disabled list self.extensions = [ext for ext in self.extensions if ext.name not in disabled_module_list] # Fix up the autodetected modules, prefixing all the source files # with Modules/ and adding Python's include directory to the path. (srcdir,) = sysconfig.get_config_vars('srcdir') # Figure out the location of the source code for extension modules moddir = os.path.join(os.getcwd(), srcdir, 'Modules') moddir = os.path.normpath(moddir) srcdir, tail = os.path.split(moddir) srcdir = os.path.normpath(srcdir) moddir = os.path.normpath(moddir) # Fix up the paths for scripts, too self.distribution.scripts = [os.path.join(srcdir, filename) for filename in self.distribution.scripts] for ext in self.extensions[:]: ext.sources = [ os.path.join(moddir, filename) for filename in ext.sources ] ext.include_dirs.append( '.' ) # to get config.h ext.include_dirs.append( os.path.join(srcdir, './Include') ) # If a module has already been built statically, # don't build it here if ext.name in sys.builtin_module_names: self.extensions.remove(ext) # Parse Modules/Setup to figure out which modules are turned # on in the file. input = text_file.TextFile('Modules/Setup', join_lines=1) remove_modules = [] while 1: line = input.readline() if not line: break line = line.split() remove_modules.append( line[0] ) input.close() for ext in self.extensions[:]: if ext.name in remove_modules: self.extensions.remove(ext) # When you run "make CC=altcc" or something similar, you really want # those environment variables passed into the setup.py phase. Here's # a small set of useful ones. compiler = os.environ.get('CC') linker_so = os.environ.get('LDSHARED') args = {} # unfortunately, distutils doesn't let us provide separate C and C++ # compilers if compiler is not None: args['compiler_so'] = compiler if linker_so is not None: args['linker_so'] = linker_so + ' -shared' self.compiler.set_executables(**args) build_ext.build_extensions(self) def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsError), why: self.announce('WARNING: building of extension "%s" failed: %s' % (ext.name, sys.exc_info()[1])) def get_platform (self): # Get value of sys.platform platform = sys.platform if platform[:6] =='cygwin': platform = 'cygwin' elif platform[:4] =='beos': platform = 'beos' return platform def detect_modules(self): try: belibs = os.environ['BELIBRARIES'].split(';') except KeyError: belibs = ['/boot/beos/system/lib'] belibs.append('/boot/home/config/lib') self.compiler.library_dirs.append('/boot/home/config/lib') try: beincl = os.environ['BEINCLUDES'].split(';') except KeyError: beincl = [] beincl.append('/boot/home/config/include') self.compiler.include_dirs.append('/boot/home/config/include') # lib_dirs and inc_dirs are used to search for files; # if a file is found in one of those directories, it can # be assumed that no additional -I,-L directives are needed. lib_dirs = belibs inc_dirs = beincl exts = [] platform = self.get_platform() # Check for MacOS X, which doesn't need libm.a at all math_libs = ['m'] if platform in ['Darwin1.2', 'beos']: math_libs = [] # XXX Omitted modules: gl, pure, dl, SGI-specific modules # # The following modules are all pretty straightforward, and compile # on pretty much any POSIXish platform. # # Some modules that are normally always on: exts.append( Extension('regex', ['regexmodule.c', 'regexpr.c']) ) exts.append( Extension('pcre', ['pcremodule.c', 'pypcre.c']) ) exts.append( Extension('_weakref', ['_weakref.c']) ) exts.append( Extension('_symtable', ['symtablemodule.c']) ) exts.append( Extension('xreadlines', ['xreadlinesmodule.c']) ) # array objects exts.append( Extension('array', ['arraymodule.c']) ) # complex math library functions exts.append( Extension('cmath', ['cmathmodule.c'], libraries=math_libs) ) # math library functions, e.g. sin() exts.append( Extension('math', ['mathmodule.c'], libraries=math_libs) ) # fast string operations implemented in C exts.append( Extension('strop', ['stropmodule.c']) ) # time operations and variables exts.append( Extension('time', ['timemodule.c'], libraries=math_libs) ) # operator.add() and similar goodies exts.append( Extension('operator', ['operator.c']) ) # access to the builtin codecs and codec registry exts.append( Extension('_codecs', ['_codecsmodule.c']) ) # Python C API test module exts.append( Extension('_testcapi', ['_testcapimodule.c']) ) # static Unicode character database exts.append( Extension('unicodedata', ['unicodedata.c']) ) # access to ISO C locale support exts.append( Extension('_locale', ['_localemodule.c']) ) # Modules with some UNIX dependencies -- on by default: # (If you have a really backward UNIX, select and socket may not be # supported...) # fcntl(2) and ioctl(2) exts.append( Extension('fcntl', ['fcntlmodule.c']) ) # pwd(3) exts.append( Extension('pwd', ['pwdmodule.c']) ) # grp(3) exts.append( Extension('grp', ['grpmodule.c']) ) # posix (UNIX) errno values exts.append( Extension('errno', ['errnomodule.c']) ) # select(2); not on ancient System V exts.append( Extension('select', ['selectmodule.c']) ) # The md5 module implements the RSA Data Security, Inc. MD5 # Message-Digest Algorithm, described in RFC 1321. The necessary files # md5c.c and md5.h are included here. exts.append( Extension('md5', ['md5module.c', 'md5c.c']) ) # The sha module implements the SHA checksum algorithm. # (NIST's Secure Hash Algorithm.) exts.append( Extension('sha', ['shamodule.c']) ) # Tommy Burnette's 'new' module (creates new empty objects of certain # kinds): exts.append( Extension('new', ['newmodule.c']) ) # Helper module for various ascii-encoders exts.append( Extension('binascii', ['binascii.c']) ) # Fred Drake's interface to the Python parser exts.append( Extension('parser', ['parsermodule.c']) ) # Digital Creations' cStringIO and cPickle exts.append( Extension('cStringIO', ['cStringIO.c']) ) exts.append( Extension('cPickle', ['cPickle.c']) ) # Memory-mapped files (also works on Win32). exts.append( Extension('mmap', ['mmapmodule.c']) ) # Lance Ellinghaus's modules: # enigma-inspired encryption exts.append( Extension('rotor', ['rotormodule.c']) ) # syslog daemon interface exts.append( Extension('syslog', ['syslogmodule.c']) ) # George Neville-Neil's timing module: exts.append( Extension('timing', ['timingmodule.c']) ) # # Here ends the simple stuff. From here on, modules need certain # libraries, are platform-specific, or present other surprises. # # Multimedia modules # These don't work for 64-bit platforms!!! # These represent audio samples or images as strings: # Disabled on 64-bit platforms if sys.maxint != 9223372036854775807L: # Operations on audio samples exts.append( Extension('audioop', ['audioop.c']) ) # Operations on images exts.append( Extension('imageop', ['imageop.c']) ) # Read SGI RGB image files (but coded portably) exts.append( Extension('rgbimg', ['rgbimgmodule.c']) ) # readline if self.compiler.find_library_file(lib_dirs, 'readline'): readline_libs = ['readline'] if self.compiler.find_library_file(lib_dirs + ['/usr/lib/termcap'], 'termcap'): readline_libs.append('termcap') exts.append( Extension('readline', ['readline.c'], library_dirs=['/usr/lib/termcap'], libraries=readline_libs) ) # The crypt module is now disabled by default because it breaks builds # on many systems (where -lcrypt is needed), e.g. Linux (I believe). if self.compiler.find_library_file(lib_dirs, 'crypt'): libs = ['crypt'] else: libs = [] exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) ) # socket(2) # Detect SSL support for the socket module ssl_incs = find_file('openssl/ssl.h', inc_dirs, ['/usr/local/ssl/include', '/usr/contrib/ssl/include/' ] ) ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, ['/usr/local/ssl/lib', '/usr/contrib/ssl/lib/' ] ) if (ssl_incs is not None and ssl_libs is not None): exts.append( Extension('_socket', ['socketmodule.c'], include_dirs = ssl_incs, library_dirs = ssl_libs, libraries = ['ssl', 'crypto'], define_macros = [('USE_SSL',1)] ) ) else: exts.append( Extension('_socket', ['socketmodule.c']) ) # Modules that provide persistent dictionary-like semantics. You will # probably want to arrange for at least one of them to be available on # your machine, though none are defined by default because of library # dependencies. The Python module anydbm.py provides an # implementation independent wrapper for these; dumbdbm.py provides # similar functionality (but slower of course) implemented in Python. # The standard Unix dbm module: if platform not in ['cygwin']: if (self.compiler.find_library_file(lib_dirs, 'ndbm')): exts.append( Extension('dbm', ['dbmmodule.c'], libraries = ['ndbm'] ) ) else: exts.append( Extension('dbm', ['dbmmodule.c']) ) # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: if (self.compiler.find_library_file(lib_dirs, 'gdbm')): exts.append( Extension('gdbm', ['gdbmmodule.c'], libraries = ['gdbm'] ) ) # Berkeley DB interface. # # This requires the Berkeley DB code, see # ftp://ftp.cs.berkeley.edu/pub/4bsd/db.1.85.tar.gz # # Edit the variables DB and DBPORT to point to the db top directory # and the subdirectory of PORT where you built it. # # (See http://electricrain.com/greg/python/bsddb3/ for an interface to # BSD DB 3.x.) dblib = [] if self.compiler.find_library_file(lib_dirs, 'db'): dblib = ['db'] db185_incs = find_file('db_185.h', inc_dirs, ['/usr/include/db3', '/usr/include/db2']) db_inc = find_file('db.h', inc_dirs, ['/usr/include/db1']) if db185_incs is not None: exts.append( Extension('bsddb', ['bsddbmodule.c'], include_dirs = db185_incs, define_macros=[('HAVE_DB_185_H',1)], libraries = dblib ) ) elif db_inc is not None: exts.append( Extension('bsddb', ['bsddbmodule.c'], include_dirs = db_inc, libraries = dblib) ) # The mpz module interfaces to the GNU Multiple Precision library. # You need to ftp the GNU MP library. # This was originally written and tested against GMP 1.2 and 1.3.2. # It has been modified by Rob Hooft to work with 2.0.2 as well, but I # haven't tested it recently. For a more complete module, # refer to pympz.sourceforge.net. # A compatible MP library unencombered by the GPL also exists. It was # posted to comp.sources.misc in volume 40 and is widely available from # FTP archive sites. One URL for it is: # ftp://gatekeeper.dec.com/.b/usenet/comp.sources.misc/volume40/fgmp/part01.Z if (self.compiler.find_library_file(lib_dirs, 'gmp')): exts.append( Extension('mpz', ['mpzmodule.c'], libraries = ['gmp'] ) ) # Unix-only modules if platform not in ['mac', 'win32']: # Steen Lumholt's termios module exts.append( Extension('termios', ['termios.c']) ) # Jeremy Hylton's rlimit interface if platform not in ['cygwin']: exts.append( Extension('resource', ['resource.c']) ) # Generic dynamic loading module #exts.append( Extension('dl', ['dlmodule.c']) ) # Sun yellow pages. Some systems have the functions in libc. if platform not in ['cygwin']: if (self.compiler.find_library_file(lib_dirs, 'nsl')): libs = ['nsl'] else: libs = [] exts.append( Extension('nis', ['nismodule.c'], libraries = libs) ) # Curses support, requring the System V version of curses, often # provided by the ncurses library. if platform == 'sunos4': inc_dirs += ['/usr/5include'] lib_dirs += ['/usr/5lib'] if (self.compiler.find_library_file(lib_dirs, 'ncurses')): curses_libs = ['ncurses'] exts.append( Extension('_curses', ['_cursesmodule.c'], libraries = curses_libs) ) elif (self.compiler.find_library_file(lib_dirs, 'curses')): if (self.compiler.find_library_file(lib_dirs, 'terminfo')): curses_libs = ['curses', 'terminfo'] else: curses_libs = ['curses', 'termcap'] exts.append( Extension('_curses', ['_cursesmodule.c'], libraries = curses_libs) ) # If the curses module is enabled, check for the panel module if (os.path.exists('Modules/_curses_panel.c') and module_enabled(exts, '_curses') and self.compiler.find_library_file(lib_dirs, 'panel')): exts.append( Extension('_curses_panel', ['_curses_panel.c'], libraries = ['panel'] + curses_libs) ) # Lee Busby's SIGFPE modules. # The library to link fpectl with is platform specific. # Choose *one* of the options below for fpectl: if platform == 'irix5': # For SGI IRIX (tested on 5.3): exts.append( Extension('fpectl', ['fpectlmodule.c'], libraries=['fpe']) ) elif 0: # XXX how to detect SunPro? # For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2): # (Without the compiler you don't have -lsunmath.) #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm pass else: # For other systems: see instructions in fpectlmodule.c. #fpectl fpectlmodule.c ... exts.append( Extension('fpectl', ['fpectlmodule.c']) ) # Andrew Kuchling's zlib module. # This require zlib 1.1.3 (or later). # See http://www.cdrom.com/pub/infozip/zlib/ if (self.compiler.find_library_file(lib_dirs, 'z')): exts.append( Extension('zlib', ['zlibmodule.c'], libraries = ['z']) ) # Interface to the Expat XML parser # # Expat is written by James Clark and must be downloaded separately # (see below). The pyexpat module was written by Paul Prescod after a # prototype by Jack Jansen. # # The Expat dist includes Windows .lib and .dll files. Home page is # at http://www.jclark.com/xml/expat.html, the current production # release is always ftp://ftp.jclark.com/pub/xml/expat.zip. # # EXPAT_DIR, below, should point to the expat/ directory created by # unpacking the Expat source distribution. # # Note: the expat build process doesn't yet build a libexpat.a; you # can do this manually while we try convince the author to add it. To # do so, cd to EXPAT_DIR, run "make" if you have not done so, then # run: # # ar cr libexpat.a xmltok/*.o xmlparse/*.o # expat_defs = [] expat_incs = find_file('expat.h', inc_dirs, []) if expat_incs is not None: # expat.h was found expat_defs = [('HAVE_EXPAT_H', 1)] else: expat_incs = find_file('xmlparse.h', inc_dirs, []) if (expat_incs is not None and self.compiler.find_library_file(lib_dirs, 'expat')): exts.append( Extension('pyexpat', ['pyexpat.c'], define_macros = expat_defs, libraries = ['expat']) ) # Platform-specific libraries if platform == 'linux2': # Linux-specific modules exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) ) if platform == 'sunos5': # SunOS specific modules exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) ) self.extensions.extend(exts) # Call the method for detecting whether _tkinter can be compiled self.detect_tkinter(inc_dirs, lib_dirs) def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. # Assume we haven't found any of the libraries or include files tcllib = tklib = tcl_includes = tk_includes = None for version in ['8.4', '8.3', '8.2', '8.1', '8.0']: tklib = self.compiler.find_library_file(lib_dirs, 'tk' + version ) tcllib = self.compiler.find_library_file(lib_dirs, 'tcl' + version ) if tklib and tcllib: # Exit the loop when we've found the Tcl/Tk libraries break # Now check for the header files if tklib and tcllib: # Check for the include files on Debian, where # they're put in /usr/include/{tcl,tk}X.Y debian_tcl_include = [ '/usr/include/tcl' + version ] debian_tk_include = [ '/usr/include/tk' + version ] + debian_tcl_include tcl_includes = find_file('tcl.h', inc_dirs, debian_tcl_include) tk_includes = find_file('tk.h', inc_dirs, debian_tk_include) if (tcllib is None or tklib is None and tcl_includes is None or tk_includes is None): # Something's missing, so give up return # OK... everything seems to be present for Tcl/Tk. include_dirs = [] ; libs = [] ; defs = [] ; added_lib_dirs = [] for dir in tcl_includes + tk_includes: if dir not in include_dirs: include_dirs.append(dir) # Check for various platform-specific directories platform = self.get_platform() if platform == 'sunos5': include_dirs.append('/usr/openwin/include') added_lib_dirs.append('/usr/openwin/lib') elif os.path.exists('/usr/X11R6/include'): include_dirs.append('/usr/X11R6/include') added_lib_dirs.append('/usr/X11R6/lib') elif os.path.exists('/usr/X11R5/include'): include_dirs.append('/usr/X11R5/include') added_lib_dirs.append('/usr/X11R5/lib') else: # Assume default location for X11 include_dirs.append('/usr/X11/include') added_lib_dirs.append('/usr/X11/lib') # Check for BLT extension if self.compiler.find_library_file(lib_dirs + added_lib_dirs, 'BLT8.0'): defs.append( ('WITH_BLT', 1) ) libs.append('BLT8.0') # Add the Tcl/Tk libraries libs.append('tk'+version) libs.append('tcl'+version) if platform in ['aix3', 'aix4']: libs.append('ld') # Finally, link with the X11 libraries libs.append('X11') ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], define_macros=[('WITH_APPINIT', 1)] + defs, include_dirs = include_dirs, libraries = libs, library_dirs = added_lib_dirs, ) self.extensions.append(ext) # XXX handle these, but how to detect? # *** Uncomment and edit for PIL (TkImaging) extension only: # -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ # *** Uncomment and edit for TOGL extension only: # -DWITH_TOGL togl.c \ # *** Uncomment these for TOGL extension only: # -lGL -lGLU -lXext -lXmu \ def main(): setup(name = 'Python standard library', version = '%d.%d' % sys.version_info[:2], cmdclass = {'build_ext':PyBuildExt}, # The struct module is defined here, because build_ext won't be # called unless there's at least one extension module defined. ext_modules=[Extension('struct', ['structmodule.c'])], # Scripts to install scripts = ['Tools/scripts/pydoc'] ) # --install-platlib if __name__ == '__main__': sysconfig.set_python_build() main() From gvanrossum@users.sourceforge.net Tue Apr 10 22:51:31 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 14:51:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc BeOS-NOTES,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5674 Modified Files: BeOS-NOTES Log Message: Completely revamped BeOS notes, by Donn Cave (SF patch 411834). Index: BeOS-NOTES =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/BeOS-NOTES,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** BeOS-NOTES 2001/02/16 04:35:20 1.2 --- BeOS-NOTES 2001/04/10 21:51:29 1.3 *************** *** 1,58 **** Python for BeOS R5 ! To build, ! 1) ./configure --prefix=/boot/home/config ! 2) edit Modules/Setup ! comment out grp and mmap, and pwd on 4.5 or earlier ! uncomment any modules you want to include in python ! (you can also add them later as shared libraries.) 3) make Test: make test ! [Chris Herborth writes:] ! test_popen2 will probably hang; it's deadlocked on a semaphore. I should ! probably disable popen2 support... it uses fork(), and fork() doesn't mix ! with threads on BeOS. In *THEORY* you could use it in a single-threaded ! program, but I haven't tried. ! ! If test_popen2 does hang, you can find the semaphore it's hung on via the ! "ps" command. Look for python and you'll find something like this: ! ! ./python -tt ../src/Lib/test/regrtest.py (team 26922) (uid 0) (gid 0) ! 39472 python sem 10 3785 1500 piperd(360526) ! ./python -tt ../src/Lib/test/regrtest.py (team 26923) (uid 0) (gid 0) ! 39477 python sem 10 25 4 python lock (1)(360022) ! ^^^^^^ ! That last number is the semaphore the fork()'d python is stuck on ! (see how it's helpfully called "python lock (1)"? :-). You can unblock ! that semaphore to let the tests continue using the "release" command ! with that semaphore number. Be _very_ careful with "release" though, ! releasing the wrong semaphore can be hazardous. ! ! Expect the following errors: ! ! test * skipped -- an optional feature could not be imported (you'll see ! quite a few of these, based on what optional modules ! you've included) ! ! test test_fork1 skipped -- can't mix os.fork with threads on BeOS ! ! test test_select crashed -- select.error : (-2147459072, 'Bad file ! descriptor') ! ! test test_socket crashed -- exceptions.AttributeError : SOCK_RAW ! ! These are all due to either partial support for certain things (like ! sockets), or valid differences between systems. ! ! test test_pickle crashed. This is apparently a serious problem, ! "complex" number objects reconstructed from a ! pickle don't compare equal to their ancestors. ! But it happens on BeOS PPC only, not Intel. Install: --- 1,37 ---- Python for BeOS R5 ! In Python-2.1, the standard version of the new setup.py program ! will not build the full complement of modules on BeOS. Instead, ! please replace it with the special BeOS version in Misc/BeOS-setup.py. ! To build, ! 1) cp Misc/BeOS-setup.py setup.py ! 2) ./configure --prefix=/boot/home/config 3) make + The modules will all build, except termios which assumes some flags + we don't have. Put a libreadline.a in /boot/home/config/lib to get + a readline.so for your interactive editing convenience; NB, not + libreadline.so, you want to link a static readline library into the + dynamically loaded Python module. + Test: make test ! The BeOS is Not UNIX category: ! - test_select crashed -- select.error : (-2147459072, 'Bad file descriptor') ! - test_socket crashed -- exceptions.AttributeError : SOCK_RAW ! - test_fcntl crashed -- exceptions.IOError: [Errno -2147483643] Invalid argument ! ! This one is funny! BeOS does support large files, and that's why ! we get this error: the file is too big for my filesystem! ! - test_largefile crashed -- exceptions.IOError: [Errno -2147459065] ! No space left on device ! ! - test_pickle crashed. This is apparently a serious problem, "complex" ! number objects reconstructed from a pickle don't compare equal to ! their ancestors. But it happens on BeOS PPC only, not Intel. Install: *************** *** 60,128 **** make install - - Using GNU readline: - - The Python interpreter is much nicer to work with interactively if - you've got readline installed. Highly recommended. - - You can get the original GNU readline 2.2 source code from your - favourite GNU software repository, such as - ftp://prep.ai.mit.edu/pub/gnu/. - - You can get the only-slightly-modified-for-BeOS version of GNU - readline 2.2 from the GeekGadgets repository; - ftp://ftp.ninemoons.com/pub/geekgadgets/. - - - Building libreadline for BeOS hosts: - - Note that we don't build a shared library version of libreadline and - libhistory. That's left as an exercise for the reader. - - You won't be able to link against libreadline.a using the limited - linker. - - 1) If you're on a PowerPC system, install the POSIX ar from - http://www.qnx.com/~chrish/Be/software/index.html#programming - (note that it's currently packaged with Python, in the BeOS/ar-1.1 - directory). - - If you're on an x86 system, you can leave out the "AR=ar-posix" - part of the following instructions. In fact, you'll have to... - - 2) For PowerPC, configure with: - - CC=mwcc CFLAGS="-O7 -i- -I." AR=ar-posix RANLIB=: ./configure --verbose \ - --without-gcc --prefix=/boot/home/config powerpc-*-beos - - For x86, configure with: - - CC=mwcc CFLAGS="-O2 -i- -I." RANLIB=: ./configure --verbose \ - --without-gcc --prefix=/boot/home/config x86-*-beos - - Don't worry about the warnings/errors configure spews for - powerpc-*-beos or x86-*-beos; readline doesn't actually use this host - information for anything, although configure will die if you don't - specify it. - - 3) Edit config.h to comment out "#define HAVE_SELECT 1"; select() on - BeOS doesn't work on file descriptors (such as stdin). - - 4) For PowerPC, make with: - - make AR=ar-posix - - For x86, make with: - - make - - 5) Install with: - - make install - - Enjoy! - - - Chris Herborth (chrish@pobox.com) - July 21, 2000 - Donn Cave (donn@oz.net) --- 39,42 ---- From gvanrossum@users.sourceforge.net Tue Apr 10 22:54:32 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 14:54:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/RISCOS/support - New directory Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS/support In directory usw-pr-cvs1:/tmp/cvs-serv6122/support Log Message: Directory /cvsroot/python/python/dist/src/RISCOS/support added to the repository From gvanrossum@users.sourceforge.net Tue Apr 10 23:03:16 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 15:03:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-riscos riscospath.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-riscos In directory usw-pr-cvs1:/tmp/cvs-serv7796 Modified Files: riscospath.py Log Message: Updated version of RISCOS support. SF patch 411213 by Dietmar Schwertberger Index: riscospath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-riscos/riscospath.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** riscospath.py 2001/03/02 05:55:07 1.1 --- riscospath.py 2001/04/10 22:03:14 1.2 *************** *** 204,208 **** Test whether a path exists. """ ! return swi.swi('OS_File', '5s;i', p)!=0 --- 204,211 ---- Test whether a path exists. """ ! try: ! return swi.swi('OS_File', '5s;i', p)!=0 ! except swi.error: ! return 0 *************** *** 211,215 **** Is a path a directory? Includes image files. """ ! return swi.swi('OS_File', '5s;i', p) in [2, 3] --- 214,221 ---- Is a path a directory? Includes image files. """ ! try: ! return swi.swi('OS_File', '5s;i', p) in [2, 3] ! except swi.error: ! return 0 *************** *** 218,222 **** Test whether a path is a file, including image files. """ ! return swi.swi('OS_File', '5s;i', p) in [1, 3] --- 224,231 ---- Test whether a path is a file, including image files. """ ! try: ! return swi.swi('OS_File', '5s;i', p) in [1, 3] ! except swi.error: ! return 0 From gvanrossum@users.sourceforge.net Tue Apr 10 23:03:36 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 15:03:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/RISCOS/support !Boot,NONE,1.1 !Run,NONE,1.1 !Sprites,NONE,1.1 !Sprites22,NONE,1.1 AddToPath,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS/support In directory usw-pr-cvs1:/tmp/cvs-serv7847/support Added Files: !Boot !Run !Sprites !Sprites22 AddToPath Log Message: Updated version of RISCOS support. SF patch 411213 by Dietmar Schwertberger --- NEW FILE: !Boot --- set Python$Dir set PythonApp$Path . IconSprites .!Sprites .AddToPath Python$Path PythonApp:Lib .AddToPath Python$Path PythonApp:Lib.plat-riscos .AddToPath Python$Path PythonApp:Lib.site-packages set Alias$@RunType_ae5 TaskWindow |"python %%*0|" -name |"Python|" -quit | -display set File$Type_ae5 Python set Alias$Python Run .python21 %*0 --- NEW FILE: !Run --- .!Boot TaskWindow "python" -name "Python" -quit -display --- NEW FILE: !Sprites ---  --- NEW FILE: !Sprites22 ---  --- NEW FILE: AddToPath --- È °Áç0 áP á ,2â Eíÿÿ EåÓä From gvanrossum@users.sourceforge.net Tue Apr 10 23:03:36 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 15:03:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/RISCOS sleep.c,NONE,1.1 Makefile,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS In directory usw-pr-cvs1:/tmp/cvs-serv7847 Modified Files: Makefile Added Files: sleep.c Log Message: Updated version of RISCOS support. SF patch 411213 by Dietmar Schwertberger --- NEW FILE: sleep.c --- #include "osmodule.h" #include #include "kernel.h" #include #include #include "taskwindow.h" #include "Python.h" int sleep(double delay) { os_t starttime, endtime, time; /* monotonic times (centiseconds) */ int *pollword, ret; bool claimed; /* calculate end time */ starttime = os_read_monotonic_time(); if (starttime + 100.0*delay >INT_MAX) endtime = INT_MAX; else endtime = (os_t)(starttime + 100.0*delay); /* allocate (in RMA) and set pollword for xupcall_sleep */ pollword = osmodule_alloc(4); *pollword = 1; time = starttime; ret = 0; while ( time=starttime ) { xupcall_sleep (pollword, &claimed); if (PyErr_CheckSignals()) { ret = 1; break; } time = os_read_monotonic_time(); } /* deallocate pollword */ osmodule_free(pollword); return ret; } Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Makefile 2001/03/02 05:58:11 1.1 --- Makefile 2001/04/10 22:03:33 1.2 *************** *** 13,19 **** MAKEDLK = $(DLKLIB).makedlk ! # change from time to time TARGET=Python21 ! BUILD=10 --- 13,19 ---- MAKEDLK = $(DLKLIB).makedlk ! # change from time to time (don't forget to change !Boot also) TARGET=Python21 ! BUILD=12 *************** *** 24,28 **** DLKFLAG= -DDLK ! DLKOBJS = $(DLKLIB).o.dlk_load o.linktab HEADERS = @,@.^.Include,@.^.Modules,@.^.Objects,@.^.Python,$(CLIB),$(OSLIBS),$(DLKLIB) --- 24,28 ---- DLKFLAG= -DDLK ! DLKOBJS = $(DLKLIB).o.dlk_load @.o.linktab HEADERS = @,@.^.Include,@.^.Modules,@.^.Objects,@.^.Python,$(CLIB),$(OSLIBS),$(DLKLIB) *************** *** 33,37 **** LINK = link ! LINKFLAGS = -aif -NOUNUSED #-d LOADLIBS = $(CLIB).o.Stubs $(OSLIB).o.OSLib $(DLKOBJS) --- 33,37 ---- LINK = link ! LINKFLAGS = -aif #-NOUNUSED #-d LOADLIBS = $(CLIB).o.Stubs $(OSLIB).o.OSLib $(DLKOBJS) *************** *** 42,182 **** # code for main Python binary ! MODULES_STATIC = \ ! @.^.Modules.o.python \ ! @.^.Modules.o.main \ ! Modules.o.config \ ! @.^.Modules.o.getbuildinfo \ ! Modules.o.getpath_riscos \ ! Modules.o.riscosmodule \ ! @.^.Modules.o._sre # dynamic Modules ! MODULES_DYNAMIC = \ ! @.^.Lib.array/pyd \ ! @.^.Lib.audioop/pyd \ ! @.^.Lib.binascii/pyd \ ! @.^.Lib.cmath/pyd \ ! @.^.Lib.cPickle/pyd \ ! @.^.Lib.cStringIO/pyd \ ! @.^.Lib.errno/pyd \ ! @.^.Lib.imageop/pyd \ ! @.^.Lib.math/pyd \ ! @.^.Lib.md5/pyd \ ! @.^.Lib.new/pyd \ ! @.^.Lib.operator/pyd \ ! @.^.Lib.parser/pyd \ ! @.^.Lib.pcre/pyd \ ! @.^.Lib.regex/pyd \ ! @.^.Lib.rgbimg/pyd \ ! @.^.Lib.rotor/pyd \ ! @.^.Lib.sha/pyd \ ! @.^.Lib.signal/pyd \ ! @.^.Lib.struct/pyd \ ! @.^.Lib.time/pyd \ ! @.^.Lib._locale/pyd \ ! @.^.Lib.zlib/pyd \ ! @.^.Lib.select/pyd \ ! @.^.Lib._socket/pyd \ ! @.^.Lib._codecs/pyd \ ! @.^.Lib._weakref/pyd \ ! @.^.Lib._testcapi/pyd \ ! @.^.Lib.unicodedata/pyd \ ! @.^.Lib.xreadlines/pyd \ ! @.^.Lib.pyexpat/pyd \ ! @.^.Lib.plat-riscos.drawf/pyd \ ! @.^.Lib.plat-riscos.swi/pyd ! ! # @.^.Lib.soundex/pyd \ ! # leave strop out? It's no longer in use for string operations ! # @.^.Lib.mmap/pyd would it make sense? I read about a mmap ! # implementation for RISC OS recently in usenet news. ! ! #@.^.Lib.strop/pyd \ ! #@.^.Lib._sre/pyd \ ! ! ! OBJECTS_PYTHON = \ ! @.^.Python.o.traceback \ ! @.^.Python.o.sysmodule \ ! @.^.Python.o.structmember \ ! @.^.Python.o.strdup \ ! @.^.Python.o.sigcheck \ ! @.^.Python.o.pythonrun \ ! @.^.Python.o.pystate \ ! @.^.Python.o.pyfpe \ ! @.^.Python.o.mystrtoul \ ! @.^.Python.o.modsupport \ ! @.^.Python.o.marshal \ ! @.^.Python.o.importdl \ ! @.^.Python.o.import \ ! @.^.Python.o.graminit \ ! @.^.Python.o.getversion \ ! @.^.Python.o.getplatform \ ! @.^.Python.o.getopt \ ! @.^.Python.o.getcopyright \ ! @.^.Python.o.getcompiler \ ! @.^.Python.o.getargs \ ! @.^.Python.o.frozenmain \ ! @.^.Python.o.frozen \ ! @.^.Python.o.errors \ ! @.^.Python.o.compile \ ! @.^.Python.o.ceval \ ! @.^.Python.o.bltinmodule \ ! @.^.Python.o.exceptions \ ! @.^.Python.o.hypot \ ! @.^.Python.o.codecs \ ! @.^.Python.o.symtable ! # @.^.Python.o.atof @.^.Python.o.strerror ! ! ! OBJECTS_RISCOS = \ ! @.Python.o.dynload_riscos \ ! @.Python.o.getcwd_riscos \ ! @.Python.o.getmtime_riscos \ @.o.unixstuff ! OBJECTS_OBJECTS = \ ! @.^.Objects.o.typeobject \ ! @.^.Objects.o.tupleobject \ ! @.^.Objects.o.stringobject \ ! @.^.Objects.o.sliceobject \ ! @.^.Objects.o.rangeobject \ ! @.^.Objects.o.object \ ! @.^.Objects.o.moduleobject \ ! @.^.Objects.o.methodobject \ ! @.^.Objects.o.longobject \ ! @.^.Objects.o.listobject \ ! @.^.Objects.o.intobject \ ! @.^.Objects.o.funcobject \ ! @.^.Objects.o.frameobject \ ! @.^.Objects.o.floatobject \ ! @.^.Objects.o.fileobject \ ! @.^.Objects.o.dictobject \ ! @.^.Objects.o.complexobject \ ! @.^.Objects.o.cobject \ ! @.^.Objects.o.classobject \ ! @.^.Objects.o.cellobject \ ! @.^.Objects.o.bufferobject \ ! @.^.Objects.o.abstract \ ! @.^.Objects.o.unicodectype \ @.^.Objects.o.unicodeobject ! OBJECTS_PARSER = \ ! @.^.Parser.o.tokenizer \ ! @.^.Parser.o.printgrammar \ ! @.^.Parser.o.parsetok \ ! @.^.Parser.o.parser \ ! @.^.Parser.o.node \ ! @.^.Parser.o.myreadline \ ! @.^.Parser.o.metagrammar \ ! @.^.Parser.o.listnode \ ! @.^.Parser.o.intrcheck \ ! @.^.Parser.o.grammar1 \ ! @.^.Parser.o.grammar \ ! @.^.Parser.o.firstsets \ ! @.^.Parser.o.bitset \ @.^.Parser.o.acceler --- 42,174 ---- # code for main Python binary ! MODULES_STATIC =\ ! @.^.Modules.o.python\ ! @.^.Modules.o.main\ ! Modules.o.config\ ! @.^.Modules.o.getbuildinfo\ ! Modules.o.getpath_riscos\ ! Modules.o.riscosmodule # dynamic Modules ! MODULES_DYNAMIC =\ ! @.^.Lib.array/pyd\ ! @.^.Lib.audioop/pyd\ ! @.^.Lib.binascii/pyd\ ! @.^.Lib.cmath/pyd\ ! @.^.Lib.cPickle/pyd\ ! @.^.Lib.cStringIO/pyd\ ! @.^.Lib.errno/pyd\ ! @.^.Lib.imageop/pyd\ ! @.^.Lib.math/pyd\ ! @.^.Lib.md5/pyd\ ! @.^.Lib.new/pyd\ ! @.^.Lib.operator/pyd\ ! @.^.Lib.parser/pyd\ ! @.^.Lib.pcre/pyd\ ! @.^.Lib.regex/pyd\ ! @.^.Lib.rgbimg/pyd\ ! @.^.Lib.rotor/pyd\ ! @.^.Lib.sha/pyd\ ! @.^.Lib.signal/pyd\ ! @.^.Lib.struct/pyd\ ! @.^.Lib.time/pyd\ ! @.^.Lib._locale/pyd\ ! @.^.Lib.zlib/pyd\ ! @.^.Lib.select/pyd\ ! @.^.Lib._socket/pyd\ ! @.^.Lib._codecs/pyd\ ! @.^.Lib._weakref/pyd\ ! @.^.Lib._testcapi/pyd\ ! @.^.Lib.unicodedata/pyd\ ! @.^.Lib.xreadlines/pyd\ ! @.^.Lib.pyexpat/pyd\ ! @.^.Lib.plat-riscos.drawf/pyd\ ! @.^.Lib.plat-riscos.swi/pyd\ ! @.^.Lib._sre/pyd ! ! ! OBJECTS_PYTHON =\ ! @.^.Python.o.traceback\ ! @.^.Python.o.sysmodule\ ! @.^.Python.o.structmember\ ! @.^.Python.o.strdup\ ! @.^.Python.o.sigcheck\ ! @.^.Python.o.pythonrun\ ! @.^.Python.o.pystate\ ! @.^.Python.o.pyfpe\ ! @.^.Python.o.mystrtoul\ ! @.^.Python.o.modsupport\ ! @.^.Python.o.marshal\ ! @.^.Python.o.importdl\ ! @.^.Python.o.import\ ! @.^.Python.o.graminit\ ! @.^.Python.o.getversion\ ! @.^.Python.o.getplatform\ ! @.^.Python.o.getopt\ ! @.^.Python.o.getcopyright\ ! @.^.Python.o.getcompiler\ ! @.^.Python.o.getargs\ ! @.^.Python.o.frozenmain\ ! @.^.Python.o.frozen\ ! @.^.Python.o.errors\ ! @.^.Python.o.compile\ ! @.^.Python.o.ceval\ ! @.^.Python.o.bltinmodule\ ! @.^.Python.o.exceptions\ ! @.^.Python.o.hypot\ ! @.^.Python.o.codecs\ ! @.^.Python.o.symtable\ ! @.^.Python.o.future ! ! ! OBJECTS_RISCOS = \ ! @.Python.o.dynload_riscos\ ! @.Python.o.getcwd_riscos\ ! @.Python.o.getmtime_riscos\ @.o.unixstuff ! OBJECTS_OBJECTS =\ ! @.^.Objects.o.typeobject\ ! @.^.Objects.o.tupleobject\ ! @.^.Objects.o.stringobject\ ! @.^.Objects.o.sliceobject\ ! @.^.Objects.o.rangeobject\ ! @.^.Objects.o.object\ ! @.^.Objects.o.moduleobject\ ! @.^.Objects.o.methodobject\ ! @.^.Objects.o.longobject\ ! @.^.Objects.o.listobject\ ! @.^.Objects.o.intobject\ ! @.^.Objects.o.funcobject\ ! @.^.Objects.o.frameobject\ ! @.^.Objects.o.floatobject\ ! @.^.Objects.o.fileobject\ ! @.^.Objects.o.dictobject\ ! @.^.Objects.o.complexobject\ ! @.^.Objects.o.cobject\ ! @.^.Objects.o.classobject\ ! @.^.Objects.o.cellobject\ ! @.^.Objects.o.bufferobject\ ! @.^.Objects.o.abstract\ ! @.^.Objects.o.unicodectype\ @.^.Objects.o.unicodeobject ! OBJECTS_PARSER =\ ! @.^.Parser.o.tokenizer\ ! @.^.Parser.o.printgrammar\ ! @.^.Parser.o.parsetok\ ! @.^.Parser.o.parser\ ! @.^.Parser.o.node\ ! @.^.Parser.o.myreadline\ ! @.^.Parser.o.metagrammar\ ! @.^.Parser.o.listnode\ ! @.^.Parser.o.intrcheck\ ! @.^.Parser.o.grammar1\ ! @.^.Parser.o.grammar\ ! @.^.Parser.o.firstsets\ ! @.^.Parser.o.bitset\ @.^.Parser.o.acceler *************** *** 197,201 **** ######################################################################### ! # Support files @.^.!Boot: support.!Boot copy support.!Boot @.^.!Boot ~C~VF --- 189,194 ---- ######################################################################### ! # RISC OS support files ! # @.^.!Boot: support.!Boot copy support.!Boot @.^.!Boot ~C~VF *************** *** 298,304 **** $(MAKEDLK) -d @.^.Lib.plat-riscos.swi/pyd -s s.linktab -o Modules.o.swilink -e initswi - @.^.Lib.time/pyd: @.^.Modules.o.timemodule s.linktab - $(MAKEDLK) -d @.^.Lib.time/pyd -s s.linktab -o @.^.Modules.o.timemodule -e inittime - @.^.Lib._locale/pyd: @.^.Modules.o._localemodule s.linktab $(MAKEDLK) -d @.^.Lib._locale/pyd -s s.linktab -o @.^.Modules.o._localemodule -e init_locale --- 291,294 ---- *************** *** 323,330 **** - ##@.^.Lib.mmap/pyd: @.^.Modules.o.mmapmodule s.linktab - ## $(MAKEDLK) -d @.^.Lib.mmap/pyd -s s.linktab -o @.^.Modules.o.mmapmodule -e initmmap - - ############################################################################ --- 313,316 ---- *************** *** 354,357 **** --- 340,348 ---- + @.^.Lib.time/pyd: @.^.Modules.o.timemodule s.linktab @.o.sleep + $(LINK) -aof -o @.^.Modules.o.timelink @.^.Modules.o.timemodule @.o.sleep $(OSLIB).o.OSLib + $(MAKEDLK) -d @.^.Lib.time/pyd -s s.linktab -o @.^.Modules.o.timelink -e inittime + + @.^.Lib.pyexpat/pyd: @.^.Modules.o.pyexpat s.linktab $(LINK) -aof -o @.^.Modules.o.pyexpatlink @.^.Modules.o.pyexpat $(EXPAT).expat_lib *************** *** 363,367 **** ########################################################################## ! o.linktab: s.linktab ObjAsm s.linktab o.linktab --- 354,359 ---- ########################################################################## ! # dynamic linking symbol table ! # o.linktab: s.linktab ObjAsm s.linktab o.linktab *************** *** 370,375 **** $(OBJSCAN) -s s.linktab -o $(OBJECTS) $(clib).o.stubs ! clean: create @.^.Objects.o.dummy create @.^.Parser.o.dummy --- 362,383 ---- $(OBJSCAN) -s s.linktab -o $(OBJECTS) $(clib).o.stubs + ########################################################################## + # special targets + # + libclean: + create @.^.Lib.dummy/pyc + create @.^.Lib.dummy/pyo + create @.^.Lib.plat-riscos.dummy/pyc + create @.^.Lib.plat-riscos.dummy/pyo + create @.^.Lib.test.dummy/pyc + create @.^.Lib.test.dummy/pyo + wipe @.^.Lib.*/pyc ~C~V + wipe @.^.Lib.*/pyo ~C~V + wipe @.^.Lib.plat-riscos.*/pyc ~C~V + wipe @.^.Lib.plat-riscos.*/pyo ~C~V + wipe @.^.Lib.test.*/pyc ~C~V + wipe @.^.Lib.test.*/pyo ~C~V ! clean: libclean create @.^.Objects.o.dummy create @.^.Parser.o.dummy *************** *** 377,385 **** create o.dummy create @.^.Python.o.dummy - create @.^.Lib.dummy/pyc - create @.^.Lib.dummy/pyo - create @.^.Lib.plat-riscos.dummy/pyc - create @.^.Lib.plat-riscos.dummy/pyo - create @.^.Lib.test.dummy/pyc wipe @.^.Modules.o.* ~C ~V wipe @.^.Objects.o.* ~C ~V --- 385,388 ---- *************** *** 387,395 **** wipe @.^.Python.o.* ~C ~V wipe o.* ~C ~V - wipe @.^.Lib.*/pyc ~C~V - wipe @.^.Lib.*/pyo ~C~V - wipe @.^.Lib.plat-riscos.*/pyc ~C~V - wipe @.^.Lib.plat-riscos.*/pyo ~C~V - wipe @.^.Lib.test.*/pyc ~C~V rebuild: clean --- 390,393 ---- From gvanrossum@users.sourceforge.net Tue Apr 10 23:07:09 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 15:07:09 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules main.c,1.51,1.52 timemodule.c,2.109,2.110 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8619 Modified Files: main.c timemodule.c Log Message: Updated version of RISCOS support. SF patch 411213 by Dietmar Schwertberger Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -r1.51 -r1.52 *** main.c 2001/03/22 02:47:57 1.51 --- main.c 2001/04/10 22:07:07 1.52 *************** *** 27,34 **** static int orig_argc; ! /* For my_readline when running under RISCOS */ ! #ifdef RISCOS extern int Py_RISCOSWimpFlag; ! #endif /* Short usage message (with %s for argv0) */ --- 27,42 ---- static int orig_argc; ! /* command line options */ ! #define BASE_OPTS "c:diOStuUvxXhVW:" ! ! #ifndef RISCOS ! #define PROGRAM_OPTS BASE_OPTS ! #else /*RISCOS*/ ! /* extra option saying that we are running under a special task window ! frontend; especially my_readline will behave different */ ! #define PROGRAM_OPTS BASE_OPTS "w" ! /* corresponding flag */ extern int Py_RISCOSWimpFlag; ! #endif /*RISCOS*/ /* Short usage message (with %s for argv0) */ *************** *** 116,124 **** PySys_ResetWarnOptions(); ! #ifdef RISCOS ! while ((c = getopt(argc, argv, "c:diOStuUvwxXhV")) != EOF) { ! #else ! while ((c = _PyOS_GetOpt(argc, argv, "c:diOStuUvxXhVW:")) != EOF) { ! #endif if (c == 'c') { /* -c is the last option; following arguments --- 124,128 ---- PySys_ResetWarnOptions(); ! while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) { if (c == 'c') { /* -c is the last option; following arguments Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.109 retrieving revision 2.110 diff -C2 -r2.109 -r2.110 *** timemodule.c 2001/03/20 03:26:49 2.109 --- timemodule.c 2001/04/10 22:07:07 2.110 *************** *** 757,763 **** /* XXX Can't interrupt this sleep */ Py_BEGIN_ALLOW_THREADS - #ifndef RISCOS delay((int)(secs * 1000 + 0.5)); /* delay() uses milliseconds */ - #endif Py_END_ALLOW_THREADS #else /* !__WATCOMC__ || __QNX__ */ --- 757,761 ---- *************** *** 832,839 **** --- 830,847 ---- } #else /* !__BEOS__ */ + #ifdef RISCOS + if (secs <= 0.0) + return 0; + Py_BEGIN_ALLOW_THREADS + /* This sleep *CAN BE* interrupted. */ + if ( sleep(secs) ) + return -1; + Py_END_ALLOW_THREADS + #else /* !RISCOS */ /* XXX Can't interrupt this sleep */ Py_BEGIN_ALLOW_THREADS sleep((int)secs); Py_END_ALLOW_THREADS + #endif /* !RISCOS */ #endif /* !__BEOS__ */ #endif /* !PYOS_OS2 */ From gvanrossum@users.sourceforge.net Tue Apr 10 23:07:45 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 15:07:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python sysmodule.c,2.84,2.85 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv8731 Modified Files: sysmodule.c Log Message: Updated version of RISCOS support. SF patch 411213 by Dietmar Schwertberger Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.84 retrieving revision 2.85 diff -C2 -r2.84 -r2.85 *** sysmodule.c 2001/03/23 02:46:52 2.84 --- sysmodule.c 2001/04/10 22:07:43 2.85 *************** *** 809,813 **** --- 809,817 ---- p = strrchr(argv0, SEP); if (p != NULL) { + #ifndef RISCOS n = p + 1 - argv0; + #else /* don't include trailing separator */ + n = p - argv0; + #endif /* RISCOS */ #if SEP == '/' /* Special case for Unix filename syntax */ if (n > 1) From gvanrossum@users.sourceforge.net Tue Apr 10 23:22:55 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 10 Apr 2001 15:22:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.90,1.91 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv11583 Modified Files: ACKS Log Message: Some new names. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -r1.90 -r1.91 *** ACKS 2001/04/09 15:23:46 1.90 --- ACKS 2001/04/10 22:22:52 1.91 *************** *** 57,60 **** --- 57,61 ---- Tommy Burnette Roger Burnham + Alastair Burt Lee Busby Ralph Butler *************** *** 93,96 **** --- 94,98 ---- Toby Dickenson Daniel Dittmar + Walter Dörwald Jaromir Dolecek Fred Drake *************** *** 226,229 **** --- 228,232 ---- Piers Lauder Chris Lawrence + Christopher Lee Kip Lehman Marc-Andre Lemburg From fdrake@users.sourceforge.net Tue Apr 10 23:25:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 15:25:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libunittest.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv12093 Modified Files: libunittest.tex Log Message: Added definition of "test fixture". Added description of optional parameter to the TestSuite constructor. Added descriptions of the TestLoader and TextTestRunner classes. Added method descriptions for the TestCase class. Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** libunittest.tex 2001/04/07 05:41:39 1.1 --- libunittest.tex 2001/04/10 22:25:06 1.2 *************** *** 23,26 **** --- 23,32 ---- \begin{definitions} + \term{test fixture} + A \dfn{test fixture} represents the preparation needed to perform one + or more tests, and any associate cleanup actions. This may involve, + for example, creating temporary or proxy databases, directories, or + starting a server process. + \term{test case} A \dfn{test case} is the smallest unit of testing. It checks for a *************** *** 120,136 **** \end{classdesc} ! \begin{classdesc}{TestSuite}{} This class represents an aggregation of individual tests cases and test suites. The class presents the interface needed by the test runner to allow it to be run as any other test case, but all the contained tests and test suites are executed. Additional methods ! are provided to add test cases and suites to the aggregation. \end{classdesc} \begin{classdesc}{TestLoader}{} \end{classdesc} \begin{classdesc}{TextTestRunner}{\optional{stream\optional{, descriptions\optional{, verbosity}}}} \end{classdesc} --- 126,155 ---- \end{classdesc} ! \begin{classdesc}{TestSuite}{\optional{tests}} This class represents an aggregation of individual tests cases and test suites. The class presents the interface needed by the test runner to allow it to be run as any other test case, but all the contained tests and test suites are executed. Additional methods ! are provided to add test cases and suites to the aggregation. If ! \var{tests} is given, it must be a sequence of individual tests that ! will be added to the suite. \end{classdesc} \begin{classdesc}{TestLoader}{} + This class is responsible for loading tests according to various + criteria and returning them wrapped in a \class{TestSuite}. + It can load all tests within a given module or \class{TestCase} + class. When loading from a module, it considers all + \class{TestCase}-derived classes. For each such class, it creates + an instance for each method with a name beginning with the string + \samp{test}. \end{classdesc} \begin{classdesc}{TextTestRunner}{\optional{stream\optional{, descriptions\optional{, verbosity}}}} + A basic test runner implementation which prints results on standard + output. It has a few configurable parameters, but is essentially + very simple. Graphical applications which run test suites should + provide alternate implementations. \end{classdesc} *************** *** 151,154 **** --- 170,294 ---- \subsection{TestCase Objects \label{testcase-objects}} + + Each \class{TestCase} instance represents a single test, but each + concrete subclass may be used to define multiple tests --- the + concrete class represents a single test fixture. The fixture is + created and cleaned up for each test case. + + \class{TestCase} instances provide three groups of methods: one group + used to run the test, another used by the test implementation to + check conditions and report failures, and some inquiry methods + allowing information about the test itself to be gathered. + + Methods in the first group are: + + \begin{methoddesc}[TestCase]{setUp}{} + Method called to prepare the test fixture. This is called + immediately before calling the test method; any exception raised by + this method will be considered an error rather than a test failure. + The default implementation does nothing. + \end{methoddesc} + + \begin{methoddesc}[TestCase]{run}{\optional{result}} + Run the test, collecting the result into the test result object + passed as \var{result}. If \var{result} is omitted or \code{None}, + a temporary result object is created and used, but is not made + available to the caller. This is equivalent to simply calling the + \class{TestCase} instance. + \end{methoddesc} + + \begin{methoddesc}[TestCase]{tearDown}{} + Method called immediately after the test method has been called and + the result recorded. This is called even if the test method raised + an exception, so the implementation in subclasses may need to be + particularly careful about checking internal state. Any exception + raised by this method will be considered an error rather than a test + failure. The default implementation does nothing. + \end{methoddesc} + + \begin{methoddesc}[TestCase]{debug}{} + Run the test without collecting the result. This allows exceptions + raised by the test to be propogated to the caller, and can be used + to support running tests under a debugger. + \end{methoddesc} + + + The test code can either raise \exception{AssertionError} or use any + of the following methods to check for and report failures: + + \begin{methoddesc}[TestCase]{failUnless}{expr\optional{, msg}} + \methodline[TestCase]{assert_}{value\optional{, msg}} + This method is similar to the \keyword{assert} statement, except it + works even when Python is executed in ``optimizing'' mode (using the + \programopt{-O} command line switch). If \var{expr} is false, + \exception{AssertionError} will be raised with \var{msg} as the + message describing the failure; \code{None} will be used for the + message if \var{msg} is omitted. This method is equivalent to + + \begin{alltt} + assert \var{expr}, \var{msg} + \end{alltt} + \end{methoddesc} + + \begin{methoddesc}[TestCase]{assertEqual}{first, second\optional{, msg}} + Test that \var{first} and \var{second} are equal. If the values do + not compare equal, the test will fail with the explanation given by + \var{msg}, or \code{None}. Note that using \method{assertEqual()} + improves upon doing the comparison as the first parameter to + \method{failUnless()} is that the default value for \var{msg} can be + computed to include representations of both \var{first} and + \var{second}. + \end{methoddesc} + + \begin{methoddesc}[TestCase]{assertNotEqual}{first, second\optional{, msg}} + Test that \var{first} and \var{second} are not equal. If the values + do compare equal, the test will fail with the explanation given by + \var{msg}, or \code{None}. Note that using \method{assertNotEqual()} + improves upon doing the comparison as the first parameter to + \method{failUnless()} is that the default value for \var{msg} can be + computed to include representations of both \var{first} and + \var{second}. + \end{methoddesc} + + \begin{methoddesc}[TestCase]{failIf}{expr\optional{, msg}} + The inverse of the \method{assert_()} method is the + \method{failIf()} method. This raises \exception{AssertionError} if + \var{expr} is true, with \var{msg} or \code{None} for the error + message. + \end{methoddesc} + + \begin{methoddesc}[TestCase]{fail}{\optional{msg}} + Fail unconditionally, with \var{msg} or \code{None} for the error + message. + \end{methoddesc} + + + Testing frameworks can use the following methods to collect + information on the test: + + \begin{methoddesc}[TestCase]{countTestCases}{} + Return the number of tests represented by the this test object. For + \class{TestCase} instances, this will always be \code{1}, but this + method is also implemented by the \class{TestSuite} class, which can + return larger values. + \end{methoddesc} + + \begin{methoddesc}[TestCase]{defaultTestResult}{} + Return the default type of test result object to be used to run this + test. + \end{methoddesc} + + \begin{methoddesc}[TestCase]{id}{} + Return a string identifying the specific test case. This is usually + the full name of the test method, including the module and class + names. + \end{methoddesc} + + \begin{methoddesc}[TestCase]{shortDescription}{} + Returns a one-line description of the test, or \code{None} if no + description has been provided. The default implementation of this + method returns the first line of the test method's docstring, if + available, or \code{None}. + \end{methoddesc} From nascheme@users.sourceforge.net Wed Apr 11 00:03:37 2001 From: nascheme@users.sourceforge.net (Neil Schemenauer) Date: Tue, 10 Apr 2001 16:03:37 -0700 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv18384 Modified Files: Makefile.pre.in Log Message: Use INSTALL_SCRIPT to install script files. INSTALL_PROGRAM may try to strip them. Closes patch #406287. CVS: do \ CVS: if test -x $$i; then \ CVS: - $(INSTALL_PROGRAM) $$i $(LIBDEST); \ CVS: - echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \ CVS: + $(INSTALL_SCRIPT) $$i $(LIBDEST); \ CVS: + echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \ CVS: else \ CVS: $(INSTALL_DATA) $$i $(LIBDEST); \ CVS: echo $(INSTALL_DATA) $$i $(LIBDEST); \ CVS: @@ -601,8 +602,8 @@ CVS: *) \ CVS: if test -d $$i; then continue; fi; \ CVS: if test -x $$i; then \ CVS: - echo $(INSTALL_PROGRAM) $$i $$b; \ CVS: - $(INSTALL_PROGRAM) $$i $$b; \ CVS: + echo $(INSTALL_SCRIPT) $$i $$b; \ CVS: + $(INSTALL_SCRIPT) $$i $$b; \ CVS: else \ CVS: echo $(INSTALL_DATA) $$i $$b; \ CVS: $(INSTALL_DATA) $$i $$b; \ CVS: @@ -666,8 +667,8 @@ CVS: $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup CVS: $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local CVS: $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config CVS: - $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup CVS: - $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh CVS: + $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup CVS: + $(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh CVS: $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in CVS: @if [ -s Modules/python.exp -a \ CVS: "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** Makefile.pre.in 2001/04/09 22:23:22 1.32 --- Makefile.pre.in 2001/04/10 23:03:35 1.33 *************** *** 44,47 **** --- 44,48 ---- INSTALL= @INSTALL@ INSTALL_PROGRAM=@INSTALL_PROGRAM@ + INSTALL_SCRIPT= @INSTALL_SCRIPT@ INSTALL_DATA= @INSTALL_DATA@ # Shared libraries must be installed with executable mode on some systems; *************** *** 580,585 **** do \ if test -x $$i; then \ ! $(INSTALL_PROGRAM) $$i $(LIBDEST); \ ! echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \ else \ $(INSTALL_DATA) $$i $(LIBDEST); \ --- 581,586 ---- do \ if test -x $$i; then \ ! $(INSTALL_SCRIPT) $$i $(LIBDEST); \ ! echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \ else \ $(INSTALL_DATA) $$i $(LIBDEST); \ *************** *** 602,607 **** if test -d $$i; then continue; fi; \ if test -x $$i; then \ ! echo $(INSTALL_PROGRAM) $$i $$b; \ ! $(INSTALL_PROGRAM) $$i $$b; \ else \ echo $(INSTALL_DATA) $$i $$b; \ --- 603,608 ---- if test -d $$i; then continue; fi; \ if test -x $$i; then \ ! echo $(INSTALL_SCRIPT) $$i $$b; \ ! $(INSTALL_SCRIPT) $$i $$b; \ else \ echo $(INSTALL_DATA) $$i $$b; \ *************** *** 667,672 **** $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config ! $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup ! $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in @if [ -s Modules/python.exp -a \ --- 668,673 ---- $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config ! $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup ! $(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in @if [ -s Modules/python.exp -a \ *************** *** 676,683 **** $(LIBPL)/python.exp; \ echo; echo "$(LIBPL)/python.exp"; \ ! $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \ $(LIBPL)/makexp_aix; \ echo "$(LIBPL)/makexp_aix"; \ ! $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \ $(LIBPL)/ld_so_aix; \ echo "$(LIBPL)/ld_so_aix"; \ --- 677,684 ---- $(LIBPL)/python.exp; \ echo; echo "$(LIBPL)/python.exp"; \ ! $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \ $(LIBPL)/makexp_aix; \ echo "$(LIBPL)/makexp_aix"; \ ! $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \ $(LIBPL)/ld_so_aix; \ echo "$(LIBPL)/ld_so_aix"; \ *************** *** 689,695 **** $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \ echo; echo "$(LIBPL)/README"; \ ! $(INSTALL_PROGRAM) Modules/ar_beos $(LIBPL)/ar_beos; \ echo "$(LIBPL)/ar_beos"; \ ! $(INSTALL_PROGRAM) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \ echo "$(LIBPL)/ld_so_beos"; \ echo; echo "See Misc/BeOS-NOTES for details."; \ --- 690,696 ---- $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \ echo; echo "$(LIBPL)/README"; \ ! $(INSTALL_SCRIPT) Modules/ar_beos $(LIBPL)/ar_beos; \ echo "$(LIBPL)/ar_beos"; \ ! $(INSTALL_SCRIPT) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \ echo "$(LIBPL)/ld_so_beos"; \ echo; echo "See Misc/BeOS-NOTES for details."; \ From ping@users.sourceforge.net Wed Apr 11 05:02:07 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Tue, 10 Apr 2001 21:02:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib SocketServer.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29257 Modified Files: SocketServer.py Log Message: Add a close_request method to the BaseServer so that the TCPServer class can close the request connection when it's done handling it. Index: SocketServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/SocketServer.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** SocketServer.py 2001/01/20 19:54:20 1.23 --- SocketServer.py 2001/04/11 04:02:05 1.24 *************** *** 155,158 **** --- 155,159 ---- - server_close() - process_request(request, client_address) + - close_request(request) - handle_error() *************** *** 215,218 **** --- 216,220 ---- except: self.handle_error(request, client_address) + self.close_request(request) def verify_request(self, request, client_address): *************** *** 244,247 **** --- 246,253 ---- self.RequestHandlerClass(request, client_address, self) + def close_request(self, request): + """Called to clean up an individual request.""" + pass + def handle_error(self, request, client_address): """Handle an error gracefully. May be overridden. *************** *** 278,281 **** --- 284,288 ---- - verify_request(request, client_address) - process_request(request, client_address) + - close_request(request) - handle_error() *************** *** 358,362 **** --- 365,373 ---- return self.socket.accept() + def close_request(self, request): + """Called to clean up an individual request.""" + request.close() + class UDPServer(TCPServer): *************** *** 377,380 **** --- 388,394 ---- pass + def close_request(self, request): + # No need to close anything. + pass class ForkingMixIn: From fdrake@users.sourceforge.net Wed Apr 11 05:38:36 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 10 Apr 2001 21:38:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.131,1.132 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv976/tut Modified Files: tut.tex Log Message: Based on a comment by Konrad Hinsen on python-list: Change "EOF" to "end-of-file", on the premise that it is easier for new programmers to understand (at least a little). This does not attempt to explain "file or device attached to standard input." Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -r1.131 -r1.132 *** tut.tex 2001/04/03 17:41:56 1.131 --- tut.tex 2001/04/11 04:38:34 1.132 *************** *** 176,180 **** \file{/usr/local/python} is a popular alternative location.) ! Typing an \EOF{} character (\kbd{Control-D} on \UNIX, \kbd{Control-Z} on DOS or Windows) at the primary prompt causes the interpreter to exit with a zero exit status. If that doesn't work, --- 176,180 ---- \file{/usr/local/python} is a popular alternative location.) ! Typing an end-of-file character (\kbd{Control-D} on \UNIX, \kbd{Control-Z} on DOS or Windows) at the primary prompt causes the interpreter to exit with a zero exit status. If that doesn't work, *************** *** 212,218 **** satisfied from \emph{file}. Since this file has already been read until the end by the parser before the program starts executing, the ! program will encounter EOF immediately. In the former case (which is ! usually what you want) they are satisfied from whatever file or device ! is connected to standard input of the Python interpreter. When a script file is used, it is sometimes useful to be able to run --- 212,218 ---- satisfied from \emph{file}. Since this file has already been read until the end by the parser before the program starts executing, the ! program will encounter end-of-file immediately. In the former case ! (which is usually what you want) they are satisfied from whatever file ! or device is connected to standard input of the Python interpreter. When a script file is used, it is sometimes useful to be able to run From moshez@users.sourceforge.net Wed Apr 11 08:33:11 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Wed, 11 Apr 2001 00:33:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libgetopt.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv13992 Modified Files: libgetopt.tex Log Message: Fixing bug 405999 -- clarifying differences between Python's getopt and GNU getopt -- Python is like classical UNIX getopt. Index: libgetopt.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgetopt.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** libgetopt.tex 2001/01/08 16:05:51 1.16 --- libgetopt.tex 2001/04/11 07:33:08 1.17 *************** *** 26,29 **** --- 26,33 ---- \cfunction{getopt()} uses). + \strong{Note:} Unlike GNU \cfunction{getopt()}, after a non-option + argument, all further arguments are considered also non-options. + This is similar to the way non-GNU \UNIX{} systems work. + \var{long_options}, if specified, must be a list of strings with the names of the long options which should be supported. The leading From moshez@users.sourceforge.net Wed Apr 11 08:44:55 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Wed, 11 Apr 2001 00:44:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib2.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14812 Modified Files: urllib2.py Log Message: Idiotic braino caused HTTP openers to ignore proxies. This fixes 413135 Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** urllib2.py 2001/03/20 13:14:28 1.11 --- urllib2.py 2001/04/11 07:44:53 1.12 *************** *** 782,786 **** def do_open(self, http_class, req): ! host = urlparse.urlparse(req.get_full_url())[1] if not host: raise URLError('no host given') --- 782,786 ---- def do_open(self, http_class, req): ! host = req.get_host() if not host: raise URLError('no host given') From moshez@users.sourceforge.net Wed Apr 11 09:01:27 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Wed, 11 Apr 2001 01:01:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/PC getpathp.c,1.22,1.22.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv16946/PC Modified Files: Tag: release20-maint getpathp.c Log Message: Checking the diff from PC/getpatchp.c 1.22 to 1.23 This fixes many bugs, and was proposed by Thomas Heller. Original log message: ''' Checkin updated version of patch #103933 . As Thomas says, fixes the bugs #131064, #129584, #127722. See the discussion in bug #131064 ''' Index: getpathp.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/getpathp.c,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -C2 -r1.22 -r1.22.2.1 *** getpathp.c 2000/10/07 11:10:50 1.22 --- getpathp.c 2001/04/11 08:01:24 1.22.2.1 *************** *** 200,203 **** --- 200,207 ---- Returns NULL, or a pointer that should be freed. + + XXX - this code is pretty strange, as it used to also + work on Win16, where the buffer sizes werent available + in advance. It could be simplied now Win16/Win32s is dead! */ *************** *** 280,283 **** --- 284,288 ---- RegCloseKey(subKey); } + /* original datasize from RegQueryInfo doesn't include the \0 */ dataBuf = malloc((dataSize+1) * sizeof(TCHAR)); if (dataBuf) { *************** *** 300,305 **** *szCur = '\0'; else { ! *(szCur++) = _T(';'); ! dataSize--; /* Now append the core path entries - this will include the NULL --- 305,313 ---- *szCur = '\0'; else { ! /* If we have no values, we dont need a ';' */ ! if (numKeys) { ! *(szCur++) = _T(';'); ! dataSize--; ! } /* Now append the core path entries - this will include the NULL From moshez@users.sourceforge.net Wed Apr 11 09:06:04 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Wed, 11 Apr 2001 01:06:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib asynchat.py,1.7,1.7.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17702/Lib Modified Files: Tag: release20-maint asynchat.py Log Message: Inspired by Tim Peters' 1.14->1.15 checkin to asynchat Quoting orignal message: ''' Fix from the Madusa mailing list: http://groups.yahoo.com/group/medusa/message/333 It's clear that Medusa should not be checking for an empty buffer via "buf is ''". The patch merely changes "is" to "==". However, there's a mystery here all the same: Python attempts to store null strings uniquely, so it's unclear why "buf is ''" ever returned false when buf actually was empty. *Some* string operations produce non-unique null strings, e.g. ''' Index: asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -r1.7 -r1.7.2.1 *** asynchat.py 2000/09/08 20:30:39 1.7 --- asynchat.py 2001/04/11 08:06:02 1.7.2.1 *************** *** 167,171 **** # this is about twice as fast, though not as clear. return not ( ! (self.ac_out_buffer is '') and self.producer_fifo.is_empty() and self.connected --- 167,171 ---- # this is about twice as fast, though not as clear. return not ( ! (self.ac_out_buffer == '') and self.producer_fifo.is_empty() and self.connected From jhylton@users.sourceforge.net Wed Apr 11 14:52:31 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 06:52:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.235,2.236 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv30700/Python Modified Files: ceval.c Log Message: Fix exception handling for non-PyFunction objects, SF bug 414743. Fix based on patch #414750 by Michael Hudson. New functions get_func_name() and get_func_desc() return reasonable names and descriptions for all objects. XXX Even objects that aren't actually callable. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.235 retrieving revision 2.236 diff -C2 -r2.235 -r2.236 *** ceval.c 2001/03/22 02:47:58 2.235 --- ceval.c 2001/04/11 13:52:29 2.236 *************** *** 41,44 **** --- 41,46 ---- PyObject *); + static char *get_func_name(PyObject *); + static char *get_func_desc(PyObject *); static PyObject *call_object(PyObject *, PyObject *, PyObject *); static PyObject *call_cfunction(PyObject *, PyObject *, PyObject *); *************** *** 2742,2745 **** --- 2744,2784 ---- */ + static char * + get_func_name(PyObject *func) + { + if (PyMethod_Check(func)) + return get_func_name(PyMethod_GET_FUNCTION(func)); + else if (PyFunction_Check(func)) + return PyString_AsString(((PyFunctionObject*)func)->func_name); + else if (PyCFunction_Check(func)) + return ((PyCFunctionObject*)func)->m_ml->ml_name; + else if (PyClass_Check(func)) + return PyString_AsString(((PyClassObject*)func)->cl_name); + else if (PyInstance_Check(func)) { + return PyString_AsString( + ((PyInstanceObject*)func)->in_class->cl_name); + } else { + return func->ob_type->tp_name; + } + } + + static char * + get_func_desc(PyObject *func) + { + if (PyMethod_Check(func)) + return "()"; + else if (PyFunction_Check(func)) + return "()"; + else if (PyCFunction_Check(func)) + return "()"; + else if (PyClass_Check(func)) + return " constructor"; + else if (PyInstance_Check(func)) { + return " instance"; + } else { + return " object"; + } + } + static PyObject * call_object(PyObject *func, PyObject *arg, PyObject *kw) *************** *** 2993,3002 **** PyObject *key = EXT_POP(*pp_stack); if (PyDict_GetItem(kwdict, key) != NULL) { - PyObject* fn = ((PyFunctionObject*) func)->func_name; PyErr_Format(PyExc_TypeError, "%.200s%s got multiple values " ! "for keyword argument '%.400s'", ! fn ? PyString_AsString(fn) : "function", ! fn ? "()" : "", PyString_AsString(key)); Py_DECREF(key); Py_DECREF(value); --- 3032,3041 ---- PyObject *key = EXT_POP(*pp_stack); if (PyDict_GetItem(kwdict, key) != NULL) { PyErr_Format(PyExc_TypeError, "%.200s%s got multiple values " ! "for keyword argument '%.200s'", ! get_func_name(func), ! get_func_desc(func), ! PyString_AsString(key)); Py_DECREF(key); Py_DECREF(value); *************** *** 3089,3097 **** kwdict = EXT_POP(*pp_stack); if (!(kwdict && PyDict_Check(kwdict))) { - PyObject* fn = ((PyFunctionObject*) func)->func_name; PyErr_Format(PyExc_TypeError, ! "%s%s argument after ** must be a dictionary", ! fn ? PyString_AsString(fn) : "function", ! fn ? "()" : ""); goto ext_call_fail; } --- 3128,3136 ---- kwdict = EXT_POP(*pp_stack); if (!(kwdict && PyDict_Check(kwdict))) { PyErr_Format(PyExc_TypeError, ! "%s%s argument after ** " ! "must be a dictionary", ! get_func_name(func), ! get_func_desc(func)); goto ext_call_fail; } *************** *** 3103,3114 **** t = PySequence_Tuple(stararg); if (t == NULL) { ! if (PyErr_ExceptionMatches(PyExc_TypeError)) { ! PyObject* fn = ! ((PyFunctionObject*) func)->func_name; ! PyErr_Format(PyExc_TypeError, ! "%s%s argument after * must be a sequence", ! fn ? PyString_AsString(fn) : "function", ! fn ? "()" : ""); ! } goto ext_call_fail; } --- 3142,3152 ---- t = PySequence_Tuple(stararg); if (t == NULL) { ! if (PyErr_ExceptionMatches(PyExc_TypeError)) { ! PyErr_Format(PyExc_TypeError, ! "%s%s argument after * " ! "must be a sequence", ! get_func_name(func), ! get_func_desc(func)); ! } goto ext_call_fail; } From jhylton@users.sourceforge.net Wed Apr 11 14:53:37 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 06:53:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_extcall.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31133/Lib/test Modified Files: test_extcall.py Log Message: Test cases for examples of ext call error handling. Fix to SF bug #414743 based on Michael Hudson's patch #414750. Index: test_extcall.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_extcall.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** test_extcall.py 2001/02/09 11:45:26 1.13 --- test_extcall.py 2001/04/11 13:53:35 1.14 *************** *** 139,142 **** --- 139,156 ---- try: + dir(*h) + except TypeError, err: + print err + else: + print "should raise TypeError: * argument must be a tuple" + + try: + None(*h) + except TypeError, err: + print err + else: + print "should raise TypeError: * argument must be a tuple" + + try: h(**h) except TypeError, err: *************** *** 144,147 **** --- 158,182 ---- else: print "should raise TypeError: ** argument must be a dictionary" + + try: + dir(**h) + except TypeError, err: + print err + else: + print "should raise TypeError: ** argument must be a dictionary" + + try: + None(**h) + except TypeError, err: + print err + else: + print "should raise TypeError: ** argument must be a dictionary" + + try: + dir(b=1,**{'b':1}) + except TypeError, err: + print err + else: + print "should raise TypeError: dir() got multiple values for keyword argument 'b'" def f2(*a, **b): From jhylton@users.sourceforge.net Wed Apr 11 14:53:37 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 06:53:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_extcall,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv31133/Lib/test/output Modified Files: test_extcall Log Message: Test cases for examples of ext call error handling. Fix to SF bug #414743 based on Michael Hudson's patch #414750. Index: test_extcall =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_extcall,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** test_extcall 2001/01/21 18:52:02 1.7 --- test_extcall 2001/04/11 13:53:35 1.8 *************** *** 26,30 **** --- 26,35 ---- h() got an unexpected keyword argument 'e' h() argument after * must be a sequence + dir() argument after * must be a sequence + None object argument after * must be a sequence h() argument after ** must be a dictionary + dir() argument after ** must be a dictionary + None object argument after ** must be a dictionary + dir() got multiple values for keyword argument 'b' 3 512 1 3 From jhylton@users.sourceforge.net Wed Apr 11 17:21:53 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 09:21:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pyassem.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv27553 Modified Files: pyassem.py Log Message: Make sure the docstring is always entered as the first element in the consts, even if it is None. Simplify _lookupName() by removing lots of redundant tests. Index: pyassem.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pyassem.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** pyassem.py 2000/11/06 03:47:39 1.15 --- pyassem.py 2001/04/11 16:21:51 1.16 *************** *** 255,259 **** def setDocstring(self, doc): self.docstring = doc - self.consts.insert(0, doc) def setFlag(self, flag): --- 255,258 ---- *************** *** 336,339 **** --- 335,339 ---- """Convert arguments from symbolic to concrete form""" assert self.stage == FLAT + self.consts.insert(0, self.docstring) for i in range(len(self.insts)): t = self.insts[i] *************** *** 348,366 **** def _lookupName(self, name, list): """Return index of name in list, appending if necessary""" - found = None t = type(name) for i in range(len(list)): # must do a comparison on type first to prevent UnicodeErrors if t == type(list[i]) and list[i] == name: - found = 1 - break - if found: - # this is cheap, but incorrect in some cases, e.g 2 vs. 2L - if type(name) == type(list[i]): return i - for i in range(len(list)): - elt = list[i] - if type(elt) == type(name) and elt == name: - return i end = len(list) list.append(name) --- 348,356 ---- From jhylton@users.sourceforge.net Wed Apr 11 17:22:28 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 09:22:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler transformer.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv27669 Modified Files: transformer.py Log Message: Add lineno attributes to Discard nodes Index: transformer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/transformer.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** transformer.py 2001/04/09 04:27:12 1.20 --- transformer.py 2001/04/11 16:22:26 1.21 *************** *** 273,277 **** exprNode = self.com_node(nodelist[-1]) if len(nodelist) == 1: ! return Discard(exprNode) if nodelist[1][0] == token.EQUAL: nodes = [] --- 273,279 ---- exprNode = self.com_node(nodelist[-1]) if len(nodelist) == 1: ! n = Discard(exprNode) ! n.lineno = exprNode.lineno ! return n if nodelist[1][0] == token.EQUAL: nodes = [] From jhylton@users.sourceforge.net Wed Apr 11 17:24:32 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 09:24:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pycodegen.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv27760 Modified Files: pycodegen.py Log Message: Generate docstrings. Fixes SF buf #217004 Add method fixDocstring() to CodeGenerator. It converts the Discard node containing the docstring into an assignment to __doc__. Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** pycodegen.py 2001/04/09 04:28:48 1.28 --- pycodegen.py 2001/04/11 16:24:30 1.29 *************** *** 142,146 **** lnf = walk(node.node, LocalNameFinder(), 0) self.locals.push(lnf.getLocals()) ! self.setDocstring(node.doc) self.visit(node.node) self.emit('LOAD_CONST', None) --- 142,147 ---- lnf = walk(node.node, LocalNameFinder(), 0) self.locals.push(lnf.getLocals()) ! if node.doc: ! self.fixDocstring(node.node) self.visit(node.node) self.emit('LOAD_CONST', None) *************** *** 149,152 **** --- 150,155 ---- def visitFunction(self, node): self._visitFuncOrLambda(node, isLambda=0) + if node.doc: + self.setDocstring(node.doc) self.storeName(node.name) *************** *** 166,169 **** --- 169,174 ---- def visitClass(self, node): gen = ClassCodeGenerator(node, self.filename) + if node.doc: + self.fixDocstring(node.code) walk(node.code, gen) gen.finish() *************** *** 179,182 **** --- 184,200 ---- self.storeName(node.name) + def fixDocstring(self, node): + """Rewrite the ast for a class with a docstring. + + The AST includes a Discard(Const(docstring)) node. Replace + this with an Assign([AssName('__doc__', ...]) + """ + assert isinstance(node, ast.Stmt) + stmts = node.nodes + discard = stmts[0] + assert isinstance(discard, ast.Discard) + stmts[0] = ast.Assign([ast.AssName('__doc__', 'OP_ASSIGN')], + discard.expr) + stmts[0].lineno = discard.lineno # The rest are standard visitor methods *************** *** 628,632 **** def visitAugSlice(self, node, mode): if mode == "load": ! self.visitSlice(node, 1) elif mode == "store": slice = 0 --- 646,650 ---- def visitAugSlice(self, node, mode): if mode == "load": ! self.visitlSice(node, 1) elif mode == "store": slice = 0 *************** *** 897,904 **** args, hasTupleArg = generateArgList(func.argnames) self.graph = pyassem.PyFlowGraph(name, filename, args, ! optimized=1) self.isLambda = isLambda self.super_init(filename) lnf = walk(func.code, LocalNameFinder(args), 0) self.locals.push(lnf.getLocals()) --- 915,925 ---- args, hasTupleArg = generateArgList(func.argnames) self.graph = pyassem.PyFlowGraph(name, filename, args, ! optimized=1) self.isLambda = isLambda self.super_init(filename) + if not isLambda and func.doc: + self.setDocstring(func.doc) + lnf = walk(func.code, LocalNameFinder(args), 0) self.locals.push(lnf.getLocals()) *************** *** 948,951 **** --- 969,974 ---- self.locals.push(lnf.getLocals()) self.graph.setFlag(CO_NEWLOCALS) + if klass.doc: + self.setDocstring(klass.doc) def finish(self): From jhylton@users.sourceforge.net Wed Apr 11 17:26:07 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 09:26:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler visitor.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv28133 Modified Files: visitor.py Log Message: Add support for extra (*) arguments to preorder. Change default dispatch to use extended call syntax in place of apply. Index: visitor.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/visitor.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** visitor.py 2000/10/25 18:02:02 1.5 --- visitor.py 2001/04/11 16:26:05 1.6 *************** *** 62,72 **** else: print "dispatch", className, (meth and meth.__name__ or '') ! return apply(meth, (node,) + args) ! def preorder(self, tree, visitor): """Do preorder walk of tree using visitor""" self.visitor = visitor visitor.visit = self._preorder ! self._preorder(tree) _preorder = dispatch --- 62,72 ---- else: print "dispatch", className, (meth and meth.__name__ or '') ! return meth(node, *args) ! def preorder(self, tree, visitor, *args): """Do preorder walk of tree using visitor""" self.visitor = visitor visitor.visit = self._preorder ! self._preorder(tree, *args) # XXX *args make sense? _preorder = dispatch From jhylton@users.sourceforge.net Wed Apr 11 17:36:28 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 09:36:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pycodegen.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv29677/compiler Modified Files: pycodegen.py Log Message: [finishing fix from earlier checkins] Call set_lineno() in visitDiscard(), which will generate linenos for discard statements, e.g. the statement "1/0" Fixes SF bug #409587 Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** pycodegen.py 2001/04/11 16:24:30 1.29 --- pycodegen.py 2001/04/11 16:36:25 1.30 *************** *** 496,499 **** --- 496,500 ---- def visitDiscard(self, node): + self.set_lineno(node) self.visit(node.expr) self.emit('POP_TOP') From jhylton@users.sourceforge.net Wed Apr 11 17:43:15 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 09:43:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pycodegen.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv30769/compiler Modified Files: pycodegen.py Log Message: typo Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** pycodegen.py 2001/04/11 16:36:25 1.30 --- pycodegen.py 2001/04/11 16:43:13 1.31 *************** *** 46,50 **** tree = parse(self.source) root, filename = os.path.split(self.filename) ! gen = ModuleCodeGenerator(filename) walk(tree, gen, 1) if display: --- 46,53 ---- tree = parse(self.source) root, filename = os.path.split(self.filename) ! if "nested_scopes" in future.find_futures(tree): ! gen = NestedScopeCodeGenerator(filename) ! else: ! gen = ModuleCodeGenerator(filename) walk(tree, gen, 1) if display: *************** *** 647,651 **** def visitAugSlice(self, node, mode): if mode == "load": ! self.visitlSice(node, 1) elif mode == "store": slice = 0 --- 650,654 ---- def visitAugSlice(self, node, mode): if mode == "load": ! self.visitSlice(node, 1) elif mode == "store": slice = 0 *************** *** 890,897 **** self.__super_init(filename) self.symbols = None - self.future = None def visitModule(self, node): - self.future = future.find_futures(node) self.symbols = self.parseSymbols(node) self.__super_visitModule(node) --- 893,898 ---- *************** *** 900,903 **** --- 901,907 ---- # XXX not implemented return None + + class NestedScopeCodeGenerator(ModuleCodeGenerator): + pass class FunctionCodeGenerator(CodeGenerator): From fdrake@users.sourceforge.net Wed Apr 11 20:17:13 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 11 Apr 2001 12:17:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libweakref.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv27264 Modified Files: libweakref.tex Log Message: Include a synopsis for the chapter overview. Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** libweakref.tex 2001/04/10 19:57:58 1.6 --- libweakref.tex 2001/04/11 19:17:11 1.7 *************** *** 3,6 **** --- 3,7 ---- \declaremodule{extension}{weakref} + \modulesynopsis{Support for weak references and weak dictionaries.} \moduleauthor{Fred L. Drake, Jr.}{fdrake@acm.org} \moduleauthor{Neil Schemenauer}{nas@arctrix.com} From bwarsaw@users.sourceforge.net Wed Apr 11 21:12:35 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 11 Apr 2001 13:12:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libmailbox.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv3868 Modified Files: libmailbox.tex Log Message: Added some additional documentation describing how BabylMailbox actually works (it returns a message containing the visible headers, not the original headers). Doc change approved by Fred; closes SF bug #412230. Index: libmailbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmailbox.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** libmailbox.tex 2001/02/02 03:51:05 1.17 --- libmailbox.tex 2001/04/11 20:12:33 1.18 *************** *** 70,77 **** \begin{classdesc}{BabylMailbox}{fp\optional{, factory}} ! Access a Babyl mailbox, which is similar to an MMDF mailbox. Mail ! messages start with a line containing only \code{'*** EOOH ***'} and ! end with a line containing only \code{'\e{}037\e{}014'}. ! \var{factory} is as with the \class{UnixMailbox} class. \end{classdesc} --- 70,85 ---- \begin{classdesc}{BabylMailbox}{fp\optional{, factory}} ! Access a Babyl mailbox, which is similar to an MMDF mailbox. In ! Babyl format, each message has two sets of headers, the ! \emph{original} headers and the \emph{visible} headers. The original ! headers appear before a a line containing only \code{'*** EOOH ***'} ! (End-Of-Original-Headers) and the visible headers appear after the ! \code{EOOH} line. Babyl-compliant mail readers will show you only the ! visible headers, and \class{BabylMailbox} objects will return messages ! containing only the visible headers. You'll have to do your own ! parsing of the mailbox file to get at the original headers. Mail ! messages start with the EOOH line and end with a line containing only ! \code{'\e{}037\e{}014'}. \var{factory} is as with the ! \class{UnixMailbox} class. \end{classdesc} From bwarsaw@users.sourceforge.net Wed Apr 11 21:23:19 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 11 Apr 2001 13:23:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc python-mode.el,3.111,3.112 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5971 Modified Files: python-mode.el Log Message: intermediate Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 3.111 retrieving revision 3.112 diff -C2 -r3.111 -r3.112 *** python-mode.el 2001/02/24 00:09:17 3.111 --- python-mode.el 2001/04/11 20:23:17 3.112 *************** *** 26,53 **** ;; responsibility for the mode. Smart Tim :-) ! ;; This version of python-mode.el is no longer compatible with Emacs ! ;; 18. I am striving to maintain compatibility with the X/Emacs 19 ! ;; lineage but as time goes on that becomes more and more difficult. ! ;; I current recommend that you upgrade to the latest stable released ! ;; version of your favorite branch: Emacs 20.3 or better, or XEmacs ! ;; 20.4 or better (XEmacs 21.0 is in beta testing as of this writing ! ;; 27-Oct-1998 appears to work fine with this version of ! ;; python-mode.el). Even Windows users should be using at least ! ;; NTEmacs 20.3, and XEmacs 21.0 will work very nicely on Windows when ! ;; it is released. ;; FOR MORE INFORMATION: ! ;; For more information on installing python-mode.el, especially with ! ;; respect to compatibility information, please see ! ;; ;; http://www.python.org/emacs/python-mode/ ;; ! ;; This site also contains links to other packages that you might find ! ;; useful, such as pdb interfaces, OO-Browser links, etc. ;; BUG REPORTING: ! ;; To submit bug reports, use C-c C-b. Please include a complete, but ;; concise code sample and a recipe for reproducing the bug. Send ;; suggestions and other comments to python-mode@python.org. --- 26,57 ---- ;; responsibility for the mode. Smart Tim :-) ! ;; pdbtrack support contributed by Ken Manheimer, April 2001. + ;; This version of python-mode.el has only been tested with XEmacs + ;; 21.1.14 and Emacs 20.7 as these are the latest versions of these + ;; Emacsen as of this writing (11-Apr-2001). I have no intent to test + ;; it with earlier Emacsen, but I will accept patches if they are + ;; small and reasonable. Please use the SourceForge Python project to + ;; submit bugs or patches: + ;; + ;; http://sourceforge.net/projects/python + ;; FOR MORE INFORMATION: ! ;; There is some information on python-mode.el at ! ;; http://www.python.org/emacs/python-mode/ ;; ! ;; but this link is fairly out of date, due to the current difficulty ! ;; in updating that site. It does contain links to other packages that ! ;; you might find useful, such as pdb interfaces, OO-Browser links, ! ;; etc. Eventually, we'll be able to update it much more easily. ;; BUG REPORTING: ! ;; As mentioned above, please use the SourceForge Python project for ! ;; submitting bug reports or patches. The old recommendation, to use ! ;; C-c C-b will still work, but those reports have a higher chance of ! ;; getting buried in my mailbox. Please include a complete, but ;; concise code sample and a recipe for reproducing the bug. Send ;; suggestions and other comments to python-mode@python.org. *************** *** 57,92 **** ;; want to contribute one, I'll certainly accept it! - ;; TO DO LIST: - - ;; - Better integration with pdb.py and gud-mode for debugging. - ;; - Rewrite according to GNU Emacs Lisp standards. - ;; - add a py-goto-block-down, bound to C-c C-d - ;;; Code: (require 'comint) (require 'custom) ! (eval-when-compile ! (require 'cl) ! (if (not (and (condition-case nil ! (require 'custom) ! (error nil)) ! ;; Stock Emacs 19.34 has a broken/old Custom library ! ;; that does more harm than good. Fortunately, it is ! ;; missing defcustom ! (fboundp 'defcustom))) ! (error "STOP! STOP! STOP! STOP! ! ! The Custom library was not found or is out of date. A more current ! version is required. Please download and install the latest version ! of the Custom library from: ! ! ! ! See the Python Mode home page for details: ! ! ! "))) ! --- 61,69 ---- ;; want to contribute one, I'll certainly accept it! ;;; Code: (require 'comint) (require 'custom) ! (require 'cl) *************** *** 275,278 **** --- 252,271 ---- (make-variable-buffer-local 'py-indent-offset) + (defcustom py-pdbtrack-do-tracking-p t + "*Controls whether the pdbtrack feature is enabled or not. + When non-nil, pdbtrack is enabled in all comint-based buffers, + e.g. shell buffers and the *Python* buffer. When using pdb to debug a + Python program, pdbtrack notices the pdb prompt and displays the + source file and line that the program is stopped at, much the same way + as gud-mode does for debugging C programs with gdb." + :type 'boolean + :group 'python) + (make-variable-buffer-local 'py-pdbtrack-do-tracking-p) + + (defcustom py-pdbtrack-minor-mode-string " PDB" + "*String to use in the minor mode list when pdbtrack is enabled." + :type 'string + :group 'python) + ;; Not customizable (defvar py-master-file nil *************** *** 298,308 **** (defconst py-emacs-features (let (features) - ;; NTEmacs 19.34.6 has a broken make-temp-name; it always returns - ;; the same string. - (let ((tmp1 (make-temp-name "")) - (tmp2 (make-temp-name ""))) - (if (string-equal tmp1 tmp2) - (push 'broken-temp-names features))) - ;; return the features features) "A list of features extant in the Emacs you are using. --- 291,294 ---- *************** *** 348,351 **** --- 334,340 ---- Currently-active file is at the head of the list.") + (defvar py-pdbtrack-is-tracking-p nil) + + ;; Constants *************** *** 429,433 **** --- 418,433 ---- "Regular expression that describes tracebacks.") + ;; pdbtrack contants + (defconst py-pdbtrack-stack-entry-regexp + "> \\([^(]+\\)(\\([0-9]+\\))[?a-zA-Z0-9_]+()" + "Regular expression pdbtrack uses to find a stack trace entry.") + + (defconst py-pdbtrack-input-prompt "\n[(<]?pdb[>)]? " + "Regular expression pdbtrack uses to recognize a pdb prompt.") + (defconst py-pdbtrack-track-range 10000 + "Max number of characters from end of buffer to search for stack entry.") + + ;; Major mode boilerplate *************** *** 490,493 **** --- 490,494 ---- (define-key py-mode-map "\C-c:" 'py-guess-indent-offset) (define-key py-mode-map "\C-c\t" 'py-indent-region) + (define-key py-mode-map "\C-c\C-d" 'py-pdbtrack-toggle-stack-tracking) (define-key py-mode-map "\C-c\C-n" 'py-next-statement) (define-key py-mode-map "\C-c\C-p" 'py-previous-statement) *************** *** 1092,1095 **** --- 1093,1160 ---- )) + (defun py-pdbtrack-overlay-arrow (activation) + "Activate or de arrow at beginning-of-line in current buffer." + ;; This was derived/simplified from edebug-overlay-arrow + (cond (activation + (setq overlay-arrow-position (make-marker)) + (setq overlay-arrow-string "=>") + (set-marker overlay-arrow-position (py-point 'bol) (current-buffer)) + (setq py-pdbtrack-is-tracking-p t)) + (overlay-arrow-position + (setq overlay-arrow-position nil) + (setq py-pdbtrack-is-tracking-p nil)) + )) + + (defun py-pdbtrack-track-stack-file (text) + "Show the file indicated by the pdb stack entry line, in a separate window. + + Activity is disabled if the buffer-local variable + `py-pdbtrack-do-tracking-p' is nil. + + We depend on the pdb input prompt matching `py-pdbtrack-input-prompt' + at the beginning of the line." + ;; Instead of trying to piece things together from partial text + ;; (which can be almost useless depending on Emacs version), we + ;; monitor to the point where we have the next pdb prompt, and then + ;; check all text from comint-last-input-end to process-mark. + ;; + ;; KLM: It might be nice to provide an optional override, so this + ;; routine could be fed debugger output strings as the text + ;; argument, for deliberate application elsewhere. + ;; + ;; KLM: We're very conservative about clearing the overlay arrow, to + ;; minimize residue. This means, for instance, that executing other + ;; pdb commands wipes out the highlight. + (let* ((origbuf (current-buffer)) + (currproc (get-buffer-process origbuf))) + (if (not (and currproc py-pdbtrack-do-tracking-p)) + (py-pdbtrack-overlay-arrow nil) + (let* (;(origdir default-directory) + (procmark (process-mark currproc)) + (block (buffer-substring (max comint-last-input-end + (- procmark + py-pdbtrack-track-range)) + procmark)) + fname lineno) + (if (not (string-match (concat py-pdbtrack-input-prompt "$") block)) + (py-pdbtrack-overlay-arrow nil) + (if (not (string-match + (concat ".*" py-pdbtrack-stack-entry-regexp ".*") + block)) + (py-pdbtrack-overlay-arrow nil) + (setq fname (match-string 1 block) + lineno (match-string 2 block)) + (if (file-exists-p fname) + (progn + (find-file-other-window fname) + (goto-line (string-to-int lineno)) + (message "L%s %s" lineno fname) + (py-pdbtrack-overlay-arrow t) + (pop-to-buffer origbuf t) ) + (if (= (elt fname 0) ?\<) + (message "(Non-file source: '%s')" fname) + (message "Not found: %s" fname)) + ))))))) + (defun py-postprocess-output-buffer (buf) "Highlight exceptions found in BUF. *************** *** 1228,1231 **** --- 1293,1299 ---- (add-hook 'comint-output-filter-functions 'py-comint-output-filter-function) + ;; pdbtrack + (add-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file) + (setq py-pdbtrack-do-tracking-p t) (set-syntax-table py-mode-syntax-table) (use-local-map py-shell-map) *************** *** 2490,2493 **** --- 2558,2584 ---- + ;; pdbtrack functions + (defun py-pdbtrack-toggle-stack-tracking (arg) + (interactive "P") + (if (not (get-buffer-process (current-buffer))) + (error "No process associated with buffer '%s'" (current-buffer))) + ;; missing or 0 is toggle, >0 turn on, <0 turn off + (if (or (not arg) + (zerop (setq arg (prefix-numeric-value arg)))) + (setq py-pdbtrack-do-tracking-p (not py-pdbtrack-do-tracking-p)) + (setq py-pdbtrack-do-tracking-p (> arg 0))) + (message "%sabled Python's pdbtrack" + (if py-pdbtrack-do-tracking-p "En" "Dis"))) + + (defun turn-on-pdbtrack () + (interactive) + (py-pdbtrack-toggle-stack-tracking 1)) + + (defun turn-off-pdbtrack () + (interactive) + (py-pdbtrack-toggle-stack-tracking 0)) + + + ;; Documentation functions *************** *** 3136,3139 **** --- 3227,3236 ---- ;; arrange to kill temp files when Emacs exists (add-hook 'kill-emacs-hook 'py-kill-emacs-hook) + (add-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file) + + ;; Add a designator to the minor mode strings + (or (assq 'py-pdbtrack-minor-mode-string minor-mode-alist) + (push '(py-pdbtrack-is-tracking-p py-pdbtrack-minor-mode-string) + minor-mode-alist)) From bwarsaw@users.sourceforge.net Wed Apr 11 21:23:26 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 11 Apr 2001 13:23:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc python-mode.el,NONE,4.0 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv6004 Modified Files: Tag: 4.0 python-mode.el Log Message: Bumping to version 4.0 since we now support only XEmacs 21.1 and Emacs 20.7, although not all of the compatibility code for older Emacsen has been removed. Specifically, the old "make sure we have a current custom.el library" stuff is removed, as is the hack-around for an NTEmacs 19.34.6 make-temp-name bug. Updated much of the Commentary section in the initial comments. Much more importantly, I've integrated Ken Manheimer's pdbtrack stuff, which is way cool. When enabled (as by default), this turns on the overlay arrow when pdb is entered, either in the shell buffer or in the *Python* buffer. Specifically: (py-mode-map): Added C-c C-d to toggle pdb tracking. (py-pdbtrack-do-tracking-p): New user customizable variable to control whether overlay arrow tracking is enabled or not. This variable is buffer local and is turned on by default. (py-pdbtrack-minor-mode-string): The string that's added to the minor mode alist when actually doing pdb overlay arrow tracking. User customizable. (py-pdbtrack-toggle-stack-tracking, turn-on-pdbtrack, turn-off-pdbtrack): New commands to control pdb tracking. (py-pdbtrack-is-tracking-p): Helper variable used to control the display of py-pdbtrack-minor-mode-string. Set to true when the overlay arrow is enabled, and false when it's disabled. (py-pdbtrack-stack-entry-regexp, py-pdbtrack-input-prompt, py-pdbtrack-track-range): Inherited from pdbtrack.el and renamed. (py-pdbtrack-overlay-arrow, py-pdbtrack-track-stack-file): New functions which actually do the tracking. (py-shell): Add py-pdbtrack-track-stack-file to comint-output-filter-functions. Finally, add py-pdbtrack-track-stack-file to comint-output-filter-functions at the file level. This and the py-shell addition should ensure that pdb tracking is installed regardless of the order of operation. Also, add py-pdbtrack-minor-mode-string to minor-mode-alist. --- NEW FILE: python-mode.el --- ;;; python-mode.el --- Major mode for editing Python programs ;; Copyright (C) 1992,1993,1994 Tim Peters ;; Author: 1995-2001 Barry A. Warsaw ;; 1992-1994 Tim Peters ;; Maintainer: python-mode@python.org ;; Created: Feb 1992 ;; Keywords: python languages oop (defconst py-version "$Revision: 4.0 $" "`python-mode' version number.") ;; This software is provided as-is, without express or implied ;; warranty. Permission to use, copy, modify, distribute or sell this ;; software, without fee, for any purpose and by any individual or ;; organization, is hereby granted, provided that the above copyright ;; notice and this paragraph appear in all copies. [...3200 lines suppressed...] (defun py-kill-emacs-hook () "Delete files in `py-file-queue'. These are Python temporary files awaiting execution." (mapcar #'(lambda (filename) (py-safe (delete-file filename))) py-file-queue)) ;; arrange to kill temp files when Emacs exists (add-hook 'kill-emacs-hook 'py-kill-emacs-hook) (add-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file) ;; Add a designator to the minor mode strings (or (assq 'py-pdbtrack-minor-mode-string minor-mode-alist) (push '(py-pdbtrack-is-tracking-p py-pdbtrack-minor-mode-string) minor-mode-alist)) (provide 'python-mode) ;;; python-mode.el ends here From bwarsaw@users.sourceforge.net Wed Apr 11 21:37:59 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 11 Apr 2001 13:37:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.140,1.141 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv8462 Modified Files: NEWS Log Message: Added news about the updated python-mode.el Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -r1.140 -r1.141 *** NEWS 2001/03/31 02:42:42 1.140 --- NEWS 2001/04/11 20:37:57 1.141 *************** *** 1,2 **** --- 1,12 ---- + What's New in Python 2.1 final? + =============================== + + - An updated python-mode.el version 4.0 which integrates Ken + Manheimer's pdbtrack.el. This makes debugging Python code via pdb + much nicer in XEmacs and Emacs. When stepping through your program + with pdb, in either the shell window or the *Python* window, the + source file and line will be tracked by an arrow. + + What's New in Python 2.1 beta 2? ================================ From gvanrossum@users.sourceforge.net Wed Apr 11 21:53:39 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 11 Apr 2001 13:53:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-unixware7 - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-unixware7 In directory usw-pr-cvs1:/tmp/cvs-serv11512/plat-unixware7 Log Message: Directory /cvsroot/python/python/dist/src/Lib/plat-unixware7 added to the repository From gvanrossum@users.sourceforge.net Wed Apr 11 21:54:46 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 11 Apr 2001 13:54:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-unixware7 FCNTL.py,NONE,1.1 IN.py,NONE,1.1 SOCKET.py,NONE,1.1 STROPTS.py,NONE,1.1 TERMIOS.py,NONE,1.1 regen,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-unixware7 In directory usw-pr-cvs1:/tmp/cvs-serv11682 Added Files: FCNTL.py IN.py SOCKET.py STROPTS.py TERMIOS.py regen Log Message: Unixware 7 support by Billy G. Allie (SF patch 413011) --- NEW FILE: FCNTL.py --- # Generated by h2py from /usr/include/sys/fcntl.h # Included from sys/types.h def quad_low(x): return x.val[0] ADT_EMASKSIZE = 8 SHRT_MIN = -32768 SHRT_MAX = 32767 INT_MIN = (-2147483647-1) INT_MAX = 2147483647 LONG_MIN = (-2147483647-1) LONG_MAX = 2147483647 OFF32_MAX = LONG_MAX ISTAT_ASSERTED = 0 ISTAT_ASSUMED = 1 ISTAT_NONE = 2 OFF_MAX = OFF32_MAX CLOCK_MAX = LONG_MAX P_MYID = (-1) P_MYHOSTID = (-1) # Included from sys/select.h FD_SETSIZE = 4096 NBBY = 8 NULL = 0 O_RDONLY = 0 O_WRONLY = 1 O_RDWR = 2 O_NDELAY = 0x04 O_APPEND = 0x08 O_SYNC = 0x10 O_NONBLOCK = 0x80 O_LARGEFILE = 0x80000 O_CREAT = 0x100 O_TRUNC = 0x200 O_EXCL = 0x400 O_NOCTTY = 0x800 F_DUPFD = 0 F_GETFD = 1 F_SETFD = 2 F_GETFL = 3 F_SETFL = 4 F_GETLK = 14 F_O_GETLK = 5 F_GETLK = 5 F_GETLK = 14 F_SETLK = 6 F_SETLKW = 7 F_CHKFL = 8 F_ALLOCSP = 10 F_FREESP = 11 F_RSETLK = 20 F_RGETLK = 21 F_RSETLKW = 22 F_GETOWN = 23 F_SETOWN = 24 F_DUP2 = 25 F_GETLK64 = 100 F_SETLKW64 = 101 F_SETLK64 = 102 F_RSETLK64 = 103 F_RGETLK64 = 104 F_RSETLKW64 = 105 F_FREESP64 = 106 F_RDCHK = 0x6001 F_GETLK = F_GETLK64 F_SETLKW = F_SETLKW64 F_SETLK = F_SETLK64 F_RSETLK = F_RSETLK64 F_RGETLK = F_RGETLK64 F_RSETLKW = F_RSETLKW64 F_FREESP = F_FREESP64 F_RDLCK = 01 F_WRLCK = 02 F_UNLCK = 03 O_ACCMODE = 3 FD_CLOEXEC = 1 --- NEW FILE: IN.py --- # Generated by h2py from /usr/include/netinet/in.h # Included from netinet/in_f.h def IN_CLASSA(i): return (((long)(i) & 0x80000000) == 0) IN_CLASSA_NET = 0xff000000 IN_CLASSA_NSHIFT = 24 IN_CLASSA_HOST = 0x00ffffff IN_CLASSA_MAX = 128 def IN_CLASSB(i): return (((long)(i) & 0xc0000000) == 0x80000000) IN_CLASSB_NET = 0xffff0000 IN_CLASSB_NSHIFT = 16 IN_CLASSB_HOST = 0x0000ffff IN_CLASSB_MAX = 65536 def IN_CLASSC(i): return (((long)(i) & 0xe0000000) == 0xc0000000) IN_CLASSC_NET = 0xffffff00 IN_CLASSC_NSHIFT = 8 IN_CLASSC_HOST = 0x000000ff def IN_CLASSD(i): return (((long)(i) & 0xf0000000) == 0xe0000000) IN_CLASSD_NET = 0xf0000000 IN_CLASSD_NSHIFT = 28 IN_CLASSD_HOST = 0x0fffffff def IN_MULTICAST(i): return IN_CLASSD(i) def IN_EXPERIMENTAL(i): return (((long)(i) & 0xe0000000) == 0xe0000000) def IN_BADCLASS(i): return (((long)(i) & 0xf0000000) == 0xf0000000) INADDR_ANY = 0x00000000 INADDR_LOOPBACK = 0x7f000001 INADDR_BROADCAST = 0xffffffff INADDR_NONE = 0xffffffff IN_LOOPBACKNET = 127 INADDR_UNSPEC_GROUP = 0xe0000000 INADDR_ALLHOSTS_GROUP = 0xe0000001 INADDR_ALLRTRS_GROUP = 0xe0000002 INADDR_MAX_LOCAL_GROUP = 0xe00000ff # Included from netinet/in6.h # Included from sys/types.h def quad_low(x): return x.val[0] ADT_EMASKSIZE = 8 SHRT_MIN = -32768 SHRT_MAX = 32767 INT_MIN = (-2147483647-1) INT_MAX = 2147483647 LONG_MIN = (-2147483647-1) LONG_MAX = 2147483647 OFF32_MAX = LONG_MAX ISTAT_ASSERTED = 0 ISTAT_ASSUMED = 1 ISTAT_NONE = 2 OFF_MAX = OFF32_MAX CLOCK_MAX = LONG_MAX P_MYID = (-1) P_MYHOSTID = (-1) # Included from sys/select.h FD_SETSIZE = 4096 NBBY = 8 NULL = 0 # Included from sys/bitypes.h # Included from netinet/in6_f.h def IN6_IS_ADDR_UNSPECIFIED(a): return IN6_ADDR_EQUAL_L(a, 0, 0, 0, 0) def IN6_SET_ADDR_UNSPECIFIED(a): return IN6_ADDR_COPY_L(a, 0, 0, 0, 0) def IN6_IS_ADDR_ANY(a): return IN6_ADDR_EQUAL_L(a, 0, 0, 0, 0) def IN6_SET_ADDR_ANY(a): return IN6_ADDR_COPY_L(a, 0, 0, 0, 0) def IN6_IS_ADDR_LOOPBACK(a): return IN6_ADDR_EQUAL_L(a, 0, 0, 0, 0x01000000) def IN6_SET_ADDR_LOOPBACK(a): return IN6_ADDR_COPY_L(a, 0, 0, 0, 0x01000000) IN6_MC_FLAG_PERMANENT = 0x0 IN6_MC_FLAG_TRANSIENT = 0x1 IN6_MC_SCOPE_NODELOCAL = 0x1 IN6_MC_SCOPE_LINKLOCAL = 0x2 IN6_MC_SCOPE_SITELOCAL = 0x5 IN6_MC_SCOPE_ORGLOCAL = 0x8 IN6_MC_SCOPE_GLOBAL = 0xE def IN6_IS_ADDR_MC_NODELOCAL(a): return \ def IN6_IS_ADDR_MC_LINKLOCAL(a): return \ def IN6_IS_ADDR_MC_SITELOCAL(a): return \ def IN6_IS_ADDR_MC_ORGLOCAL(a): return \ def IN6_IS_ADDR_MC_GLOBAL(a): return \ # Included from sys/convsa.h __NETLIB_UW211_SVR4 = 1 __NETLIB_UW211_XPG4 = 2 __NETLIB_GEMINI_SVR4 = 3 __NETLIB_GEMINI_XPG4 = 4 __NETLIB_FP1_SVR4 = 5 __NETLIB_FP1_XPG4 = 6 __NETLIB_BASE_VERSION__ = __NETLIB_UW211_SVR4 __NETLIB_VERSION__ = __NETLIB_FP1_SVR4 __NETLIB_VERSION__ = __NETLIB_FP1_XPG4 __NETLIB_VERSION__ = __NETLIB_GEMINI_SVR4 __NETLIB_VERSION__ = __NETLIB_GEMINI_XPG4 __NETLIB_VERSION__ = __NETLIB_UW211_SVR4 __NETLIB_VERSION__ = __NETLIB_UW211_XPG4 __NETLIB_VERSION__ = __NETLIB_FP1_XPG4 # Included from sys/byteorder.h LITTLE_ENDIAN = 1234 BIG_ENDIAN = 4321 PDP_ENDIAN = 3412 # Included from sys/byteorder_f.h BYTE_ORDER = LITTLE_ENDIAN def htonl(hl): return __htonl(hl) def ntohl(nl): return __ntohl(nl) def htons(hs): return __htons(hs) def ntohs(ns): return __ntohs(ns) def ntohl(x): return (x) def ntohs(x): return (x) def htonl(x): return (x) def htons(x): return (x) def __NETLIB_VERSION_IS_XPG4(version): return (((version) % 2) == 0) def __NETLIB_VERSION_HAS_SALEN(version): return ((version) >= __NETLIB_GEMINI_SVR4) def __NETLIB_VERSION_IS_IKS(version): return ((version) >= __NETLIB_FP1_SVR4) def SA_FAMILY_GET(sa): return \ INET6_ADDRSTRLEN = 46 IPV6_UNICAST_HOPS = 3 IPV6_ADDRFORM = 24 IPV6_MULTICAST_HOPS = 25 IPV6_MULTICAST_IF = 26 IPV6_MULTICAST_LOOP = 27 IPV6_ADD_MEMBERSHIP = 28 IPV6_DROP_MEMBERSHIP = 29 # Included from sys/insrem.h def LIST_INIT(head): return \ def LIST_INIT(head): return \ def remque(a): return REMQUE(a) # Included from sys/socket.h # Included from sys/uio.h SHUT_RD = 0 SHUT_WR = 1 SHUT_RDWR = 2 # Included from sys/netconfig.h # Included from sys/cdefs.h def __P(protos): return protos def __STRING(x): return #x def __P(protos): return () def __STRING(x): return "x" NETCONFIG = "/etc/netconfig" NETPATH = "NETPATH" NC_TPI_CLTS = 1 NC_TPI_COTS = 2 NC_TPI_COTS_ORD = 3 NC_TPI_RAW = 4 NC_NOFLAG = 00 NC_VISIBLE = 01 NC_BROADCAST = 02 NC_NOPROTOFMLY = "-" NC_LOOPBACK = "loopback" NC_INET = "inet" NC_INET6 = "inet6" NC_IMPLINK = "implink" NC_PUP = "pup" NC_CHAOS = "chaos" NC_NS = "ns" NC_NBS = "nbs" NC_ECMA = "ecma" NC_DATAKIT = "datakit" NC_CCITT = "ccitt" NC_SNA = "sna" NC_DECNET = "decnet" NC_DLI = "dli" NC_LAT = "lat" NC_HYLINK = "hylink" NC_APPLETALK = "appletalk" NC_NIT = "nit" NC_IEEE802 = "ieee802" NC_OSI = "osi" NC_X25 = "x25" NC_OSINET = "osinet" NC_GOSIP = "gosip" NC_NETWARE = "netware" NC_NOPROTO = "-" NC_TCP = "tcp" NC_UDP = "udp" NC_ICMP = "icmp" NC_IPX = "ipx" NC_SPX = "spx" NC_TPI_CLTS = 1 NC_TPI_COTS = 2 NC_TPI_COTS_ORD = 3 NC_TPI_RAW = 4 SOCK_STREAM = 2 SOCK_DGRAM = 1 SOCK_RAW = 4 SOCK_RDM = 5 SOCK_SEQPACKET = 6 SO_DEBUG = 0x0001 SO_ACCEPTCONN = 0x0002 SO_REUSEADDR = 0x0004 SO_KEEPALIVE = 0x0008 SO_DONTROUTE = 0x0010 SO_BROADCAST = 0x0020 SO_USELOOPBACK = 0x0040 SO_LINGER = 0x0080 SO_OOBINLINE = 0x0100 SO_ORDREL = 0x0200 SO_IMASOCKET = 0x0400 SO_MGMT = 0x0800 SO_REUSEPORT = 0x1000 SO_LISTENING = 0x2000 SO_RDWR = 0x4000 SO_SEMA = 0x8000 SO_DONTLINGER = (~SO_LINGER) SO_SNDBUF = 0x1001 SO_RCVBUF = 0x1002 SO_SNDLOWAT = 0x1003 SO_RCVLOWAT = 0x1004 SO_SNDTIMEO = 0x1005 SO_RCVTIMEO = 0x1006 SO_ERROR = 0x1007 SO_TYPE = 0x1008 SO_PROTOTYPE = 0x1009 SO_ALLRAW = 0x100a SOL_SOCKET = 0xffff AF_UNSPEC = 0 AF_UNIX = 1 AF_LOCAL = AF_UNIX AF_INET = 2 AF_IMPLINK = 3 AF_PUP = 4 AF_CHAOS = 5 AF_NS = 6 AF_NBS = 7 AF_ECMA = 8 AF_DATAKIT = 9 AF_CCITT = 10 AF_SNA = 11 AF_DECnet = 12 AF_DLI = 13 AF_LAT = 14 AF_HYLINK = 15 AF_APPLETALK = 16 AF_NIT = 17 AF_802 = 18 AF_OSI = 19 AF_ISO = AF_OSI AF_X25 = 20 AF_OSINET = 21 AF_GOSIP = 22 AF_YNET = 23 AF_ROUTE = 24 AF_LINK = 25 pseudo_AF_XTP = 26 AF_INET6 = 27 AF_MAX = 27 AF_INET_BSWAP = 0x0200 PF_UNSPEC = AF_UNSPEC PF_UNIX = AF_UNIX PF_LOCAL = AF_LOCAL PF_INET = AF_INET PF_IMPLINK = AF_IMPLINK PF_PUP = AF_PUP PF_CHAOS = AF_CHAOS PF_NS = AF_NS PF_NBS = AF_NBS PF_ECMA = AF_ECMA PF_DATAKIT = AF_DATAKIT PF_CCITT = AF_CCITT PF_SNA = AF_SNA PF_DECnet = AF_DECnet PF_DLI = AF_DLI PF_LAT = AF_LAT PF_HYLINK = AF_HYLINK PF_APPLETALK = AF_APPLETALK PF_NIT = AF_NIT PF_802 = AF_802 PF_OSI = AF_OSI PF_ISO = PF_OSI PF_X25 = AF_X25 PF_OSINET = AF_OSINET PF_GOSIP = AF_GOSIP PF_YNET = AF_YNET PF_ROUTE = AF_ROUTE PF_LINK = AF_LINK pseudo_PF_XTP = pseudo_AF_XTP PF_INET6 = AF_INET6 PF_MAX = AF_MAX SOMAXCONN = 5 SCM_RIGHTS = 1 MSG_OOB = 0x1 MSG_PEEK = 0x2 MSG_DONTROUTE = 0x4 MSG_CTRUNC = 0x8 MSG_TRUNC = 0x10 MSG_EOR = 0x30 MSG_WAITALL = 0x20 MSG_MAXIOVLEN = 16 def OPTLEN(x): return ((((x) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) GIARG = 0x1 CONTI = 0x2 GITAB = 0x4 SOCKETSYS = 88 SOCKETSYS = 83 SO_ACCEPT = 1 SO_BIND = 2 SO_CONNECT = 3 SO_GETPEERNAME = 4 SO_GETSOCKNAME = 5 SO_GETSOCKOPT = 6 SO_LISTEN = 7 SO_RECV = 8 SO_RECVFROM = 9 SO_SEND = 10 SO_SENDTO = 11 SO_SETSOCKOPT = 12 SO_SHUTDOWN = 13 SO_SOCKET = 14 SO_SOCKPOLL = 15 SO_GETIPDOMAIN = 16 SO_SETIPDOMAIN = 17 SO_ADJTIME = 18 # Included from sys/stream.h # Included from sys/cred.h # Included from sys/ksynch.h # Included from sys/dl.h SIGNBIT = 0x80000000 # Included from sys/ipl.h # Included from sys/disp_p.h # Included from sys/trap.h DIVERR = 0 SGLSTP = 1 NMIFLT = 2 BPTFLT = 3 INTOFLT = 4 BOUNDFLT = 5 INVOPFLT = 6 NOEXTFLT = 7 DBLFLT = 8 EXTOVRFLT = 9 INVTSSFLT = 10 SEGNPFLT = 11 STKFLT = 12 GPFLT = 13 PGFLT = 14 EXTERRFLT = 16 ALIGNFLT = 17 MCEFLT = 18 USERFLT = 0x100 TRP_PREEMPT = 0x200 TRP_UNUSED = 0x201 PF_ERR_MASK = 0x01 PF_ERR_PAGE = 0 PF_ERR_PROT = 1 PF_ERR_WRITE = 2 PF_ERR_USER = 4 EVT_STRSCHED = 0x04 EVT_GLOBCALLOUT = 0x08 EVT_LCLCALLOUT = 0x10 EVT_SOFTINTMASK = (EVT_STRSCHED|EVT_GLOBCALLOUT|EVT_LCLCALLOUT) PL0 = 0 PL1 = 1 PL2 = 2 PL3 = 3 PL4 = 4 PL5 = 5 PL6 = 6 PLHI = 8 PL7 = PLHI PLBASE = PL0 PLTIMEOUT = PL1 PLDISK = PL5 PLSTR = PL6 PLTTY = PLSTR PLMIN = PL0 PLMIN = PL1 MAX_INTR_LEVELS = 10 MAX_INTR_NESTING = 50 STRSCHED = EVT_STRSCHED GLOBALSOFTINT = EVT_GLOBCALLOUT LOCALSOFTINT = EVT_LCLCALLOUT # Included from sys/ksynch_p.h def GET_TIME(timep): return \ LK_THRESHOLD = 500000 # Included from sys/list.h # Included from sys/listasm.h def remque_null(e): return \ def LS_ISEMPTY(listp): return \ LK_BASIC = 0x1 LK_SLEEP = 0x2 LK_NOSTATS = 0x4 def CYCLES_SINCE(c): return CYCLES_BETWEEN((c), CYCLES()) LSB_NLKDS = 92 EVT_RUNRUN = 0x01 EVT_KPRUNRUN = 0x02 SP_UNLOCKED = 0 SP_LOCKED = 1 KS_LOCKTEST = 0x01 KS_MPSTATS = 0x02 KS_DEINITED = 0x04 KS_NVLTTRACE = 0x08 RWS_READ = (ord('r')) RWS_WRITE = (ord('w')) RWS_UNLOCKED = (ord('u')) RWS_BUSY = (ord('b')) def SLEEP_LOCKOWNED(lkp): return \ def SLEEP_DISOWN(lkp): return \ KS_NOPRMPT = 0x00000001 __KS_LOCKTEST = KS_LOCKTEST __KS_LOCKTEST = 0 __KS_MPSTATS = KS_MPSTATS __KS_MPSTATS = 0 __KS_NVLTTRACE = KS_NVLTTRACE __KS_NVLTTRACE = 0 KSFLAGS = (__KS_LOCKTEST|__KS_MPSTATS|__KS_NVLTTRACE) KSVUNIPROC = 1 KSVMPDEBUG = 2 KSVMPNODEBUG = 3 KSVFLAG = KSVUNIPROC KSVFLAG = KSVMPDEBUG KSVFLAG = KSVMPNODEBUG # Included from sys/ksinline.h _A_SP_LOCKED = 1 _A_SP_UNLOCKED = 0 _A_INVPL = -1 def _ATOMIC_INT_INCR(atomic_intp): return \ def _ATOMIC_INT_DECR(atomic_intp): return \ def ATOMIC_INT_READ(atomic_intp): return _ATOMIC_INT_READ(atomic_intp) def ATOMIC_INT_INCR(atomic_intp): return _ATOMIC_INT_INCR(atomic_intp) def ATOMIC_INT_DECR(atomic_intp): return _ATOMIC_INT_DECR(atomic_intp) def FSPIN_INIT(lp): return def FSPIN_LOCK(l): return DISABLE() def FSPIN_TRYLOCK(l): return (DISABLE(), B_TRUE) def FSPIN_UNLOCK(l): return ENABLE() def LOCK_DEINIT(lp): return def LOCK_DEALLOC(lp): return def LOCK_OWNED(lp): return (B_TRUE) def RW_DEINIT(lp): return def RW_DEALLOC(lp): return def RW_OWNED(lp): return (B_TRUE) def IS_LOCKED(lockp): return B_FALSE def LOCK_PLMIN(lockp): return \ def TRYLOCK_PLMIN(lockp): return LOCK_PLMIN(lockp) def LOCK_SH_PLMIN(lockp): return LOCK_PLMIN(lockp) def RW_RDLOCK_PLMIN(lockp): return LOCK_PLMIN(lockp) def RW_WRLOCK_PLMIN(lockp): return LOCK_PLMIN(lockp) def LOCK_DEINIT(l): return def LOCK_PLMIN(lockp): return LOCK((lockp), PLMIN) def TRYLOCK_PLMIN(lockp): return TRYLOCK((lockp), PLMIN) def LOCK_SH_PLMIN(lockp): return LOCK_SH((lockp), PLMIN) def RW_RDLOCK_PLMIN(lockp): return RW_RDLOCK((lockp), PLMIN) def RW_WRLOCK_PLMIN(lockp): return RW_WRLOCK((lockp), PLMIN) def FSPIN_IS_LOCKED(fsp): return B_FALSE def SPIN_IS_LOCKED(lockp): return B_FALSE def FSPIN_OWNED(l): return (B_TRUE) CR_MLDREAL = 0x00000001 CR_RDUMP = 0x00000002 def crhold(credp): return crholdn((credp), 1) def crfree(credp): return crfreen((credp), 1) # Included from sys/strmdep.h def str_aligned(X): return (((uint)(X) & (sizeof(int) - 1)) == 0) # Included from sys/engine.h # Included from sys/clock.h # Included from sys/time.h DST_NONE = 0 DST_USA = 1 DST_AUST = 2 DST_WET = 3 DST_MET = 4 DST_EET = 5 DST_CAN = 6 DST_GB = 7 DST_RUM = 8 DST_TUR = 9 DST_AUSTALT = 10 ITIMER_REAL = 0 ITIMER_VIRTUAL = 1 ITIMER_PROF = 2 FD_SETSIZE = 4096 FD_NBBY = 8 # Included from time.h NULL = 0 CLOCKS_PER_SEC = 1000000 # Included from sys/clock_p.h CGBITS = 4 IDBITS = 28 def toid_unpackcg(idval): return (((idval) >> IDBITS) & 0xf) def toid_unpackid(idval): return ((idval) & 0xfffffff) def toid_unpackcg(idval): return 0 def toid_unpackid(idval): return (idval) NCALLOUT_HASH = 1024 CALLOUT_MAXVAL = 0x7fffffff TO_PERIODIC = 0x80000000 TO_IMMEDIATE = 0x80000000 SEC = 1 MILLISEC = 1000 MICROSEC = 1000000 NANOSEC = 1000000000 SECHR = (60*60) SECDAY = (24*SECHR) SECYR = (365*SECDAY) def TIME_OWNED_R(cgnum): return (B_TRUE) LOOPSECONDS = 1800 LOOPMICROSECONDS = (LOOPSECONDS * MICROSEC) def TICKS_SINCE(t): return TICKS_BETWEEN(t, TICKS()) MAXRQS = 2 E_OFFLINE = 0x01 E_BAD = 0x02 E_SHUTDOWN = 0x04 E_DRIVER = 0x08 E_DEFAULTKEEP = 0x100 E_DRIVERBOUND = 0x200 E_EXCLUSIVE = 0x400 E_CGLEADER = 0x800 E_NOWAY = (E_OFFLINE|E_BAD|E_SHUTDOWN) E_BOUND = 0x01 E_GLOBAL = 0x00 E_UNAVAIL = -1 ENGINE_ONLINE = 1 def PROCESSOR_UNMAP(e): return ((e) - engine) BOOTENG = 0 QMOVED = 0x0001 QWANTR = 0x0002 QWANTW = 0x0004 QFULL = 0x0008 QREADR = 0x0010 QUSE = 0x0020 QNOENB = 0x0040 QUP = 0x0080 QBACK = 0x0100 QINTER = 0x0200 QPROCSON = 0x0400 QTOENAB = 0x0800 QFREEZE = 0x1000 QBOUND = 0x2000 QDEFCNT = 0x4000 QENAB = 0x0001 QSVCBUSY = 0x0002 STRM_PUTCNT_TABLES = 31 def STRM_MYENG_PUTCNT(sdp): return STRM_PUTCNT(l.eng_num, sdp) QB_FULL = 0x01 QB_WANTW = 0x02 QB_BACK = 0x04 NBAND = 256 DB_WASDUPED = 0x1 DB_2PIECE = 0x2 STRLEAKHASHSZ = 1021 MSGMARK = 0x01 MSGNOLOOP = 0x02 MSGDELIM = 0x04 MSGNOGET = 0x08 MSGLOG = 0x10 M_DATA = 0x00 M_PROTO = 0x01 M_BREAK = 0x08 M_PASSFP = 0x09 M_SIG = 0x0b M_DELAY = 0x0c M_CTL = 0x0d M_IOCTL = 0x0e M_SETOPTS = 0x10 M_RSE = 0x11 M_TRAIL = 0x12 M_IOCACK = 0x81 M_IOCNAK = 0x82 M_PCPROTO = 0x83 M_PCSIG = 0x84 M_READ = 0x85 M_FLUSH = 0x86 M_STOP = 0x87 M_START = 0x88 M_HANGUP = 0x89 M_ERROR = 0x8a M_COPYIN = 0x8b M_COPYOUT = 0x8c M_IOCDATA = 0x8d M_PCRSE = 0x8e M_STOPI = 0x8f M_STARTI = 0x90 M_PCCTL = 0x91 M_PCSETOPTS = 0x92 QNORM = 0x00 QPCTL = 0x80 STRCANON = 0x01 RECOPY = 0x02 SO_ALL = 0x003f SO_READOPT = 0x0001 SO_WROFF = 0x0002 SO_MINPSZ = 0x0004 SO_MAXPSZ = 0x0008 SO_HIWAT = 0x0010 SO_LOWAT = 0x0020 SO_MREADON = 0x0040 SO_MREADOFF = 0x0080 SO_NDELON = 0x0100 SO_NDELOFF = 0x0200 SO_ISTTY = 0x0400 SO_ISNTTY = 0x0800 SO_TOSTOP = 0x1000 SO_TONSTOP = 0x2000 SO_BAND = 0x4000 SO_DELIM = 0x8000 SO_NODELIM = 0x010000 SO_STRHOLD = 0x020000 SO_LOOP = 0x040000 DRVOPEN = 0x0 MODOPEN = 0x1 CLONEOPEN = 0x2 OPENFAIL = -1 BPRI_LO = 1 BPRI_MED = 2 BPRI_HI = 3 INFPSZ = -1 FLUSHALL = 1 FLUSHDATA = 0 STRHIGH = 5120 STRLOW = 1024 MAXIOCBSZ = 1024 def straln(a): return (caddr_t)((long)(a) & ~(sizeof(int)-1)) IPM_ID = 200 ICMPM_ID = 201 TCPM_ID = 202 UDPM_ID = 203 ARPM_ID = 204 APPM_ID = 205 RIPM_ID = 206 PPPM_ID = 207 AHDLCM_ID = 208 MHDLCRIPM_ID = 209 HDLCM_ID = 210 PPCID_ID = 211 IGMPM_ID = 212 IPIPM_ID = 213 IPPROTO_IP = 0 IPPROTO_HOPOPTS = 0 IPPROTO_ICMP = 1 IPPROTO_IGMP = 2 IPPROTO_GGP = 3 IPPROTO_IPIP = 4 IPPROTO_TCP = 6 IPPROTO_EGP = 8 IPPROTO_PUP = 12 IPPROTO_UDP = 17 IPPROTO_IDP = 22 IPPROTO_TP = 29 IPPROTO_IPV6 = 41 IPPROTO_ROUTING = 43 IPPROTO_FRAGMENT = 44 IPPROTO_ESP = 50 IPPROTO_AH = 51 IPPROTO_ICMPV6 = 58 IPPROTO_NONE = 59 IPPROTO_DSTOPTS = 60 IPPROTO_HELLO = 63 IPPROTO_ND = 77 IPPROTO_EON = 80 IPPROTO_RAW = 255 IPPROTO_MAX = 256 IPPORT_ECHO = 7 IPPORT_DISCARD = 9 IPPORT_SYSTAT = 11 IPPORT_DAYTIME = 13 IPPORT_NETSTAT = 15 IPPORT_FTP = 21 IPPORT_TELNET = 23 IPPORT_SMTP = 25 IPPORT_TIMESERVER = 37 IPPORT_NAMESERVER = 42 IPPORT_WHOIS = 43 IPPORT_MTP = 57 IPPORT_TFTP = 69 IPPORT_RJE = 77 IPPORT_FINGER = 79 IPPORT_TTYLINK = 87 IPPORT_SUPDUP = 95 IPPORT_EXECSERVER = 512 IPPORT_LOGINSERVER = 513 IPPORT_CMDSERVER = 514 IPPORT_EFSSERVER = 520 IPPORT_BIFFUDP = 512 IPPORT_WHOSERVER = 513 IPPORT_ROUTESERVER = 520 IPPORT_RESERVED = 1024 IPPORT_USERRESERVED = 65535 IPPORT_RESERVED_LOW = 512 IPPORT_RESERVED_HIGH = 1023 IPPORT_USERRESERVED_LOW = 32768 IPPORT_USERRESERVED_HIGH = 65535 INET_ADDRSTRLEN = 16 IP_OPTIONS = 1 IP_TOS = 2 IP_TTL = 3 IP_HDRINCL = 4 IP_RECVOPTS = 5 IP_RECVRETOPTS = 6 IP_RECVDSTADDR = 7 IP_RETOPTS = 8 IP_MULTICAST_IF = 9 IP_MULTICAST_LOOP = 10 IP_ADD_MEMBERSHIP = 11 IP_DROP_MEMBERSHIP = 12 IP_BROADCAST_IF = 14 IP_RECVIFINDEX = 15 IP_MULTICAST_TTL = 16 MRT_INIT = 17 MRT_DONE = 18 MRT_ADD_VIF = 19 MRT_DEL_VIF = 20 MRT_ADD_MFC = 21 MRT_DEL_MFC = 22 MRT_VERSION = 23 IP_DEFAULT_MULTICAST_TTL = 1 IP_DEFAULT_MULTICAST_LOOP = 1 IP_MAX_MEMBERSHIPS = 20 INADDR_UNSPEC_GROUP = 0xe0000000 INADDR_ALLHOSTS_GROUP = 0xe0000001 INADDR_ALLRTRS_GROUP = 0xe0000002 INADDR_MAX_LOCAL_GROUP = 0xe00000ff # Included from netinet/in_mp.h # Included from netinet/in_mp_ddi.h # Included from sys/inline.h IP_HIER_BASE = (20) def ASSERT_LOCK(x): return def ASSERT_WRLOCK(x): return def ASSERT_UNLOCK(x): return def CANPUT(q): return canput((q)) def CANPUTNEXT(q): return canputnext((q)) INET_DEBUG = 1 --- NEW FILE: SOCKET.py --- # Generated by h2py from /usr/include/sys/socket.h # Included from sys/byteorder.h LITTLE_ENDIAN = 1234 BIG_ENDIAN = 4321 PDP_ENDIAN = 3412 # Included from sys/byteorder_f.h BYTE_ORDER = LITTLE_ENDIAN def htonl(hl): return __htonl(hl) def ntohl(nl): return __ntohl(nl) def htons(hs): return __htons(hs) def ntohs(ns): return __ntohs(ns) def ntohl(x): return (x) def ntohs(x): return (x) def htonl(x): return (x) def htons(x): return (x) # Included from sys/types.h def quad_low(x): return x.val[0] ADT_EMASKSIZE = 8 SHRT_MIN = -32768 SHRT_MAX = 32767 INT_MIN = (-2147483647-1) INT_MAX = 2147483647 LONG_MIN = (-2147483647-1) LONG_MAX = 2147483647 OFF32_MAX = LONG_MAX ISTAT_ASSERTED = 0 ISTAT_ASSUMED = 1 ISTAT_NONE = 2 OFF_MAX = OFF32_MAX CLOCK_MAX = LONG_MAX P_MYID = (-1) P_MYHOSTID = (-1) # Included from sys/select.h FD_SETSIZE = 4096 NBBY = 8 NULL = 0 # Included from sys/bitypes.h # Included from sys/convsa.h __NETLIB_UW211_SVR4 = 1 __NETLIB_UW211_XPG4 = 2 __NETLIB_GEMINI_SVR4 = 3 __NETLIB_GEMINI_XPG4 = 4 __NETLIB_FP1_SVR4 = 5 __NETLIB_FP1_XPG4 = 6 __NETLIB_BASE_VERSION__ = __NETLIB_UW211_SVR4 __NETLIB_VERSION__ = __NETLIB_FP1_SVR4 __NETLIB_VERSION__ = __NETLIB_FP1_XPG4 __NETLIB_VERSION__ = __NETLIB_GEMINI_SVR4 __NETLIB_VERSION__ = __NETLIB_GEMINI_XPG4 __NETLIB_VERSION__ = __NETLIB_UW211_SVR4 __NETLIB_VERSION__ = __NETLIB_UW211_XPG4 __NETLIB_VERSION__ = __NETLIB_FP1_XPG4 def __NETLIB_VERSION_IS_XPG4(version): return (((version) % 2) == 0) def __NETLIB_VERSION_HAS_SALEN(version): return ((version) >= __NETLIB_GEMINI_SVR4) def __NETLIB_VERSION_IS_IKS(version): return ((version) >= __NETLIB_FP1_SVR4) def SA_FAMILY_GET(sa): return \ # Included from sys/uio.h SHUT_RD = 0 SHUT_WR = 1 SHUT_RDWR = 2 # Included from sys/netconfig.h # Included from sys/cdefs.h def __P(protos): return protos def __STRING(x): return #x def __P(protos): return () def __STRING(x): return "x" NETCONFIG = "/etc/netconfig" NETPATH = "NETPATH" NC_TPI_CLTS = 1 NC_TPI_COTS = 2 NC_TPI_COTS_ORD = 3 NC_TPI_RAW = 4 NC_NOFLAG = 00 NC_VISIBLE = 01 NC_BROADCAST = 02 NC_NOPROTOFMLY = "-" NC_LOOPBACK = "loopback" NC_INET = "inet" NC_INET6 = "inet6" NC_IMPLINK = "implink" NC_PUP = "pup" NC_CHAOS = "chaos" NC_NS = "ns" NC_NBS = "nbs" NC_ECMA = "ecma" NC_DATAKIT = "datakit" NC_CCITT = "ccitt" NC_SNA = "sna" NC_DECNET = "decnet" NC_DLI = "dli" NC_LAT = "lat" NC_HYLINK = "hylink" NC_APPLETALK = "appletalk" NC_NIT = "nit" NC_IEEE802 = "ieee802" NC_OSI = "osi" NC_X25 = "x25" NC_OSINET = "osinet" NC_GOSIP = "gosip" NC_NETWARE = "netware" NC_NOPROTO = "-" NC_TCP = "tcp" NC_UDP = "udp" NC_ICMP = "icmp" NC_IPX = "ipx" NC_SPX = "spx" NC_TPI_CLTS = 1 NC_TPI_COTS = 2 NC_TPI_COTS_ORD = 3 NC_TPI_RAW = 4 SOCK_STREAM = 2 SOCK_DGRAM = 1 SOCK_RAW = 4 SOCK_RDM = 5 SOCK_SEQPACKET = 6 SO_DEBUG = 0x0001 SO_ACCEPTCONN = 0x0002 SO_REUSEADDR = 0x0004 SO_KEEPALIVE = 0x0008 SO_DONTROUTE = 0x0010 SO_BROADCAST = 0x0020 SO_USELOOPBACK = 0x0040 SO_LINGER = 0x0080 SO_OOBINLINE = 0x0100 SO_ORDREL = 0x0200 SO_IMASOCKET = 0x0400 SO_MGMT = 0x0800 SO_REUSEPORT = 0x1000 SO_LISTENING = 0x2000 SO_RDWR = 0x4000 SO_SEMA = 0x8000 SO_DONTLINGER = (~SO_LINGER) SO_SNDBUF = 0x1001 SO_RCVBUF = 0x1002 SO_SNDLOWAT = 0x1003 SO_RCVLOWAT = 0x1004 SO_SNDTIMEO = 0x1005 SO_RCVTIMEO = 0x1006 SO_ERROR = 0x1007 SO_TYPE = 0x1008 SO_PROTOTYPE = 0x1009 SO_ALLRAW = 0x100a SOL_SOCKET = 0xffff AF_UNSPEC = 0 AF_UNIX = 1 AF_LOCAL = AF_UNIX AF_INET = 2 AF_IMPLINK = 3 AF_PUP = 4 AF_CHAOS = 5 AF_NS = 6 AF_NBS = 7 AF_ECMA = 8 AF_DATAKIT = 9 AF_CCITT = 10 AF_SNA = 11 AF_DECnet = 12 AF_DLI = 13 AF_LAT = 14 AF_HYLINK = 15 AF_APPLETALK = 16 AF_NIT = 17 AF_802 = 18 AF_OSI = 19 AF_ISO = AF_OSI AF_X25 = 20 AF_OSINET = 21 AF_GOSIP = 22 AF_YNET = 23 AF_ROUTE = 24 AF_LINK = 25 pseudo_AF_XTP = 26 AF_INET6 = 27 AF_MAX = 27 AF_INET_BSWAP = 0x0200 PF_UNSPEC = AF_UNSPEC PF_UNIX = AF_UNIX PF_LOCAL = AF_LOCAL PF_INET = AF_INET PF_IMPLINK = AF_IMPLINK PF_PUP = AF_PUP PF_CHAOS = AF_CHAOS PF_NS = AF_NS PF_NBS = AF_NBS PF_ECMA = AF_ECMA PF_DATAKIT = AF_DATAKIT PF_CCITT = AF_CCITT PF_SNA = AF_SNA PF_DECnet = AF_DECnet PF_DLI = AF_DLI PF_LAT = AF_LAT PF_HYLINK = AF_HYLINK PF_APPLETALK = AF_APPLETALK PF_NIT = AF_NIT PF_802 = AF_802 PF_OSI = AF_OSI PF_ISO = PF_OSI PF_X25 = AF_X25 PF_OSINET = AF_OSINET PF_GOSIP = AF_GOSIP PF_YNET = AF_YNET PF_ROUTE = AF_ROUTE PF_LINK = AF_LINK pseudo_PF_XTP = pseudo_AF_XTP PF_INET6 = AF_INET6 PF_MAX = AF_MAX SOMAXCONN = 5 SCM_RIGHTS = 1 MSG_OOB = 0x1 MSG_PEEK = 0x2 MSG_DONTROUTE = 0x4 MSG_CTRUNC = 0x8 MSG_TRUNC = 0x10 MSG_EOR = 0x30 MSG_WAITALL = 0x20 MSG_MAXIOVLEN = 16 def OPTLEN(x): return ((((x) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) GIARG = 0x1 CONTI = 0x2 GITAB = 0x4 SOCKETSYS = 88 SOCKETSYS = 83 SO_ACCEPT = 1 SO_BIND = 2 SO_CONNECT = 3 SO_GETPEERNAME = 4 SO_GETSOCKNAME = 5 SO_GETSOCKOPT = 6 SO_LISTEN = 7 SO_RECV = 8 SO_RECVFROM = 9 SO_SEND = 10 SO_SENDTO = 11 SO_SETSOCKOPT = 12 SO_SHUTDOWN = 13 SO_SOCKET = 14 SO_SOCKPOLL = 15 SO_GETIPDOMAIN = 16 SO_SETIPDOMAIN = 17 SO_ADJTIME = 18 --- NEW FILE: STROPTS.py --- # Generated by h2py from /usr/include/sys/stropts.h # Included from sys/types.h def quad_low(x): return x.val[0] ADT_EMASKSIZE = 8 SHRT_MIN = -32768 SHRT_MAX = 32767 INT_MIN = (-2147483647-1) INT_MAX = 2147483647 LONG_MIN = (-2147483647-1) LONG_MAX = 2147483647 OFF32_MAX = LONG_MAX ISTAT_ASSERTED = 0 ISTAT_ASSUMED = 1 ISTAT_NONE = 2 OFF_MAX = OFF32_MAX CLOCK_MAX = LONG_MAX P_MYID = (-1) P_MYHOSTID = (-1) # Included from sys/select.h FD_SETSIZE = 4096 NBBY = 8 NULL = 0 # Included from sys/conf.h D_NEW = 0x00 D_OLD = 0x01 D_DMA = 0x02 D_BLKOFF = 0x400 D_LFS = 0x8000 D_STR = 0x0800 D_MOD = 0x1000 D_PSEUDO = 0x2000 D_RANDOM = 0x4000 D_HOT = 0x10000 D_SEEKNEG = 0x04 D_TAPE = 0x08 D_NOBRKUP = 0x10 D_INITPUB = 0x20 D_NOSPECMACDATA = 0x40 D_RDWEQ = 0x80 SECMASK = (D_INITPUB|D_NOSPECMACDATA|D_RDWEQ) DAF_REQDMA = 0x1 DAF_PHYSREQ = 0x2 DAF_PRE8 = 0x4 DAF_STATIC = 0x8 DAF_STR = 0x10 D_MP = 0x100 D_UPF = 0x200 ROOTFS_NAMESZ = 7 FMNAMESZ = 8 MCD_VERSION = 1 DI_BCBP = 0 DI_MEDIA = 1 # Included from sys/secsys.h ES_MACOPENLID = 1 ES_MACSYSLID = 2 ES_MACROOTLID = 3 ES_PRVINFO = 4 ES_PRVSETCNT = 5 ES_PRVSETS = 6 ES_MACADTLID = 7 ES_PRVID = 8 ES_TPGETMAJOR = 9 SA_EXEC = 001 SA_WRITE = 002 SA_READ = 004 SA_SUBSIZE = 010 # Included from sys/stropts_f.h X_STR = (ord('S')<<8) X_I_BASE = (X_STR|0200) X_I_NREAD = (X_STR|0201) X_I_PUSH = (X_STR|0202) X_I_POP = (X_STR|0203) X_I_LOOK = (X_STR|0204) X_I_FLUSH = (X_STR|0205) X_I_SRDOPT = (X_STR|0206) X_I_GRDOPT = (X_STR|0207) X_I_STR = (X_STR|0210) X_I_SETSIG = (X_STR|0211) X_I_GETSIG = (X_STR|0212) X_I_FIND = (X_STR|0213) X_I_LINK = (X_STR|0214) X_I_UNLINK = (X_STR|0215) X_I_PEEK = (X_STR|0217) X_I_FDINSERT = (X_STR|0220) X_I_SENDFD = (X_STR|0221) X_I_RECVFD = (X_STR|0222) # Included from unistd.h # Included from sys/unistd.h R_OK = 004 W_OK = 002 X_OK = 001 F_OK = 000 EFF_ONLY_OK = 010 EX_OK = 020 SEEK_SET = 0 SEEK_CUR = 1 SEEK_END = 2 _SC_ARG_MAX = 1 _SC_CHILD_MAX = 2 _SC_CLK_TCK = 3 _SC_NGROUPS_MAX = 4 _SC_OPEN_MAX = 5 _SC_JOB_CONTROL = 6 _SC_SAVED_IDS = 7 _SC_VERSION = 8 _SC_PASS_MAX = 9 _SC_LOGNAME_MAX = 10 _SC_PAGESIZE = 11 _SC_PAGE_SIZE = _SC_PAGESIZE _SC_XOPEN_VERSION = 12 _SC_NACLS_MAX = 13 _SC_NPROCESSORS_CONF = 14 _SC_NPROCESSORS_ONLN = 15 _SC_NPROCESSES = 39 _SC_TOTAL_MEMORY = 40 _SC_USEABLE_MEMORY = 41 _SC_GENERAL_MEMORY = 42 _SC_DEDICATED_MEMORY = 43 _SC_NCGS_CONF = 44 _SC_NCGS_ONLN = 45 _SC_MAX_CPUS_PER_CG = 46 _SC_CG_SIMPLE_IMPL = 47 _SC_CACHE_LINE = 48 _SC_SYSTEM_ID = 49 _SC_THREADS = 51 _SC_THREAD_ATTR_STACKADDR = 52 _SC_THREAD_ATTR_STACKSIZE = 53 _SC_THREAD_DESTRUCTOR_ITERATIONS = 54 _SC_THREAD_KEYS_MAX = 55 _SC_THREAD_PRIORITY_SCHEDULING = 56 _SC_THREAD_PRIO_INHERIT = 57 _SC_THREAD_PRIO_PROTECT = 58 _SC_THREAD_STACK_MIN = 59 _SC_THREAD_PROCESS_SHARED = 60 _SC_THREAD_SAFE_FUNCTIONS = 61 _SC_THREAD_THREADS_MAX = 62 _SC_KERNEL_VM = 63 _SC_TZNAME_MAX = 320 _SC_STREAM_MAX = 321 _SC_XOPEN_CRYPT = 323 _SC_XOPEN_ENH_I18N = 324 _SC_XOPEN_SHM = 325 _SC_XOPEN_XCU_VERSION = 327 _SC_AES_OS_VERSION = 330 _SC_ATEXIT_MAX = 331 _SC_2_C_BIND = 350 _SC_2_C_DEV = 351 _SC_2_C_VERSION = 352 _SC_2_CHAR_TERM = 353 _SC_2_FORT_DEV = 354 _SC_2_FORT_RUN = 355 _SC_2_LOCALEDEF = 356 _SC_2_SW_DEV = 357 _SC_2_UPE = 358 _SC_2_VERSION = 359 _SC_BC_BASE_MAX = 370 _SC_BC_DIM_MAX = 371 _SC_BC_SCALE_MAX = 372 _SC_BC_STRING_MAX = 373 _SC_COLL_WEIGHTS_MAX = 380 _SC_EXPR_NEST_MAX = 381 _SC_LINE_MAX = 382 _SC_RE_DUP_MAX = 383 _SC_IOV_MAX = 390 _SC_NPROC_CONF = 391 _SC_NPROC_ONLN = 392 _SC_XOPEN_UNIX = 400 _SC_SEMAPHORES = 440 _CS_PATH = 1 __O_CS_HOSTNAME = 2 _CS_RELEASE = 3 _CS_VERSION = 4 __O_CS_MACHINE = 5 __O_CS_ARCHITECTURE = 6 _CS_HW_SERIAL = 7 __O_CS_HW_PROVIDER = 8 _CS_SRPC_DOMAIN = 9 _CS_INITTAB_NAME = 10 __O_CS_SYSNAME = 11 _CS_LFS_CFLAGS = 20 _CS_LFS_LDFLAGS = 21 _CS_LFS_LIBS = 22 _CS_LFS_LINTFLAGS = 23 _CS_LFS64_CFLAGS = 24 _CS_LFS64_LDFLAGS = 25 _CS_LFS64_LIBS = 26 _CS_LFS64_LINTFLAGS = 27 _CS_ARCHITECTURE = 100 _CS_BUSTYPES = 101 _CS_HOSTNAME = 102 _CS_HW_PROVIDER = 103 _CS_KERNEL_STAMP = 104 _CS_MACHINE = 105 _CS_OS_BASE = 106 _CS_OS_PROVIDER = 107 _CS_SYSNAME = 108 _CS_USER_LIMIT = 109 _PC_LINK_MAX = 1 _PC_MAX_CANON = 2 _PC_MAX_INPUT = 3 _PC_NAME_MAX = 4 _PC_PATH_MAX = 5 _PC_PIPE_BUF = 6 _PC_NO_TRUNC = 7 _PC_VDISABLE = 8 _PC_CHOWN_RESTRICTED = 9 _PC_FILESIZEBITS = 10 _POSIX_VERSION = 199009L _XOPEN_VERSION = 4 GF_PATH = "/etc/group" PF_PATH = "/etc/passwd" F_ULOCK = 0 F_LOCK = 1 F_TLOCK = 2 F_TEST = 3 _POSIX_JOB_CONTROL = 1 _POSIX_SAVED_IDS = 1 _POSIX_VDISABLE = 0 NULL = 0 STDIN_FILENO = 0 STDOUT_FILENO = 1 STDERR_FILENO = 2 _XOPEN_UNIX = 1 _XOPEN_ENH_I18N = 1 _XOPEN_XPG4 = 1 _POSIX2_C_VERSION = 199209L _POSIX2_VERSION = 199209L _XOPEN_XCU_VERSION = 4 _POSIX_SEMAPHORES = 1 _POSIX_THREADS = 1 _POSIX_THREAD_ATTR_STACKADDR = 1 _POSIX_THREAD_ATTR_STACKSIZE = 1 _POSIX_THREAD_PRIORITY_SCHEDULING = 1 _POSIX_THREAD_PROCESS_SHARED = 1 _POSIX_THREAD_SAFE_FUNCTIONS = 1 _POSIX2_C_BIND = 1 _POSIX2_CHAR_TERM = 1 _POSIX2_FORT_RUN = 1 _POSIX2_LOCALEDEF = 1 _POSIX2_UPE = 1 _LFS_ASYNCHRONOUS_IO = 1 _LFS_LARGEFILE = 1 _LFS64_ASYNCHRONOUS_IO = 1 _LFS64_LARGEFILE = 1 _LFS64_STDIO = 1 FMNAMESZ = 8 SNDZERO = 0x001 SNDPIPE = 0x002 RNORM = 0x000 RMSGD = 0x001 RMSGN = 0x002 RMODEMASK = 0x003 RPROTDAT = 0x004 RPROTDIS = 0x008 RPROTNORM = 0x010 RPROTMASK = 0x01c FLUSHR = 0x01 FLUSHW = 0x02 FLUSHRW = 0x03 FLUSHBAND = 0x04 S_INPUT = 0x0001 S_HIPRI = 0x0002 S_OUTPUT = 0x0004 S_MSG = 0x0008 S_ERROR = 0x0010 S_HANGUP = 0x0020 S_RDNORM = 0x0040 S_WRNORM = S_OUTPUT S_RDBAND = 0x0080 S_WRBAND = 0x0100 S_BANDURG = 0x0200 RS_HIPRI = 0x01 MSG_HIPRI = 0x01 MSG_ANY = 0x02 MSG_BAND = 0x04 MSG_DISCARD = 0x08 MSG_PEEKIOCTL = 0x10 MORECTL = 1 MOREDATA = 2 MUXID_ALL = (-1) ANYMARK = 0x01 LASTMARK = 0x02 STR = (ord('S')<<8) I_NREAD = (STR|01) I_PUSH = (STR|02) I_POP = (STR|03) I_LOOK = (STR|04) I_FLUSH = (STR|05) I_SRDOPT = (STR|06) I_GRDOPT = (STR|07) I_STR = (STR|010) I_SETSIG = (STR|011) I_GETSIG = (STR|012) I_FIND = (STR|013) I_LINK = (STR|014) I_UNLINK = (STR|015) I_PEEK = (STR|017) I_FDINSERT = (STR|020) I_SENDFD = (STR|021) I_RECVFD = (STR|022) I_E_RECVFD = (STR|016) I_RECVFD = (STR|016) I_RECVFD = (STR|022) I_SWROPT = (STR|023) I_GWROPT = (STR|024) I_LIST = (STR|025) I_PLINK = (STR|026) I_PUNLINK = (STR|027) I_FLUSHBAND = (STR|034) I_CKBAND = (STR|035) I_GETBAND = (STR|036) I_ATMARK = (STR|037) I_SETCLTIME = (STR|040) I_GETCLTIME = (STR|041) I_CANPUT = (STR|042) I_S_RECVFD = (STR|043) I_STATS = (STR|044) I_BIGPIPE = (STR|045) I_GETTP = (STR|046) INFTIM = -1 --- NEW FILE: TERMIOS.py --- # Generated by h2py from /usr/include/termios.h # Included from sys/termios.h # Included from sys/types.h def quad_low(x): return x.val[0] ADT_EMASKSIZE = 8 SHRT_MIN = -32768 SHRT_MAX = 32767 INT_MIN = (-2147483647-1) INT_MAX = 2147483647 LONG_MIN = (-2147483647-1) LONG_MAX = 2147483647 OFF32_MAX = LONG_MAX ISTAT_ASSERTED = 0 ISTAT_ASSUMED = 1 ISTAT_NONE = 2 OFF_MAX = OFF32_MAX CLOCK_MAX = LONG_MAX P_MYID = (-1) P_MYHOSTID = (-1) # Included from sys/select.h FD_SETSIZE = 4096 NBBY = 8 NULL = 0 NCC = 8 NCCS = 19 VINTR = 0 VQUIT = 1 VERASE = 2 VKILL = 3 VEOF = 4 VEOL = 5 VEOL2 = 6 VMIN = 4 VTIME = 5 VSWTCH = 7 VSTART = 8 VSTOP = 9 VSUSP = 10 VDSUSP = 11 VREPRINT = 12 VDISCARD = 13 VWERASE = 14 VLNEXT = 15 VCEOF = NCC VCEOL = (NCC + 1) _POSIX_VDISABLE = 0 def CTRL(c): return ((c)&037) CINTR = ord('\177') CQUIT = CTRL(ord('\\')) CERASE = CTRL(ord('H')) CKILL = CTRL(ord('U')) CEOF = CTRL(ord('D')) CEOL = _POSIX_VDISABLE CEOL2 = _POSIX_VDISABLE CNSWTCH = _POSIX_VDISABLE CSTART = CTRL(ord('Q')) CSTOP = CTRL(ord('S')) CSUSP = CTRL(ord('Z')) CDSUSP = CTRL(ord('Y')) CREPRINT = CTRL(ord('R')) CDISCARD = CTRL(ord('O')) CWERASE = CTRL(ord('W')) CLNEXT = CTRL(ord('V')) CNUL = _POSIX_VDISABLE CBRK = ord('\377') CDEL = ord('\377') CESC = ord('\\') CEOT = CTRL(ord('D')) CSWTCH = CTRL(ord('Z')) CRPRNT = CREPRINT CFLUSH = CDISCARD IGNBRK = 0x00000001 BRKINT = 0x00000002 IGNPAR = 0x00000004 PARMRK = 0x00000008 INPCK = 0x00000010 ISTRIP = 0x00000020 INLCR = 0x00000040 IGNCR = 0x00000080 ICRNL = 0x00000100 IUCLC = 0x00000200 IXON = 0x00000400 IXANY = 0x00000800 IXOFF = 0x00001000 IMAXBEL = 0x00002000 DOSMODE = 0x00008000 OPOST = 0x00000001 OLCUC = 0x00000002 ONLCR = 0x00000004 OCRNL = 0x00000008 ONOCR = 0x00000010 ONLRET = 0x00000020 OFILL = 0x00000040 OFDEL = 0x00000080 NLDLY = 0x00000100 NL0 = 0 NL1 = 0x00000100 CRDLY = 0x00000600 CR0 = 0 CR1 = 0x00000200 CR2 = 0x00000400 CR3 = 0x00000600 TABDLY = 0x00001800 TAB0 = 0 TAB1 = 0x00000800 TAB2 = 0x00001000 TAB3 = 0x00001800 BSDLY = 0x00002000 BS0 = 0 BS1 = 0x00002000 VTDLY = 0x00004000 VT0 = 0 VT1 = 0x00004000 FFDLY = 0x00008000 FF0 = 0 FF1 = 0x00008000 XTABS = TAB3 PAGEOUT = 0x00010000 WRAP = 0x00020000 CBAUD = 0x0000000F CSIZE = 0x00000030 CS5 = 0 CS6 = 0x00000010 CS7 = 0x00000020 CS8 = 0x00000030 CSTOPB = 0x00000040 CREAD = 0x00000080 PARENB = 0x00000100 PARODD = 0x00000200 HUPCL = 0x00000400 CLOCAL = 0x00000800 RCV1EN = 0x00001000 XMT1EN = 0x00002000 LOBLK = 0x00004000 XCLUDE = 0x00008000 CIBAUD = 0x000F0000 IBSHIFT = 16 PAREXT = 0x00100000 B0 = 0 B50 = 1 B75 = 2 B110 = 3 B134 = 4 B150 = 5 B200 = 6 B300 = 7 B600 = 8 B1200 = 9 B1800 = 10 B2400 = 11 B4800 = 12 B9600 = 13 B19200 = 14 B38400 = 15 EXTA = B19200 EXTB = B38400 ISIG = 0x00000001 ICANON = 0x00000002 XCASE = 0x00000004 ECHO = 0x00000008 ECHOE = 0x00000010 ECHOK = 0x00000020 ECHONL = 0x00000040 NOFLSH = 0x00000080 TOSTOP = 0x00000100 ECHOCTL = 0x00000200 ECHOPRT = 0x00000400 ECHOKE = 0x00000800 DEFECHO = 0x00001000 FLUSHO = 0x00002000 PENDIN = 0x00004000 IEXTEN = 0x00008000 IOCTYPE = 0xff00 TIOC = (ord('T')<<8) TCGETA = (TIOC|1) TCSETA = (TIOC|2) TCSETAW = (TIOC|3) TCSETAF = (TIOC|4) TCSBRK = (TIOC|5) TCXONC = (TIOC|6) TCFLSH = (TIOC|7) TIOCKBON = (TIOC|8) TIOCKBOF = (TIOC|9) KBENABLED = (TIOC|10) KB_XSCANCODE = 4 KB_ISSCANCODE = 8 TCDSET = (TIOC|32) RTS_TOG = (TIOC|33) TIOCGWINSZ = (TIOC|104) TIOCSWINSZ = (TIOC|103) TCGETS = (TIOC|13) TCSETS = (TIOC|14) TCSANOW = ((ord('T')<<8)|14) TCSETSW = (TIOC|15) TCSADRAIN = ((ord('T')<<8)|15) TCSETSF = (TIOC|16) TCSAFLUSH = ((ord('T')<<8)|16) TCIFLUSH = 0 TCOFLUSH = 1 TCIOFLUSH = 2 TCOOFF = 0 TCOON = 1 TCIOFF = 2 TCION = 3 tIOC = (ord('t')<<8) TIOCGETD = (tIOC|0) TIOCSETD = (tIOC|1) TIOCHPCL = (tIOC|2) TIOCGETP = (tIOC|8) TIOCSETP = (tIOC|9) TIOCSETN = (tIOC|10) TIOCEXCL = (tIOC|13) TIOCNXCL = (tIOC|14) TIOCFLUSH = (tIOC|16) TIOCSETC = (tIOC|17) TIOCGETC = (tIOC|18) TIOCLBIS = (tIOC|127) TIOCLBIC = (tIOC|126) TIOCLSET = (tIOC|125) TIOCLGET = (tIOC|124) TIOCSBRK = (tIOC|123) TIOCCBRK = (tIOC|122) TIOCSDTR = (tIOC|121) TIOCCDTR = (tIOC|120) TIOCSLTC = (tIOC|117) TIOCGLTC = (tIOC|116) TIOCOUTQ = (tIOC|115) TIOCNOTTY = (tIOC|113) TIOCSTOP = (tIOC|111) TIOCSTART = (tIOC|110) TIOCGPGRP = (tIOC|20) TIOCSPGRP = (tIOC|21) TIOCGSID = (tIOC|22) TIOCSSID = (tIOC|24) TIOCSTI = (tIOC|23) TIOCMSET = (tIOC|26) TIOCMBIS = (tIOC|27) TIOCMBIC = (tIOC|28) TIOCMGET = (tIOC|29) TIOCM_LE = 0x0001 TIOCM_DTR = 0x0002 TIOCM_RTS = 0x0004 TIOCM_ST = 0x0008 TIOCM_SR = 0x0010 TIOCM_CTS = 0x0020 TIOCM_CAR = 0x0040 TIOCM_CD = TIOCM_CAR TIOCM_RNG = 0x0080 TIOCM_RI = TIOCM_RNG TIOCM_DSR = 0x0100 TIOCREMOTE = (tIOC|30) TIOCSIGNAL = (tIOC|31) LDIOC = (ord('D')<<8) LDOPEN = (LDIOC|0) LDCLOSE = (LDIOC|1) LDCHG = (LDIOC|2) LDGETT = (LDIOC|8) LDSETT = (LDIOC|9) LDSMAP = (LDIOC|10) LDGMAP = (LDIOC|11) LDNMAP = (LDIOC|12) DIOC = (ord('d')<<8) DIOCGETP = (DIOC|8) DIOCSETP = (DIOC|9) FIORDCHK = ((ord('f')<<8)|3) --- NEW FILE: regen --- #! /bin/sh case `uname -sr` in UnixWare*) ;; *) echo Probably not on a UnixWare system 1>&2 exit 1;; esac set -v h2py /usr/include/sys/fcntl.h h2py /usr/include/sys/socket.h h2py -i '(u_long)' /usr/include/netinet/in.h h2py /usr/include/termios.h h2py /usr/include/sys/stropts.h From gvanrossum@users.sourceforge.net Wed Apr 11 21:56:21 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 11 Apr 2001 13:56:21 -0700 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.33,1.34 config.h.in,2.90,2.91 configure,1.206,1.207 configure.in,1.214,1.215 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv11866 Modified Files: Makefile.pre.in config.h.in configure configure.in Log Message: Unixware 7 support by Billy G. Allie (SF patch 413011) Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** Makefile.pre.in 2001/04/10 23:03:35 1.33 --- Makefile.pre.in 2001/04/11 20:56:18 1.34 *************** *** 310,314 **** $(RANLIB) $@ ! # This rule is only here for DG/UX and BeOS!!! libpython$(VERSION).so: $(LIBRARY) case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \ --- 310,314 ---- $(RANLIB) $@ ! # This rule is only here for DG/UX, UnixWare, and BeOS!!! libpython$(VERSION).so: $(LIBRARY) case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \ *************** *** 317,320 **** --- 317,323 ---- (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \ /bin/rm -rf ./dgux \ + ;; \ + unixware*) \ + $(LDSHARED) -o $@ $(LIBRARY_OBJS) \ ;; \ beos) \ Index: config.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/config.h.in,v retrieving revision 2.90 retrieving revision 2.91 diff -C2 -r2.90 -r2.91 *** config.h.in 2001/03/20 13:09:13 2.90 --- config.h.in 2001/04/11 20:56:18 2.91 *************** *** 270,276 **** #undef SIZEOF_VOID_P - /* Define if you have the _getpty function. */ - #undef HAVE__GETPTY - /* Define if you have the alarm function. */ #undef HAVE_ALARM --- 270,273 ---- *************** *** 360,363 **** --- 357,363 ---- #undef HAVE_GETPID + /* Define if you have the _getpty function. */ + #undef HAVE__GETPTY + /* Define if you have the getpwent function. */ #undef HAVE_GETPWENT *************** *** 519,530 **** #undef HAVE_WAITPID ! /* Define if you have the header file. */ ! #undef HAVE_DB_H /* Define if you have the header file. */ #undef HAVE_DB1_NDBM_H ! /* Define if you have the header file. */ ! #undef HAVE_DB_185_H /* Define if you have the header file. */ --- 519,530 ---- #undef HAVE_WAITPID ! /* Define if you have the header file. */ ! #undef HAVE_DB_185_H /* Define if you have the header file. */ #undef HAVE_DB1_NDBM_H ! /* Define if you have the header file. */ ! #undef HAVE_DB_H /* Define if you have the header file. */ Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.206 retrieving revision 1.207 diff -C2 -r1.206 -r1.207 *** configure 2001/03/31 00:01:55 1.206 --- configure 2001/04/11 20:56:18 1.207 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.213 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.215 [...4569 lines suppressed...] if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < *************** *** 6188,6192 **** SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:6191: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then --- 6223,6227 ---- SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:6226: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.214 retrieving revision 1.215 diff -C2 -r1.214 -r1.215 *** configure.in 2001/03/31 00:01:55 1.214 --- configure.in 2001/04/11 20:56:19 1.215 *************** *** 53,57 **** then ac_sys_system=`uname -s` ! if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then ac_sys_release=`uname -v` else --- 53,59 ---- then ac_sys_system=`uname -s` ! if test "$ac_sys_system" = "AIX" -o \ ! "$ac_sys_system" = "Monterey64" -o \ ! "$ac_sys_system" = "UnixWare"; then ac_sys_release=`uname -v` else *************** *** 126,131 **** Monterey*) RANLIB=: ! without_gcc=;; ! *) without_gcc=no;; esac]) AC_MSG_RESULT($without_gcc) --- 128,140 ---- Monterey*) RANLIB=: ! without_gcc= ! ;; ! UnixWare*) ! RANLIB=: ! without_gcc= ! ;; ! *) ! without_gcc=no ! ;; esac]) AC_MSG_RESULT($without_gcc) *************** *** 265,268 **** --- 274,280 ---- DLLLIBRARY='libpython$(VERSION).dll' ;; + unixware*) + LDLIBRARY='libpython$(VERSION).so' + ;; esac AC_MSG_RESULT($LDLIBRARY) *************** *** 299,308 **** yes) case $ac_cv_prog_cc_g in ! yes) OPT="-g -O2 -Wall -Wstrict-prototypes";; ! *) OPT="-O2 -Wall -Wstrict-prototypes";; esac ;; ! *) OPT="-O";; esac fi --- 311,328 ---- yes) case $ac_cv_prog_cc_g in ! yes) ! OPT="-g -O2 -Wall -Wstrict-prototypes";; ! *) ! OPT="-O2 -Wall -Wstrict-prototypes";; esac ;; ! *) ! case $ac_sys_system in ! UnixWare*) ! OPT="-O -K pentium,host,inline,loop_unroll,alloca ";; ! *) ! OPT="-O";; esac + esac fi *************** *** 598,602 **** if test "$GCC" = "yes" then LDSHARED="$(CC) -shared" ! else LDSHARED="$(CC) -G" fi;; SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; --- 618,622 ---- if test "$GCC" = "yes" then LDSHARED="$(CC) -shared" ! else LDSHARED="ld -G -dy -Bdynamic" fi;; SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; *************** *** 628,632 **** if test "$GCC" = "yes" then CCSHARED="-fPIC" ! else CCSHARED="-KPIC" fi;; SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; --- 648,652 ---- if test "$GCC" = "yes" then CCSHARED="-fPIC" ! else CCSHARED="-KPIC -G -dy -Bdynamic" fi;; SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; *************** *** 659,663 **** next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;; Darwin/*) LINKFORSHARED="-u __dummy -framework System -framework Foundation" ;; ! UnixWare*) LINKFORSHARED="-Wl,-Bexport";; SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";; ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";; --- 679,683 ---- next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;; Darwin/*) LINKFORSHARED="-u __dummy -framework System -framework Foundation" ;; ! UnixWare*) LINKFORSHARED="-dy -Bdynamic -Wl,-Bexport";; SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";; ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";; *************** *** 794,868 **** USE_THREAD_MODULE="#" else ! if test ! -z "$with_threads" -a -d "$with_threads" ! then LDFLAGS="$LDFLAGS -L$with_threads" ! fi ! if test ! -z "$withval" -a -d "$withval" ! then LDFLAGS="$LDFLAGS -L$withval" ! fi ! AC_DEFINE(_REENTRANT) ! AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(C_THREADS) ! LIBOBJS="$LIBOBJS thread.o"],[ ! AC_MSG_CHECKING(for --with-pth) ! AC_ARG_WITH(pth, ! [ --with-pth use GNU pth threading libraries], [ ! AC_MSG_RESULT($withval) ! AC_DEFINE(WITH_THREAD) ! AC_DEFINE(HAVE_PTH) ! LIBS="-lpth $LIBS" ! LIBOBJS="$LIBOBJS thread.o"],[ ! AC_MSG_RESULT(no) ! AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="-lpthread $LIBS" ! LIBOBJS="$LIBOBJS thread.o"],[ ! AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) ! case $ac_sys_system in ! Darwin*) ;; ! *) AC_DEFINE(_POSIX_THREADS);; ! esac ! LIBOBJS="$LIBOBJS thread.o"],[ ! AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(BEOS_THREADS) ! LIBOBJS="$LIBOBJS thread.o"],[ ! AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="$LIBS -lpthreads" ! LIBOBJS="$LIBOBJS thread.o"], [ ! AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="$LIBS -lc_r" ! LIBOBJS="$LIBOBJS thread.o"], [ ! AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS thread.o"], [ ! AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="$LIBS -lpthread" ! LIBOBJS="$LIBOBJS thread.o"], [ ! AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="$LIBS -lcma" ! LIBOBJS="$LIBOBJS thread.o"],[ ! USE_THREAD_MODULE="#"]) ! ])])])])])])])])]) ! ! AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) ! LIBS="$LIBS -lmpc" ! LIBOBJS="$LIBOBJS thread.o" ! USE_THREAD_MODULE=""]) ! AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) ! LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS thread.o" ! USE_THREAD_MODULE=""]) ! ! if test "$USE_THREAD_MODULE" != "#" ! then ! # If the above checks didn't disable threads, (at least) OSF1 ! # needs this '-threads' argument during linking. ! case $ac_sys_system in ! OSF1) LDLAST=-threads;; ! esac fi fi --- 814,897 ---- USE_THREAD_MODULE="#" else ! if test "$ac_sys_system" = "UnixWare" ! then ! CC="${CC} -Kthread" ! LIBOBJS="$LIBOBJS thread.o" ! AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! USE_THREAD_MODULE="" ! else ! if test ! -z "$with_threads" -a -d "$with_threads" ! then LDFLAGS="$LDFLAGS -L$with_threads" ! fi ! if test ! -z "$withval" -a -d "$withval" ! then LDFLAGS="$LDFLAGS -L$withval" ! fi ! AC_DEFINE(_REENTRANT) ! AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(C_THREADS) ! LIBOBJS="$LIBOBJS thread.o"],[ ! AC_MSG_CHECKING(for --with-pth) ! AC_ARG_WITH(pth, ! [ --with-pth use GNU pth threading libraries], [ ! AC_MSG_RESULT($withval) ! AC_DEFINE(WITH_THREAD) ! AC_DEFINE(HAVE_PTH) ! LIBS="-lpth $LIBS" ! LIBOBJS="$LIBOBJS thread.o"],[ ! AC_MSG_RESULT(no) ! AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="-lpthread $LIBS" ! LIBOBJS="$LIBOBJS thread.o"],[ ! AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) ! case $ac_sys_system in ! Darwin*) ;; ! *) AC_DEFINE(_POSIX_THREADS);; ! esac ! LIBOBJS="$LIBOBJS thread.o"],[ ! AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(BEOS_THREADS) ! LIBOBJS="$LIBOBJS thread.o"],[ ! AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="$LIBS -lpthreads" ! LIBOBJS="$LIBOBJS thread.o"], [ ! AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="$LIBS -lc_r" ! LIBOBJS="$LIBOBJS thread.o"], [ ! AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS thread.o"], [ ! AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="$LIBS -lpthread" ! LIBOBJS="$LIBOBJS thread.o"], [ ! AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(_POSIX_THREADS) ! LIBS="$LIBS -lcma" ! LIBOBJS="$LIBOBJS thread.o"],[ ! USE_THREAD_MODULE="#"]) ! ])])])])])])])])]) ! ! AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) ! LIBS="$LIBS -lmpc" ! LIBOBJS="$LIBOBJS thread.o" ! USE_THREAD_MODULE=""]) ! AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) ! LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS thread.o" ! USE_THREAD_MODULE=""]) ! ! if test "$USE_THREAD_MODULE" != "#" ! then ! # If the above checks didn't disable threads, (at least) OSF1 ! # needs this '-threads' argument during linking. ! case $ac_sys_system in ! OSF1) LDLAST=-threads;; ! esac ! fi fi fi From gvanrossum@users.sourceforge.net Wed Apr 11 21:57:59 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 11 Apr 2001 13:57:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.185,2.186 termios.c,2.23,2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12257 Modified Files: posixmodule.c termios.c Log Message: Unixware 7 support by Billy G. Allie (SF patch 413011) Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.185 retrieving revision 2.186 diff -C2 -r2.185 -r2.186 *** posixmodule.c 2001/02/27 17:04:34 2.185 --- posixmodule.c 2001/04/11 20:57:57 2.186 *************** *** 90,93 **** --- 90,96 ---- #define HAVE_EXECV 1 #define HAVE_FORK 1 + #if defined(__USLC__) && defined(__SCO_VERSION__) /* SCO UDK Compiler */ + #define HAVE_FORK1 1 + #endif #define HAVE_GETCWD 1 #define HAVE_GETEGID 1 *************** *** 1655,1658 **** --- 1658,1685 ---- + #ifdef HAVE_FORK1 + static char posix_fork1__doc__[] = + "fork1() -> pid\n\ + Fork a child process with a single multiplexed (i.e., not bound) thread.\n\ + \n\ + Return 0 to child process and PID of child to parent process."; + + static PyObject * + posix_fork1(self, args) + PyObject *self; + PyObject *args; + { + int pid; + if (!PyArg_ParseTuple(args, ":fork1")) + return NULL; + pid = fork1(); + if (pid == -1) + return posix_error(); + PyOS_AfterFork(); + return PyInt_FromLong((long)pid); + } + #endif + + #ifdef HAVE_FORK static char posix_fork__doc__[] = *************** *** 5262,5265 **** --- 5289,5295 ---- {"spawnve", posix_spawnve, METH_VARARGS, posix_spawnve__doc__}, #endif /* HAVE_SPAWNV */ + #ifdef HAVE_FORK1 + {"fork1", posix_fork1, METH_VARARGS, posix_fork1__doc__}, + #endif /* HAVE_FORK1 */ #ifdef HAVE_FORK {"fork", posix_fork, METH_VARARGS, posix_fork__doc__}, Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -r2.23 -r2.24 *** termios.c 2001/04/09 19:32:52 2.23 --- termios.c 2001/04/11 20:57:57 2.24 *************** *** 325,330 **** --- 325,334 ---- {"B19200", B19200}, {"B38400", B38400}, + #ifdef B57600 {"B57600", B57600}, + #endif + #ifdef B115200 {"B115200", B115200}, + #endif #ifdef B230400 {"B230400", B230400}, From gvanrossum@users.sourceforge.net Wed Apr 11 21:58:22 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 11 Apr 2001 13:58:22 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_math.py,1.10,1.11 test_fork1.py,1.8,1.9 test_fcntl.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12386 Modified Files: test_math.py test_fork1.py test_fcntl.py Log Message: Unixware 7 support by Billy G. Allie (SF patch 413011) Index: test_math.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_math.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** test_math.py 2000/12/12 23:11:42 1.10 --- test_math.py 2001/04/11 20:58:20 1.11 *************** *** 2,5 **** --- 2,6 ---- # XXXX Should not do tests around zero only + import sys from test_support import * *************** *** 36,40 **** testit('atan2(-1, 0)', math.atan2(-1, 0), -math.pi/2) testit('atan2(-1, 1)', math.atan2(-1, 1), -math.pi/4) ! testit('atan2(0, 1)', math.atan2(0, 1), 0) testit('atan2(1, 1)', math.atan2(1, 1), math.pi/4) testit('atan2(1, 0)', math.atan2(1, 0), math.pi/2) --- 37,44 ---- testit('atan2(-1, 0)', math.atan2(-1, 0), -math.pi/2) testit('atan2(-1, 1)', math.atan2(-1, 1), -math.pi/4) ! if sys.platform in ['unixware7']: ! testit('atan2(0, 1)', math.atan2(0, 1), math.pi) ! else: ! testit('atan2(0, 1)', math.atan2(0, 1), 0) testit('atan2(1, 1)', math.atan2(1, 1), math.pi/4) testit('atan2(1, 0)', math.atan2(1, 0), math.pi/2) Index: test_fork1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fork1.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** test_fork1.py 2001/01/30 18:35:32 1.8 --- test_fork1.py 2001/04/11 20:58:20 1.9 *************** *** 49,53 **** prefork_lives = alive.copy() ! cpid = os.fork() if cpid == 0: --- 49,56 ---- prefork_lives = alive.copy() ! if sys.platform in ['unixware7']: ! cpid = os.fork1() ! else: ! cpid = os.fork() if cpid == 0: Index: test_fcntl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fcntl.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** test_fcntl.py 2001/03/28 01:14:56 1.16 --- test_fcntl.py 2001/04/11 20:58:20 1.17 *************** *** 22,26 **** 'openbsd', 'openbsd2'): lockdata = struct.pack('lxxxxlxxxxlhh', 0, 0, 0, FCNTL.F_WRLCK, 0) ! elif sys.platform in ['aix3', 'aix4', 'hp-uxB']: lockdata = struct.pack('hhlllii', FCNTL.F_WRLCK, 0, 0, 0, 0, 0, 0) else: --- 22,26 ---- 'openbsd', 'openbsd2'): lockdata = struct.pack('lxxxxlxxxxlhh', 0, 0, 0, FCNTL.F_WRLCK, 0) ! elif sys.platform in ['aix3', 'aix4', 'hp-uxB', 'unixware7']: lockdata = struct.pack('hhlllii', FCNTL.F_WRLCK, 0, 0, 0, 0, 0, 0) else: From gvanrossum@users.sourceforge.net Wed Apr 11 22:03:34 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 11 Apr 2001 14:03:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.141,1.142 ACKS,1.91,1.92 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13556 Modified Files: NEWS ACKS Log Message: Noted the improved RISCOS port and the new Unixware 7 port. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -r1.141 -r1.142 *** NEWS 2001/04/11 20:37:57 1.141 --- NEWS 2001/04/11 21:03:31 1.142 *************** *** 8,11 **** --- 8,15 ---- source file and line will be tracked by an arrow. + - New port: SCO Unixware 7, by Billy G. Allie. + + - Updated the RISCOS port. + What's New in Python 2.1 beta 2? Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -r1.91 -r1.92 *** ACKS 2001/04/10 22:22:52 1.91 --- ACKS 2001/04/11 21:03:32 1.92 *************** *** 13,16 **** --- 13,17 ---- Jim Ahlstrom Jyrki Alakuijala + Billy G. Allie Mark Anacker Anders Andersen From fdrake@users.sourceforge.net Wed Apr 11 22:33:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 11 Apr 2001 14:33:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libfcntl.tex,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv19132/lib Modified Files: libfcntl.tex Log Message: Fixed bug in example. This closes SF bug #415522. Also fix markup error in text following the example. Index: libfcntl.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfcntl.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** libfcntl.tex 2001/01/25 00:36:54 1.24 --- libfcntl.tex 2001/04/11 21:33:47 1.25 *************** *** 107,111 **** file = open(...) ! rv = fcntl(file.fileno(), FCNTL.O_NDELAY, 1) lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0) --- 107,111 ---- file = open(...) ! rv = fcntl(file.fileno(), FCNTL.F_SETFL, FCNTL.O_NDELAY) lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0) *************** *** 113,117 **** \end{verbatim} ! Note that in the first example the return value variable \code{rv} will hold an integer value; in the second example it will hold a string value. The structure lay-out for the \var{lockdata} variable is --- 113,117 ---- \end{verbatim} ! Note that in the first example the return value variable \var{rv} will hold an integer value; in the second example it will hold a string value. The structure lay-out for the \var{lockdata} variable is From bwarsaw@users.sourceforge.net Wed Apr 11 23:27:43 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 11 Apr 2001 15:27:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc python-mode.el,4.0,4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv27678 Modified Files: python-mode.el Log Message: (py-pdbtrack-track-stack-file): On Ken's suggestion, add "pdbtrack:" prefix to the message lines. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.0 retrieving revision 4.1 diff -C2 -r4.0 -r4.1 *** python-mode.el 2001/04/11 20:23:24 4.0 --- python-mode.el 2001/04/11 22:27:41 4.1 *************** *** 1149,1158 **** (find-file-other-window fname) (goto-line (string-to-int lineno)) ! (message "L%s %s" lineno fname) (py-pdbtrack-overlay-arrow t) (pop-to-buffer origbuf t) ) (if (= (elt fname 0) ?\<) ! (message "(Non-file source: '%s')" fname) ! (message "Not found: %s" fname)) ))))))) --- 1149,1158 ---- (find-file-other-window fname) (goto-line (string-to-int lineno)) ! (message "pdbtrack: line %s, file %s" lineno fname) (py-pdbtrack-overlay-arrow t) (pop-to-buffer origbuf t) ) (if (= (elt fname 0) ?\<) ! (message "pdbtrack: (Non-file source: '%s')" fname) ! (message "pdbtrack: File not found: %s" fname)) ))))))) From gvanrossum@users.sourceforge.net Thu Apr 12 00:43:11 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 11 Apr 2001 16:43:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-unixware7 regen,1.1,1.2 SOCKET.py,1.1,NONE TERMIOS.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-unixware7 In directory usw-pr-cvs1:/tmp/cvs-serv7864 Modified Files: regen Removed Files: SOCKET.py TERMIOS.py Log Message: SOCKET.py and TERMIOS.py are no longer used in this release. Index: regen =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-unixware7/regen,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** regen 2001/04/11 20:54:43 1.1 --- regen 2001/04/11 23:43:09 1.2 *************** *** 7,12 **** set -v h2py /usr/include/sys/fcntl.h - h2py /usr/include/sys/socket.h h2py -i '(u_long)' /usr/include/netinet/in.h - h2py /usr/include/termios.h h2py /usr/include/sys/stropts.h --- 7,10 ---- --- SOCKET.py DELETED --- --- TERMIOS.py DELETED --- From tim_one@users.sourceforge.net Thu Apr 12 01:24:43 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 11 Apr 2001 17:24:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_math.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14753 Modified Files: test_math.py Log Message: Reverting the "unixware7" patch: atan2(0, 1) should be 0, regardless of platform. If it returns pi on the unixware7 platform, they have a bug in their libm atan2. Index: test_math.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_math.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** test_math.py 2001/04/11 20:58:20 1.11 --- test_math.py 2001/04/12 00:24:41 1.12 *************** *** 2,6 **** # XXXX Should not do tests around zero only - import sys from test_support import * --- 2,5 ---- *************** *** 37,44 **** testit('atan2(-1, 0)', math.atan2(-1, 0), -math.pi/2) testit('atan2(-1, 1)', math.atan2(-1, 1), -math.pi/4) ! if sys.platform in ['unixware7']: ! testit('atan2(0, 1)', math.atan2(0, 1), math.pi) ! else: ! testit('atan2(0, 1)', math.atan2(0, 1), 0) testit('atan2(1, 1)', math.atan2(1, 1), math.pi/4) testit('atan2(1, 0)', math.atan2(1, 0), math.pi/2) --- 36,40 ---- testit('atan2(-1, 0)', math.atan2(-1, 0), -math.pi/2) testit('atan2(-1, 1)', math.atan2(-1, 1), -math.pi/4) ! testit('atan2(0, 1)', math.atan2(0, 1), 0) testit('atan2(1, 1)', math.atan2(1, 1), math.pi/4) testit('atan2(1, 0)', math.atan2(1, 0), math.pi/2) From tim_one@users.sourceforge.net Thu Apr 12 01:35:53 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 11 Apr 2001 17:35:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_format.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16212/python/dist/src/Lib/test Modified Files: test_format.py Log Message: Fix for SF bug #415514: "%#x" % 0 caused assertion failure/abort. http://sourceforge.net/tracker/index.php?func=detail&aid=415514&group_id=5470&atid=105470 For short ints, Python defers to the platform C library to figure out what %#x should do. The code asserted that the platform C returned a string beginning with "0x". However, that's not true when-- and only when --the *value* being formatted is 0. Changed the code to live with C's inconsistency here. In the meantime, the problem does not arise if you format a long 0 (0L) instead. However, that's because the code *we* wrote to do %#x conversions on longs produces a leading "0x" regardless of value. That's probably wrong too: we should drop leading "0x", for consistency with C, when (& only when) formatting 0L. So I changed the long formatting code to do that too. Index: test_format.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_format.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** test_format.py 2001/02/09 11:46:37 1.9 --- test_format.py 2001/04/12 00:35:50 1.10 *************** *** 165,168 **** --- 165,184 ---- testboth("%d", 42L, "42") testboth("%d", -42L, "-42") + testboth("%#x", 1, "0x1") + testboth("%#x", 1L, "0x1") + testboth("%#X", 1, "0X1") + testboth("%#X", 1L, "0X1") + testboth("%#o", 1, "01") + testboth("%#o", 1L, "01") + testboth("%#o", 0, "0") + testboth("%#o", 0L, "0") + testboth("%o", 0, "0") + testboth("%o", 0L, "0") + testboth("%d", 0, "0") + testboth("%d", 0L, "0") + testboth("%#x", 0, "0") + testboth("%#x", 0L, "0") + testboth("%#X", 0, "0") + testboth("%#X", 0L, "0") testboth("%x", 0x42, "42") From tim_one@users.sourceforge.net Thu Apr 12 01:35:53 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 11 Apr 2001 17:35:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.100,2.101 unicodeobject.c,2.80,2.81 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16212/python/dist/src/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Fix for SF bug #415514: "%#x" % 0 caused assertion failure/abort. http://sourceforge.net/tracker/index.php?func=detail&aid=415514&group_id=5470&atid=105470 For short ints, Python defers to the platform C library to figure out what %#x should do. The code asserted that the platform C returned a string beginning with "0x". However, that's not true when-- and only when --the *value* being formatted is 0. Changed the code to live with C's inconsistency here. In the meantime, the problem does not arise if you format a long 0 (0L) instead. However, that's because the code *we* wrote to do %#x conversions on longs produces a leading "0x" regardless of value. That's probably wrong too: we should drop leading "0x", for consistency with C, when (& only when) formatting 0L. So I changed the long formatting code to do that too. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.100 retrieving revision 2.101 diff -C2 -r2.100 -r2.101 *** stringobject.c 2001/02/23 16:40:26 2.100 --- stringobject.c 2001/04/12 00:35:51 2.101 *************** *** 2576,2581 **** assert(numdigits > 0); ! /* Get rid of base marker unless F_ALT */ ! if ((flags & F_ALT) == 0) { /* Need to skip 0x, 0X or 0. */ int skipped = 0; --- 2576,2589 ---- assert(numdigits > 0); ! /* Get rid of base marker unless F_ALT. Even if F_ALT, leading 0x ! * must be stripped if the *value* is 0. ! */ ! if ((flags & F_ALT) == 0 || ! ((flags & F_ALT) && ! (type == 'x' || type == 'X') && ! numdigits == 1 && ! !sign && ! buf[2] == '0' ! )) { /* Need to skip 0x, 0X or 0. */ int skipped = 0; *************** *** 3016,3030 **** } if ((flags & F_ALT) && (c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); ! assert(pbuf[1] == c); ! if (fill != ' ') { ! *res++ = *pbuf++; ! *res++ = *pbuf++; ! } ! rescnt -= 2; ! width -= 2; ! if (width < 0) ! width = 0; ! len -= 2; } if (width > len && !(flags & F_LJUST)) { --- 3024,3042 ---- } if ((flags & F_ALT) && (c == 'x' || c == 'X')) { + /* There's a base marker ("0x" or "0X") if and + * only if the value is non-zero. + */ assert(pbuf[0] == '0'); ! if (pbuf[1] == c) { ! if (fill != ' ') { ! *res++ = *pbuf++; ! *res++ = *pbuf++; ! } ! rescnt -= 2; ! width -= 2; ! if (width < 0) ! width = 0; ! len -= 2; ! } } if (width > len && !(flags & F_LJUST)) { *************** *** 3038,3044 **** *res++ = sign; if ((flags & F_ALT) && ! (c == 'x' || c == 'X')) { ! assert(pbuf[0] == '0'); ! assert(pbuf[1] == c); *res++ = *pbuf++; *res++ = *pbuf++; --- 3050,3055 ---- *res++ = sign; if ((flags & F_ALT) && ! (c == 'x' || c == 'X') && ! pbuf[1] == c) { *res++ = *pbuf++; *res++ = *pbuf++; Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.80 retrieving revision 2.81 diff -C2 -r2.80 -r2.81 *** unicodeobject.c 2001/02/18 22:13:49 2.80 --- unicodeobject.c 2001/04/12 00:35:51 2.81 *************** *** 5082,5095 **** if ((flags & F_ALT) && (c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); ! assert(pbuf[1] == c); ! if (fill != ' ') { ! *res++ = *pbuf++; ! *res++ = *pbuf++; } - rescnt -= 2; - width -= 2; - if (width < 0) - width = 0; - len -= 2; } if (width > len && !(flags & F_LJUST)) { --- 5082,5096 ---- if ((flags & F_ALT) && (c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); ! if (pbuf[1] == c) { ! if (fill != ' ') { ! *res++ = *pbuf++; ! *res++ = *pbuf++; ! } ! rescnt -= 2; ! width -= 2; ! if (width < 0) ! width = 0; ! len -= 2; } } if (width > len && !(flags & F_LJUST)) { *************** *** 5102,5108 **** if (sign) *res++ = sign; ! if ((flags & F_ALT) && (c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); - assert(pbuf[1] == c); *res++ = *pbuf++; *res++ = *pbuf++; --- 5103,5109 ---- if (sign) *res++ = sign; ! if ((flags & F_ALT) && (c == 'x' || c == 'X') && ! pbuf[1] == c) { assert(pbuf[0] == '0'); *res++ = *pbuf++; *res++ = *pbuf++; From gvanrossum@users.sourceforge.net Thu Apr 12 03:31:29 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 11 Apr 2001 19:31:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.142,1.143 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv31319 Modified Files: NEWS Log Message: Note that __debug__ assignments are legal again. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -r1.142 -r1.143 *** NEWS 2001/04/11 21:03:31 1.142 --- NEWS 2001/04/12 02:31:27 1.143 *************** *** 8,11 **** --- 8,14 ---- source file and line will be tracked by an arrow. + - After a public outcry, assignment to __debug__ is no longer illegal; + instead, a warning is issued. It will become illegal in 2.2. + - New port: SCO Unixware 7, by Billy G. Allie. From tim_one@users.sourceforge.net Thu Apr 12 05:01:41 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 11 Apr 2001 21:01:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.8,1.9 python20.wse,1.36,1.37 pythoncore.dsp,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv13357/python/dist/src/PCbuild Modified Files: BUILDno.txt python20.wse pythoncore.dsp Log Message: Update Windows build # and installer for 2.1c1. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** BUILDno.txt 2001/03/21 06:09:14 1.8 --- BUILDno.txt 2001/04/12 04:01:39 1.9 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 13 2.1c1 + 12-Apr-2001 12 2.1b2 20-Mar-2001 Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** python20.wse 2001/03/23 20:21:29 1.36 --- python20.wse 2001/04/12 04:01:39 1.37 *************** *** 2,6 **** item: Global Version=5.0 ! Title=Python 2.1 beta 2 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=5.0 ! Title=Python 2.1 release candidate 1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 67,71 **** item: Set Variable Variable=APPTITLE ! Value=Python 2.1 beta 2 end item: Set Variable --- 67,71 ---- item: Set Variable Variable=APPTITLE ! Value=Python 2.1 release candidate 1 end item: Set Variable *************** *** 633,640 **** item: Remark Text=Where system DLLs are installed (choose one of the following): - end - remarked item: Set Variable - Variable=DLLDEST - Value=%MAINDIR% end item: Set Variable --- 633,636 ---- Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** pythoncore.dsp 2001/03/21 06:09:14 1.10 --- pythoncore.dsp 2001/04/12 04:01:39 1.11 *************** *** 740,748 **** !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=12 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=12 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" --- 740,748 ---- !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=13 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=13 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" From fdrake@users.sourceforge.net Thu Apr 12 05:03:24 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 11 Apr 2001 21:03:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.97,1.98 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv13623 Modified Files: python.perl Log Message: When forming the tag for a \seepep or \seerfc, make sure we strip HTML markup from the string used as the title in the TITLE attribute. This fixes formatting in the "What's New in Python 2.1" document. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -r1.97 -r1.98 *** python.perl 2001/04/10 17:13:39 1.97 --- python.perl 2001/04/12 04:03:22 1.98 *************** *** 1498,1501 **** --- 1498,1509 ---- } + sub strip_html_markup($){ + my $str = @_[0]; + my $s = "$str"; + $s =~ s/<[a-zA-Z0-9]+(\s+[a-zA-Z0-9]+(\s*=\s*(\'[^\']*\'|\"[^\"]*\"|[a-zA-Z0-9]+))?)*\s*>//g; + $s =~ s/<\/[a-zA-Z0-9]+>//g; + return $s; + } + sub handle_rfclike_reference{ local($_, $what, $format) = @_; *************** *** 1505,1511 **** my $url = get_rfc_url($rfcnum, $format); my $icon = get_link_icon($url); return '
' . "\n
$what $rfcnum, $title$icon" . "\n
$text\n
" --- 1513,1520 ---- my $url = get_rfc_url($rfcnum, $format); my $icon = get_link_icon($url); + my $attrtitle = strip_html_markup($title); return '
' . "\n
$what $rfcnum, $title$icon" . "\n
$text\n
" From gvanrossum@users.sourceforge.net Thu Apr 12 05:11:53 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 11 Apr 2001 21:11:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include patchlevel.h,2.46,2.47 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv15200 Modified Files: patchlevel.h Log Message: Prepare for release candidate 1... aka 2.1c1. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.46 retrieving revision 2.47 diff -C2 -r2.46 -r2.47 *** patchlevel.h 2001/03/20 19:57:10 2.46 --- patchlevel.h 2001/04/12 04:11:51 2.47 *************** *** 23,34 **** #define PY_MINOR_VERSION 1 #define PY_MICRO_VERSION 0 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_BETA #define PY_RELEASE_SERIAL 2 /* Version as a string */ ! #define PY_VERSION "2.1b2" /* Historic */ ! #define PATCHLEVEL "2.1b2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 23,34 ---- #define PY_MINOR_VERSION 1 #define PY_MICRO_VERSION 0 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA #define PY_RELEASE_SERIAL 2 /* Version as a string */ ! #define PY_VERSION "2.1c1" /* Historic */ ! #define PATCHLEVEL "2.1c1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From fdrake@users.sourceforge.net Thu Apr 12 05:26:26 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 11 Apr 2001 21:26:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.132,1.133 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv17994/tut Modified Files: tut.tex Log Message: Update to reflect the new string repr -- \n instead of \012. This is the only documentation file that appears to be affected by the change! Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -r1.132 -r1.133 *** tut.tex 2001/04/11 04:38:34 1.132 --- tut.tex 2001/04/12 04:26:24 1.133 *************** *** 2623,2627 **** >>> hellos = `hello` >>> print hellos ! 'hello, world\012' >>> # The argument of reverse quotes may be a tuple: ... `x, y, ('spam', 'eggs')` --- 2623,2627 ---- >>> hellos = `hello` >>> print hellos ! 'hello, world\n' >>> # The argument of reverse quotes may be a tuple: ... `x, y, ('spam', 'eggs')` *************** *** 2784,2788 **** \begin{verbatim} >>> f.read() ! 'This is the entire file.\012' >>> f.read() '' --- 2784,2788 ---- \begin{verbatim} >>> f.read() ! 'This is the entire file.\n' >>> f.read() '' *************** *** 2799,2805 **** \begin{verbatim} >>> f.readline() ! 'This is the first line of the file.\012' >>> f.readline() ! 'Second line of the file\012' >>> f.readline() '' --- 2799,2805 ---- \begin{verbatim} >>> f.readline() ! 'This is the first line of the file.\n' >>> f.readline() ! 'Second line of the file\n' >>> f.readline() '' *************** *** 2815,2819 **** \begin{verbatim} >>> f.readlines() ! ['This is the first line of the file.\012', 'Second line of the file\012'] \end{verbatim} --- 2815,2819 ---- \begin{verbatim} >>> f.readlines() ! ['This is the first line of the file.\n', 'Second line of the file\n'] \end{verbatim} From fdrake@users.sourceforge.net Thu Apr 12 05:34:28 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 11 Apr 2001 21:34:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.215,1.216 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv19785 Modified Files: Makefile Log Message: Use "2.1c1" since that is what Guido used for the Python version number. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.215 retrieving revision 1.216 diff -C2 -r1.215 -r1.216 *** Makefile 2001/04/10 20:19:24 1.215 --- Makefile 2001/04/12 04:34:26 1.216 *************** *** 68,72 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1rc1 PYTHON= python --- 68,72 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1c1 PYTHON= python From fdrake@users.sourceforge.net Thu Apr 12 05:34:28 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 11 Apr 2001 21:34:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs boilerplate.tex,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv19785/texinputs Modified Files: boilerplate.tex Log Message: Use "2.1c1" since that is what Guido used for the Python version number. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -r1.56 -r1.57 *** boilerplate.tex 2001/04/10 20:19:25 1.56 --- boilerplate.tex 2001/04/12 04:34:26 1.57 *************** *** 7,10 **** \date{\today} % XXX update before release! ! \release{2.1 rc 1} % software release, not documentation \setshortversion{2.1} % major.minor only for software --- 7,10 ---- \date{\today} % XXX update before release! ! \release{2.1c1} % software release, not documentation \setshortversion{2.1} % major.minor only for software From fdrake@users.sourceforge.net Thu Apr 12 05:50:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 11 Apr 2001 21:50:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libunittest.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv24246/lib Modified Files: libunittest.tex Log Message: Added a lot of text from Steve Purcell's HTML documentation. Updated reference material substantially based on discussions on the pyunit-interest mailing list (not all changes are in the code in CVS yet). Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** libunittest.tex 2001/04/10 22:25:06 1.2 --- libunittest.tex 2001/04/12 04:50:06 1.3 *************** *** 66,70 **** --- 66,283 ---- \label{organizing-tests}} + The basic building blocks of unit testing are \dfn{test cases} --- + single scenarios that must be set up and checked for correctness. In + PyUnit, test cases are represented by instances of the + \class{TestCase} class in the \refmodule{unittest} module. To make + your own test cases you must write subclasses of \class{TestCase}, or + use \class{FunctionTestCase}. + + An instance of a \class{TestCase}-derived class is an object that can + completely run a single test method, together with optional set-up + and tidy-up code. + + The testing code of a \class{TestCase} instance should be entirely + self contained, such that it can be run either in isolation or in + arbitrary combination with any number of other test cases. + The simplest test case subclass will simply override the + \method{runTest()} method in order to perform specific testing code: + + \begin{verbatim} + import unittest + + class DefaultWidgetSizeTestCase(unittest.TestCase): + def runTest(self): + widget = Widget("The widget") + assert widget.size() == (50,50), 'incorrect default size' + \end{verbatim} + + Note that in order to test something, we just use the built-in 'assert' + statement of Python. If the test fails when the test case runs, + \class{TestFailed} will be raised, and the testing framework + will identify the test case as a \dfn{failure}. Other exceptions that + do not arise from explicit 'assert' checks are identified by the testing + framework as dfn{errors}. + + The way to run a test case will be described later. For now, note + that to construct an instance of such a test case, we call its + constructor without arguments: + + \begin{verbatim} + testCase = DefaultWidgetSizeTestCase() + \end{verbatim} + + Now, such test cases can be numerous, and their set-up can be + repetitive. In the above case, constructing a ``Widget'' in each of + 100 Widget test case subclasses would mean unsightly duplication. + + Luckily, we can factor out such set-up code by implementing a method + called \method{setUp()}, which the testing framework will + automatically call for us when we run the test: + + \begin{verbatim} + import unittest + + class SimpleWidgetTestCase(unittest.TestCase): + def setUp(self): + self.widget = Widget("The widget") + + class DefaultWidgetSizeTestCase(SimpleWidgetTestCase): + def runTest(self): + assert self.widget.size() == (50,50), 'incorrect default size' + + class WidgetResizeTestCase(SimpleWidgetTestCase): + def runTest(self): + self.widget.resize(100,150) + assert self.widget.size() == (100,150), \ + 'wrong size after resize' + \end{verbatim} + + If the \method{setUp()} method raises an exception while the test is + running, the framework will consider the test to have suffered an + error, and the \method{runTest()} method will not be executed. + + Similarly, we can provide a \method{tearDown()} method that tidies up + after the \method{runTest()} method has been run: + + \begin{verbatim} + import unittest + + class SimpleWidgetTestCase(unittest.TestCase): + def setUp(self): + self.widget = Widget("The widget") + + def tearDown(self): + self.widget.dispose() + self.widget = None + \end{verbatim} + + If \method{setUp()} succeeded, the \method{tearDown()} method will be + run regardless of whether or not \method{runTest()} succeeded. + + Such a working environment for the testing code is called a + \dfn{fixture}. + + Often, many small test cases will use the same fixture. In this case, + we would end up subclassing \class{SimpleWidgetTestCase} into many + small one-method classes such as + \class{DefaultWidgetSizeTestCase}. This is time-consuming and + discouraging, so in the same vein as JUnit, PyUnit provides a simpler + mechanism: + + \begin{verbatim} + import unittest + + class WidgetTestCase(unittest.TestCase): + def setUp(self): + self.widget = Widget("The widget") + + def tearDown(self): + self.widget.dispose() + self.widget = None + + def testDefaultSize(self): + assert self.widget.size() == (50,50), \ + 'incorrect default size' + + def testResize(self): + self.widget.resize(100,150) + assert self.widget.size() == (100,150), \ + 'wrong size after resize' + \end{verbatim} + + Here we have not provided a \method{runTest()} method, but have + instead provided two different test methods. Class instances will now + each run one of the \method{test*()} methods, with \code{self.widget} + created and destroyed separately for each instance. When creating an + instance we must specify the test method it is to run. We do this by + passing the method name in the constructor: + + \begin{verbatim} + defaultSizeTestCase = WidgetTestCase("testDefaultSize") + resizeTestCase = WidgetTestCase("testResize") + \end{verbatim} + + Test case instances are grouped together according to the features + they test. PyUnit provides a mechanism for this: the \class{test + suite}, represented by the class \class{TestSuite} in the + \refmodule{unittest} module: + + \begin{verbatim} + widgetTestSuite = unittest.TestSuite() + widgetTestSuite.addTest(WidgetTestCase("testDefaultSize")) + widgetTestSuite.addTest(WidgetTestCase("testResize")) + \end{verbatim} + + For the ease of running tests, as we will see later, it is a good + idea to provide in each test module a callable object that returns a + pre-built test suite: + + \begin{verbatim} + def suite(): + suite = unittest.TestSuite() + suite.addTest(WidgetTestCase("testDefaultSize")) + suite.addTest(WidgetTestCase("testResize")) + return suite + \end{verbatim} + + or even: + + \begin{verbatim} + class WidgetTestSuite(unittest.TestSuite): + def __init__(self): + unittest.TestSuite.__init__(self,map(WidgetTestCase, + ("testDefaultSize", + "testResize"))) + \end{verbatim} + + (The latter is admittedly not for the faint-hearted!) + + Since it is a common pattern to create a \class{TestCase} subclass + with many similarly named test functions, there is a convenience + function called \function{makeSuite()} provided in the + \refmodule{unittest} module that constructs a test suite that + comprises all of the test cases in a test case class: + + \begin{verbatim} + suite = unittest.makeSuite(WidgetTestCase,'test') + \end{verbatim} + + Note that when using the \function{makeSuite()} function, the order in + which the various test cases will be run by the test suite is the + order determined by sorting the test function names using the + \function{cmp()} built-in function. + + Often it is desirable to group suites of test cases together, so as to + run tests for the whole system at once. This is easy, since + \class{TestSuite} instances can be added to a \class{TestSuite} just + as \class{TestCase} instances can be added to a \class{TestSuite}: + + \begin{verbatim} + suite1 = module1.TheTestSuite() + suite2 = module2.TheTestSuite() + alltests = unittest.TestSuite((suite1, suite2)) + \end{verbatim} + + You can place the definitions of test cases and test suites in the + same modules as the code they are to test (e.g.\ \file{widget.py}), + but there are several advantages to placing the test code in a + separate module, such as \file{widgettests.py}: + + \begin{itemize} + \item The test module can be run standalone from the command line. + \item The test code can more easily be separated from shipped code. + \item There is less temptation to change test code to fit the code. + it tests without a good reason. + \item Test code should be modified much less frequently than the + code it tests. + \item Tested code can be refactored more easily. + \item Tests for modules written in C must be in separate modules + anyway, so why not be consistent? + \item If the testing strategy changes, there is no need to change + the source code. + \end{itemize} + + \subsection{Re-using old test code \label{legacy-unit-tests}} *************** *** 104,107 **** --- 317,325 ---- + \strong{Note:} PyUnit supports the use of \exception{AssertionError} + as an indicator of test failure, but does not recommend it. Future + versions may treat \exception{AssertionError} differently. + + \subsection{Classes and functions \label{unittest-contents}} *************** *** 157,163 **** defaultTest\optional{, argv\optional{, testRunner\optional{, testRunner}}}}}} ! A command-line program that runs a set of tests; this is primarily ! for making test modules conveniently executable. The simplest use for ! this function is: \begin{verbatim} --- 375,381 ---- defaultTest\optional{, argv\optional{, testRunner\optional{, testRunner}}}}}} ! A command-line program that runs a set of tests; this is primarily ! for making test modules conveniently executable. The simplest use ! for this function is: \begin{verbatim} *************** *** 167,170 **** --- 385,394 ---- \end{funcdesc} + \begin{excdesc}{TestFailed} + Exception raised to indicate that a test failed. The + \method{TestCase.fail()} method is responsible for creating and + raising this exception. + \end{excdesc} + \subsection{TestCase Objects *************** *** 214,238 **** ! The test code can either raise \exception{AssertionError} or use any ! of the following methods to check for and report failures: \begin{methoddesc}[TestCase]{failUnless}{expr\optional{, msg}} - \methodline[TestCase]{assert_}{value\optional{, msg}} This method is similar to the \keyword{assert} statement, except it works even when Python is executed in ``optimizing'' mode (using the ! \programopt{-O} command line switch). If \var{expr} is false, ! \exception{AssertionError} will be raised with \var{msg} as the message describing the failure; \code{None} will be used for the ! message if \var{msg} is omitted. This method is equivalent to ! ! \begin{alltt} ! assert \var{expr}, \var{msg} ! \end{alltt} \end{methoddesc} ! \begin{methoddesc}[TestCase]{assertEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are equal. If the values do not compare equal, the test will fail with the explanation given by ! \var{msg}, or \code{None}. Note that using \method{assertEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()} is that the default value for \var{msg} can be --- 438,458 ---- ! The test code can use any of the following methods to check for and ! report failures: \begin{methoddesc}[TestCase]{failUnless}{expr\optional{, msg}} This method is similar to the \keyword{assert} statement, except it works even when Python is executed in ``optimizing'' mode (using the ! \programopt{-O} command line switch), and raises the ! \exception{TestFailed} exception. If \var{expr} is false, ! \exception{TestFailed} will be raised with \var{msg} as the message describing the failure; \code{None} will be used for the ! message if \var{msg} is omitted. \end{methoddesc} ! \begin{methoddesc}[TestCase]{failUnlessEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are equal. If the values do not compare equal, the test will fail with the explanation given by ! \var{msg}, or \code{None}. Note that using \method{failUnlessEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()} is that the default value for \var{msg} can be *************** *** 241,248 **** \end{methoddesc} ! \begin{methoddesc}[TestCase]{assertNotEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are not equal. If the values do compare equal, the test will fail with the explanation given by ! \var{msg}, or \code{None}. Note that using \method{assertNotEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()} is that the default value for \var{msg} can be --- 461,468 ---- \end{methoddesc} ! \begin{methoddesc}[TestCase]{failIfEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are not equal. If the values do compare equal, the test will fail with the explanation given by ! \var{msg}, or \code{None}. Note that using \method{failIfEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()} is that the default value for \var{msg} can be *************** *** 252,257 **** \begin{methoddesc}[TestCase]{failIf}{expr\optional{, msg}} ! The inverse of the \method{assert_()} method is the ! \method{failIf()} method. This raises \exception{AssertionError} if \var{expr} is true, with \var{msg} or \code{None} for the error message. --- 472,477 ---- \begin{methoddesc}[TestCase]{failIf}{expr\optional{, msg}} ! The inverse of the \method{failUnless()} method is the ! \method{failIf()} method. This raises \exception{TestFailed} if \var{expr} is true, with \var{msg} or \code{None} for the error message. *************** *** 338,348 **** A list containing pairs of \class{TestCase} instances and the \function{sys.exc_info()} results for tests which raised exceptions ! other than \exception{AssertionError}. \end{memberdesc} \begin{memberdesc}[TestResult]{failures} A list containing pairs of \class{TestCase} instances and the ! \function{sys.exc_info()} results for tests which raised the ! \exception{AssertionError} exception. \end{memberdesc} --- 558,568 ---- A list containing pairs of \class{TestCase} instances and the \function{sys.exc_info()} results for tests which raised exceptions ! other than \exception{AssertionError} and \exception{TestFailed}. \end{memberdesc} \begin{memberdesc}[TestResult]{failures} A list containing pairs of \class{TestCase} instances and the ! \function{sys.exc_info()} results for tests which raised either ! \exception{TestFailed} or \exception{AssertionError}. \end{memberdesc} *************** *** 374,380 **** \begin{methoddesc}[TestResult]{addError}{test, err} Called when the test case \var{test} results in an exception other ! than \exception{AssertionError}. \var{err} is a tuple of the form ! returned by \function{sys.exc_info()}: \code{(\var{type}, ! \var{value}, \var{traceback})}. \end{methoddesc} --- 594,601 ---- \begin{methoddesc}[TestResult]{addError}{test, err} Called when the test case \var{test} results in an exception other ! than \exception{TestFailed} or \exception{AssertionError}. ! \var{err} is a tuple of the form returned by ! \function{sys.exc_info()}: \code{(\var{type}, \var{value}, ! \var{traceback})}. \end{methoddesc} *************** *** 382,389 **** Called when the test case \var{test} results in an \exception{AssertionError} exception; the assumption is that the ! test raised the \exception{AssertionError} and not the ! implementation being tested. \var{err} is a tuple of the form ! returned by \function{sys.exc_info()}: \code{(\var{type}, ! \var{value}, \var{traceback})}. \end{methoddesc} --- 603,611 ---- Called when the test case \var{test} results in an \exception{AssertionError} exception; the assumption is that the ! test raised either \exception{TestFailed} or ! \exception{AssertionError} and not the implementation being tested. ! \var{err} is a tuple of the form returned by ! \function{sys.exc_info()}: \code{(\var{type}, \var{value}, ! \var{traceback})}. \end{methoddesc} From jhylton@users.sourceforge.net Thu Apr 12 07:39:26 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 23:39:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler consts.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv6322 Modified Files: consts.py Log Message: Define constants for types of scopes Index: consts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/consts.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** consts.py 2000/02/08 18:57:51 1.1 --- consts.py 2001/04/12 06:39:24 1.2 *************** *** 8,9 **** --- 8,14 ---- OP_APPLY = 'OP_APPLY' + SC_LOCAL = 1 + SC_GLOBAL = 2 + SC_FREE = 3 + SC_CELL = 4 + SC_UNKNOWN = 5 From jhylton@users.sourceforge.net Thu Apr 12 07:40:44 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 23:40:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pyassem.py,1.16,1.17 pycodegen.py,1.31,1.32 symbols.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv6499 Modified Files: pyassem.py pycodegen.py symbols.py Log Message: Preliminary support for nested scopes XXX Still doesn't work right for classes XXX Still doesn't do sufficient error checking Index: pyassem.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pyassem.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** pyassem.py 2001/04/11 16:21:51 1.16 --- pyassem.py 2001/04/12 06:40:42 1.17 *************** *** 100,109 **** order.append(self.exit) - ## for b in order: - ## print repr(b) - ## print "\t", b.get_children() - ## print b - ## print - return order --- 100,103 ---- *************** *** 223,226 **** --- 217,221 ---- CO_VARARGS = 0x0004 CO_VARKEYWORDS = 0x0008 + CO_NESTED = 0x0010 # the FlowGraph is transformed in place; it exists in one of these states *************** *** 246,249 **** --- 241,253 ---- self.consts = [] self.names = [] + # Free variables found by the symbol table scan, including + # variables used only in nested scopes, are included here. + self.freevars = [] + self.cellvars = [] + # The closure list is used to track the order of cell + # variables and free variables in the resulting code object. + # The offsets used by LOAD_CLOSURE/LOAD_DEREF refer to both + # kinds of variables. + self.closure = [] self.varnames = list(args) or [] for i in range(len(self.varnames)): *************** *** 261,264 **** --- 265,274 ---- self.argcount = self.argcount - 1 + def setFreeVars(self, names): + self.freevars = list(names) + + def setCellVars(self, names): + self.cellvars = names + def getCode(self): """Get a Python code object""" *************** *** 336,339 **** --- 346,350 ---- assert self.stage == FLAT self.consts.insert(0, self.docstring) + self.sort_cellvars() for i in range(len(self.insts)): t = self.insts[i] *************** *** 346,349 **** --- 357,373 ---- self.stage = CONV + def sort_cellvars(self): + """Sort cellvars in the order of varnames and prune from freevars. + """ + cells = {} + for name in self.cellvars: + cells[name] = 1 + self.cellvars = [name for name in self.varnames + if cells.has_key(name)] + for name in self.cellvars: + del cells[name] + self.cellvars = self.cellvars + cells.keys() + self.closure = self.cellvars + self.freevars + def _lookupName(self, name, list): """Return index of name in list, appending if necessary""" *************** *** 383,386 **** --- 407,421 ---- _convert_DELETE_GLOBAL = _convert_NAME + def _convert_DEREF(self, arg): + self._lookupName(arg, self.names) + self._lookupName(arg, self.varnames) + return self._lookupName(arg, self.closure) + _convert_LOAD_DEREF = _convert_DEREF + _convert_STORE_DEREF = _convert_DEREF + + def _convert_LOAD_CLOSURE(self, arg): + self._lookupName(arg, self.varnames) + return self._lookupName(arg, self.closure) + _cmp = list(dis.cmp_op) def _convert_COMPARE_OP(self, arg): *************** *** 433,437 **** tuple(self.names), tuple(self.varnames), self.filename, self.name, self.lnotab.firstline, ! self.lnotab.getTable()) def getConsts(self): --- 468,473 ---- tuple(self.names), tuple(self.varnames), self.filename, self.name, self.lnotab.firstline, ! self.lnotab.getTable(), tuple(self.freevars), ! tuple(self.cellvars)) def getConsts(self): Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** pycodegen.py 2001/04/11 16:43:13 1.31 --- pycodegen.py 2001/04/12 06:40:42 1.32 *************** *** 10,15 **** from compiler import ast, parse, walk ! from compiler import pyassem, misc, future ! from compiler.pyassem import CO_VARARGS, CO_VARKEYWORDS, CO_NEWLOCALS, TupleArg # Do we have Python 1.x or Python 2.x? --- 10,17 ---- from compiler import ast, parse, walk ! from compiler import pyassem, misc, future, symbols ! from compiler.consts import SC_LOCAL, SC_GLOBAL, SC_FREE, SC_CELL ! from compiler.pyassem import CO_VARARGS, CO_VARKEYWORDS, CO_NEWLOCALS,\ ! CO_NESTED, TupleArg # Do we have Python 1.x or Python 2.x? *************** *** 47,51 **** root, filename = os.path.split(self.filename) if "nested_scopes" in future.find_futures(tree): ! gen = NestedScopeCodeGenerator(filename) else: gen = ModuleCodeGenerator(filename) --- 49,53 ---- root, filename = os.path.split(self.filename) if "nested_scopes" in future.find_futures(tree): ! gen = NestedScopeModuleCodeGenerator(filename) else: gen = ModuleCodeGenerator(filename) *************** *** 71,82 **** return self.MAGIC + mtime class CodeGenerator: optimized = 0 # is namespace access optimized? def __init__(self, filename): ! ## Subclasses must define a constructor that intializes self.graph ! ## before calling this init function, e.g. ! ## self.graph = pyassem.PyFlowGraph() self.filename = filename self.locals = misc.Stack() --- 73,141 ---- return self.MAGIC + mtime + class LocalNameFinder: + """Find local names in scope""" + def __init__(self, names=()): + self.names = misc.Set() + self.globals = misc.Set() + for name in names: + self.names.add(name) + + # XXX list comprehensions and for loops + + def getLocals(self): + for elt in self.globals.elements(): + if self.names.has_elt(elt): + self.names.remove(elt) + return self.names + + def visitDict(self, node): + pass + + def visitGlobal(self, node): + for name in node.names: + self.globals.add(name) + + def visitFunction(self, node): + self.names.add(node.name) + + def visitLambda(self, node): + pass + + def visitImport(self, node): + for name, alias in node.names: + self.names.add(alias or name) + + def visitFrom(self, node): + for name, alias in node.names: + self.names.add(alias or name) + + def visitClass(self, node): + self.names.add(node.name) + + def visitAssName(self, node): + self.names.add(node.name) + class CodeGenerator: + """Defines basic code generator for Python bytecode + This class is an abstract base class. Concrete subclasses must + define an __init__() that defines self.graph and then calls the + __init__() defined in this class. + + The concrete class must also define the class attributes + NameFinder, FunctionGen, and ClassGen. These attributes can be + defined in the initClass() method, which is a hook for + initializing these methods after all the classes have been + defined. + """ + optimized = 0 # is namespace access optimized? + __initialized = None def __init__(self, filename): ! if self.__initialized is None: ! self.initClass() ! self.__class__.__initialized = 1 ! self.checkClass() self.filename = filename self.locals = misc.Stack() *************** *** 87,90 **** --- 146,163 ---- self._setupGraphDelegation() + def initClass(self): + """This method is called once for each class""" + + def checkClass(self): + """Verify that class is constructed correctly""" + try: + assert hasattr(self, 'graph') + assert getattr(self, 'NameFinder') + assert getattr(self, 'FunctionGen') + assert getattr(self, 'ClassGen') + except AssertionError, msg: + intro = "Bad class construction for %s" % self.__class__.__name__ + raise AssertionError, intro + def _setupGraphDelegation(self): self.emit = self.graph.emit *************** *** 140,147 **** # The first few visitor methods handle nodes that generator new ! # code objects def visitModule(self, node): ! lnf = walk(node.node, LocalNameFinder(), 0) self.locals.push(lnf.getLocals()) if node.doc: --- 213,225 ---- # The first few visitor methods handle nodes that generator new ! # code objects. They use class attributes to determine what ! # specialized code generators to use. ! ! NameFinder = LocalNameFinder ! FunctionGen = None ! ClassGen = None def visitModule(self, node): ! lnf = walk(node.node, self.NameFinder(), 0) self.locals.push(lnf.getLocals()) if node.doc: *************** *** 160,165 **** self._visitFuncOrLambda(node, isLambda=1) ! def _visitFuncOrLambda(self, node, isLambda): ! gen = FunctionCodeGenerator(node, self.filename, isLambda) walk(node.code, gen) gen.finish() --- 238,243 ---- self._visitFuncOrLambda(node, isLambda=1) ! def _visitFuncOrLambda(self, node, isLambda=0): ! gen = self.FunctionGen(node, self.filename, self.scopes, isLambda) walk(node.code, gen) gen.finish() *************** *** 171,175 **** def visitClass(self, node): ! gen = ClassCodeGenerator(node, self.filename) if node.doc: self.fixDocstring(node.code) --- 249,253 ---- def visitClass(self, node): ! gen = self.ClassGen(node, self.filename, self.scopes) if node.doc: self.fixDocstring(node.code) *************** *** 181,185 **** self.visit(base) self.emit('BUILD_TUPLE', len(node.bases)) ! self.emit('LOAD_CONST', gen.getCode()) self.emit('MAKE_FUNCTION', 0) self.emit('CALL_FUNCTION', 0) --- 259,263 ---- self.visit(base) self.emit('BUILD_TUPLE', len(node.bases)) ! self.emit('LOAD_CONST', gen) self.emit('MAKE_FUNCTION', 0) self.emit('CALL_FUNCTION', 0) *************** *** 884,915 **** self.emit('STORE_SUBSCR') ! class ModuleCodeGenerator(CodeGenerator): ! __super_init = CodeGenerator.__init__ __super_visitModule = CodeGenerator.visitModule ! ! def __init__(self, filename): ! # XXX is ? in compile.c ! self.graph = pyassem.PyFlowGraph("", filename) ! self.__super_init(filename) ! self.symbols = None def visitModule(self, node): ! self.symbols = self.parseSymbols(node) self.__super_visitModule(node) ! def parseSymbols(self, node): ! # XXX not implemented ! return None ! class NestedScopeCodeGenerator(ModuleCodeGenerator): ! pass ! class FunctionCodeGenerator(CodeGenerator): ! super_init = CodeGenerator.__init__ optimized = 1 lambdaCount = 0 ! def __init__(self, func, filename, isLambda=0): if isLambda: klass = FunctionCodeGenerator --- 962,1073 ---- self.emit('STORE_SUBSCR') ! class NestedScopeCodeGenerator(CodeGenerator): __super_visitModule = CodeGenerator.visitModule ! __super_visitClass = CodeGenerator.visitClass ! __super__visitFuncOrLambda = CodeGenerator._visitFuncOrLambda ! ! def parseSymbols(self, tree): ! s = symbols.SymbolVisitor() ! walk(tree, s) ! return s.scopes def visitModule(self, node): ! self.scopes = self.parseSymbols(node) ! self.scope = self.scopes[node] self.__super_visitModule(node) ! def _nameOp(self, prefix, name): ! scope = self.scope.check_name(name) ! if scope == SC_LOCAL: ! if not self.optimized: ! self.emit(prefix + '_NAME', name) ! else: ! self.emit(prefix + '_FAST', name) ! elif scope == SC_GLOBAL: ! self.emit(prefix + '_GLOBAL', name) ! elif scope == SC_FREE or scope == SC_CELL: ! self.emit(prefix + '_DEREF', name) ! else: ! raise RuntimeError, "unsupported scope for var %s: %d" % \ ! (name, scope) ! def _visitFuncOrLambda(self, node, isLambda=0): ! gen = self.FunctionGen(node, self.filename, self.scopes, isLambda) ! walk(node.code, gen) ! gen.finish() ! self.set_lineno(node) ! for default in node.defaults: ! self.visit(default) ! frees = gen.scope.get_free_vars() ! if frees: ! for name in frees: ! self.emit('LOAD_CLOSURE', name) ! self.emit('LOAD_CONST', gen) ! self.emit('MAKE_CLOSURE', len(node.defaults)) ! else: ! self.emit('LOAD_CONST', gen) ! self.emit('MAKE_FUNCTION', len(node.defaults)) ! def visitClass(self, node): ! gen = self.ClassGen(node, self.filename, self.scopes) ! if node.doc: ! self.fixDocstring(node.code) ! walk(node.code, gen) ! gen.finish() ! self.set_lineno(node) ! self.emit('LOAD_CONST', node.name) ! for base in node.bases: ! self.visit(base) ! self.emit('BUILD_TUPLE', len(node.bases)) ! frees = gen.scope.get_free_vars() ! for name in frees: ! self.emit('LOAD_CLOSURE', name) ! self.emit('LOAD_CONST', gen) ! if frees: ! self.emit('MAKE_CLOSURE', 0) ! else: ! self.emit('MAKE_FUNCTION', 0) ! self.emit('CALL_FUNCTION', 0) ! self.emit('BUILD_CLASS') ! self.storeName(node.name) ! ! ! class LGBScopeMixin: ! """Defines initClass() for Python 2.1-compatible scoping""" ! def initClass(self): ! self.__class__.NameFinder = LocalNameFinder ! self.__class__.FunctionGen = FunctionCodeGenerator ! self.__class__.ClassGen = ClassCodeGenerator ! ! class NestedScopeMixin: ! """Defines initClass() for nested scoping (Python 2.2-compatible)""" ! def initClass(self): ! self.__class__.NameFinder = LocalNameFinder ! self.__class__.FunctionGen = NestedFunctionCodeGenerator ! self.__class__.ClassGen = NestedClassCodeGenerator ! ! class ModuleCodeGenerator(LGBScopeMixin, CodeGenerator): ! __super_init = CodeGenerator.__init__ ! ! scopes = None ! ! def __init__(self, filename): ! self.graph = pyassem.PyFlowGraph("", filename) ! self.__super_init(filename) ! ! class NestedScopeModuleCodeGenerator(NestedScopeMixin, ! NestedScopeCodeGenerator): ! __super_init = CodeGenerator.__init__ ! ! def __init__(self, filename): ! self.graph = pyassem.PyFlowGraph("", filename) ! self.__super_init(filename) ! self.graph.setFlag(CO_NESTED) + class AbstractFunctionCode: optimized = 1 lambdaCount = 0 ! def __init__(self, func, filename, scopes, isLambda): if isLambda: klass = FunctionCodeGenerator *************** *** 927,931 **** self.setDocstring(func.doc) ! lnf = walk(func.code, LocalNameFinder(args), 0) self.locals.push(lnf.getLocals()) if func.varargs: --- 1085,1089 ---- self.setDocstring(func.doc) ! lnf = walk(func.code, self.NameFinder(args), 0) self.locals.push(lnf.getLocals()) if func.varargs: *************** *** 964,975 **** unpackTuple = unpackSequence ! class ClassCodeGenerator(CodeGenerator): ! super_init = CodeGenerator.__init__ ! def __init__(self, klass, filename): self.graph = pyassem.PyFlowGraph(klass.name, filename, optimized=0) self.super_init(filename) ! lnf = walk(klass.code, LocalNameFinder(), 0) self.locals.push(lnf.getLocals()) self.graph.setFlag(CO_NEWLOCALS) --- 1122,1151 ---- unpackTuple = unpackSequence ! class FunctionCodeGenerator(LGBScopeMixin, AbstractFunctionCode, ! CodeGenerator): ! super_init = CodeGenerator.__init__ # call be other init ! scopes = None ! ! class NestedFunctionCodeGenerator(AbstractFunctionCode, ! NestedScopeMixin, ! NestedScopeCodeGenerator): ! super_init = NestedScopeCodeGenerator.__init__ # call be other init ! __super_init = AbstractFunctionCode.__init__ ! ! def __init__(self, func, filename, scopes, isLambda): ! self.scopes = scopes ! self.scope = scopes[func] ! self.__super_init(func, filename, scopes, isLambda) ! self.graph.setFreeVars(self.scope.get_free_vars()) ! self.graph.setCellVars(self.scope.get_cell_vars()) ! self.graph.setFlag(CO_NESTED) ! ! class AbstractClassCode: ! def __init__(self, klass, filename, scopes): self.graph = pyassem.PyFlowGraph(klass.name, filename, optimized=0) self.super_init(filename) ! lnf = walk(klass.code, self.NameFinder(), 0) self.locals.push(lnf.getLocals()) self.graph.setFlag(CO_NEWLOCALS) *************** *** 982,985 **** --- 1158,1179 ---- self.emit('RETURN_VALUE') + class ClassCodeGenerator(LGBScopeMixin, AbstractClassCode, CodeGenerator): + super_init = CodeGenerator.__init__ + scopes = None + + class NestedClassCodeGenerator(AbstractClassCode, + NestedScopeMixin, + NestedScopeCodeGenerator): + super_init = NestedScopeCodeGenerator.__init__ # call be other init + __super_init = AbstractClassCode.__init__ + + def __init__(self, klass, filename, scopes): + self.scopes = scopes + self.scope = scopes[klass] + self.__super_init(klass, filename, scopes) + self.graph.setFreeVars(self.scope.get_free_vars()) + self.graph.setCellVars(self.scope.get_cell_vars()) + self.graph.setFlag(CO_NESTED) + def generateArgList(arglist): """Generate an arg list marking TupleArgs""" *************** *** 997,1043 **** raise ValueError, "unexpect argument type:", elt return args + extra, count - - class LocalNameFinder: - """Find local names in scope""" - def __init__(self, names=()): - self.names = misc.Set() - self.globals = misc.Set() - for name in names: - self.names.add(name) - - # XXX list comprehensions and for loops - - def getLocals(self): - for elt in self.globals.elements(): - if self.names.has_elt(elt): - self.names.remove(elt) - return self.names - - def visitDict(self, node): - pass - - def visitGlobal(self, node): - for name in node.names: - self.globals.add(name) - - def visitFunction(self, node): - self.names.add(node.name) - - def visitLambda(self, node): - pass - - def visitImport(self, node): - for name, alias in node.names: - self.names.add(alias or name) - - def visitFrom(self, node): - for name, alias in node.names: - self.names.add(alias or name) - - def visitClass(self, node): - self.names.add(node.name) - - def visitAssName(self, node): - self.names.add(node.name) def findOp(node): --- 1191,1194 ---- Index: symbols.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/symbols.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** symbols.py 2001/04/09 20:11:59 1.3 --- symbols.py 2001/04/12 06:40:42 1.4 *************** *** 2,7 **** --- 2,10 ---- from compiler import ast + from compiler.consts import SC_LOCAL, SC_GLOBAL, SC_FREE, SC_CELL, SC_UNKNOWN import types + import sys + MANGLE_LEN = 256 *************** *** 15,19 **** --- 18,27 ---- self.globals = {} self.params = {} + self.frees = {} + self.cells = {} self.children = [] + # nested is true if the class could contain free variables, + # i.e. if it is nested within another function. + self.nested = None self.klass = None if klass is not None: *************** *** 71,74 **** --- 79,178 ---- return self.children + def DEBUG(self): + return + print >> sys.stderr, self.name, self.nested and "nested" or "" + print >> sys.stderr, "\tglobals: ", self.globals + print >> sys.stderr, "\tcells: ", self.cells + print >> sys.stderr, "\tdefs: ", self.defs + print >> sys.stderr, "\tuses: ", self.uses + print >> sys.stderr, "\tfrees:", self.frees + + def check_name(self, name): + """Return scope of name. + + The scope of a name could be LOCAL, GLOBAL, FREE, or CELL. + """ + if self.globals.has_key(name): + return SC_GLOBAL + if self.cells.has_key(name): + return SC_CELL + if self.defs.has_key(name): + return SC_LOCAL + if self.nested and (self.frees.has_key(name) or + self.uses.has_key(name)): + return SC_FREE + if self.nested: + return SC_UNKNOWN + else: + return SC_GLOBAL + + def get_free_vars(self): + if not self.nested: + return () + free = {} + free.update(self.frees) + for name in self.uses.keys(): + if not (self.defs.has_key(name) or + self.globals.has_key(name)): + free[name] = 1 + return free.keys() + + def handle_children(self): + for child in self.children: + frees = child.get_free_vars() + globals = self.add_frees(frees) + for name in globals: + child.force_global(name) + + def force_global(self, name): + """Force name to be global in scope. + + Some child of the current node had a free reference to name. + When the child was processed, it was labelled a free + variable. Now that all its enclosing scope have been + processed, the name is known to be a global or builtin. So + walk back down the child chain and set the name to be global + rather than free. + + Be careful to stop if a child does not think the name is + free. + """ + self.globals[name] = 1 + if self.frees.has_key(name): + del self.frees[name] + for child in self.children: + if child.check_name(name) == SC_FREE: + child.force_global(name) + + def add_frees(self, names): + """Process list of free vars from nested scope. + + Returns a list of names that are either 1) declared global in the + parent or 2) undefined in a top-level parent. In either case, + the nested scope should treat them as globals. + """ + child_globals = [] + for name in names: + sc = self.check_name(name) + if self.nested: + if sc == SC_UNKNOWN or sc == SC_FREE \ + or isinstance(self, ClassScope): + self.frees[name] = 1 + elif sc == SC_GLOBAL: + child_globals.append(name) + elif isinstance(self, FunctionScope) and sc == SC_LOCAL: + self.cells[name] = 1 + else: + child_globals.append(name) + else: + if sc == SC_LOCAL: + self.cells[name] = 1 + else: + child_globals.append(name) + return child_globals + + def get_cell_vars(self): + return self.cells.keys() + class ModuleScope(Scope): __super_init = Scope.__init__ *************** *** 76,81 **** def __init__(self): self.__super_init("global", self) ! class LambdaScope(Scope): __super_init = Scope.__init__ --- 180,188 ---- def __init__(self): self.__super_init("global", self) + + class FunctionScope(Scope): + pass ! class LambdaScope(FunctionScope): __super_init = Scope.__init__ *************** *** 87,93 **** self.__super_init("lambda.%d" % i, module, klass) - class FunctionScope(Scope): - pass - class ClassScope(Scope): __super_init = Scope.__init__ --- 194,197 ---- *************** *** 112,126 **** self.visit(n, parent) scope = FunctionScope(node.name, self.module, self.klass) self.scopes[node] = scope self._do_args(scope, node.argnames) self.visit(node.code, scope) ! def visitLambda(self, node, parent): for n in node.defaults: self.visit(n, parent) scope = LambdaScope(self.module, self.klass) self.scopes[node] = scope self._do_args(scope, node.argnames) self.visit(node.code, scope) def _do_args(self, scope, args): --- 216,237 ---- self.visit(n, parent) scope = FunctionScope(node.name, self.module, self.klass) + if parent.nested or isinstance(parent, FunctionScope): + scope.nested = 1 self.scopes[node] = scope self._do_args(scope, node.argnames) self.visit(node.code, scope) ! self.handle_free_vars(scope, parent) ! scope.DEBUG() ! def visitLambda(self, node, parent): for n in node.defaults: self.visit(n, parent) scope = LambdaScope(self.module, self.klass) + if parent.nested or isinstance(parent, FunctionScope): + scope.nested = 1 self.scopes[node] = scope self._do_args(scope, node.argnames) self.visit(node.code, scope) + self.handle_free_vars(scope, parent) def _do_args(self, scope, args): *************** *** 131,134 **** --- 242,251 ---- scope.add_param(name) + def handle_free_vars(self, scope, parent): + parent.add_child(scope) + if scope.children: + scope.DEBUG() + scope.handle_children() + def visitClass(self, node, parent): parent.add_def(node.name) *************** *** 136,139 **** --- 253,258 ---- self.visit(n, parent) scope = ClassScope(node.name, self.module) + if parent.nested or isinstance(parent, FunctionScope): + scope.nested = 1 self.scopes[node] = scope prev = self.klass *************** *** 141,144 **** --- 260,264 ---- self.visit(node.code, scope) self.klass = prev + self.handle_free_vars(scope, parent) # name can be a def or a use From jhylton@users.sourceforge.net Thu Apr 12 07:49:02 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 23:49:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pycodegen.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv7361/compiler Modified Files: pycodegen.py Log Message: Inside a class scope always use LOAD_NAME, STORE_NAME, DEL_NAME Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** pycodegen.py 2001/04/12 06:40:42 1.32 --- pycodegen.py 2001/04/12 06:49:00 1.33 *************** *** 1153,1156 **** --- 1153,1159 ---- self.setDocstring(klass.doc) + def _nameOp(self, prefix, name): + self.emit(prefix + '_NAME', name) + def finish(self): self.graph.startExitBlock() From jhylton@users.sourceforge.net Thu Apr 12 07:52:29 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 11 Apr 2001 23:52:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pycodegen.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv7730/compiler Modified Files: pycodegen.py Log Message: Fix unpackSequence() to use _nameOp() rather than LOAD_FAST Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** pycodegen.py 2001/04/12 06:49:00 1.33 --- pycodegen.py 2001/04/12 06:52:27 1.34 *************** *** 1118,1122 **** self.unpackSequence(elt) else: ! self.emit('STORE_FAST', elt) unpackTuple = unpackSequence --- 1118,1122 ---- self.unpackSequence(elt) else: ! self._nameOp('STORE', elt) unpackTuple = unpackSequence *************** *** 1154,1157 **** --- 1154,1158 ---- def _nameOp(self, prefix, name): + # Class namespaces are always unoptimized self.emit(prefix + '_NAME', name) From jhylton@users.sourceforge.net Thu Apr 12 08:06:28 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 12 Apr 2001 00:06:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler symbols.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv9162/compiler Modified Files: symbols.py Log Message: Only treat an AugAssign as def if its the target is a Name. Fixes last bug found with test_scope.py. Index: symbols.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/symbols.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** symbols.py 2001/04/12 06:40:42 1.4 --- symbols.py 2001/04/12 07:06:25 1.5 *************** *** 300,306 **** def visitAugAssign(self, node, scope): ! # basically, the node is referenced and defined by the same expr self.visit(node.node, scope) ! self.visit(node.node, scope, 1) self.visit(node.expr, scope) --- 300,308 ---- def visitAugAssign(self, node, scope): ! # If the LHS is a name, then this counts as assignment. ! # Otherwise, it's just use. self.visit(node.node, scope) ! if isinstance(node.node, ast.Name): ! self.visit(node.node, scope, 1) # XXX worry about this self.visit(node.expr, scope) From purcell@users.sourceforge.net Thu Apr 12 10:05:03 2001 From: purcell@users.sourceforge.net (Steve Purcell) Date: Thu, 12 Apr 2001 02:05:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib unittest.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25226 Modified Files: unittest.py Log Message: - New fail*() methods, and comprehensive set of assert*() synonyms - TestCase.failureException defines the exception that indicates a test failure - Docstrings for TestLoader class - Added exc_info() hack back in Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** unittest.py 2001/04/09 15:37:31 1.4 --- unittest.py 2001/04/12 09:05:01 1.5 *************** *** 132,135 **** --- 132,142 ---- in order to be run. """ + + # This attribute determines which exception will be raised when + # the instance's assertion methods fail; test methods raising this + # exception will be deemed to have 'failed' rather than 'errored' + + failureException = AssertionError + def __init__(self, methodName='runTest'): """Create an instance of the class that will use the named test *************** *** 190,194 **** self.setUp() except: ! result.addError(self,sys.exc_info()) return --- 197,201 ---- self.setUp() except: ! result.addError(self,self.__exc_info()) return *************** *** 197,209 **** testMethod() ok = 1 ! except AssertionError, e: ! result.addFailure(self,sys.exc_info()) except: ! result.addError(self,sys.exc_info()) try: self.tearDown() except: ! result.addError(self,sys.exc_info()) ok = 0 if ok: result.addSuccess(self) --- 204,216 ---- testMethod() ok = 1 ! except self.failureException, e: ! result.addFailure(self,self.__exc_info()) except: ! result.addError(self,self.__exc_info()) try: self.tearDown() except: ! result.addError(self,self.__exc_info()) ok = 0 if ok: result.addSuccess(self) *************** *** 217,235 **** self.tearDown() ! def assert_(self, expr, msg=None): ! """Equivalent of built-in 'assert', but is not optimised out when ! __debug__ is false. """ ! if not expr: ! raise AssertionError, msg ! failUnless = assert_ def failIf(self, expr, msg=None): "Fail the test if the expression is true." ! apply(self.assert_,(not expr,msg)) ! def assertRaises(self, excClass, callableObj, *args, **kwargs): ! """Assert that an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is --- 224,254 ---- self.tearDown() ! def __exc_info(self): ! """Return a version of sys.exc_info() with the traceback frame ! minimised; usually the top level of the traceback frame is not ! needed. """ ! exctype, excvalue, tb = sys.exc_info() ! if sys.platform[:4] == 'java': ## tracebacks look different in Jython ! return (exctype, excvalue, tb) ! newtb = tb.tb_next ! if newtb is None: ! return (exctype, excvalue, tb) ! return (exctype, excvalue, newtb) ! def fail(self, msg=None): ! """Fail immediately, with the given message.""" ! raise self.failureException, msg def failIf(self, expr, msg=None): "Fail the test if the expression is true." ! if expr: raise self.failureException, msg ! ! def failUnless(self, expr, msg=None): ! """Fail the test unless the expression is true.""" ! if not expr: raise self.failureException, msg ! def failUnlessRaises(self, excClass, callableObj, *args, **kwargs): ! """Fail unless an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is *************** *** 245,271 **** if hasattr(excClass,'__name__'): excName = excClass.__name__ else: excName = str(excClass) ! raise AssertionError, excName ! def assertEquals(self, first, second, msg=None): ! """Assert that the two objects are equal as determined by the '==' operator. """ ! self.assert_((first == second), msg or '%s != %s' % (first, second)) ! def assertNotEquals(self, first, second, msg=None): ! """Assert that the two objects are unequal as determined by the '!=' operator. """ ! self.assert_((first != second), msg or '%s == %s' % (first, second)) ! assertEqual = assertEquals ! assertNotEqual = assertNotEquals ! def fail(self, msg=None): ! """Fail immediately, with the given message.""" ! raise AssertionError, msg class TestSuite: """A test suite is a composite test consisting of a number of TestCases. --- 264,293 ---- if hasattr(excClass,'__name__'): excName = excClass.__name__ else: excName = str(excClass) ! raise self.failureException, excName ! def failUnlessEqual(self, first, second, msg=None): ! """Fail if the two objects are unequal as determined by the '!=' operator. """ ! if first != second: ! raise self.failureException, (msg or '%s != %s' % (first, second)) ! def failIfEqual(self, first, second, msg=None): ! """Fail if the two objects are equal as determined by the '==' operator. """ ! if first == second: ! raise self.failureException, (msg or '%s != %s' % (first, second)) ! assertEqual = assertEquals = failUnlessEqual ! assertNotEqual = assertNotEquals = failIfEqual ! assertRaises = failUnlessRaises + assert_ = failUnless + + class TestSuite: """A test suite is a composite test consisting of a number of TestCases. *************** *** 365,370 **** """This class is responsible for loading tests according to various criteria and returning them wrapped in a Test - - It can load all tests within a given, module """ testMethodPrefix = 'test' --- 387,390 ---- *************** *** 373,380 **** --- 393,402 ---- def loadTestsFromTestCase(self, testCaseClass): + """Return a suite of all tests cases contained in testCaseClass""" return self.suiteClass(map(testCaseClass, self.getTestCaseNames(testCaseClass))) def loadTestsFromModule(self, module): + """Return a suite of all tests cases contained in the given module""" tests = [] for name in dir(module): *************** *** 385,388 **** --- 407,418 ---- def loadTestsFromName(self, name, module=None): + """Return a suite of all tests cases given a string specifier. + + The name may resolve either to a module, a test case class, a + test method within a test case class, or a callable object which + returns a TestCase or TestSuite instance. + + The method optionally resolves the names relative to a given module. + """ parts = string.split(name, '.') if module is None: *************** *** 420,423 **** --- 450,456 ---- def loadTestsFromNames(self, names, module=None): + """Return a suite of all tests cases found using the given sequence + of string specifiers. See 'loadTestsFromName()'. + """ suites = [] for name in names: *************** *** 426,429 **** --- 459,464 ---- def getTestCaseNames(self, testCaseClass): + """Return a sorted sequence of method names found within testCaseClass + """ testFnNames = filter(lambda n,p=self.testMethodPrefix: n[:len(p)] == p, dir(testCaseClass)) From ping@users.sourceforge.net Thu Apr 12 11:50:25 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 12 Apr 2001 03:50:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5475 Modified Files: pydoc.py Log Message: Properly qualify methods inherited from classes in other modules. Fix so that docother() doesn't blow up. Eliminate man() function since doc() and man() did nearly the same thing. Various other code cleanup and refactoring to reduce duplication. Simplify and rewrite freshimport() so modules are always up to date, even within packages (where reload() doesn't work). Add finalization callback to the server (so that if the server fails to start for some reason, the main thread isn't left hanging). Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** pydoc.py 2001/04/10 12:22:01 1.23 --- pydoc.py 2001/04/12 10:50:23 1.24 *************** *** 67,71 **** else: # text modules can be directly examined line = file.readline() ! while line[:1] == '#' or strip(line) == '': line = file.readline() if not line: break --- 67,71 ---- else: # text modules can be directly examined line = file.readline() ! while line[:1] == '#' or not strip(line): line = file.readline() if not line: break *************** *** 126,131 **** def replace(text, *pairs): """Do a series of global replacements on a string.""" ! for old, new in pairs: ! text = join(split(text, old), new) return text --- 126,132 ---- def replace(text, *pairs): """Do a series of global replacements on a string.""" ! while pairs: ! text = join(split(text, pairs[0]), pairs[1]) ! pairs = pairs[2:] return text *************** *** 225,229 **** def escape(self, text): ! return replace(text, ('&', '&'), ('<', '<'), ('>', '>')) def repr(self, object): --- 226,230 ---- def escape(self, text): ! return replace(text, '&', '&', '<', '<', '>', '>') def repr(self, object): *************** *** 240,244 **** test = cram(x, self.maxstring) testrepr = repr(test) ! if '\\' in test and '\\' not in replace(testrepr, (r'\\', '')): # Backslashes are only literal in the string and are never # needed to make any special characters, so show a raw string. --- 241,245 ---- test = cram(x, self.maxstring) testrepr = repr(test) ! if '\\' in test and '\\' not in replace(testrepr, r'\\', ''): # Backslashes are only literal in the string and are never # needed to make any special characters, so show a raw string. *************** *** 317,322 **** """Format literal preformatted text.""" text = self.escape(expandtabs(text)) ! return replace(text, ('\n\n', '\n \n'), ('\n\n', '\n \n'), ! (' ', ' '), ('\n', '
\n')) def multicolumn(self, list, format, cols=4): --- 318,323 ---- """Format literal preformatted text.""" text = self.escape(expandtabs(text)) ! return replace(text, '\n\n', '\n \n', '\n\n', '\n \n', ! ' ', ' ', '\n', '
\n') def multicolumn(self, list, format, cols=4): *************** *** 344,350 **** def classlink(self, object, modname, *dicts): """Make a link for a class.""" ! name = object.__name__ ! if object.__module__ != modname: ! name = object.__module__ + '.' + name for dict in dicts: if dict.has_key(object): --- 345,349 ---- def classlink(self, object, modname, *dicts): """Make a link for a class.""" ! name = classname(object, modname) for dict in dicts: if dict.has_key(object): *************** *** 426,430 **** return '
\n%s
\n' % result ! def docmodule(self, object, name=None): """Produce HTML documentation for a module object.""" name = object.__name__ # ignore the passed-in name --- 425,429 ---- return '
\n%s
\n' % result ! def docmodule(self, object, name=None, mod=None): """Produce HTML documentation for a module object.""" name = object.__name__ # ignore the passed-in name *************** *** 510,514 **** inspect.getclasstree(classlist, 1), name, cdict)] for key, value in classes: ! contents.append(self.document(value, key, fdict, cdict)) result = result + self.bigsection( 'Classes', '#ffffff', '#ee77aa', join(contents)) --- 509,513 ---- inspect.getclasstree(classlist, 1), name, cdict)] for key, value in classes: ! contents.append(self.document(value, key, name, fdict, cdict)) result = result + self.bigsection( 'Classes', '#ffffff', '#ee77aa', join(contents)) *************** *** 516,520 **** contents = [] for key, value in funcs: ! contents.append(self.document(value, key, fdict, cdict)) result = result + self.bigsection( 'Functions', '#ffffff', '#eeaa77', join(contents)) --- 515,519 ---- contents = [] for key, value in funcs: ! contents.append(self.document(value, key, name, fdict, cdict)) result = result + self.bigsection( 'Functions', '#ffffff', '#eeaa77', join(contents)) *************** *** 536,540 **** return result ! def docclass(self, object, name=None, funcs={}, classes={}): """Produce HTML documentation for a class object.""" realname = object.__name__ --- 535,539 ---- return result ! def docclass(self, object, name=None, mod=None, funcs={}, classes={}): """Produce HTML documentation for a class object.""" realname = object.__name__ *************** *** 543,554 **** contents = '' ! methods, mdict = [], {} ! for key, value in allmethods(object).items(): ! methods.append((key, value)) ! mdict[key] = mdict[value] = '#' + name + '-' + key methods.sort() for key, value in methods: contents = contents + self.document( ! value, key, funcs, classes, mdict, object) if name == realname: --- 542,552 ---- contents = '' ! methods, mdict = allmethods(object).items(), {} methods.sort() for key, value in methods: + mdict[key] = mdict[value] = '#' + name + '-' + key + for key, value in methods: contents = contents + self.document( ! value, key, mod, funcs, classes, mdict, object) if name == realname: *************** *** 574,578 **** return self.small(self.grey('=' + self.repr(object))) ! def docroutine(self, object, name=None, funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" --- 572,576 ---- return self.small(self.grey('=' + self.repr(object))) ! def docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" *************** *** 584,599 **** if inspect.ismethod(object): if cl: ! if object.im_class is not cl: ! base = object.im_class ! url = '#%s-%s' % (base.__name__, name) ! basename = base.__name__ ! if base.__module__ != cl.__module__: ! url = base.__module__ + '.html' + url ! basename = base.__module__ + '.' + basename ! note = ' from %s' % (url, basename) skipdocs = 1 else: note = (object.im_self and ! ' method of ' + self.repr(object.im_self) or ' unbound %s method' % object.im_class.__name__) object = object.im_func --- 582,595 ---- if inspect.ismethod(object): if cl: ! imclass = object.im_class ! if imclass is not cl: ! url = '%s.html#%s-%s' % ( ! imclass.__module__, imclass.__name__, name) ! note = ' from %s' % ( ! url, classname(imclass, mod)) skipdocs = 1 else: note = (object.im_self and ! ' method of %s instance' + object.im_self.__class__ or ' unbound %s method' % object.im_class.__name__) object = object.im_func *************** *** 632,638 **** return '
%s%s
\n' % (decl, doc) ! def docother(self, object, name=None): """Produce HTML documentation for a data object.""" ! return '%s = %s' % (name, self.repr(object)) def index(self, dir, shadowed=None): --- 628,635 ---- return '
%s%s
\n' % (decl, doc) ! def docother(self, object, name=None, mod=None): """Produce HTML documentation for a data object.""" ! lhs = name and '%s = ' % name or '' ! return lhs + self.repr(object) def index(self, dir, shadowed=None): *************** *** 683,687 **** test = cram(x, self.maxstring) testrepr = repr(test) ! if '\\' in test and '\\' not in replace(testrepr, (r'\\', '')): # Backslashes are only literal in the string and are never # needed to make any special characters, so show a raw string. --- 680,684 ---- test = cram(x, self.maxstring) testrepr = repr(test) ! if '\\' in test and '\\' not in replace(testrepr, r'\\', ''): # Backslashes are only literal in the string and are never # needed to make any special characters, so show a raw string. *************** *** 737,741 **** return result ! def docmodule(self, object, name=None): """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name --- 734,738 ---- return result ! def docmodule(self, object, name=None, mod=None): """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name *************** *** 781,785 **** inspect.getclasstree(classlist, 1), name)] for key, value in classes: ! contents.append(self.document(value, key)) result = result + self.section('CLASSES', join(contents, '\n')) --- 778,782 ---- inspect.getclasstree(classlist, 1), name)] for key, value in classes: ! contents.append(self.document(value, key, name)) result = result + self.section('CLASSES', join(contents, '\n')) *************** *** 787,791 **** contents = [] for key, value in funcs: ! contents.append(self.document(value, key)) result = result + self.section('FUNCTIONS', join(contents, '\n')) --- 784,788 ---- contents = [] for key, value in funcs: ! contents.append(self.document(value, key, name)) result = result + self.section('FUNCTIONS', join(contents, '\n')) *************** *** 793,797 **** contents = [] for key, value in constants: ! contents.append(self.docother(value, key, 70)) result = result + self.section('CONSTANTS', join(contents, '\n')) --- 790,794 ---- contents = [] for key, value in constants: ! contents.append(self.docother(value, key, name, 70)) result = result + self.section('CONSTANTS', join(contents, '\n')) *************** *** 809,813 **** return result ! def docclass(self, object, name=None): """Produce text documentation for a given class object.""" realname = object.__name__ --- 806,810 ---- return result ! def docclass(self, object, name=None, mod=None): """Produce text documentation for a given class object.""" realname = object.__name__ *************** *** 829,833 **** methods.sort() for key, value in methods: ! contents = contents + '\n' + self.document(value, key, object) if not contents: return title + '\n' --- 826,830 ---- methods.sort() for key, value in methods: ! contents = contents + '\n' + self.document(value, key, mod, object) if not contents: return title + '\n' *************** *** 838,842 **** return '=' + self.repr(object) ! def docroutine(self, object, name=None, cl=None): """Produce text documentation for a function or method object.""" realname = object.__name__ --- 835,839 ---- return '=' + self.repr(object) ! def docroutine(self, object, name=None, mod=None, cl=None): """Produce text documentation for a function or method object.""" realname = object.__name__ *************** *** 845,861 **** skipdocs = 0 if inspect.ismethod(object): if cl: ! if object.im_class is not cl: ! base = object.im_class ! basename = base.__name__ ! if base.__module__ != cl.__module__: ! basename = base.__module__ + '.' + basename ! note = ' from %s' % basename skipdocs = 1 else: ! if object.im_self: ! note = ' method of %s' % self.repr(object.im_self) ! else: ! note = ' unbound %s method' % object.im_class.__name__ object = object.im_func --- 842,854 ---- skipdocs = 0 if inspect.ismethod(object): + imclass = object.im_class if cl: ! if imclass is not cl: ! note = ' from ' + classname(imclass, mod) skipdocs = 1 else: ! note = (object.im_self and ! ' method of %s instance' + object.im_self.__class__ or ! ' unbound %s method' % classname(imclass, mod)) object = object.im_func *************** *** 884,895 **** return decl + '\n' + (doc and rstrip(self.indent(doc)) + '\n') ! def docother(self, object, name=None, maxlen=None): """Produce text documentation for a data object.""" repr = self.repr(object) if maxlen: ! line = name + ' = ' + repr chop = maxlen - len(line) if chop < 0: repr = repr[:chop] + '...' ! line = self.bold(name) + ' = ' + repr return line --- 877,888 ---- return decl + '\n' + (doc and rstrip(self.indent(doc)) + '\n') ! def docother(self, object, name=None, mod=None, maxlen=None): """Produce text documentation for a data object.""" repr = self.repr(object) if maxlen: ! line = (name and name + ' = ' or '') + repr chop = maxlen - len(line) if chop < 0: repr = repr[:chop] + '...' ! line = (name and self.bold(name) + ' = ' or '') + repr return line *************** *** 1018,1085 **** return type(thing).__name__ ! def freshimport(name, cache={}): ! """Import a module, reloading it if the source file has changed.""" ! topmodule = __import__(name) ! module = None ! for component in split(name, '.'): ! if module == None: ! module = topmodule ! path = split(name, '.')[0] else: ! module = getattr(module, component) ! path = path + '.' + component ! if hasattr(module, '__file__'): ! file = module.__file__ ! if os.path.exists(file): ! info = (file, os.path.getmtime(file), os.path.getsize(file)) ! if cache.get(path) == info: ! continue ! module = reload(module) ! file = module.__file__ ! if os.path.exists(file): ! info = (file, os.path.getmtime(file), os.path.getsize(file)) ! cache[path] = info return module def locate(path): ! """Locate an object by name (or dotted path), importing as necessary.""" ! if not path: # special case: imp.find_module('') strangely succeeds ! return None ! if type(path) is not types.StringType: ! return path parts = split(path, '.') ! n = len(parts) ! while n > 0: ! path = join(parts[:n], '.') ! try: ! module = freshimport(path) ! except: ! # Did the error occur before or after the module was found? ! (exc, value, tb) = info = sys.exc_info() ! if sys.modules.has_key(path): ! # An error occured while executing the imported module. ! raise ErrorDuringImport(sys.modules[path].__file__, info) ! elif exc is SyntaxError: ! # A SyntaxError occurred before we could execute the module. ! raise ErrorDuringImport(value.filename, info) ! elif exc is ImportError and \ ! split(lower(str(value)))[:2] == ['no', 'module']: ! # The module was not found. ! n = n - 1 ! continue ! else: ! # Some other error occurred before executing the module. ! raise ErrorDuringImport(path, sys.exc_info()) ! try: ! x = module ! for p in parts[n:]: ! x = getattr(x, p) ! return x ! except AttributeError: ! n = n - 1 ! continue ! if hasattr(__builtins__, path): ! return getattr(__builtins__, path) ! return None # --------------------------------------- interactive interpreter interface --- 1011,1063 ---- return type(thing).__name__ ! def freshimport(path, cache={}): ! """Import a module freshly from disk, making sure it's up to date.""" ! if sys.modules.has_key(path): ! # This is the only way to be sure. Checking the mtime of the file ! # isn't good enough (e.g. what if the module contains a class that ! # inherits from another module that has changed?). ! if path not in sys.builtin_module_names: ! del sys.modules[path] ! try: ! module = __import__(path) ! except: ! # Did the error occur before or after the module was found? ! (exc, value, tb) = info = sys.exc_info() ! if sys.modules.has_key(path): ! # An error occured while executing the imported module. ! raise ErrorDuringImport(sys.modules[path].__file__, info) ! elif exc is SyntaxError: ! # A SyntaxError occurred before we could execute the module. ! raise ErrorDuringImport(value.filename, info) ! elif exc is ImportError and \ ! split(lower(str(value)))[:2] == ['no', 'module']: ! # The module was not found. ! return None else: ! # Some other error occurred during the importing process. ! raise ErrorDuringImport(path, sys.exc_info()) ! for part in split(path, '.')[1:]: ! try: module = getattr(module, part) ! except AttributeError: return None return module def locate(path): ! """Locate an object by name or dotted path, importing as necessary.""" parts = split(path, '.') ! module, n = None, 0 ! while n < len(parts): ! nextmodule = freshimport(join(parts[:n+1], '.')) ! if nextmodule: module, n = nextmodule, n + 1 ! else: break ! if module: ! object = module ! for part in parts[n:]: ! try: object = getattr(object, part) ! except AttributeError: return None ! return object ! else: ! import __builtin__ ! if hasattr(__builtin__, path): ! return getattr(__builtin__, path) # --------------------------------------- interactive interpreter interface *************** *** 1088,1094 **** html = HTMLDoc() ! def doc(thing): ! """Display documentation on an object (for interactive use).""" ! if type(thing) is type(""): try: object = locate(thing) --- 1066,1073 ---- html = HTMLDoc() ! def doc(thing, title='Python Library Documentation: '): ! """Display text documentation, given an object or a path to an object.""" ! suffix, name = '', None ! if type(thing) is type(''): try: object = locate(thing) *************** *** 1096,1110 **** print value return ! if object: ! thing = object ! else: print 'no Python documentation found for %s' % repr(thing) return desc = describe(thing) module = inspect.getmodule(thing) ! if module and module is not thing: ! desc = desc + ' in module ' + module.__name__ ! pager('Help on %s:\n\n' % desc + text.document(thing)) def writedoc(key): --- 1075,1091 ---- print value return ! if not object: print 'no Python documentation found for %s' % repr(thing) return + parts = split(thing, '.') + if len(parts) > 1: suffix = ' in ' + join(parts[:-1], '.') + name = parts[-1] + thing = object desc = describe(thing) module = inspect.getmodule(thing) ! if not suffix and module and module is not thing: ! suffix = ' in module ' + module.__name__ ! pager(title + desc + suffix + '\n\n' + text.document(object, name)) def writedoc(key): *************** *** 1155,1177 **** help = Helper() - def man(key): - """Display documentation on an object in a form similar to man(1).""" - object = locate(key) - if object: - title = 'Python Library Documentation: ' + describe(object) - lastdot = rfind(key, '.') - if lastdot > 0: title = title + ' in ' + key[:lastdot] - pager('\n' + title + '\n\n' + text.document(object, key)) - found = 1 - else: - print 'no Python documentation found for %s' % repr(key) - class Scanner: """A generic tree iterator.""" ! def __init__(self, roots, children, recurse): self.roots = roots[:] self.state = [] self.children = children ! self.recurse = recurse def next(self): --- 1136,1146 ---- help = Helper() class Scanner: """A generic tree iterator.""" ! def __init__(self, roots, children, descendp): self.roots = roots[:] self.state = [] self.children = children ! self.descendp = descendp def next(self): *************** *** 1186,1190 **** return self.next() child = children.pop(0) ! if self.recurse(child): self.state.append((child, self.children(child))) return child --- 1155,1159 ---- return self.next() child = children.pop(0) ! if self.descendp(child): self.state.append((child, self.children(child))) return child *************** *** 1204,1208 **** else: children.append((path, package)) ! children.sort() return children --- 1173,1177 ---- else: children.append((path, package)) ! children.sort() # so that spam.py comes before spam.pyc or spam.pyo return children *************** *** 1211,1214 **** --- 1180,1184 ---- def run(self, key, callback, completer=None): + key = lower(key) self.quit = 0 seen = {} *************** *** 1218,1222 **** seen[modname] = 1 desc = split(freshimport(modname).__doc__ or '', '\n')[0] ! if find(lower(modname + ' - ' + desc), lower(key)) >= 0: callback(None, modname, desc) --- 1188,1192 ---- seen[modname] = 1 desc = split(freshimport(modname).__doc__ or '', '\n')[0] ! if find(lower(modname + ' - ' + desc), key) >= 0: callback(None, modname, desc) *************** *** 1229,1236 **** modname = package + (package and '.') + modname if not seen.has_key(modname): ! seen[modname] = 1 ! desc = synopsis(path) or '' ! if find(lower(modname + ' - ' + desc), lower(key)) >= 0: ! callback(path, modname, desc) if completer: completer() --- 1199,1209 ---- modname = package + (package and '.') + modname if not seen.has_key(modname): ! seen[modname] = 1 # if we see spam.py, skip spam.pyc ! if key: ! desc = synopsis(path) or '' ! if find(lower(modname + ' - ' + desc), key) >= 0: ! callback(path, modname, desc) ! else: ! callback(path, modname, '') if completer: completer() *************** *** 1248,1253 **** # --------------------------------------------------- web browser interface ! def serve(port, callback=None): ! import BaseHTTPServer, mimetools, select # Patch up mimetools.Message so it doesn't break if rfc822 is reloaded. --- 1221,1226 ---- # --------------------------------------------------- web browser interface ! def serve(port, callback=None, finalizer=None): ! import BaseHTTPServer, SocketServer, mimetools, select # Patch up mimetools.Message so it doesn't break if rfc822 is reloaded. *************** *** 1307,1311 **** def log_message(self, *args): pass ! class DocServer(BaseHTTPServer.HTTPServer): def __init__(self, port, callback): host = (sys.platform == 'mac') and '127.0.0.1' or 'localhost' --- 1280,1284 ---- def log_message(self, *args): pass ! class DocServer(SocketServer.ForkingMixIn, BaseHTTPServer.HTTPServer): def __init__(self, port, callback): host = (sys.platform == 'mac') and '127.0.0.1' or 'localhost' *************** *** 1330,1337 **** DocHandler.MessageClass = Message try: ! DocServer(port, callback).serve_until_quit() ! except (KeyboardInterrupt, select.error): ! pass ! print 'server stopped' # ----------------------------------------------------- graphical interface --- 1303,1312 ---- DocHandler.MessageClass = Message try: ! try: ! DocServer(port, callback).serve_until_quit() ! except (KeyboardInterrupt, select.error): ! pass ! finally: ! if finalizer: finalizer() # ----------------------------------------------------- graphical interface *************** *** 1405,1409 **** import threading ! threading.Thread(target=serve, args=(port, self.ready)).start() def ready(self, server): --- 1380,1385 ---- import threading ! threading.Thread( ! target=serve, args=(port, self.ready, self.quit)).start() def ready(self, server): *************** *** 1545,1550 **** raise BadUsage def ready(server): ! print 'server ready at %s' % server.url ! serve(port, ready) return if opt == '-w': --- 1521,1528 ---- raise BadUsage def ready(server): ! print 'pydoc server ready at %s' % server.url ! def stopped(): ! print 'pydoc server stopped' ! serve(port, ready, stopped) return if opt == '-w': *************** *** 1562,1566 **** writedoc(arg) else: ! man(arg) except ErrorDuringImport, value: print value --- 1540,1544 ---- writedoc(arg) else: ! doc(arg) except ErrorDuringImport, value: print value From ping@users.sourceforge.net Thu Apr 12 12:59:52 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 12 Apr 2001 04:59:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14013 Modified Files: pydoc.py Log Message: Typo fixes and small touches. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** pydoc.py 2001/04/12 10:50:23 1.24 --- pydoc.py 2001/04/12 11:59:50 1.25 *************** *** 1066,1070 **** html = HTMLDoc() ! def doc(thing, title='Python Library Documentation: '): """Display text documentation, given an object or a path to an object.""" suffix, name = '', None --- 1066,1070 ---- html = HTMLDoc() ! def doc(thing, title='Python Library Documentation: %s'): """Display text documentation, given an object or a path to an object.""" suffix, name = '', None *************** *** 1087,1091 **** if not suffix and module and module is not thing: suffix = ' in module ' + module.__name__ ! pager(title + desc + suffix + '\n\n' + text.document(object, name)) def writedoc(key): --- 1087,1091 ---- if not suffix and module and module is not thing: suffix = ' in module ' + module.__name__ ! pager(title % (desc + suffix) + '\n\n' + text.document(thing, name)) def writedoc(key): *************** *** 1179,1184 **** return ispackage(dir) ! def run(self, key, callback, completer=None): ! key = lower(key) self.quit = 0 seen = {} --- 1179,1184 ---- return ispackage(dir) ! def run(self, callback, key=None, completer=None): ! if key: key = lower(key) self.quit = 0 seen = {} *************** *** 1187,1193 **** if modname != '__main__': seen[modname] = 1 ! desc = split(freshimport(modname).__doc__ or '', '\n')[0] ! if find(lower(modname + ' - ' + desc), key) >= 0: ! callback(None, modname, desc) while not self.quit: --- 1187,1196 ---- if modname != '__main__': seen[modname] = 1 ! if key is None: ! callback(None, modname, '') ! else: ! desc = split(freshimport(modname).__doc__ or '', '\n')[0] ! if find(lower(modname + ' - ' + desc), key) >= 0: ! callback(None, modname, desc) while not self.quit: *************** *** 1200,1209 **** if not seen.has_key(modname): seen[modname] = 1 # if we see spam.py, skip spam.pyc ! if key: desc = synopsis(path) or '' if find(lower(modname + ' - ' + desc), key) >= 0: callback(path, modname, desc) - else: - callback(path, modname, '') if completer: completer() --- 1203,1212 ---- if not seen.has_key(modname): seen[modname] = 1 # if we see spam.py, skip spam.pyc ! if key is None: ! callback(path, modname, '') ! else: desc = synopsis(path) or '' if find(lower(modname + ' - ' + desc), key) >= 0: callback(path, modname, desc) if completer: completer() *************** *** 1217,1225 **** except ImportError: pass else: warnings.filterwarnings('ignore') # ignore problems during import ! ModuleScanner().run(key, callback) # --------------------------------------------------- web browser interface ! def serve(port, callback=None, finalizer=None): import BaseHTTPServer, SocketServer, mimetools, select --- 1220,1228 ---- except ImportError: pass else: warnings.filterwarnings('ignore') # ignore problems during import ! ModuleScanner().run(callback, key) # --------------------------------------------------- web browser interface ! def serve(port, callback=None, completer=None): import BaseHTTPServer, SocketServer, mimetools, select *************** *** 1308,1312 **** pass finally: ! if finalizer: finalizer() # ----------------------------------------------------- graphical interface --- 1311,1315 ---- pass finally: ! if completer: completer() # ----------------------------------------------------- graphical interface From gvanrossum@users.sourceforge.net Thu Apr 12 13:27:36 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 12 Apr 2001 05:27:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python getcopyright.c,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv18200 Modified Files: getcopyright.c Log Message: Update copyright to PSF. Index: getcopyright.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getcopyright.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** getcopyright.c 2001/01/18 14:50:11 1.13 --- getcopyright.c 2001/04/12 12:27:34 1.14 *************** *** 5,9 **** static char cprt[] = "\ ! Copyright (c) 2000, 2001 Guido van Rossum.\n\ All Rights Reserved.\n\ \n\ --- 5,9 ---- static char cprt[] = "\ ! Copyright (c) 2001 Python Software Foundation.\n\ All Rights Reserved.\n\ \n\ From fdrake@users.sourceforge.net Thu Apr 12 13:37:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 12 Apr 2001 05:37:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref5.tex,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv20058/ref Modified Files: ref5.tex Log Message: Work around the conversion of ">>" and "<<" to guillemets. Reported by Ping on the Doc-SIG mailing list. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -r1.42 -r1.43 *** ref5.tex 2001/03/06 07:32:11 1.42 --- ref5.tex 2001/04/12 12:37:03 1.43 *************** *** 932,936 **** \lineii{\code{\&}} {Bitwise AND} \hline ! \lineii{\code{<<}, \code{>>}} {Shifts} \hline \lineii{\code{+}, \code{-}}{Addition and subtraction} --- 932,936 ---- \lineii{\code{\&}} {Bitwise AND} \hline ! \lineii{\code{<}\code{<}, \code{>}\code{>}} {Shifts} \hline \lineii{\code{+}, \code{-}}{Addition and subtraction} From ping@users.sourceforge.net Thu Apr 12 13:54:38 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 12 Apr 2001 05:54:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23127 Modified Files: pydoc.py Log Message: Remove forking. Doesn't work in Windows. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** pydoc.py 2001/04/12 11:59:50 1.25 --- pydoc.py 2001/04/12 12:54:36 1.26 *************** *** 1225,1229 **** def serve(port, callback=None, completer=None): ! import BaseHTTPServer, SocketServer, mimetools, select # Patch up mimetools.Message so it doesn't break if rfc822 is reloaded. --- 1225,1229 ---- def serve(port, callback=None, completer=None): ! import BaseHTTPServer, mimetools, select # Patch up mimetools.Message so it doesn't break if rfc822 is reloaded. *************** *** 1283,1287 **** def log_message(self, *args): pass ! class DocServer(SocketServer.ForkingMixIn, BaseHTTPServer.HTTPServer): def __init__(self, port, callback): host = (sys.platform == 'mac') and '127.0.0.1' or 'localhost' --- 1283,1287 ---- def log_message(self, *args): pass ! class DocServer(BaseHTTPServer.HTTPServer): def __init__(self, port, callback): host = (sys.platform == 'mac') and '127.0.0.1' or 'localhost' From ping@users.sourceforge.net Thu Apr 12 14:17:19 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 12 Apr 2001 06:17:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26252 Modified Files: inspect.py Log Message: Robustify getcomments() so it doesn't crash on empty files. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** inspect.py 2001/04/10 11:43:00 1.12 --- inspect.py 2001/04/12 13:17:17 1.13 *************** *** 306,313 **** # Look for a comment block at the top of the file. start = 0 ! if lines[0][:2] == '#!': start = 1 while start < len(lines) and string.strip(lines[start]) in ['', '#']: start = start + 1 ! if lines[start][:1] == '#': comments = [] end = start --- 306,313 ---- # Look for a comment block at the top of the file. start = 0 ! if lines and lines[0][:2] == '#!': start = 1 while start < len(lines) and string.strip(lines[start]) in ['', '#']: start = start + 1 ! if start < len(lines) and lines[start][:1] == '#': comments = [] end = start From ping@users.sourceforge.net Thu Apr 12 14:37:41 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 12 Apr 2001 06:37:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29541 Modified Files: pydoc.py Log Message: Give up trying to keep dynamically loaded extensions up to date: the import.c machinery has soundly defeated my every attempt. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** pydoc.py 2001/04/12 12:54:36 1.26 --- pydoc.py 2001/04/12 13:37:39 1.27 *************** *** 1018,1022 **** # inherits from another module that has changed?). if path not in sys.builtin_module_names: ! del sys.modules[path] try: module = __import__(path) --- 1018,1028 ---- # inherits from another module that has changed?). if path not in sys.builtin_module_names: ! # Python never loads a dynamic extension a second time from the ! # same path, even if the file is changed or missing. Deleting ! # the entry in sys.modules doesn't help for dynamic extensions, ! # so we're not even going to try to keep them up to date. ! info = inspect.getmoduleinfo(sys.modules[path].__file__) ! if info[3] != imp.C_EXTENSION: ! del sys.modules[path] try: module = __import__(path) From fdrake@users.sourceforge.net Thu Apr 12 17:47:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 12 Apr 2001 09:47:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libbase64.tex,1.16,1.17 libjpeg.tex,1.15,1.16 libre.tex,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv30595/lib Modified Files: libbase64.tex libjpeg.tex libre.tex Log Message: Convert several \seetext references to \seerfc and \seetitle versions. These format somewhat better and include more semantic information in the source. Index: libbase64.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbase64.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** libbase64.tex 2000/10/18 17:43:06 1.16 --- libbase64.tex 2001/04/12 16:47:17 1.17 *************** *** 53,60 **** \seemodule{binascii}{Support module containing \ASCII{}-to-binary and binary-to-\ASCII{} conversions.} ! \seetext{Internet \rfc{1521}, \emph{MIME (Multipurpose Internet ! Mail Extensions) Part One: Mechanisms for Specifying and ! Describing the Format of Internet Message Bodies}, section ! 5.2, ``Base64 Content-Transfer-Encoding,'' provides the ! definition of the base64 encoding.} \end{seealso} --- 53,60 ---- \seemodule{binascii}{Support module containing \ASCII{}-to-binary and binary-to-\ASCII{} conversions.} ! \seerfc{1521}{MIME (Multipurpose Internet Mail Extensions) Part One: ! Mechanisms for Specifying and Describing the Format of ! Internet Message Bodies}{Section 5.2, ``Base64 ! Content-Transfer-Encoding,'' provides the definition of the ! base64 encoding.} \end{seealso} Index: libjpeg.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libjpeg.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** libjpeg.tex 1999/03/12 15:27:35 1.15 --- libjpeg.tex 2001/04/12 16:47:17 1.16 *************** *** 69,78 **** \begin{seealso} ! \seetext{\emph{JPEG Still Image Data Compression Standard}, by ! Pennebaker and Mitchell, is the canonical reference for the JPEG ! image format.} ! \seetext{The ISO standard for JPEG is also published as ITU T.81. ! This is available in PDF form at ! \url{http://www.w3.org/Graphics/JPEG/itu-t81.pdf}.} \end{seealso} --- 69,80 ---- \begin{seealso} ! \seetitle{JPEG Still Image Data Compression Standard}{The ! canonical reference for the JPEG image format, by ! Pennebaker and Mitchell.} ! \seetitle[http://www.w3.org/Graphics/JPEG/itu-t81.pdf]{Information ! Technology - Digital Compression and Coding of ! Continuous-tone Still Images - Requirements and ! Guidelines}{The ISO standard for JPEG is also published as ! ITU T.81. This is available online in PDF form.} \end{seealso} Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -r1.59 -r1.60 *** libre.tex 2000/10/18 23:08:13 1.59 --- libre.tex 2001/04/12 16:47:17 1.60 *************** *** 44,47 **** --- 44,56 ---- + \begin{seealso} + \seetitle{Mastering Regular Expressions}{Book on regular expressions + by Jeffrey Friedl, published by O'Reilly. The Python + material in this book dates from before the \refmodule{re} + module, but it covers writing good regular expression + patterns in great detail.} + \end{seealso} + + \subsection{Regular Expression Syntax \label{re-syntax}} *************** *** 752,761 **** The string passed to \function{match()} or \function{search()}. \end{memberdesc} - - \begin{seealso} - \seetext{Jeffrey Friedl, \citetitle{Mastering Regular Expressions}, - O'Reilly. The Python material in this book dates from before the - \module{re} module, but it covers writing good regular expression - patterns in great detail.} - \end{seealso} - --- 761,762 ---- From jhylton@users.sourceforge.net Thu Apr 12 18:33:37 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 12 Apr 2001 10:33:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pyassem.py,1.17,1.18 pycodegen.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv6736/compiler Modified Files: pyassem.py pycodegen.py Log Message: Revise handling of tuple arguments so that the variables names match those used by compile.c. (test_grammar now depends on the names) Index: pyassem.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pyassem.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** pyassem.py 2001/04/12 06:40:42 1.17 --- pyassem.py 2001/04/12 17:33:34 1.18 *************** *** 496,500 **** return "TupleArg(%s, %s)" % (self.count, self.names) def getName(self): ! return ".nested%d" % self.count def getArgCount(args): --- 496,500 ---- return "TupleArg(%s, %s)" % (self.count, self.names) def getName(self): ! return ".%d" % self.count def getArgCount(args): Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** pycodegen.py 2001/04/12 06:52:27 1.34 --- pycodegen.py 2001/04/12 17:33:34 1.35 *************** *** 1102,1110 **** def generateArgUnpack(self, args): ! count = 0 ! for arg in args: if type(arg) == types.TupleType: ! self.emit('LOAD_FAST', '.nested%d' % count) ! count = count + 1 self.unpackSequence(arg) --- 1102,1109 ---- def generateArgUnpack(self, args): ! for i in range(len(args)): ! arg = args[i] if type(arg) == types.TupleType: ! self.emit('LOAD_FAST', '.%d' % (i * 2)) self.unpackSequence(arg) *************** *** 1185,1195 **** extra = [] count = 0 ! for elt in arglist: if type(elt) == types.StringType: args.append(elt) elif type(elt) == types.TupleType: ! args.append(TupleArg(count, elt)) ! count = count + 1 extra.extend(misc.flatten(elt)) else: raise ValueError, "unexpect argument type:", elt --- 1184,1195 ---- extra = [] count = 0 ! for i in range(len(arglist)): ! elt = arglist[i] if type(elt) == types.StringType: args.append(elt) elif type(elt) == types.TupleType: ! args.append(TupleArg(i * 2, elt)) extra.extend(misc.flatten(elt)) + count = count + 1 else: raise ValueError, "unexpect argument type:", elt From tim_one@users.sourceforge.net Thu Apr 12 19:38:50 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 12 Apr 2001 11:38:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_format.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15600/python/dist/src/Lib/test Modified Files: test_format.py Log Message: Bug 415514 reported that e.g. "%#x" % 0 blew up, at heart because C sprintf supplies a base marker if and only if the value is not 0. I then fixed that, by tolerating C's inconsistency when it does %#x, and taking away that *Python* produced 0x0 when formatting 0L (the "long" flavor of 0) under %#x itself. But after talking with Guido, we agreed it would be better to supply 0x for the short int case too, despite that it's inconsistent with C, because C is inconsistent with itself and with Python's hex(0) (plus, while "%#x" % 0 didn't work before, "%#x" % 0L *did*, and returned "0x0"). Similarly for %#X conversion. Index: test_format.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_format.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** test_format.py 2001/04/12 00:35:50 1.10 --- test_format.py 2001/04/12 18:38:48 1.11 *************** *** 177,184 **** testboth("%d", 0, "0") testboth("%d", 0L, "0") ! testboth("%#x", 0, "0") ! testboth("%#x", 0L, "0") ! testboth("%#X", 0, "0") ! testboth("%#X", 0L, "0") testboth("%x", 0x42, "42") --- 177,184 ---- testboth("%d", 0, "0") testboth("%d", 0L, "0") ! testboth("%#x", 0, "0x0") ! testboth("%#x", 0L, "0x0") ! testboth("%#X", 0, "0X0") ! testboth("%#X", 0L, "0X0") testboth("%x", 0x42, "42") From tim_one@users.sourceforge.net Thu Apr 12 19:38:50 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 12 Apr 2001 11:38:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.101,2.102 unicodeobject.c,2.81,2.82 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv15600/python/dist/src/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Bug 415514 reported that e.g. "%#x" % 0 blew up, at heart because C sprintf supplies a base marker if and only if the value is not 0. I then fixed that, by tolerating C's inconsistency when it does %#x, and taking away that *Python* produced 0x0 when formatting 0L (the "long" flavor of 0) under %#x itself. But after talking with Guido, we agreed it would be better to supply 0x for the short int case too, despite that it's inconsistent with C, because C is inconsistent with itself and with Python's hex(0) (plus, while "%#x" % 0 didn't work before, "%#x" % 0L *did*, and returned "0x0"). Similarly for %#X conversion. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.101 retrieving revision 2.102 diff -C2 -r2.101 -r2.102 *** stringobject.c 2001/04/12 00:35:51 2.101 --- stringobject.c 2001/04/12 18:38:48 2.102 *************** *** 2576,2589 **** assert(numdigits > 0); ! /* Get rid of base marker unless F_ALT. Even if F_ALT, leading 0x ! * must be stripped if the *value* is 0. ! */ ! if ((flags & F_ALT) == 0 || ! ((flags & F_ALT) && ! (type == 'x' || type == 'X') && ! numdigits == 1 && ! !sign && ! buf[2] == '0' ! )) { /* Need to skip 0x, 0X or 0. */ int skipped = 0; --- 2576,2581 ---- assert(numdigits > 0); ! /* Get rid of base marker unless F_ALT */ ! if ((flags & F_ALT) == 0) { /* Need to skip 0x, 0X or 0. */ int skipped = 0; *************** *** 2679,2682 **** --- 2671,2684 ---- } sprintf(buf, fmt, x); + /* When converting 0 under %#x or %#X, C leaves off the base marker, + * but we want it (for consistency with other %#x conversions, and + * for consistency with Python's hex() function). + */ + if (x == 0 && (flags & F_ALT) && (type == 'x' || type == 'X')) { + assert(buf[1] != type); /* else this C *is* adding 0x/0X */ + memmove(buf+2, buf, strlen(buf) + 1); + buf[0] = '0'; + buf[1] = (char)type; + } return strlen(buf); } *************** *** 3024,3042 **** } if ((flags & F_ALT) && (c == 'x' || c == 'X')) { - /* There's a base marker ("0x" or "0X") if and - * only if the value is non-zero. - */ assert(pbuf[0] == '0'); ! if (pbuf[1] == c) { ! if (fill != ' ') { ! *res++ = *pbuf++; ! *res++ = *pbuf++; ! } ! rescnt -= 2; ! width -= 2; ! if (width < 0) ! width = 0; ! len -= 2; ! } } if (width > len && !(flags & F_LJUST)) { --- 3026,3040 ---- } if ((flags & F_ALT) && (c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); ! assert(pbuf[1] == c); ! if (fill != ' ') { ! *res++ = *pbuf++; ! *res++ = *pbuf++; ! } ! rescnt -= 2; ! width -= 2; ! if (width < 0) ! width = 0; ! len -= 2; } if (width > len && !(flags & F_LJUST)) { *************** *** 3050,3055 **** *res++ = sign; if ((flags & F_ALT) && ! (c == 'x' || c == 'X') && ! pbuf[1] == c) { *res++ = *pbuf++; *res++ = *pbuf++; --- 3048,3054 ---- *res++ = sign; if ((flags & F_ALT) && ! (c == 'x' || c == 'X')) { ! assert(pbuf[0] == '0'); ! assert(pbuf[1] == c); *res++ = *pbuf++; *res++ = *pbuf++; Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.81 retrieving revision 2.82 diff -C2 -r2.81 -r2.82 *** unicodeobject.c 2001/04/12 00:35:51 2.81 --- unicodeobject.c 2001/04/12 18:38:48 2.82 *************** *** 4684,4688 **** return -1; } ! sprintf(fmt, "%%%s.%dl%c", (flags & F_ALT) ? "#" : "", prec, type); return usprintf(buf, fmt, x); } --- 4684,4695 ---- return -1; } ! /* When converting 0 under %#x or %#X, C leaves off the base marker, ! * but we want it (for consistency with other %#x conversions, and ! * for consistency with Python's hex() function). ! */ ! if (x == 0 && (flags & F_ALT) && (type == 'x' || type == 'X')) ! sprintf(fmt, "0%c%%%s.%dl%c", type, "#", prec, type); ! else ! sprintf(fmt, "%%%s.%dl%c", (flags & F_ALT) ? "#" : "", prec, type); return usprintf(buf, fmt, x); } *************** *** 5082,5096 **** if ((flags & F_ALT) && (c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); ! if (pbuf[1] == c) { ! if (fill != ' ') { ! *res++ = *pbuf++; ! *res++ = *pbuf++; ! } ! rescnt -= 2; ! width -= 2; ! if (width < 0) ! width = 0; ! len -= 2; ! } } if (width > len && !(flags & F_LJUST)) { --- 5089,5102 ---- if ((flags & F_ALT) && (c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); ! assert(pbuf[1] == c); ! if (fill != ' ') { ! *res++ = *pbuf++; ! *res++ = *pbuf++; ! } ! rescnt -= 2; ! width -= 2; ! if (width < 0) ! width = 0; ! len -= 2; } if (width > len && !(flags & F_LJUST)) { *************** *** 5103,5109 **** if (sign) *res++ = sign; ! if ((flags & F_ALT) && (c == 'x' || c == 'X') && ! pbuf[1] == c) { assert(pbuf[0] == '0'); *res++ = *pbuf++; *res++ = *pbuf++; --- 5109,5115 ---- if (sign) *res++ = sign; ! if ((flags & F_ALT) && (c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); + assert(pbuf[1] == c); *res++ = *pbuf++; *res++ = *pbuf++; From fdrake@users.sourceforge.net Thu Apr 12 20:34:40 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 12 Apr 2001 12:34:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libunittest.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv30066 Modified Files: libunittest.tex Log Message: Added module synopsis for the chapter summary. Added documentation for TestCase.assertRaises(). Added text for "Mapping concepts to classes", and merged it into the front matter instead of separating it into a new section. Removed use of "assert" in examples. Update the descriptions to reflect further changes from discussions on the pyunit-interest list. Added documentation for the defaultTestLoader object and the TestLoader methods. Added the assert*() names for the TestCase helper methods. Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** libunittest.tex 2001/04/12 04:50:06 1.3 --- libunittest.tex 2001/04/12 19:34:38 1.4 *************** *** 3,6 **** --- 3,7 ---- \declaremodule{standard}{unittest} + \modulesynopsis{Unit testing framework for Python.} \moduleauthor{Steve Purcell}{stephen\textunderscore{}purcell@yahoo.com} \sectionauthor{Steve Purcell}{stephen\textunderscore{}purcell@yahoo.com} *************** *** 20,24 **** set of tests. ! To achieve this, PyUnit supports three major concepts: \begin{definitions} --- 21,25 ---- set of tests. ! To achieve this, PyUnit supports some important concepts: \begin{definitions} *************** *** 48,52 **** --- 49,83 ---- + The test case and test fixture concepts are supported through the + \class{TestCase} and \class{FunctionTestCase} classes; the former + should be used when creating new tests, and the later can be used when + integrating existing test code with a PyUnit-driven framework. When + building test fixtures using \class{TestCase}, the \method{setUp()} + and \method{tearDown()} methods can be overridden to provide + initialization and cleanup for the fixture. With + \class{FunctionTestCase}, existing functions can be passed to the + constructor for these purposes. When the test is run, the + fixture initialization is run first; if it succeeds, the cleanup + method is run after the test has been executed, regardless of the + outcome of the test. Each instance of the \class{TestCase} will only + be used to run a single test method, so a new fixture is created for + each test. + + Test suites are implemented by the \class{TestSuite} class. This + class allows individual tests and test suites to be aggregated; when + the suite is executed, all tests added directly to the suite and in + ``child'' test suites are run. + + A test runner is an object that provides a single method, + \method{run()}, which accepts a \class{TestCase} or \class{TestSuite} + object as a parameter, and returns a result object. The class + \class{TestResult} is provided for use as the result object. PyUnit + provide the \class{TextTestRunner} as an example test runner which + reports test results on the standard error stream by default. + Alternate runners can be implemented for other environments (such as + graphical environments) without any need to derive from a specific + class. + \begin{seealso} \seetitle[http://pyunit.sourceforge.net/]{PyUnit Web Site}{The *************** *** 59,66 **** - \subsection{Mapping concepts to classes - \label{test-concept-classes}} - - \subsection{Organizing test code \label{organizing-tests}} --- 90,93 ---- *************** *** 90,102 **** def runTest(self): widget = Widget("The widget") ! assert widget.size() == (50,50), 'incorrect default size' \end{verbatim} ! Note that in order to test something, we just use the built-in 'assert' ! statement of Python. If the test fails when the test case runs, ! \class{TestFailed} will be raised, and the testing framework ! will identify the test case as a \dfn{failure}. Other exceptions that ! do not arise from explicit 'assert' checks are identified by the testing ! framework as dfn{errors}. The way to run a test case will be described later. For now, note --- 117,131 ---- def runTest(self): widget = Widget("The widget") ! self.failUnless(widget.size() == (50,50), 'incorrect default size') \end{verbatim} ! Note that in order to test something, we use the one of the ! \method{assert*()} or \method{fail*()} methods provided by the ! \class{TestCase} base class. If the test fails when the test case ! runs, an exception will be raised, and the testing framework will ! identify the test case as a \dfn{failure}. Other exceptions that do ! not arise from checks made through the \method{assert*()} and ! \method{fail*()} methods are identified by the testing framework as ! dfn{errors}. The way to run a test case will be described later. For now, note *************** *** 125,135 **** class DefaultWidgetSizeTestCase(SimpleWidgetTestCase): def runTest(self): ! assert self.widget.size() == (50,50), 'incorrect default size' class WidgetResizeTestCase(SimpleWidgetTestCase): def runTest(self): self.widget.resize(100,150) ! assert self.widget.size() == (100,150), \ ! 'wrong size after resize' \end{verbatim} --- 154,165 ---- class DefaultWidgetSizeTestCase(SimpleWidgetTestCase): def runTest(self): ! self.failUnless(self.widget.size() == (50,50), ! 'incorrect default size') class WidgetResizeTestCase(SimpleWidgetTestCase): def runTest(self): self.widget.resize(100,150) ! self.failUnless(self.widget.size() == (100,150), ! 'wrong size after resize') \end{verbatim} *************** *** 178,188 **** def testDefaultSize(self): ! assert self.widget.size() == (50,50), \ ! 'incorrect default size' def testResize(self): self.widget.resize(100,150) ! assert self.widget.size() == (100,150), \ ! 'wrong size after resize' \end{verbatim} --- 208,218 ---- def testDefaultSize(self): ! self.failUnless(self.widget.size() == (50,50), ! 'incorrect default size') def testResize(self): self.widget.resize(100,150) ! self.failUnless(self.widget.size() == (100,150), ! 'wrong size after resize') \end{verbatim} *************** *** 316,320 **** \end{verbatim} - \strong{Note:} PyUnit supports the use of \exception{AssertionError} as an indicator of test failure, but does not recommend it. Future --- 346,349 ---- *************** *** 335,339 **** \begin{classdesc}{FunctionTestCase}{testFunc\optional{, ! setup\optional{, tearDown\optional{, description}}}} This class implements the portion of the \class{TestCase} interface which allows the test runner to drive the test, but does not provide --- 364,368 ---- \begin{classdesc}{FunctionTestCase}{testFunc\optional{, ! setUp\optional{, tearDown\optional{, description}}}} This class implements the portion of the \class{TestCase} interface which allows the test runner to drive the test, but does not provide *************** *** 364,367 **** --- 393,402 ---- \end{classdesc} + \begin{datadesc}{defaultTestLoader} + Instance of the \class{TestLoader} class which can be shared. If no + customization of the \class{TestLoader} is needed, this instance can + always be used instead of creating new instances. + \end{datadesc} + \begin{classdesc}{TextTestRunner}{\optional{stream\optional{, descriptions\optional{, verbosity}}}} *************** *** 385,394 **** \end{funcdesc} - \begin{excdesc}{TestFailed} - Exception raised to indicate that a test failed. The - \method{TestCase.fail()} method is responsible for creating and - raising this exception. - \end{excdesc} - \subsection{TestCase Objects --- 420,423 ---- *************** *** 414,425 **** \end{methoddesc} - \begin{methoddesc}[TestCase]{run}{\optional{result}} - Run the test, collecting the result into the test result object - passed as \var{result}. If \var{result} is omitted or \code{None}, - a temporary result object is created and used, but is not made - available to the caller. This is equivalent to simply calling the - \class{TestCase} instance. - \end{methoddesc} - \begin{methoddesc}[TestCase]{tearDown}{} Method called immediately after the test method has been called and --- 443,446 ---- *************** *** 428,434 **** particularly careful about checking internal state. Any exception raised by this method will be considered an error rather than a test ! failure. The default implementation does nothing. \end{methoddesc} \begin{methoddesc}[TestCase]{debug}{} Run the test without collecting the result. This allows exceptions --- 449,465 ---- particularly careful about checking internal state. Any exception raised by this method will be considered an error rather than a test ! failure. This method will only be called if the \method{setUp()} ! succeeds, regardless of the outcome of the test method. ! The default implementation does nothing. \end{methoddesc} + \begin{methoddesc}[TestCase]{run}{\optional{result}} + Run the test, collecting the result into the test result object + passed as \var{result}. If \var{result} is omitted or \code{None}, + a temporary result object is created and used, but is not made + available to the caller. This is equivalent to simply calling the + \class{TestCase} instance. + \end{methoddesc} + \begin{methoddesc}[TestCase]{debug}{} Run the test without collecting the result. This allows exceptions *************** *** 439,465 **** The test code can use any of the following methods to check for and ! report failures: ! \begin{methoddesc}[TestCase]{failUnless}{expr\optional{, msg}} ! This method is similar to the \keyword{assert} statement, except it ! works even when Python is executed in ``optimizing'' mode (using the ! \programopt{-O} command line switch), and raises the ! \exception{TestFailed} exception. If \var{expr} is false, ! \exception{TestFailed} will be raised with \var{msg} as the ! message describing the failure; \code{None} will be used for the ! message if \var{msg} is omitted. \end{methoddesc} ! \begin{methoddesc}[TestCase]{failUnlessEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are equal. If the values do not compare equal, the test will fail with the explanation given by \var{msg}, or \code{None}. Note that using \method{failUnlessEqual()} improves upon doing the comparison as the first parameter to ! \method{failUnless()} is that the default value for \var{msg} can be computed to include representations of both \var{first} and \var{second}. \end{methoddesc} ! \begin{methoddesc}[TestCase]{failIfEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are not equal. If the values do compare equal, the test will fail with the explanation given by --- 470,495 ---- The test code can use any of the following methods to check for and ! report failures. ! \begin{methoddesc}[TestCase]{assert_}{expr\optional{, msg}} ! \methodline{failUnless}{expr\optional{, msg}} ! Signal a test failure if \var{expr} is false; the explanation for ! the error will be \var{msg} if given, otherwise it will be ! \code{None}. \end{methoddesc} ! \begin{methoddesc}[TestCase]{assertEqual}{first, second\optional{, msg}} ! \methodline{failUnlessEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are equal. If the values do not compare equal, the test will fail with the explanation given by \var{msg}, or \code{None}. Note that using \method{failUnlessEqual()} improves upon doing the comparison as the first parameter to ! \method{failUnless()}: the default value for \var{msg} can be computed to include representations of both \var{first} and \var{second}. \end{methoddesc} ! \begin{methoddesc}[TestCase]{assertNotEqual}{first, second\optional{, msg}} ! \methodline{failIfEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are not equal. If the values do compare equal, the test will fail with the explanation given by *************** *** 471,486 **** \end{methoddesc} \begin{methoddesc}[TestCase]{failIf}{expr\optional{, msg}} The inverse of the \method{failUnless()} method is the ! \method{failIf()} method. This raises \exception{TestFailed} if ! \var{expr} is true, with \var{msg} or \code{None} for the error ! message. \end{methoddesc} \begin{methoddesc}[TestCase]{fail}{\optional{msg}} ! Fail unconditionally, with \var{msg} or \code{None} for the error ! message. \end{methoddesc} Testing frameworks can use the following methods to collect --- 501,534 ---- \end{methoddesc} + \begin{methoddesc}[TestCase]{assertRaises}{exception, callable, \moreargs} + \methodline{failUnlessRaises}{exception, callable, \moreargs} + Test that an exception is raised when \var{callable} is called with + any positional or keyword arguments that are also passed to + \method{assertRaises()}. The test passes if \var{exception} is + raised, is an error if another exception is raised, or fails if no + exception is raised. To catch any of a group of exceptions, a tuple + containing the exception classes may be passed as \var{exception}. + \end{methoddesc} + \begin{methoddesc}[TestCase]{failIf}{expr\optional{, msg}} The inverse of the \method{failUnless()} method is the ! \method{failIf()} method. This signals a test failure if \var{expr} ! is true, with \var{msg} or \code{None} for the error message. \end{methoddesc} \begin{methoddesc}[TestCase]{fail}{\optional{msg}} ! Signals a test failure unconditionally, with \var{msg} or ! \code{None} for the error message. \end{methoddesc} + \begin{memberdesc}[TestCase]{failureException} + This class attribute gives the exception raised by the + \method{test()} method. If a test framework needs to use a + specialized exception, possibly to carry additional information, it + must subclass this exception in order to ``play fair'' with the + framework. The initial value of this attribute is + \exception{AssertionError}. + \end{memberdesc} + Testing frameworks can use the following methods to collect *************** *** 557,568 **** \begin{memberdesc}[TestResult]{errors} A list containing pairs of \class{TestCase} instances and the ! \function{sys.exc_info()} results for tests which raised exceptions ! other than \exception{AssertionError} and \exception{TestFailed}. \end{memberdesc} \begin{memberdesc}[TestResult]{failures} A list containing pairs of \class{TestCase} instances and the ! \function{sys.exc_info()} results for tests which raised either ! \exception{TestFailed} or \exception{AssertionError}. \end{memberdesc} --- 605,616 ---- \begin{memberdesc}[TestResult]{errors} A list containing pairs of \class{TestCase} instances and the ! \function{sys.exc_info()} results for tests which raised an ! exception but did not signal a test failure. \end{memberdesc} \begin{memberdesc}[TestResult]{failures} A list containing pairs of \class{TestCase} instances and the ! \function{sys.exc_info()} results for tests which signalled a ! failure in the code under test. \end{memberdesc} *************** *** 593,608 **** \begin{methoddesc}[TestResult]{addError}{test, err} ! Called when the test case \var{test} results in an exception other ! than \exception{TestFailed} or \exception{AssertionError}. ! \var{err} is a tuple of the form returned by ! \function{sys.exc_info()}: \code{(\var{type}, \var{value}, ! \var{traceback})}. \end{methoddesc} \begin{methoddesc}[TestResult]{addFailure}{test, err} ! Called when the test case \var{test} results in an ! \exception{AssertionError} exception; the assumption is that the ! test raised either \exception{TestFailed} or ! \exception{AssertionError} and not the implementation being tested. \var{err} is a tuple of the form returned by \function{sys.exc_info()}: \code{(\var{type}, \var{value}, --- 641,652 ---- \begin{methoddesc}[TestResult]{addError}{test, err} ! Called when the test case \var{test} raises an exception without ! signalling a test failure. \var{err} is a tuple of the form ! returned by \function{sys.exc_info()}: \code{(\var{type}, ! \var{value}, \var{traceback})}. \end{methoddesc} \begin{methoddesc}[TestResult]{addFailure}{test, err} ! Called when the test case \var{test} signals a failure. \var{err} is a tuple of the form returned by \function{sys.exc_info()}: \code{(\var{type}, \var{value}, *************** *** 627,628 **** --- 671,747 ---- similar manner. \end{methoddesc} + + + \subsection{TestLoader Objects + \label{testloader-objects}} + + The \class{TestLoader} class is used to create test suites from + classes and modules. Normally, there is no need to create an instance + of this class; the \refmodule{unittest} module provides an instance + that can be shared as the \code{defaultTestLoader} module attribute. + Using a subclass or instance would allow customization of some + configurable properties. + + \class{TestLoader} objects have the following methods: + + \begin{methoddesc}[TestLoader]{loadTestsFromTestCase}{testCaseClass} + Return a suite of all tests cases contained in the + \class{TestCase}-derived class \class{testCaseClass}. + \end{methoddesc} + + \begin{methoddesc}[TestLoader]{loadTestsFromModule}{module} + Return a suite of all tests cases contained in the given module. + This method searches \var{module} for classes derived from + \class{TestCase} and creates an instance of the class for each test + method defined for the class. + + \strong{Warning:} While using a hierarchy of + \class{Testcase}-derived classes can be convenient in sharing + fixtures and helper functions, defining test methods on base classes + that are not intended to be instantiated directly does not play well + with this method. Doing so, however, can be useful when the + fixtures are different and defined in subclasses. + \end{methoddesc} + + \begin{methoddesc}[TestLoader]{loadTestsFromName}{name\optional{, module}} + Return a suite of all tests cases given a string specifier. + + The specifier \var{name} may resolve either to a module, a test case + class, a test method within a test case class, or a callable object + which returns a \class{TestCase} or \class{TestSuite} instance. + + The method optionally resolves \var{name} relative to a given module. + \end{methoddesc} + + \begin{methoddesc}[TestLoader]{loadTestsFromNames}{names\optional{, module}} + Similar to \method{loadTestsFromName()}, but takes a sequence of + names rather than a single name. The return value is a test suite + which supports all the tests defined for each name. + \end{methoddesc} + + \begin{methoddesc}[TestLoader]{getTestCaseNames}{testCaseClass} + Return a sorted sequence of method names found within + \var{testCaseClass}. + \end{methoddesc} + + + The following attributes of a \class{TestLoader} can be configured + either by subclassing or assignment on an instance: + + \begin{memberdesc}[TestLoader]{testMethodPrefix} + String giving the prefix of method names which will be interpreted + as test methods. The default value is \code{'test'}. + \end{memberdesc} + + \begin{memberdesc}[TestLoader]{sortTestMethodsUsing} + Function to be used to compare method names when sorting them in + \method{getTestCaseNames()}. The default value is the built-in + \function{cmp()} function; it can be set to \code{None} to disable + the sort. + \end{memberdesc} + + \begin{memberdesc}[TestLoader]{suiteClass} + Callable object that constructs a test suite from a list of tests. + No methods on the resulting object are needed. The default value is + the \class{TestSuite} class. + \end{memberdesc} From ping@users.sourceforge.net Thu Apr 12 20:53:54 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 12 Apr 2001 12:53:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1372 Modified Files: pydoc.py Log Message: Added a big new Helper class to provide interactive help! Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** pydoc.py 2001/04/12 13:37:39 1.27 --- pydoc.py 2001/04/12 19:53:52 1.28 *************** *** 929,934 **** pipe.close() except IOError: ! # Ignore broken pipes caused by quitting the pager program. ! pass def tempfilepager(text, cmd): --- 929,933 ---- pipe.close() except IOError: ! pass # Ignore broken pipes caused by quitting the pager program. def tempfilepager(text, cmd): *************** *** 1127,1144 **** class Helper: def __repr__(self): ! return '''Welcome to Python %s! ! To get help on a Python object, call help(object). ! To get help on a module or package, either import it before calling ! help(module) or call help('modulename').''' % sys.version[:3] ! ! def __call__(self, *args): ! if args: ! doc(args[0]) else: ! print repr(self) ! help = Helper() class Scanner: --- 1126,1408 ---- class Helper: + keywords = { + 'and': 'BOOLEAN', + 'assert': 'ASSERT', + 'break': ('ref/break', 'while for'), + 'class': ('ref/class', 'CLASSES SPECIALMETHODS'), + 'continue': ('ref/continue', 'while for'), + 'def': ('ref/function', ''), + 'del': ('ref/del', 'BASICMETHODS'), + 'elif': 'if', + 'else': ('ref/if', 'while for'), + 'except': 'try', + 'exec': ('ref/exec', ''), + 'finally': 'try', + 'for': ('ref/for', 'break continue while'), + 'from': 'import', + 'global': ('ref/global', 'NAMESPACES'), + 'if': ('ref/if', 'TRUTHVALUE'), + 'import': ('ref/import', 'MODULES'), + 'in': ('ref/comparisons', 'SEQUENCEMETHODS2'), + 'is': 'COMPARISON', + 'lambda': ('ref/lambda', 'FUNCTIONS'), + 'not': 'BOOLEAN', + 'or': 'BOOLEAN', + 'pass': 'PASS', + 'print': ('ref/print', ''), + 'raise': ('ref/raise', 'EXCEPTIONS'), + 'return': ('ref/return', ''), + 'try': ('ref/try', 'EXCEPTIONS'), + 'while': ('ref/while', 'break continue if TRUTHVALUE'), + } + + topics = { + 'TYPES': ('ref/types', 'STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect'), + 'STRINGS': ('ref/strings', 'UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES'), + 'STRINGMETHODS': ('lib/string-methods', 'STRINGS FORMATTING'), + 'FORMATTING': ('lib/typesseq-strings', 'OPERATORS'), + 'UNICODE': ('ref/unicode', 'TYPES STRING'), + 'NUMBERS': ('ref/numbers', 'INTEGER FLOAT COMPLEX TYPES'), + 'INTEGER': ('ref/integers', 'int range'), + 'FLOAT': ('ref/floating', 'float math'), + 'COMPLEX': ('ref/imaginary', 'complex cmath'), + 'SEQUENCES': ('lib/typesseq', 'LISTS'), + 'MAPPINGS': 'DICTIONARIES', + 'FUNCTIONS': ('lib/typesfunctions', 'def TYPES'), + 'METHODS': ('lib/typesmethods', 'class def CLASSES TYPES'), + 'CODEOBJECTS': ('lib/bltin-code-objects', 'compile FUNCTIONS TYPES'), + 'TYPEOBJECTS': ('lib/bltin-type-objects', 'TYPES'), + 'FRAMEOBJECTS': 'TYPES', + 'TRACEBACKS': 'TYPES', + 'NONE': ('lib/bltin-null-object', ''), + 'ELLIPSIS': ('lib/bltin-ellipsis-object', 'SLICINGS'), + 'FILES': ('lib/bltin-file-objects', ''), + 'SPECIALATTRIBUTES': ('lib/specialattrs', ''), + 'CLASSES': ('ref/types', 'class SPECIALMETHODS PRIVATENAMES'), + 'MODULES': ('lib/typesmodules', 'import'), + 'PACKAGES': 'import', + 'EXPRESSIONS': ('ref/summary', 'lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES BACKQUOTES'), + 'OPERATORS': 'EXPRESSIONS', + 'PRECEDENCE': 'EXPRESSIONS', + 'OBJECTS': ('ref/objects', 'TYPES'), + 'SPECIALMETHODS': ('ref/specialnames', 'BASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS1 MAPPINGMETHODS SEQUENCEMETHODS2 NUMBERMETHODS CLASSES'), + 'BASICMETHODS': ('ref/customization', 'SPECIALMETHODS'), + 'ATTRIBUTEMETHODS': ('ref/attribute-access', 'SPECIALMETHODS'), + 'CALLABLEMETHODS': ('ref/callable-types', 'SPECIALMETHODS'), + 'SEQUENCEMETHODS1': ('ref/sequence-types', 'SEQUENCEMETHODS2'), + 'SEQUENCEMETHODS2': ('ref/sequence-methods', 'SEQUENCEMETHODS1'), + 'MAPPINGMETHODS': ('ref/sequence-types', 'SPECIALMETHODS'), + 'NUMBERMETHODS': ('ref/numeric-types', 'SPECIALMETHODS'), + 'EXECUTION': ('ref/execframes', ''), + 'NAMESPACES': ('ref/execframes', 'global ASSIGNMENT DELETION'), + 'SCOPING': 'NAMESPACES', + 'FRAMES': 'NAMESPACES', + 'EXCEPTIONS': ('ref/exceptions', 'try except finally raise'), + 'COERCIONS': 'CONVERSIONS', + 'CONVERSIONS': ('ref/conversions', ''), + 'IDENTIFIERS': ('ref/identifiers', 'keywords SPECIALIDENTIFIERS'), + 'SPECIALIDENTIFIERS': ('ref/id-classes', ''), + 'PRIVATENAMES': ('ref/identifiers', ''), + 'LITERALS': ('ref/atom-literals', 'STRINGS BACKQUOTES NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS'), + 'TUPLES': 'SEQUENCES', + 'TUPLELITERALS': ('ref/exprlists', 'LITERALS'), + 'LISTS': ('lib/typesseq-mutable', 'LISTLITERALS'), + 'LISTLITERALS': ('ref/lists', 'LITERALS'), + 'DICTIONARIES': ('lib/typesmapping', 'DICTIONARYLITERALS'), + 'DICTIONARYLITERALS': ('ref/dict', 'LITERALS'), + 'BACKQUOTES': ('ref/string-conversions', 'LITERALS'), + 'ATTRIBUTES': ('ref/attribute-references', 'getattr hasattr setattr ATTRIBUTEMETHODS'), + 'SUBSCRIPTS': ('ref/subscriptions', 'SEQUENCEMETHODS1'), + 'SLICINGS': ('ref/slicings', 'SEQUENCEMETHODS2'), + 'CALLS': ('ref/calls', 'EXPRESSIONS'), + 'POWER': ('ref/power', 'EXPRESSIONS'), + 'UNARY': ('ref/unary', 'EXPRESSIONS'), + 'BINARY': ('ref/binary', 'EXPRESSIONS'), + 'SHIFTING': ('ref/shifting', 'EXPRESSIONS'), + 'BITWISE': ('ref/bitwise', 'EXPRESSIONS'), + 'COMPARISON': ('ref/comparisons', 'EXPRESSIONS BASICMETHODS'), + 'BOOLEAN': ('ref/lambda', 'EXPRESSIONS'), + 'ASSERTION': 'assert', + 'ASSIGNMENT': ('ref/assignment', 'AUGMENTEDASSIGNMENT'), + 'AUGMENTEDASSIGNMENT': ('ref/augassign', ''), + 'DELETION': 'del', + 'PRINTING': 'print', + 'RETURNING': 'return', + 'IMPORTING': 'import', + 'CONDITIONAL': 'if', + 'LOOPING': ('ref/compound', 'for while break continue'), + 'TRUTHVALUE': ('lib/truth', 'if while and or not BASICMETHODS'), + } + + def __init__(self, input, output): + self.input = input + self.output = output + self.docdir = None + execdir = os.path.dirname(sys.executable) + homedir = os.environ.get('PYTHONHOME') + for dir in [os.environ.get('PYTHONDOCS'), + homedir and os.path.join(homedir, 'doc'), + os.path.join(execdir, 'doc'), + '/usr/doc/python-docs-' + split(sys.version)[0], + '/usr/doc/python-' + split(sys.version)[0], + '/usr/doc/python-docs-' + sys.version[:3], + '/usr/doc/python-' + sys.version[:3]]: + if dir and os.path.isdir(os.path.join(dir, 'lib')): + self.docdir = dir + def __repr__(self): ! self() ! return '' ! ! def __call__(self, request=None): ! if request is not None: ! self.help(request) ! else: ! self.intro() ! self.output.write('\n') ! while 1: ! self.output.write('help> ') ! self.output.flush() ! try: ! request = self.input.readline() ! if not request: break ! except KeyboardInterrupt: break ! request = strip(replace(request, '"', '', "'", '')) ! if lower(request) in ['q', 'quit']: break ! self.help(request) ! self.output.write(''' ! You're now leaving help and returning to the Python interpreter. ! If you want to ask for help on a particular object directly from the ! interpreter, you can type "help(object)". Executing "help('string')" ! has the same effect as typing a particular string at the help> prompt. ! ''') ! ! def help(self, request): ! if type(request) is type(''): ! if request == 'help': self.intro() ! elif request == 'keywords': self.listkeywords() ! elif request == 'topics': self.listtopics() ! elif request == 'modules': self.listmodules() ! elif request[:8] == 'modules ': ! self.listmodules(split(request)[1]) ! elif self.keywords.has_key(request): self.showtopic(request) ! elif self.topics.has_key(request): self.showtopic(request) ! elif request: doc(request, 'Help on %s:') ! elif isinstance(request, Helper): self() ! else: doc(request, 'Help on %s:') ! self.output.write('\n') ! ! def intro(self): ! self.output.write(''' ! Welcome to Python %s! This is the online help utility. ! ! If this is your first time using Python, you should definitely check out ! the tutorial on the Internet at http://www.python.org/doc/tut/. ! ! Enter the name of any module, keyword, or topic to get help on writing ! Python programs and using Python modules. To quit this help utility and ! return to the interpreter, just type "quit". ! ! To get a list of available modules, keywords, or topics, type "modules", ! "keywords", or "topics". Each module also comes with a one-line summary ! of what it does; to list the modules whose summaries contain a given word ! such as "spam", type "modules spam". ! ''' % sys.version[:3]) ! ! def list(self, items, columns=4, width=80): ! items = items[:] ! items.sort() ! colw = width / columns ! rows = (len(items) + columns - 1) / columns ! for row in range(rows): ! for col in range(columns): ! i = col * rows + row ! if i < len(items): ! self.output.write(items[i]) ! if col < columns - 1: ! self.output.write(' ' + ' ' * (colw-1 - len(items[i]))) ! self.output.write('\n') ! ! def listkeywords(self): ! self.output.write(''' ! Here is a list of the Python keywords. Enter any keyword to get more help. ! ! ''') ! self.list(self.keywords.keys()) ! ! def listtopics(self): ! self.output.write(''' ! Here is a list of available topics. Enter any topic name to get more help. ! ! ''') ! self.list(self.topics.keys()) ! ! def showtopic(self, topic): ! if not self.docdir: ! self.output.write(''' ! Sorry, topic and keyword documentation is not available because the Python ! HTML documentation files could not be found. If you have installed them, ! please set the environment variable PYTHONDOCS to indicate their location. ! ''') ! return ! target = self.topics.get(topic, self.keywords.get(topic)) ! if not target: ! self.output.write('no documentation found for %s\n' % repr(topic)) ! return ! if type(target) is type(''): ! return self.showtopic(target) ! filename, xrefs = target ! filename = self.docdir + '/' + filename + '.html' ! try: ! file = open(filename) ! except: ! self.output.write('could not read docs from %s\n' % filename) ! return ! ! divpat = re.compile(']*navigat.*?]*>', re.I | re.S) ! addrpat = re.compile(']*>.*?]*>', re.I | re.S) ! document = re.sub(addrpat, '', re.sub(divpat, '', file.read())) ! file.close() ! ! import htmllib, formatter, StringIO ! buffer = StringIO.StringIO() ! parser = htmllib.HTMLParser( ! formatter.AbstractFormatter(formatter.DumbWriter(buffer))) ! parser.start_table = parser.do_p ! parser.end_table = lambda parser=parser: parser.do_p({}) ! parser.start_tr = parser.do_br ! parser.start_td = parser.start_th = lambda a, b=buffer: b.write('\t') ! parser.feed(document) ! buffer = replace(buffer.getvalue(), '\xa0', ' ', '\n', '\n ') ! pager(' ' + strip(buffer) + '\n') ! if xrefs: self.output.write('\nRelated help topics: %s\n' % xrefs) ! ! def listmodules(self, key=''): ! if key: ! self.output.write(''' ! Here is a list of matching modules. Enter any module name to get more help. ! ! ''') ! apropos(key) else: ! self.output.write(''' ! Please wait a moment while I gather a list of all available modules... ! ! ''') ! modules = {} ! def callback(path, modname, desc, modules=modules): ! if modname and modname[-9:] == '.__init__': ! modname = modname[:-9] + ' (package)' ! if find(modname, '.') < 0: ! modules[modname] = 1 ! ModuleScanner().run(callback) ! self.list(modules.keys()) ! self.output.write(''' ! Enter any module name to get more help. Or, type "modules spam" to search ! for modules whose descriptions contain the word "spam". ! ''') ! help = Helper(sys.stdin, sys.stdout) class Scanner: From jhylton@users.sourceforge.net Thu Apr 12 21:21:41 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 12 Apr 2001 13:21:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pycodegen.py,1.35,1.36 pyassem.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv7276/compiler Modified Files: pycodegen.py pyassem.py Log Message: pyassem.py: Fix annoying bugs in flow graph layout code. In some cases the implicit control transfers weren't honored. In other cases, JUMP_FORWARD instructions jumped backwards. Remove unused arg from nextBlock(). pycodegen.py Add optional force kwarg to set_lineno() that will emit a SET_LINENO even if it is the same as the previous lineno. Use explicit LOAD_FAST and STORE_FAST to access list comp implicit variables. (The symbol table doesn't know about them.) Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** pycodegen.py 2001/04/12 17:33:34 1.35 --- pycodegen.py 2001/04/12 20:21:39 1.36 *************** *** 194,198 **** self.emit(prefix + '_GLOBAL', name) ! def set_lineno(self, node): """Emit SET_LINENO if node has lineno attribute and it is different than the last lineno emitted. --- 194,198 ---- self.emit(prefix + '_GLOBAL', name) ! def set_lineno(self, node, force=0): """Emit SET_LINENO if node has lineno attribute and it is different than the last lineno emitted. *************** *** 206,210 **** """ lineno = getattr(node, 'lineno', None) ! if lineno is not None and lineno != self.last_lineno: self.emit('SET_LINENO', lineno) self.last_lineno = lineno --- 206,211 ---- """ lineno = getattr(node, 'lineno', None) ! if lineno is not None and (lineno != self.last_lineno ! or force): self.emit('SET_LINENO', lineno) self.last_lineno = lineno *************** *** 414,420 **** def visitListComp(self, node): - # XXX would it be easier to transform the AST into the form it - # would have if the list comp were expressed as a series of - # for and if stmts and an explicit append? self.set_lineno(node) # setup list --- 415,418 ---- *************** *** 424,431 **** self.emit('DUP_TOP') self.emit('LOAD_ATTR', 'append') ! self.storeName(append) ! l = len(node.quals) stack = [] ! for i, for_ in zip(range(l), node.quals): start, anchor = self.visit(for_) cont = None --- 422,429 ---- self.emit('DUP_TOP') self.emit('LOAD_ATTR', 'append') ! self.emit('STORE_FAST', append) ! stack = [] ! for i, for_ in zip(range(len(node.quals)), node.quals): start, anchor = self.visit(for_) cont = None *************** *** 435,440 **** self.visit(if_, cont) stack.insert(0, (start, cont, anchor)) ! ! self.loadName(append) self.visit(node.expr) self.emit('CALL_FUNCTION', 1) --- 433,438 ---- self.visit(if_, cont) stack.insert(0, (start, cont, anchor)) ! ! self.emit('LOAD_FAST', append) self.visit(node.expr) self.emit('CALL_FUNCTION', 1) *************** *** 450,459 **** self.emit('JUMP_ABSOLUTE', start) self.startBlock(anchor) ! self.delName(append) self.__list_count = self.__list_count - 1 def visitListCompFor(self, node): - self.set_lineno(node) start = self.newBlock() anchor = self.newBlock() --- 448,456 ---- self.emit('JUMP_ABSOLUTE', start) self.startBlock(anchor) ! self.emit('DELETE_FAST', append) self.__list_count = self.__list_count - 1 def visitListCompFor(self, node): start = self.newBlock() anchor = self.newBlock() *************** *** 469,473 **** def visitListCompIf(self, node, branch): ! self.set_lineno(node) self.visit(node.test) self.emit('JUMP_IF_FALSE', branch) --- 466,470 ---- def visitListCompIf(self, node, branch): ! self.set_lineno(node, force=1) self.visit(node.test) self.emit('JUMP_IF_FALSE', branch) *************** *** 673,676 **** --- 670,674 ---- def _visitAssSequence(self, node, op='UNPACK_SEQUENCE'): + ## print >> sys.stderr, "AssSequence", op, findOp(node), node if findOp(node) != 'OP_DELETE': self.emit(op, len(node.nodes)) Index: pyassem.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pyassem.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** pyassem.py 2001/04/12 17:33:34 1.18 --- pyassem.py 2001/04/12 20:21:39 1.19 *************** *** 28,36 **** if self.current: print "end", repr(self.current) print " ", self.current.get_children() print repr(block) self.current = block ! def nextBlock(self, block=None, force=0): # XXX think we need to specify when there is implicit transfer # from one block to the next. might be better to represent this --- 28,37 ---- if self.current: print "end", repr(self.current) + print " next", self.current.next print " ", self.current.get_children() print repr(block) self.current = block ! def nextBlock(self, block=None): # XXX think we need to specify when there is implicit transfer # from one block to the next. might be better to represent this *************** *** 96,99 **** --- 97,101 ---- order = dfs_postorder(self.entry, {}) order.reverse() + self.fixupOrder(order, self.exit) # hack alert if not self.exit in order: *************** *** 102,105 **** --- 104,204 ---- return order + def fixupOrder(self, blocks, default_next): + """Fixup bad order introduced by DFS.""" + + # XXX This is a total mess. There must be a better way to get + # the code blocks in the right order. + + self.fixupOrderHonorNext(blocks, default_next) + self.fixupOrderForward(blocks, default_next) + + def fixupOrderHonorNext(self, blocks, default_next): + """Fix one problem with DFS. + + The DFS uses child block, but doesn't know about the special + "next" block. As a result, the DFS can order blocks so that a + block isn't next to the right block for implicit control + transfers. + """ + index = {} + for i in range(len(blocks)): + index[blocks[i]] = i + + for i in range(0, len(blocks) - 1): + b = blocks[i] + n = blocks[i + 1] + if not b.next or b.next[0] == default_next or b.next[0] == n: + continue + # The blocks are in the wrong order. Find the chain of + # blocks to insert where they belong. + cur = b + chain = [] + elt = cur + while elt.next and elt.next[0] != default_next: + chain.append(elt.next[0]) + elt = elt.next[0] + # Now remove the blocks in the chain from the current + # block list, so that they can be re-inserted. + l = [] + for b in chain: + assert index[b] > i + l.append((index[b], b)) + l.sort() + l.reverse() + for j, b in l: + del blocks[index[b]] + # Insert the chain in the proper location + blocks[i:i + 1] = [cur] + chain + # Finally, re-compute the block indexes + for i in range(len(blocks)): + index[blocks[i]] = i + + def fixupOrderForward(self, blocks, default_next): + """Make sure all JUMP_FORWARDs jump forward""" + index = {} + chains = [] + cur = [] + for b in blocks: + index[b] = len(chains) + cur.append(b) + if b.next and b.next[0] == default_next: + chains.append(cur) + cur = [] + chains.append(cur) + + while 1: + constraints = [] + + for i in range(len(chains)): + l = chains[i] + for b in l: + for c in b.get_children(): + if index[c] < i: + forward_p = 0 + for inst in b.insts: + if inst[0] == 'JUMP_FORWARD': + if inst[1] == c: + forward_p = 1 + if not forward_p: + continue + constraints.append((index[c], i)) + + if not constraints: + break + + # XXX just do one for now + # do swaps to get things in the right order + goes_before, a_chain = constraints[0] + assert a_chain > goes_before + c = chains[a_chain] + chains.remove(c) + chains.insert(goes_before, c) + + + del blocks[:] + for c in chains: + for b in c: + blocks.append(b) + def getBlocks(self): return self.blocks.elements() From jhylton@users.sourceforge.net Thu Apr 12 21:24:28 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 12 Apr 2001 13:24:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pycodegen.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv7770/compiler Modified Files: pycodegen.py Log Message: Add support for visitAssAttr to findOp(). Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** pycodegen.py 2001/04/12 20:21:39 1.36 --- pycodegen.py 2001/04/12 20:24:26 1.37 *************** *** 670,674 **** def _visitAssSequence(self, node, op='UNPACK_SEQUENCE'): - ## print >> sys.stderr, "AssSequence", op, findOp(node), node if findOp(node) != 'OP_DELETE': self.emit(op, len(node.nodes)) --- 670,673 ---- *************** *** 1208,1211 **** --- 1207,1211 ---- elif self.op != node.flags: raise ValueError, "mixed ops in stmt" + visitAssAttr = visitAssName class Delegator: From fdrake@users.sourceforge.net Thu Apr 12 21:26:51 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 12 Apr 2001 13:26:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib liburllib.tex,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv8396/lib Modified Files: liburllib.tex Log Message: Added warning that FancyURLopener prompts the user on the terminal when basic authentication is needed. Added documentation for FancyURLopener.prompt_user_passwd(), explaining that subclasses should provide more appropriate behavior for the hosting environment. Index: liburllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** liburllib.tex 2001/02/15 17:00:40 1.34 --- liburllib.tex 2001/04/12 20:26:49 1.35 *************** *** 212,215 **** --- 212,222 ---- The parameters to the constructor are the same as those for \class{URLopener}. + + \strong{Note:} When performing basic authentication, a + \class{FancyURLopener} instance calls its + \method{prompt_user_passwd()} method. The default implementation asks + the users for the required information on the controlling terminal. A + subclass may override this method to support more appropriate behavior + if needed. \end{classdesc} *************** *** 315,318 **** --- 322,339 ---- before calling the base constructor. \end{memberdesc} + + The \class{FancyURLopener} class offers one additional method that + should be overloaded to provide the appropriate behavior: + + \begin{methoddesc}[FancyURLopener]{prompt_user_passwd}{host, realm} + Return information needed to authenticate the user at the given host + in the specified security realm. The return value should be a tuple, + \code{(\var{user}, \var{password})}, which can be used for basic + authentication. + + The implementation prompts for this information on the terminal; an + application should override this method to use an appropriate + interaction model in the local environment. + \end{methoddesc} From ping@users.sourceforge.net Thu Apr 12 21:27:33 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 12 Apr 2001 13:27:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8456 Modified Files: pydoc.py Log Message: Fix call to ModuleScanner from GUI search interface. Fix handling of unbound top-level methods. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** pydoc.py 2001/04/12 19:53:52 1.28 --- pydoc.py 2001/04/12 20:27:31 1.29 *************** *** 581,586 **** skipdocs = 0 if inspect.ismethod(object): if cl: - imclass = object.im_class if imclass is not cl: url = '%s.html#%s-%s' % ( --- 581,586 ---- skipdocs = 0 if inspect.ismethod(object): + imclass = object.im_class if cl: if imclass is not cl: url = '%s.html#%s-%s' % ( *************** *** 590,596 **** skipdocs = 1 else: ! note = (object.im_self and ! ' method of %s instance' + object.im_self.__class__ or ! ' unbound %s method' % object.im_class.__name__) object = object.im_func --- 590,597 ---- skipdocs = 1 else: ! inst = object.im_self ! note = (inst and ! ' method of %s instance' % classname(inst.__class__, mod) or ! ' unbound %s method' % classname(imclass, mod)) object = object.im_func *************** *** 848,854 **** skipdocs = 1 else: ! note = (object.im_self and ! ' method of %s instance' + object.im_self.__class__ or ! ' unbound %s method' % classname(imclass, mod)) object = object.im_func --- 849,856 ---- skipdocs = 1 else: ! inst = object.im_self ! note = (inst and ! ' method of %s instance' % classname(inst.__class__, mod) or ! ' unbound %s method' % classname(imclass, mod)) object = object.im_func *************** *** 1700,1704 **** self.scanner = ModuleScanner() threading.Thread(target=self.scanner.run, ! args=(key, self.update, self.done)).start() def update(self, path, modname, desc): --- 1702,1706 ---- self.scanner = ModuleScanner() threading.Thread(target=self.scanner.run, ! args=(self.update, key, self.done)).start() def update(self, path, modname, desc): From tim_one@users.sourceforge.net Thu Apr 12 21:29:50 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 12 Apr 2001 13:29:50 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0226.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv8990/python/nondist/peps Modified Files: pep-0226.txt Log Message: Slip 2.1 final release a day (to next Tuesday). Seems prudent. Index: pep-0226.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0226.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** pep-0226.txt 2001/04/10 02:12:22 1.8 --- pep-0226.txt 2001/04/12 20:29:48 1.9 *************** *** 23,27 **** 13-Apr-2001: 2.1 release candidate 1 ! 16-Apr-2001: 2.1 final release Past release dates: --- 23,27 ---- 13-Apr-2001: 2.1 release candidate 1 ! 17-Apr-2001: 2.1 final release Past release dates: From ping@users.sourceforge.net Thu Apr 12 21:39:16 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 12 Apr 2001 13:39:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10514 Modified Files: pydoc.py Log Message: Fix linking to classes (in class tree, and add links on unbound methods). Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** pydoc.py 2001/04/12 20:27:31 1.29 --- pydoc.py 2001/04/12 20:39:14 1.30 *************** *** 343,352 **** return name ! def classlink(self, object, modname, *dicts): """Make a link for a class.""" name = classname(object, modname) ! for dict in dicts: ! if dict.has_key(object): ! return '%s' % (dict[object], name) return name --- 343,353 ---- return name ! def classlink(self, object, modname): """Make a link for a class.""" name = classname(object, modname) ! if sys.modules.has_key(object.__module__) and \ ! getattr(sys.modules[object.__module__], object.__name__) is object: ! return '%s' % ( ! object.__module__, object.__name__, name) return name *************** *** 406,410 **** # ---------------------------------------------- type-specific routines ! def formattree(self, tree, modname, classes={}, parent=None): """Produce HTML for a class tree as given by inspect.getclasstree().""" result = '' --- 407,411 ---- # ---------------------------------------------- type-specific routines ! def formattree(self, tree, modname, parent=None): """Produce HTML for a class tree as given by inspect.getclasstree().""" result = '' *************** *** 413,426 **** c, bases = entry result = result + '
' ! result = result + self.classlink(c, modname, classes) if bases and bases != (parent,): parents = [] for base in bases: ! parents.append(self.classlink(base, modname, classes)) result = result + '(' + join(parents, ', ') + ')' result = result + '\n
' elif type(entry) is type([]): result = result + '
\n%s
\n' % self.formattree( ! entry, modname, classes, c) return '
\n%s
\n' % result --- 414,427 ---- c, bases = entry result = result + '
' ! result = result + self.classlink(c, modname) if bases and bases != (parent,): parents = [] for base in bases: ! parents.append(self.classlink(base, modname)) result = result + '(' + join(parents, ', ') + ')' result = result + '\n
' elif type(entry) is type([]): result = result + '
\n%s
\n' % self.formattree( ! entry, modname, c) return '
\n%s
\n' % result *************** *** 506,511 **** if classes: classlist = map(lambda (key, value): value, classes) ! contents = [self.formattree( ! inspect.getclasstree(classlist, 1), name, cdict)] for key, value in classes: contents.append(self.document(value, key, name, fdict, cdict)) --- 507,512 ---- if classes: classlist = map(lambda (key, value): value, classes) ! contents = [ ! self.formattree(inspect.getclasstree(classlist, 1), name)] for key, value in classes: contents.append(self.document(value, key, name, fdict, cdict)) *************** *** 559,564 **** parents = [] for base in bases: ! parents.append( ! self.classlink(base, object.__module__, classes)) title = title + '(%s)' % join(parents, ', ') doc = self.markup( --- 560,564 ---- parents = [] for base in bases: ! parents.append(self.classlink(base, object.__module__)) title = title + '(%s)' % join(parents, ', ') doc = self.markup( *************** *** 584,597 **** if cl: if imclass is not cl: ! url = '%s.html#%s-%s' % ( ! imclass.__module__, imclass.__name__, name) ! note = ' from %s' % ( ! url, classname(imclass, mod)) skipdocs = 1 else: ! inst = object.im_self ! note = (inst and ! ' method of %s instance' % classname(inst.__class__, mod) or ! ' unbound %s method' % classname(imclass, mod)) object = object.im_func --- 584,595 ---- if cl: if imclass is not cl: ! note = ' from ' + self.classlink(imclass, mod) skipdocs = 1 else: ! if object.im_self: ! note = ' method of %s instance' % self.classlink( ! object.im_self.__class__, mod) ! else: ! note = ' unbound %s method' % self.classlink(imclass,mod) object = object.im_func *************** *** 849,856 **** skipdocs = 1 else: ! inst = object.im_self ! note = (inst and ! ' method of %s instance' % classname(inst.__class__, mod) or ! ' unbound %s method' % classname(imclass, mod)) object = object.im_func --- 847,855 ---- skipdocs = 1 else: ! if object.im_self: ! note = ' method of %s instance' % classname( ! object.im_self.__class__, mod) ! else: ! note = ' unbound %s method' % classname(imclass,mod) object = object.im_func From gvanrossum@users.sourceforge.net Thu Apr 12 21:52:25 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 12 Apr 2001 13:52:25 -0700 Subject: [Python-checkins] CVS: python/dist/src README,1.119,1.120 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12866 Modified Files: README Log Message: Because this code was derived from Python 1.6.1 (amongst others), the CNRI copyright should be updated to include 2001. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -r1.119 -r1.120 *** README 2001/04/04 18:35:19 1.119 --- README 2001/04/12 20:52:23 1.120 *************** *** 8,12 **** All rights reserved. ! Copyright (c) 1995-2000 Corporation for National Research Initiatives. All rights reserved. --- 8,12 ---- All rights reserved. ! Copyright (c) 1995-2001 Corporation for National Research Initiatives. All rights reserved. From gvanrossum@users.sourceforge.net Thu Apr 12 21:53:33 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 12 Apr 2001 13:53:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python getcopyright.c,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv13191 Modified Files: getcopyright.c Log Message: Because this code was derived from Python 1.6.1 (amongst others), the CNRI copyright should be updated to include 2001. Index: getcopyright.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getcopyright.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** getcopyright.c 2001/04/12 12:27:34 1.14 --- getcopyright.c 2001/04/12 20:53:31 1.15 *************** *** 11,15 **** All Rights Reserved.\n\ \n\ ! Copyright (c) 1995-2000 Corporation for National Research Initiatives.\n\ All Rights Reserved.\n\ \n\ --- 11,15 ---- All Rights Reserved.\n\ \n\ ! Copyright (c) 1995-2001 Corporation for National Research Initiatives.\n\ All Rights Reserved.\n\ \n\ From jhylton@users.sourceforge.net Thu Apr 12 22:04:45 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 12 Apr 2001 14:04:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pycodegen.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv15065/compiler Modified Files: pycodegen.py Log Message: Use new _implicitNameOp() to generate name op code for list comprehensions. Always emit a SET_LINENO 0 at the beginning of the module. The builtin compiler does this, and it's much easier to compare bytecode generated by the two compilers if they both do. Move the SET_LINENO inside the FOR_LOOP block for list comprehensions. Also for compat. with builtin compiler. Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** pycodegen.py 2001/04/12 20:24:26 1.37 --- pycodegen.py 2001/04/12 21:04:43 1.38 *************** *** 194,197 **** --- 194,209 ---- self.emit(prefix + '_GLOBAL', name) + def _implicitNameOp(self, prefix, name): + """Emit name ops for names generated implicitly by for loops + + The interpreter generates names that start with a period or + dollar sign. The symbol table ignores these names because + they aren't present in the program text. + """ + if self.optimized: + self.emit(prefix + '_FAST', name) + else: + self.emit(prefix + '_NAME', name) + def set_lineno(self, node, force=0): """Emit SET_LINENO if node has lineno attribute and it is *************** *** 222,225 **** --- 234,238 ---- def visitModule(self, node): + self.emit('SET_LINENO', 0) lnf = walk(node.node, self.NameFinder(), 0) self.locals.push(lnf.getLocals()) *************** *** 422,426 **** self.emit('DUP_TOP') self.emit('LOAD_ATTR', 'append') ! self.emit('STORE_FAST', append) stack = [] --- 435,439 ---- self.emit('DUP_TOP') self.emit('LOAD_ATTR', 'append') ! self._implicitNameOp('STORE', append) stack = [] *************** *** 434,438 **** stack.insert(0, (start, cont, anchor)) ! self.emit('LOAD_FAST', append) self.visit(node.expr) self.emit('CALL_FUNCTION', 1) --- 447,451 ---- stack.insert(0, (start, cont, anchor)) ! self._implicitNameOp('LOAD', append) self.visit(node.expr) self.emit('CALL_FUNCTION', 1) *************** *** 448,452 **** self.emit('JUMP_ABSOLUTE', start) self.startBlock(anchor) ! self.emit('DELETE_FAST', append) self.__list_count = self.__list_count - 1 --- 461,465 ---- self.emit('JUMP_ABSOLUTE', start) self.startBlock(anchor) ! self._implicitNameOp('DELETE', append) self.__list_count = self.__list_count - 1 *************** *** 458,463 **** self.visit(node.list) self.visit(ast.Const(0)) - self.emit('SET_LINENO', node.lineno) self.nextBlock(start) self.emit('FOR_LOOP', anchor) self.nextBlock() --- 471,476 ---- self.visit(node.list) self.visit(ast.Const(0)) self.nextBlock(start) + self.emit('SET_LINENO', node.lineno) self.emit('FOR_LOOP', anchor) self.nextBlock() From jhylton@users.sourceforge.net Thu Apr 12 22:54:43 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 12 Apr 2001 14:54:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/compiler/compiler pycodegen.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler In directory usw-pr-cvs1:/tmp/cvs-serv25483/compiler Modified Files: pycodegen.py Log Message: Pop loop off the loop stack before handling the loop's else clause. Otherwise, continue/break will attempt to affect the wrong loop. A few more fiddles to get the SET_LINENOs consistent across compilers. Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/pycodegen.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -r1.38 -r1.39 *** pycodegen.py 2001/04/12 21:04:43 1.38 --- pycodegen.py 2001/04/12 21:54:41 1.39 *************** *** 327,331 **** self.loops.push(loop) ! self.set_lineno(node) self.visit(node.test) self.emit('JUMP_IF_FALSE', else_ or after) --- 327,331 ---- self.loops.push(loop) ! self.set_lineno(node, force=1) self.visit(node.test) self.emit('JUMP_IF_FALSE', else_ or after) *************** *** 339,345 **** self.emit('POP_TOP') self.emit('POP_BLOCK') if node.else_: self.visit(node.else_) - self.loops.pop() self.nextBlock(after) --- 339,345 ---- self.emit('POP_TOP') self.emit('POP_BLOCK') + self.loops.pop() if node.else_: self.visit(node.else_) self.nextBlock(after) *************** *** 355,359 **** self.visit(ast.Const(0)) self.nextBlock(start) ! self.set_lineno(node) self.emit('FOR_LOOP', anchor) self.nextBlock() --- 355,359 ---- self.visit(ast.Const(0)) self.nextBlock(start) ! self.set_lineno(node, force=1) self.emit('FOR_LOOP', anchor) self.nextBlock() *************** *** 363,369 **** self.startBlock(anchor) self.emit('POP_BLOCK') if node.else_: self.visit(node.else_) - self.loops.pop() self.nextBlock(after) --- 363,369 ---- self.startBlock(anchor) self.emit('POP_BLOCK') + self.loops.pop() if node.else_: self.visit(node.else_) self.nextBlock(after) From fdrake@users.sourceforge.net Thu Apr 12 23:07:29 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 12 Apr 2001 15:07:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib webbrowser.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28285 Modified Files: webbrowser.py Log Message: _synthesize(): Helper function: when the users passes a specific value for the 'using' parameter of the get() function or the BROWSER environment variable, if the thing passed in is a path (as seems to be the case with KDE) instead of a short name, examine the available controllers to see if we can synthesize one based on a pre-registered controller that shares the same base name. get(): If the user specifies a browser we don't know about, use _synthesize() to attempt to create a usable controller. Some small adjustments were needed in some of the browser classes to support this. Index: webbrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** webbrowser.py 2001/03/31 01:50:52 1.17 --- webbrowser.py 2001/04/12 22:07:27 1.18 *************** *** 28,32 **** else: # User gave us a browser name. ! command = _browsers[browser.lower()] if command[1] is None: return command[0]() --- 28,35 ---- else: # User gave us a browser name. ! try: ! command = _browsers[browser.lower()] ! except KeyError: ! command = _synthesize(browser) if command[1] is None: return command[0]() *************** *** 43,46 **** --- 46,80 ---- get().open(url, 1) + + def _synthesize(browser): + """Attempt to synthesize a controller base on existing controllers. + + This is useful to create a controller when a user specifies a path to + an entry in the BROWSER environment variable -- we can copy a general + controller to operate using a specific installation of the desired + browser in this way. + + If we can't create a controller in this way, or if there is no + executable for the requested browser, return [None, None]. + + """ + if not os.path.exists(browser): + return [None, None] + name = os.path.basename(browser) + try: + command = _browsers[name.lower()] + except KeyError: + return [None, None] + # now attempt to clone to fit the new name: + controller = command[1] + if controller and name.lower() == controller.basename: + import copy + controller = copy.copy(controller) + controller.name = browser + controller.basename = os.path.basename(browser) + register(browser, None, controller) + return [None, controller] + ret + # # Everything after this point initializes _browsers and _tryorder, *************** *** 75,82 **** class GenericBrowser: def __init__(self, cmd): ! self.command = cmd def open(self, url, new=0, autoraise=1): ! os.system(self.command % url) def open_new(self, url): # Deprecated. May be removed in 2.1. --- 109,118 ---- class GenericBrowser: def __init__(self, cmd): ! self.name, self.args = cmd.split(None, 1) ! self.basename = os.path.basename(self.name) def open(self, url, new=0, autoraise=1): ! command = "%s %s" % (self.name, self.args) ! os.system(command % url) def open_new(self, url): # Deprecated. May be removed in 2.1. *************** *** 103,106 **** --- 139,143 ---- def __init__(self, name): self.name = name + self.basename = os.path.basename(name) def _remote(self, action, autoraise): *************** *** 145,148 **** --- 182,191 ---- """ + def __init__(self): + if _iscommand("konqueror"): + self.name = self.basename = "konqueror" + else: + self.name = self.basename = "kfm" + def _remote(self, action): cmd = "kfmclient %s >/dev/null 2>&1" % action *************** *** 150,157 **** if rc: import time ! if _iscommand("konqueror"): ! os.system("konqueror --silent &") else: ! os.system("kfm -d &") time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd) --- 193,200 ---- if rc: import time ! if self.basename == "konqueror": ! os.system(self.name + " --silent &") else: ! os.system(self.name + " -d &") time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd) *************** *** 166,170 **** open_new = open ! register("kfm", Konqueror, None) # Grail, the Python browser. --- 209,213 ---- open_new = open ! register("kfm", Konqueror, Konqueror()) # Grail, the Python browser. From esr@users.sourceforge.net Fri Apr 13 01:23:04 2001 From: esr@users.sourceforge.net (Eric S. Raymond) Date: Thu, 12 Apr 2001 17:23:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pstats.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21017/src/Lib Modified Files: pstats.py Log Message: Added a test main to the pstats library that can help you browse profile dumps. Index: pstats.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pstats.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** pstats.py 2001/02/12 02:00:42 1.11 --- pstats.py 2001/04/13 00:23:01 1.12 *************** *** 525,526 **** --- 525,652 ---- def f8(x): return fpformat.fix(x, 3).rjust(8) + + #************************************************************************** + # Statistics browser added by ESR, April 2001 + #************************************************************************** + + if __name__ == '__main__': + import cmd + + class ProfileBrowser(cmd.Cmd): + def __init__(self, profile=None): + self.prompt = "% " + if profile: + self.stats = Stats(profile) + else: + self.stats = None + + def generic(self, fn, line): + args = line.split() + processed = [] + for term in args: + try: + processed.append(int(term)) + continue + except ValueError: + pass + try: + frac = float(term) + if frac > 1 or frac < 0: + print "Fraction argument mus be in [0, 1]" + continue + processed.append(frac) + continue + except ValueError: + pass + processed.append(term) + if self.stats: + apply(getattr(self.stats, fn), processed) + else: + print "No statistics object is loaded." + return 0 + + def do_add(self, line): + self.stats.add(line) + return 0 + def help_add(self): + print "Add profile info from given file to current stastics object." + + def do_callees(self, line): + return self.generic('callees', line) + def help_callees(self): + print "Print callees statistics from the current stat object." + + def do_callers(self, line): + return self.generic('callers', line) + def help_callers(self): + print "Print callers statistics from the current stat object." + + def do_EOF(self, line): + print "" + return 1 + def help_EOF(self): + print "Leave the profile brower." + + def do_quit(self, line): + return 1 + def help_quit(self): + print "Leave the profile brower." + + def do_read(self, line): + if line: + try: + self.stats = Stats(line) + except IOError, args: + print args[1] + return + self.prompt = line + "% " + elif len(self.prompt > 2): + line = self.prompt[-2:] + else: + print "No statistics object is current -- cannot reload." + return 0 + def help_read(self): + print "Read in profile data from a specified file." + + def do_reverse(self, line): + self.stats.reverse_order() + return 0 + def help_reverse(self): + print "Reverse the sort order of the profiling report." + + def do_sort(self, line): + apply(self.stats.sort_stats, line.split()) + return 0 + def help_sort(self): + print "Sort profile data according to specified keys." + + def do_stats(self, line): + return self.generic('print_stats', line) + def help_stats(self): + print "Print statistics from the current stat object." + + def do_strip(self, line): + self.stats.strip_order() + return 0 + def help_strip(self): + print "Strip leading path information from filenames in the report." + + def postcmd(self, stop, line): + if stop: + return stop + return None + + import sys + print "Welcome to the profile statistics browser." + if len(sys.argv) > 1: + initprofile = sys.argv[1] + else: + initprofile = None + try: + ProfileBrowser(initprofile).cmdloop() + print "Goodbye." + except KeyboardInterrupt: + pass + + # That's all, folks. + From esr@users.sourceforge.net Fri Apr 13 01:23:04 2001 From: esr@users.sourceforge.net (Eric S. Raymond) Date: Thu, 12 Apr 2001 17:23:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libprofile.tex,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv21017/src/Doc/lib Modified Files: libprofile.tex Log Message: Added a test main to the pstats library that can help you browse profile dumps. Index: libprofile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libprofile.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** libprofile.tex 1999/04/22 21:23:22 1.30 --- libprofile.tex 2001/04/13 00:23:01 1.31 *************** *** 221,224 **** --- 221,229 ---- \end{verbatim} + Invoked as a script, the \module{pstats} module is a statistics + browser for reading and examining profile dumps. It has a simple + line-oriented interface (implemented using \module{cmd}) and + interactive help. + \section{What Is Deterministic Profiling?} \nodename{Deterministic Profiling} From gvanrossum@users.sourceforge.net Fri Apr 13 01:46:16 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 12 Apr 2001 17:46:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.143,1.144 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv25334 Modified Files: NEWS Log Message: Note additions to pydoc and pstats. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -r1.143 -r1.144 *** NEWS 2001/04/12 02:31:27 1.143 --- NEWS 2001/04/13 00:46:14 1.144 *************** *** 2,5 **** --- 2,10 ---- =============================== + - Eric Raymond extended the pstats module with a simple interactive + statistics browser, invoked when the module is run as a script. + + - Ping added an interactive help browser to pydoc. + - An updated python-mode.el version 4.0 which integrates Ken Manheimer's pdbtrack.el. This makes debugging Python code via pdb From fdrake@users.sourceforge.net Fri Apr 13 05:49:32 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 12 Apr 2001 21:49:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/mac libcolorpicker.tex,NONE,1.1 mac.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory usw-pr-cvs1:/tmp/cvs-serv7280/mac Modified Files: mac.tex Added Files: libcolorpicker.tex Log Message: Documentation for Just's ColorPicker module, so the Mac OS guys get something out of this documentation release as well. ;-) --- NEW FILE: libcolorpicker.tex --- \section{\module{ColorPicker} --- Color selection dialog} \declaremodule{extension}{ColorPicker} \modulesynopsis{} \moduleauthor{Just van Rossum}{just@letterror.com} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} The \module{ColorPicker} module provides access to the standard color picker dialog. \begin{funcdesc}{GetColor}{prompt, rgb} Show a standard color selection dialog and allow the user to select a color. The user is given instruction by the \var{prompt} string, and the default color is set to \var{rgb}. \var{rgb} must be a tuple giving the red, green, and blue components of the color. \function{GetColor()} returns a tuple giving the user's selected color and a flag indicating whether they accepted the selection of cancelled. \end{funcdesc} Index: mac.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/mac.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** mac.tex 2000/10/14 05:41:17 1.6 --- mac.tex 2001/04/13 04:49:30 1.7 *************** *** 68,71 **** --- 68,72 ---- \input{toolbox} % MacOS Toolbox Modules + \input{libcolorpicker} \input{undoc} % Undocumented Modules From fdrake@users.sourceforge.net Fri Apr 13 05:50:03 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 12 Apr 2001 21:50:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile.deps,1.64,1.65 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv7430 Modified Files: Makefile.deps Log Message: Add entry for ColorPicker documentation as well. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -r1.64 -r1.65 *** Makefile.deps 2001/04/07 05:42:13 1.64 --- Makefile.deps 2001/04/13 04:50:01 1.65 *************** *** 266,269 **** --- 266,270 ---- mac/toolbox.tex \ mac/undoc.tex \ + mac/libcolorpicker.tex \ mac/libmac.tex \ mac/libaepack.tex \ From fdrake@users.sourceforge.net Fri Apr 13 06:13:57 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 12 Apr 2001 22:13:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.5,1.6 update-docs.sh,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv11945 Modified Files: push-docs.sh update-docs.sh Log Message: Update the helper scripts that push development docs to SourceForge; this version avoids having to build a separate authenticated connection to push the update-docs.sh script to SF. Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** push-docs.sh 2001/03/03 19:57:26 1.5 --- push-docs.sh 2001/04/13 05:13:55 1.6 *************** *** 29,35 **** make --no-print-directory bziphtml || exit $? RELEASE=`grep '^RELEASE=' Makefile | sed 's|RELEASE=||'` ! scp "html-$RELEASE.tar.bz2" $TARGET/python-docs-update.tar.bz2 || exit $? ! scp tools/update-docs.sh $TARGET/update-docs.sh || exit $? ! ssh python.sourceforge.net 'tmp/update-docs.sh && rm tmp/update-docs.sh' || exit $? Mail -s '[development doc updates]' $ADDRESSES < Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15077/python/dist/src/Lib Modified Files: pstats.py unittest.py Log Message: Whitespace normalization. Index: pstats.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pstats.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** pstats.py 2001/04/13 00:23:01 1.12 --- pstats.py 2001/04/13 05:37:27 1.13 *************** *** 650,652 **** # That's all, folks. - --- 650,651 ---- Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** unittest.py 2001/04/12 09:05:01 1.5 --- unittest.py 2001/04/13 05:37:27 1.6 *************** *** 412,416 **** test method within a test case class, or a callable object which returns a TestCase or TestSuite instance. ! The method optionally resolves the names relative to a given module. """ --- 412,416 ---- test method within a test case class, or a callable object which returns a TestCase or TestSuite instance. ! The method optionally resolves the names relative to a given module. """ From loewis@users.sourceforge.net Fri Apr 13 09:09:53 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Fri, 13 Apr 2001 01:09:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_locale.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4882/test Added Files: test_locale.py Log Message: Patch #415777: new grouping strategy. fixes bug #414940, and redoes the fix for #129417 in a different way. It also fixes a number of other problems with locale-specific formatting: If there is leading or trailing spaces, then no grouping should be applied in the spaces, and the total length of the string should not be changed due to grouping. Also added test case which works only if the en_US locale is available. --- NEW FILE: test_locale.py --- from test_support import verbose import locale oldlocale = locale.setlocale(locale.LC_NUMERIC) try: locale.setlocale(locale.LC_NUMERIC, "en_US") except locale.Error: raise ImportError, "test locale en_US not supported" def testformat(formatstr, value, grouping = 0, output=None): if verbose: if output: print "%s %% %s =? %s ..." %\ (repr(formatstr), repr(value), repr(output)), else: print "%s %% %s works? ..." % (repr(formatstr), repr(value)), result = locale.format(formatstr, value, grouping = grouping) if output and result != output: if verbose: print 'no' print "%s %% %s == %s != %s" %\ (repr(formatstr), repr(value), repr(result), repr(output)) else: if verbose: print "yes" try: testformat("%f", 1024, grouping=1, output='1,024.000000') testformat("%f", 102, grouping=1, output='102.000000') testformat("%f", -42, grouping=1, output='-42.000000') testformat("%+f", -42, grouping=1, output='-42.000000') testformat("%20.f", -42, grouping=1, output=' -42') testformat("%+10.f", -4200, grouping=1, output=' -4,200') testformat("%-10.f", 4200, grouping=1, output='4,200 ') finally: locale.setlocale(locale.LC_NUMERIC, oldlocale) From loewis@users.sourceforge.net Fri Apr 13 09:09:52 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Fri, 13 Apr 2001 01:09:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib locale.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4882 Modified Files: locale.py Log Message: Patch #415777: new grouping strategy. fixes bug #414940, and redoes the fix for #129417 in a different way. It also fixes a number of other problems with locale-specific formatting: If there is leading or trailing spaces, then no grouping should be applied in the spaces, and the total length of the string should not be changed due to grouping. Also added test case which works only if the en_US locale is available. Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** locale.py 2001/03/23 17:00:07 1.16 --- locale.py 2001/04/13 08:09:50 1.17 *************** *** 96,99 **** --- 96,105 ---- if not grouping:return s result="" + seps = 0 + spaces = "" + if s[-1] == ' ': + sp = s.find(' ') + spaces = s[sp:] + s = s[:sp] while s and grouping: # if grouping is -1, we are done *************** *** 107,118 **** if result: result=s[-group:]+conv['thousands_sep']+result else: result=s[-group:] s=s[:-group] if not result: ! return s if s: result=s+conv['thousands_sep']+result ! return result def format(f,val,grouping=0): --- 113,129 ---- if result: result=s[-group:]+conv['thousands_sep']+result + seps += 1 else: result=s[-group:] s=s[:-group] + if s and s[-1] not in "0123456789": + # the leading string is only spaces and signs + return s+result+spaces,seps if not result: ! return s+spaces,seps if s: result=s+conv['thousands_sep']+result ! seps += 1 ! return result+spaces,seps def format(f,val,grouping=0): *************** *** 120,138 **** but takes the current locale into account. Grouping is applied if the third parameter is true.""" ! result = f % abs(val) fields = result.split(".") if grouping: ! fields[0]=_group(fields[0]) if len(fields)==2: ! res = fields[0]+localeconv()['decimal_point']+fields[1] elif len(fields)==1: ! res = fields[0] else: raise Error, "Too many decimal points in result string" ! if val < 0: ! return '-'+res ! else: ! return res def str(val): --- 131,158 ---- but takes the current locale into account. Grouping is applied if the third parameter is true.""" ! result = f % val fields = result.split(".") + seps = 0 if grouping: ! fields[0],seps=_group(fields[0]) if len(fields)==2: ! result = fields[0]+localeconv()['decimal_point']+fields[1] elif len(fields)==1: ! result = fields[0] else: raise Error, "Too many decimal points in result string" ! while seps: ! # If the number was formatted for a specific width, then it ! # might have been filled with spaces to the left or right. If ! # so, kill as much spaces as there where separators. ! # Leading zeroes as fillers are not yet dealt with, as it is ! # not clear how they should interact with grouping. ! sp = result.find(" ") ! if sp==-1:break ! result = result[:sp]+result[sp+1:] ! seps -= 1 ! ! return result def str(val): From loewis@users.sourceforge.net Fri Apr 13 09:09:53 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Fri, 13 Apr 2001 01:09:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_locale,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv4882/test/output Added Files: test_locale Log Message: Patch #415777: new grouping strategy. fixes bug #414940, and redoes the fix for #129417 in a different way. It also fixes a number of other problems with locale-specific formatting: If there is leading or trailing spaces, then no grouping should be applied in the spaces, and the total length of the string should not be changed due to grouping. Also added test case which works only if the en_US locale is available. --- NEW FILE: test_locale --- test_locale From ping@users.sourceforge.net Fri Apr 13 10:15:10 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 13 Apr 2001 02:15:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14091 Modified Files: inspect.py Log Message: Remove duplicate type objects from isroutine() and isbuiltin(). Make getmodule() on a module return the module itself. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** inspect.py 2001/04/12 13:17:17 1.13 --- inspect.py 2001/04/13 09:15:08 1.14 *************** *** 124,135 **** __name__ original name of this function or method __self__ instance to which a method is bound, or None""" ! return type(object) in [types.BuiltinFunctionType, ! types.BuiltinMethodType] def isroutine(object): """Return true if the object is any kind of function or method.""" return type(object) in [types.FunctionType, types.LambdaType, ! types.MethodType, types.BuiltinFunctionType, ! types.BuiltinMethodType] def getmembers(object, predicate=None): --- 124,133 ---- __name__ original name of this function or method __self__ instance to which a method is bound, or None""" ! return type(object) is types.BuiltinFunctionType def isroutine(object): """Return true if the object is any kind of function or method.""" return type(object) in [types.FunctionType, types.LambdaType, ! types.MethodType, types.BuiltinFunctionType] def getmembers(object, predicate=None): *************** *** 232,235 **** --- 230,235 ---- def getmodule(object): """Return the module an object was defined in, or None if not found.""" + if ismodule(object): + return object if isclass(object): return sys.modules.get(object.__module__) From ping@users.sourceforge.net Fri Apr 13 10:55:51 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 13 Apr 2001 02:55:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18520 Modified Files: pydoc.py Log Message: Make force-loading optional; don't force-load in interactive mode. Make synopsis() load modules as '__temp__' so they don't clobber anything. Change "constants" section to "data" section. Don't show __builtins__ or __doc__ in "data" section. For Bob Weiner: don't boldface text in Emacs shells or dumb terminals. Remove Helper.__repr__ (it really belongs in site.py, and should be guarded by a check for len(inspect.stack) <= 2). Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** pydoc.py 2001/04/12 20:39:14 1.30 --- pydoc.py 2001/04/13 09:55:49 1.31 *************** *** 54,87 **** # --------------------------------------------------------- common routines - def synopsis(filename, cache={}): - """Get the one-line summary out of a module file.""" - mtime = os.stat(filename)[stat.ST_MTIME] - lastupdate, result = cache.get(filename, (0, None)) - if lastupdate < mtime: - info = inspect.getmoduleinfo(filename) - file = open(filename) - if info and 'b' in info[2]: # binary modules have to be imported - try: module = imp.load_module(info[0], file, filename, info[1:]) - except: return None - result = split(module.__doc__ or '', '\n')[0] - else: # text modules can be directly examined - line = file.readline() - while line[:1] == '#' or not strip(line): - line = file.readline() - if not line: break - line = strip(line) - if line[:4] == 'r"""': line = line[1:] - if line[:3] == '"""': - line = line[3:] - if line[-1:] == '\\': line = line[:-1] - while not strip(line): - line = file.readline() - if not line: break - result = strip(split(line, '"""')[0]) - else: result = None - file.close() - cache[filename] = (mtime, result) - return result - def pathdirs(): """Convert sys.path into a list of absolute, existing, unique paths.""" --- 54,57 ---- *************** *** 117,126 **** return name ! def isconstant(object): ! """Check if an object is of a type that probably means it's a constant.""" ! return type(object) in [ ! types.FloatType, types.IntType, types.ListType, types.LongType, ! types.StringType, types.TupleType, types.TypeType, ! hasattr(types, 'UnicodeType') and types.UnicodeType or 0] def replace(text, *pairs): --- 87,95 ---- return name ! def isdata(object): ! """Check if an object is of a type that probably means it's data.""" ! return not (inspect.ismodule(object) or inspect.isclass(object) or ! inspect.isroutine(object) or inspect.isframe(object) or ! inspect.istraceback(object) or inspect.iscode(object)) def replace(text, *pairs): *************** *** 157,160 **** --- 126,169 ---- return methods + # ----------------------------------------------------- module manipulation + + def ispackage(path): + """Guess whether a path refers to a package directory.""" + if os.path.isdir(path): + for ext in ['.py', '.pyc', '.pyo']: + if os.path.isfile(os.path.join(path, '__init__' + ext)): + return 1 + + def synopsis(filename, cache={}): + """Get the one-line summary out of a module file.""" + mtime = os.stat(filename)[stat.ST_MTIME] + lastupdate, result = cache.get(filename, (0, None)) + if lastupdate < mtime: + info = inspect.getmoduleinfo(filename) + file = open(filename) + if info and 'b' in info[2]: # binary modules have to be imported + try: module = imp.load_module('__temp__', file, filename, info[1:]) + except: return None + result = split(module.__doc__ or '', '\n')[0] + del sys.modules['__temp__'] + else: # text modules can be directly examined + line = file.readline() + while line[:1] == '#' or not strip(line): + line = file.readline() + if not line: break + line = strip(line) + if line[:4] == 'r"""': line = line[1:] + if line[:3] == '"""': + line = line[3:] + if line[-1:] == '\\': line = line[:-1] + while not strip(line): + line = file.readline() + if not line: break + result = strip(split(line, '"""')[0]) + else: result = None + file.close() + cache[filename] = (mtime, result) + return result + class ErrorDuringImport(Exception): """Errors that occurred while trying to import something to document it.""" *************** *** 190,200 **** return module ! def ispackage(path): ! """Guess whether a path refers to a package directory.""" ! if os.path.isdir(path): ! for ext in ['.py', '.pyc', '.pyo']: ! if os.path.isfile(os.path.join(path, '__init__' + ext)): ! return 1 # ---------------------------------------------------- formatter base class --- 199,246 ---- return module ! def safeimport(path, forceload=0, cache={}): ! """Import a module; handle errors; return None if the module isn't found. + If the module *is* found but an exception occurs, it's wrapped in an + ErrorDuringImport exception and reraised. Unlike __import__, if a + package path is specified, the module at the end of the path is returned, + not the package at the beginning. If the optional 'forceload' argument + is 1, we reload the module from disk (unless it's a dynamic extension).""" + if forceload and sys.modules.has_key(path): + # This is the only way to be sure. Checking the mtime of the file + # isn't good enough (e.g. what if the module contains a class that + # inherits from another module that has changed?). + if path not in sys.builtin_module_names: + # Python never loads a dynamic extension a second time from the + # same path, even if the file is changed or missing. Deleting + # the entry in sys.modules doesn't help for dynamic extensions, + # so we're not even going to try to keep them up to date. + info = inspect.getmoduleinfo(sys.modules[path].__file__) + if info[3] != imp.C_EXTENSION: + cache[path] = sys.modules[path] # prevent module from clearing + del sys.modules[path] + try: + module = __import__(path) + except: + # Did the error occur before or after the module was found? + (exc, value, tb) = info = sys.exc_info() + if sys.modules.has_key(path): + # An error occured while executing the imported module. + raise ErrorDuringImport(sys.modules[path].__file__, info) + elif exc is SyntaxError: + # A SyntaxError occurred before we could execute the module. + raise ErrorDuringImport(value.filename, info) + elif exc is ImportError and \ + split(lower(str(value)))[:2] == ['no', 'module']: + # The module was not found. + return None + else: + # Some other error occurred during the importing process. + raise ErrorDuringImport(path, sys.exc_info()) + for part in split(path, '.')[1:]: + try: module = getattr(module, part) + except AttributeError: return None + return module + # ---------------------------------------------------- formatter base class *************** *** 222,226 **** def __init__(self): Repr.__init__(self) ! self.maxlist = self.maxtuple = self.maxdict = 10 self.maxstring = self.maxother = 100 --- 268,273 ---- def __init__(self): Repr.__init__(self) ! self.maxlist = self.maxtuple = 20 ! self.maxdict = 10 self.maxstring = self.maxother = 100 *************** *** 345,354 **** def classlink(self, object, modname): """Make a link for a class.""" ! name = classname(object, modname) ! if sys.modules.has_key(object.__module__) and \ ! getattr(sys.modules[object.__module__], object.__name__) is object: return '%s' % ( ! object.__module__, object.__name__, name) ! return name def modulelink(self, object): --- 392,400 ---- def classlink(self, object, modname): """Make a link for a class.""" ! name, module = object.__name__, sys.modules.get(object.__module__) ! if hasattr(module, name) and getattr(module, name) is object: return '%s' % ( ! module.__name__, name, classname(object, modname)) ! return classname(object, modname) def modulelink(self, object): *************** *** 476,482 **** fdict[key] = '#-' + key if inspect.isfunction(value): fdict[value] = fdict[key] ! constants = [] ! for key, value in inspect.getmembers(object, isconstant): ! constants.append((key, value)) doc = self.markup(getdoc(object), self.preformat, fdict, cdict) --- 522,529 ---- fdict[key] = '#-' + key if inspect.isfunction(value): fdict[value] = fdict[key] ! data = [] ! for key, value in inspect.getmembers(object, isdata): ! if key not in ['__builtins__', '__doc__']: ! data.append((key, value)) doc = self.markup(getdoc(object), self.preformat, fdict, cdict) *************** *** 519,528 **** result = result + self.bigsection( 'Functions', '#ffffff', '#eeaa77', join(contents)) ! if constants: contents = [] ! for key, value in constants: contents.append(self.document(value, key)) result = result + self.bigsection( ! 'Constants', '#ffffff', '#55aa55', join(contents, '
')) if hasattr(object, '__author__'): contents = self.markup(str(object.__author__), self.preformat) --- 566,575 ---- result = result + self.bigsection( 'Functions', '#ffffff', '#eeaa77', join(contents)) ! if data: contents = [] ! for key, value in data: contents.append(self.document(value, key)) result = result + self.bigsection( ! 'Data', '#ffffff', '#55aa55', join(contents, '
\n')) if hasattr(object, '__author__'): contents = self.markup(str(object.__author__), self.preformat) *************** *** 666,670 **** def __init__(self): Repr.__init__(self) ! self.maxlist = self.maxtuple = self.maxdict = 10 self.maxstring = self.maxother = 100 --- 713,718 ---- def __init__(self): Repr.__init__(self) ! self.maxlist = self.maxtuple = 20 ! self.maxdict = 10 self.maxstring = self.maxother = 100 *************** *** 755,761 **** if inspect.isbuiltin(value) or inspect.getmodule(value) is object: funcs.append((key, value)) ! constants = [] ! for key, value in inspect.getmembers(object, isconstant): ! constants.append((key, value)) if hasattr(object, '__path__'): --- 803,810 ---- if inspect.isbuiltin(value) or inspect.getmodule(value) is object: funcs.append((key, value)) ! data = [] ! for key, value in inspect.getmembers(object, isdata): ! if key not in ['__builtins__', '__doc__']: ! data.append((key, value)) if hasattr(object, '__path__'): *************** *** 786,794 **** result = result + self.section('FUNCTIONS', join(contents, '\n')) ! if constants: contents = [] ! for key, value in constants: contents.append(self.docother(value, key, name, 70)) ! result = result + self.section('CONSTANTS', join(contents, '\n')) if hasattr(object, '__version__'): --- 835,843 ---- result = result + self.section('FUNCTIONS', join(contents, '\n')) ! if data: contents = [] ! for key, value in data: contents.append(self.docother(value, key, name, 70)) ! result = result + self.section('DATA', join(contents, '\n')) if hasattr(object, '__version__'): *************** *** 904,914 **** if os.environ.has_key('PAGER'): if sys.platform == 'win32': # pipes completely broken in Windows ! return lambda a: tempfilepager(a, os.environ['PAGER']) else: ! return lambda a: pipepager(a, os.environ['PAGER']) if sys.platform == 'win32': ! return lambda a: tempfilepager(a, 'more <') if hasattr(os, 'system') and os.system('less 2>/dev/null') == 0: ! return lambda a: pipepager(a, 'less') import tempfile --- 953,965 ---- if os.environ.has_key('PAGER'): if sys.platform == 'win32': # pipes completely broken in Windows ! return lambda text: tempfilepager(plain(text), os.environ['PAGER']) ! elif os.environ.get('TERM') in ['dumb', 'emacs']: ! return lambda text: pipepager(plain(text), os.environ['PAGER']) else: ! return lambda text: pipepager(text, os.environ['PAGER']) if sys.platform == 'win32': ! return lambda text: tempfilepager(plain(text), 'more <') if hasattr(os, 'system') and os.system('less 2>/dev/null') == 0: ! return lambda text: pipepager(text, 'less') import tempfile *************** *** 923,926 **** --- 974,981 ---- os.unlink(filename) + def plain(text): + """Remove boldface formatting from text.""" + return re.sub('.\b', '', text) + def pipepager(text, cmd): """Page through text by feeding it to another program.""" *************** *** 944,951 **** os.unlink(filename) - def plain(text): - """Remove boldface formatting from text.""" - return re.sub('.\b', '', text) - def ttypager(text): """Page through text on a text terminal.""" --- 999,1002 ---- *************** *** 1010,1057 **** return 'instance of ' + thing.__class__.__name__ return type(thing).__name__ - - def freshimport(path, cache={}): - """Import a module freshly from disk, making sure it's up to date.""" - if sys.modules.has_key(path): - # This is the only way to be sure. Checking the mtime of the file - # isn't good enough (e.g. what if the module contains a class that - # inherits from another module that has changed?). - if path not in sys.builtin_module_names: - # Python never loads a dynamic extension a second time from the - # same path, even if the file is changed or missing. Deleting - # the entry in sys.modules doesn't help for dynamic extensions, - # so we're not even going to try to keep them up to date. - info = inspect.getmoduleinfo(sys.modules[path].__file__) - if info[3] != imp.C_EXTENSION: - del sys.modules[path] - try: - module = __import__(path) - except: - # Did the error occur before or after the module was found? - (exc, value, tb) = info = sys.exc_info() - if sys.modules.has_key(path): - # An error occured while executing the imported module. - raise ErrorDuringImport(sys.modules[path].__file__, info) - elif exc is SyntaxError: - # A SyntaxError occurred before we could execute the module. - raise ErrorDuringImport(value.filename, info) - elif exc is ImportError and \ - split(lower(str(value)))[:2] == ['no', 'module']: - # The module was not found. - return None - else: - # Some other error occurred during the importing process. - raise ErrorDuringImport(path, sys.exc_info()) - for part in split(path, '.')[1:]: - try: module = getattr(module, part) - except AttributeError: return None - return module ! def locate(path): """Locate an object by name or dotted path, importing as necessary.""" parts = split(path, '.') module, n = None, 0 while n < len(parts): ! nextmodule = freshimport(join(parts[:n+1], '.')) if nextmodule: module, n = nextmodule, n + 1 else: break --- 1061,1071 ---- return 'instance of ' + thing.__class__.__name__ return type(thing).__name__ ! def locate(path, forceload=0): """Locate an object by name or dotted path, importing as necessary.""" parts = split(path, '.') module, n = None, 0 while n < len(parts): ! nextmodule = safeimport(join(parts[:n+1], '.'), forceload) if nextmodule: module, n = nextmodule, n + 1 else: break *************** *** 1072,1081 **** html = HTMLDoc() ! def doc(thing, title='Python Library Documentation: %s'): """Display text documentation, given an object or a path to an object.""" suffix, name = '', None if type(thing) is type(''): try: ! object = locate(thing) except ErrorDuringImport, value: print value --- 1086,1095 ---- html = HTMLDoc() ! def doc(thing, title='Python Library Documentation: %s', forceload=0): """Display text documentation, given an object or a path to an object.""" suffix, name = '', None if type(thing) is type(''): try: ! object = locate(thing, forceload) except ErrorDuringImport, value: print value *************** *** 1095,1102 **** pager(title % (desc + suffix) + '\n\n' + text.document(thing, name)) ! def writedoc(key): """Write HTML documentation to a file in the current directory.""" try: ! object = locate(key) except ErrorDuringImport, value: print value --- 1109,1116 ---- pager(title % (desc + suffix) + '\n\n' + text.document(thing, name)) ! def writedoc(key, forceload=0): """Write HTML documentation to a file in the current directory.""" try: ! object = locate(key, forceload) except ErrorDuringImport, value: print value *************** *** 1112,1121 **** print 'no Python documentation found for %s' % repr(key) ! def writedocs(dir, pkgpath='', done={}): """Write out HTML documentation for all modules in a directory tree.""" for file in os.listdir(dir): path = os.path.join(dir, file) if ispackage(path): ! writedocs(path, pkgpath + file + '.') elif os.path.isfile(path): modname = inspect.getmodulename(path) --- 1126,1136 ---- print 'no Python documentation found for %s' % repr(key) ! def writedocs(dir, pkgpath='', done=None): """Write out HTML documentation for all modules in a directory tree.""" + if done is None: done = {} for file in os.listdir(dir): path = os.path.join(dir, file) if ispackage(path): ! writedocs(path, pkgpath + file + '.', done) elif os.path.isfile(path): modname = inspect.getmodulename(path) *************** *** 1252,1259 **** self.docdir = dir - def __repr__(self): - self() - return '' - def __call__(self, request=None): if request is not None: --- 1267,1270 ---- *************** *** 1261,1275 **** else: self.intro() ! self.output.write('\n') ! while 1: ! self.output.write('help> ') ! self.output.flush() ! try: ! request = self.input.readline() ! if not request: break ! except KeyboardInterrupt: break ! request = strip(replace(request, '"', '', "'", '')) ! if lower(request) in ['q', 'quit']: break ! self.help(request) self.output.write(''' You're now leaving help and returning to the Python interpreter. --- 1272,1276 ---- else: self.intro() ! self.interact() self.output.write(''' You're now leaving help and returning to the Python interpreter. *************** *** 1279,1282 **** --- 1280,1296 ---- ''') + def interact(self): + self.output.write('\n') + while 1: + self.output.write('help> ') + self.output.flush() + try: + request = self.input.readline() + if not request: break + except KeyboardInterrupt: break + request = strip(replace(request, '"', '', "'", '')) + if lower(request) in ['q', 'quit']: break + self.help(request) + def help(self, request): if type(request) is type(''): *************** *** 1362,1367 **** return ! divpat = re.compile(']*navigat.*?]*>', re.I | re.S) ! addrpat = re.compile(']*>.*?]*>', re.I | re.S) document = re.sub(addrpat, '', re.sub(divpat, '', file.read())) file.close() --- 1376,1381 ---- return ! divpat = re.compile(']*navigat.*?', re.I | re.S) ! addrpat = re.compile('.*?', re.I | re.S) document = re.sub(addrpat, '', re.sub(divpat, '', file.read())) file.close() *************** *** 1461,1465 **** callback(None, modname, '') else: ! desc = split(freshimport(modname).__doc__ or '', '\n')[0] if find(lower(modname + ' - ' + desc), key) >= 0: callback(None, modname, desc) --- 1475,1479 ---- callback(None, modname, '') else: ! desc = split(__import__(modname).__doc__ or '', '\n')[0] if find(lower(modname + ' - ' + desc), key) >= 0: callback(None, modname, desc) *************** *** 1523,1527 **** if path and path != '.': try: ! obj = locate(path) except ErrorDuringImport, value: self.send_document(path, html.escape(str(value))) --- 1537,1541 ---- if path and path != '.': try: ! obj = locate(path, forceload=1) except ErrorDuringImport, value: self.send_document(path, html.escape(str(value))) From ping@users.sourceforge.net Fri Apr 13 11:53:27 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 13 Apr 2001 03:53:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31241 Modified Files: pydoc.py Log Message: Another pass through the topic table to fill in cross references. Restore Helper.__repr__ for now. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** pydoc.py 2001/04/13 09:55:49 1.31 --- pydoc.py 2001/04/13 10:53:25 1.32 *************** *** 1144,1148 **** keywords = { 'and': 'BOOLEAN', ! 'assert': 'ASSERT', 'break': ('ref/break', 'while for'), 'class': ('ref/class', 'CLASSES SPECIALMETHODS'), --- 1144,1148 ---- keywords = { 'and': 'BOOLEAN', ! 'assert': ('ref/assert', ''), 'break': ('ref/break', 'while for'), 'class': ('ref/class', 'CLASSES SPECIALMETHODS'), *************** *** 1168,1172 **** 'print': ('ref/print', ''), 'raise': ('ref/raise', 'EXCEPTIONS'), ! 'return': ('ref/return', ''), 'try': ('ref/try', 'EXCEPTIONS'), 'while': ('ref/while', 'break continue if TRUTHVALUE'), --- 1168,1172 ---- 'print': ('ref/print', ''), 'raise': ('ref/raise', 'EXCEPTIONS'), ! 'return': ('ref/return', 'FUNCTIONS'), 'try': ('ref/try', 'EXCEPTIONS'), 'while': ('ref/while', 'break continue if TRUTHVALUE'), *************** *** 1175,1192 **** topics = { 'TYPES': ('ref/types', 'STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect'), ! 'STRINGS': ('ref/strings', 'UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES'), 'STRINGMETHODS': ('lib/string-methods', 'STRINGS FORMATTING'), 'FORMATTING': ('lib/typesseq-strings', 'OPERATORS'), ! 'UNICODE': ('ref/unicode', 'TYPES STRING'), 'NUMBERS': ('ref/numbers', 'INTEGER FLOAT COMPLEX TYPES'), 'INTEGER': ('ref/integers', 'int range'), 'FLOAT': ('ref/floating', 'float math'), 'COMPLEX': ('ref/imaginary', 'complex cmath'), ! 'SEQUENCES': ('lib/typesseq', 'LISTS'), 'MAPPINGS': 'DICTIONARIES', 'FUNCTIONS': ('lib/typesfunctions', 'def TYPES'), 'METHODS': ('lib/typesmethods', 'class def CLASSES TYPES'), 'CODEOBJECTS': ('lib/bltin-code-objects', 'compile FUNCTIONS TYPES'), ! 'TYPEOBJECTS': ('lib/bltin-type-objects', 'TYPES'), 'FRAMEOBJECTS': 'TYPES', 'TRACEBACKS': 'TYPES', --- 1175,1192 ---- topics = { 'TYPES': ('ref/types', 'STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect'), ! 'STRINGS': ('ref/strings', 'str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES'), 'STRINGMETHODS': ('lib/string-methods', 'STRINGS FORMATTING'), 'FORMATTING': ('lib/typesseq-strings', 'OPERATORS'), ! 'UNICODE': ('ref/unicode', 'encodings unicode TYPES STRING'), 'NUMBERS': ('ref/numbers', 'INTEGER FLOAT COMPLEX TYPES'), 'INTEGER': ('ref/integers', 'int range'), 'FLOAT': ('ref/floating', 'float math'), 'COMPLEX': ('ref/imaginary', 'complex cmath'), ! 'SEQUENCES': ('lib/typesseq', 'STRINGMETHODS FORMATTING xrange LISTS'), 'MAPPINGS': 'DICTIONARIES', 'FUNCTIONS': ('lib/typesfunctions', 'def TYPES'), 'METHODS': ('lib/typesmethods', 'class def CLASSES TYPES'), 'CODEOBJECTS': ('lib/bltin-code-objects', 'compile FUNCTIONS TYPES'), ! 'TYPEOBJECTS': ('lib/bltin-type-objects', 'types TYPES'), 'FRAMEOBJECTS': 'TYPES', 'TRACEBACKS': 'TYPES', *************** *** 1203,1213 **** 'OBJECTS': ('ref/objects', 'TYPES'), 'SPECIALMETHODS': ('ref/specialnames', 'BASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS1 MAPPINGMETHODS SEQUENCEMETHODS2 NUMBERMETHODS CLASSES'), ! 'BASICMETHODS': ('ref/customization', 'SPECIALMETHODS'), ! 'ATTRIBUTEMETHODS': ('ref/attribute-access', 'SPECIALMETHODS'), ! 'CALLABLEMETHODS': ('ref/callable-types', 'SPECIALMETHODS'), ! 'SEQUENCEMETHODS1': ('ref/sequence-types', 'SEQUENCEMETHODS2'), ! 'SEQUENCEMETHODS2': ('ref/sequence-methods', 'SEQUENCEMETHODS1'), ! 'MAPPINGMETHODS': ('ref/sequence-types', 'SPECIALMETHODS'), ! 'NUMBERMETHODS': ('ref/numeric-types', 'SPECIALMETHODS'), 'EXECUTION': ('ref/execframes', ''), 'NAMESPACES': ('ref/execframes', 'global ASSIGNMENT DELETION'), --- 1203,1213 ---- 'OBJECTS': ('ref/objects', 'TYPES'), 'SPECIALMETHODS': ('ref/specialnames', 'BASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS1 MAPPINGMETHODS SEQUENCEMETHODS2 NUMBERMETHODS CLASSES'), ! 'BASICMETHODS': ('ref/customization', 'cmp hash repr str SPECIALMETHODS'), ! 'ATTRIBUTEMETHODS': ('ref/attribute-access', 'ATTRIBUTES SPECIALMETHODS'), ! 'CALLABLEMETHODS': ('ref/callable-types', 'CALLS SPECIALMETHODS'), ! 'SEQUENCEMETHODS1': ('ref/sequence-types', 'SEQUENCES SEQUENCEMETHODS2 SPECIALMETHODS'), ! 'SEQUENCEMETHODS2': ('ref/sequence-methods', 'SEQUENCES SEQUENCEMETHODS1 SPECIALMETHODS'), ! 'MAPPINGMETHODS': ('ref/sequence-types', 'MAPPINGS SPECIALMETHODS'), ! 'NUMBERMETHODS': ('ref/numeric-types', 'NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS'), 'EXECUTION': ('ref/execframes', ''), 'NAMESPACES': ('ref/execframes', 'global ASSIGNMENT DELETION'), *************** *** 1219,1231 **** 'IDENTIFIERS': ('ref/identifiers', 'keywords SPECIALIDENTIFIERS'), 'SPECIALIDENTIFIERS': ('ref/id-classes', ''), ! 'PRIVATENAMES': ('ref/identifiers', ''), 'LITERALS': ('ref/atom-literals', 'STRINGS BACKQUOTES NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS'), 'TUPLES': 'SEQUENCES', ! 'TUPLELITERALS': ('ref/exprlists', 'LITERALS'), 'LISTS': ('lib/typesseq-mutable', 'LISTLITERALS'), ! 'LISTLITERALS': ('ref/lists', 'LITERALS'), 'DICTIONARIES': ('lib/typesmapping', 'DICTIONARYLITERALS'), ! 'DICTIONARYLITERALS': ('ref/dict', 'LITERALS'), ! 'BACKQUOTES': ('ref/string-conversions', 'LITERALS'), 'ATTRIBUTES': ('ref/attribute-references', 'getattr hasattr setattr ATTRIBUTEMETHODS'), 'SUBSCRIPTS': ('ref/subscriptions', 'SEQUENCEMETHODS1'), --- 1219,1231 ---- 'IDENTIFIERS': ('ref/identifiers', 'keywords SPECIALIDENTIFIERS'), 'SPECIALIDENTIFIERS': ('ref/id-classes', ''), ! 'PRIVATENAMES': ('ref/atom-identifiers', ''), 'LITERALS': ('ref/atom-literals', 'STRINGS BACKQUOTES NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS'), 'TUPLES': 'SEQUENCES', ! 'TUPLELITERALS': ('ref/exprlists', 'TUPLES LITERALS'), 'LISTS': ('lib/typesseq-mutable', 'LISTLITERALS'), ! 'LISTLITERALS': ('ref/lists', 'LISTS LITERALS'), 'DICTIONARIES': ('lib/typesmapping', 'DICTIONARYLITERALS'), ! 'DICTIONARYLITERALS': ('ref/dict', 'DICTIONARIES LITERALS'), ! 'BACKQUOTES': ('ref/string-conversions', 'repr str STRINGS LITERALS'), 'ATTRIBUTES': ('ref/attribute-references', 'getattr hasattr setattr ATTRIBUTEMETHODS'), 'SUBSCRIPTS': ('ref/subscriptions', 'SEQUENCEMETHODS1'), *************** *** 1238,1245 **** 'BITWISE': ('ref/bitwise', 'EXPRESSIONS'), 'COMPARISON': ('ref/comparisons', 'EXPRESSIONS BASICMETHODS'), ! 'BOOLEAN': ('ref/lambda', 'EXPRESSIONS'), 'ASSERTION': 'assert', 'ASSIGNMENT': ('ref/assignment', 'AUGMENTEDASSIGNMENT'), ! 'AUGMENTEDASSIGNMENT': ('ref/augassign', ''), 'DELETION': 'del', 'PRINTING': 'print', --- 1238,1245 ---- 'BITWISE': ('ref/bitwise', 'EXPRESSIONS'), 'COMPARISON': ('ref/comparisons', 'EXPRESSIONS BASICMETHODS'), ! 'BOOLEAN': ('ref/lambda', 'EXPRESSIONS TRUTHVALUE'), 'ASSERTION': 'assert', 'ASSIGNMENT': ('ref/assignment', 'AUGMENTEDASSIGNMENT'), ! 'AUGMENTEDASSIGNMENT': ('ref/augassign', 'NUMBERMETHODS'), 'DELETION': 'del', 'PRINTING': 'print', *************** *** 1249,1252 **** --- 1249,1253 ---- 'LOOPING': ('ref/compound', 'for while break continue'), 'TRUTHVALUE': ('lib/truth', 'if while and or not BASICMETHODS'), + 'DEBUGGING': ('lib/module-pdb', 'pdb'), } *************** *** 1266,1269 **** --- 1267,1276 ---- if dir and os.path.isdir(os.path.join(dir, 'lib')): self.docdir = dir + + def __repr__(self): + if len(inspect.stack()) <= 2: + self() + return '' + return '' % id(self) def __call__(self, request=None): From ping@users.sourceforge.net Fri Apr 13 12:02:53 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 13 Apr 2001 04:02:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32300 Modified Files: pydoc.py Log Message: Word-wrap the list of cross-references. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** pydoc.py 2001/04/13 10:53:25 1.32 --- pydoc.py 2001/04/13 11:02:51 1.33 *************** *** 1399,1403 **** buffer = replace(buffer.getvalue(), '\xa0', ' ', '\n', '\n ') pager(' ' + strip(buffer) + '\n') ! if xrefs: self.output.write('\nRelated help topics: %s\n' % xrefs) def listmodules(self, key=''): --- 1399,1407 ---- buffer = replace(buffer.getvalue(), '\xa0', ' ', '\n', '\n ') pager(' ' + strip(buffer) + '\n') ! if xrefs: ! buffer = StringIO.StringIO() ! formatter.DumbWriter(buffer).send_flowing_data( ! 'Related help topics: ' + join(split(xrefs), ', ') + '\n') ! self.output.write('\n%s\n' % buffer.getvalue()) def listmodules(self, key=''): From ping@users.sourceforge.net Fri Apr 13 13:10:42 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 13 Apr 2001 05:10:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8563 Modified Files: inspect.py Log Message: Robustify getfile() against classes that lie about their __module__s (such as the exceptions in _weakref and _locale!) Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** inspect.py 2001/04/13 09:15:08 1.14 --- inspect.py 2001/04/13 12:10:40 1.15 *************** *** 174,178 **** raise TypeError, 'arg is a built-in module' if isclass(object): ! object = sys.modules[object.__module__] if hasattr(object, '__file__'): return object.__file__ --- 174,178 ---- raise TypeError, 'arg is a built-in module' if isclass(object): ! object = sys.modules.get(object.__module__) if hasattr(object, '__file__'): return object.__file__ From ping@users.sourceforge.net Fri Apr 13 13:11:21 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 13 Apr 2001 05:11:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8803 Modified Files: pydoc.py Log Message: Small style change to accommodate Netscape. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** pydoc.py 2001/04/13 11:02:51 1.33 --- pydoc.py 2001/04/13 12:11:19 1.34 *************** *** 319,323 **** Python: %s %s --- 319,323 ---- Python: %s %s From ping@users.sourceforge.net Fri Apr 13 14:53:10 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 13 Apr 2001 06:53:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31768 Modified Files: pydoc.py Log Message: Add inode checks to detect circular symbolic links (so that the Tools/idle/idlelib link doesn't cause an infinite loop -- aack!) Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** pydoc.py 2001/04/13 12:11:19 1.34 --- pydoc.py 2001/04/13 13:53:07 1.35 *************** *** 1459,1463 **** def __init__(self): roots = map(lambda dir: (dir, ''), pathdirs()) ! Scanner.__init__(self, roots, self.submodules, self.ispackage) def submodules(self, (dir, package)): --- 1459,1464 ---- def __init__(self): roots = map(lambda dir: (dir, ''), pathdirs()) ! Scanner.__init__(self, roots, self.submodules, self.isnewpackage) ! self.inodes = map(lambda (dir, pkg): os.stat(dir)[1], roots) def submodules(self, (dir, package)): *************** *** 1472,1477 **** return children ! def ispackage(self, (dir, package)): ! return ispackage(dir) def run(self, callback, key=None, completer=None): --- 1473,1481 ---- return children ! def isnewpackage(self, (dir, package)): ! inode = os.stat(dir)[1] # detect circular symbolic links ! if not (os.path.islink(dir) and inode in self.inodes): ! self.inodes.append(inode) ! return ispackage(dir) def run(self, callback, key=None, completer=None): From ping@users.sourceforge.net Fri Apr 13 14:57:34 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 13 Apr 2001 06:57:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32735 Modified Files: pydoc.py Log Message: Use inspect.stack()[1][3] to tell if Helper.__repr__ is called interactively. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** pydoc.py 2001/04/13 13:53:07 1.35 --- pydoc.py 2001/04/13 13:57:31 1.36 *************** *** 1269,1276 **** def __repr__(self): ! if len(inspect.stack()) <= 2: self() return '' ! return '' % id(self) def __call__(self, request=None): --- 1269,1276 ---- def __repr__(self): ! if inspect.stack()[1][3] == '?': self() return '' ! return '' def __call__(self, request=None): From ping@users.sourceforge.net Fri Apr 13 15:04:04 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 13 Apr 2001 07:04:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1448 Modified Files: inspect.py Log Message: Clean up isroutine(). Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** inspect.py 2001/04/13 12:10:40 1.15 --- inspect.py 2001/04/13 14:04:02 1.16 *************** *** 128,133 **** def isroutine(object): """Return true if the object is any kind of function or method.""" ! return type(object) in [types.FunctionType, types.LambdaType, ! types.MethodType, types.BuiltinFunctionType] def getmembers(object, predicate=None): --- 128,132 ---- def isroutine(object): """Return true if the object is any kind of function or method.""" ! return isbuiltin(object) or isfunction(object) or ismethod(object) def getmembers(object, predicate=None): From fdrake@users.sourceforge.net Fri Apr 13 15:35:00 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 07:35:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libprofile.tex,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv7746/lib Modified Files: libprofile.tex Log Message: Minor markup adjustments. Turn reference to the cmd module into a hyperlink. Index: libprofile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libprofile.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** libprofile.tex 2001/04/13 00:23:01 1.31 --- libprofile.tex 2001/04/13 14:34:58 1.32 *************** *** 223,227 **** Invoked as a script, the \module{pstats} module is a statistics browser for reading and examining profile dumps. It has a simple ! line-oriented interface (implemented using \module{cmd}) and interactive help. --- 223,227 ---- Invoked as a script, the \module{pstats} module is a statistics browser for reading and examining profile dumps. It has a simple ! line-oriented interface (implemented using \refmodule{cmd}) and interactive help. *************** *** 230,234 **** \dfn{Deterministic profiling} is meant to reflect the fact that all ! \dfn{function call}, \dfn{function return}, and \dfn{exception} events are monitored, and precise timings are made for the intervals between these events (during which time the user's code is executing). In --- 230,234 ---- \dfn{Deterministic profiling} is meant to reflect the fact that all ! \emph{function call}, \emph{function return}, and \emph{exception} events are monitored, and precise timings are made for the intervals between these events (during which time the user's code is executing). In From jhylton@users.sourceforge.net Fri Apr 13 15:36:53 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 13 Apr 2001 07:36:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test tokenize_tests.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8081 Modified Files: tokenize_tests.py Log Message: There's no need for the tokenize tests to include a SyntaxError. Index: tokenize_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/tokenize_tests.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** tokenize_tests.py 2001/01/15 22:04:30 1.2 --- tokenize_tests.py 2001/04/13 14:36:51 1.3 *************** *** 145,149 **** def d22(a, b, c=1, d=2): pass ! def d01v(a=1, *rest, **rest): pass (x, y) <> ({'a':1}, {'b':2}) --- 145,149 ---- def d22(a, b, c=1, d=2): pass ! def d01v(a=1, *restt, **restd): pass (x, y) <> ({'a':1}, {'b':2}) From fdrake@users.sourceforge.net Fri Apr 13 15:52:42 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 07:52:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.115,1.116 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv10766/api Modified Files: api.tex Log Message: Work around the conversion of ">>" and "<<" to guillemets. Reported by Ping. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -r1.115 -r1.116 *** api.tex 2001/04/07 16:14:49 1.115 --- api.tex 2001/04/13 14:52:39 1.116 *************** *** 1722,1726 **** Returns the result of left shifting \var{o1} by \var{o2} on success, or \NULL{} on failure. This is the equivalent of the Python ! expression \samp{\var{o1} << \var{o2}}. \end{cfuncdesc} --- 1722,1726 ---- Returns the result of left shifting \var{o1} by \var{o2} on success, or \NULL{} on failure. This is the equivalent of the Python ! expression \samp{\var{o1} <\code{<} \var{o2}}. \end{cfuncdesc} *************** *** 1729,1733 **** Returns the result of right shifting \var{o1} by \var{o2} on success, or \NULL{} on failure. This is the equivalent of the Python ! expression \samp{\var{o1} >> \var{o2}}. \end{cfuncdesc} --- 1729,1733 ---- Returns the result of right shifting \var{o1} by \var{o2} on success, or \NULL{} on failure. This is the equivalent of the Python ! expression \samp{\var{o1} >\code{>} \var{o2}}. \end{cfuncdesc} *************** *** 1803,1807 **** \NULL{} on failure. The operation is done \emph{in-place} when \var{o1} supports it. This is the equivalent of the Python expression \samp{\var{o1} ! <<= \var{o2}}. \end{cfuncdesc} --- 1803,1807 ---- \NULL{} on failure. The operation is done \emph{in-place} when \var{o1} supports it. This is the equivalent of the Python expression \samp{\var{o1} ! <\code{<=} \var{o2}}. \end{cfuncdesc} *************** *** 1811,1815 **** \NULL{} on failure. The operation is done \emph{in-place} when \var{o1} supports it. This is the equivalent of the Python expression \samp{\var{o1} ! >>= \var{o2}}. \end{cfuncdesc} --- 1811,1815 ---- \NULL{} on failure. The operation is done \emph{in-place} when \var{o1} supports it. This is the equivalent of the Python expression \samp{\var{o1} ! >\code{>=} \var{o2}}. \end{cfuncdesc} From jhylton@users.sourceforge.net Fri Apr 13 15:55:20 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 13 Apr 2001 07:55:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_tokenize,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv11351 Modified Files: test_tokenize Log Message: Update to reflect new tokenize_test.py Index: test_tokenize =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_tokenize,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** test_tokenize 2001/01/24 17:19:08 1.5 --- test_tokenize 2001/04/13 14:55:18 1.6 *************** *** 471,482 **** 147,12-147,13: OP ',' 147,14-147,15: OP '*' ! 147,15-147,19: NAME 'rest' ! 147,19-147,20: OP ',' ! 147,21-147,23: OP '**' ! 147,23-147,27: NAME 'rest' ! 147,27-147,28: OP ')' ! 147,28-147,29: OP ':' ! 147,30-147,34: NAME 'pass' ! 147,34-147,35: NEWLINE '\n' 148,0-148,1: NL '\n' 149,0-149,1: OP '(' --- 471,482 ---- 147,12-147,13: OP ',' 147,14-147,15: OP '*' ! 147,15-147,20: NAME 'restt' ! 147,20-147,21: OP ',' ! 147,22-147,24: OP '**' ! 147,24-147,29: NAME 'restd' ! 147,29-147,30: OP ')' ! 147,30-147,31: OP ':' ! 147,32-147,36: NAME 'pass' ! 147,36-147,37: NEWLINE '\n' 148,0-148,1: NL '\n' 149,0-149,1: OP '(' From jhylton@users.sourceforge.net Fri Apr 13 15:57:10 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 13 Apr 2001 07:57:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib httplib.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11625 Modified Files: httplib.py Log Message: SF patch #405845 by Martin von Löwis Fixes SF bug #405427. If an http response has a bogus return code, e.g. 400.100, raise BadStatusLine. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** httplib.py 2001/02/01 23:35:20 1.33 --- httplib.py 2001/04/13 14:57:08 1.34 *************** *** 127,131 **** raise BadStatusLine(line) ! self.status = status = int(status) self.reason = reason.strip() --- 127,137 ---- raise BadStatusLine(line) ! # The status code is a three-digit number ! try: ! self.status = status = int(status) ! if status < 100 or status > 999: ! raise BadStatusLine(line) ! except ValueError: ! raise BadStatusLine(line) self.reason = reason.strip() From jhylton@users.sourceforge.net Fri Apr 13 15:57:46 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 13 Apr 2001 07:57:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_httplib,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv11988/output Added Files: test_httplib Log Message: Add test for SF bug #405427 --- NEW FILE: test_httplib --- test_httplib reply: 'HTTP/1.1 200 Ok\r\n' Text reply: 'HTTP/1.1 400.100 Not Ok\r\n' BadStatusLine raised as expected From jhylton@users.sourceforge.net Fri Apr 13 15:57:46 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 13 Apr 2001 07:57:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_httplib.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11988 Added Files: test_httplib.py Log Message: Add test for SF bug #405427 --- NEW FILE: test_httplib.py --- from test.test_support import verify,verbose import httplib import StringIO class FakeSocket: def __init__(self, text): self.text = text def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise UnimplementedFileMode() return StringIO.StringIO(self.text) # Test HTTP status lines body = "HTTP/1.1 200 Ok\r\n\r\nText" sock = FakeSocket(body) resp = httplib.HTTPResponse(sock,1) resp.begin() print resp.read() resp.close() body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) resp = httplib.HTTPResponse(sock,1) try: resp.begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" else: print "Expect BadStatusLine" From ping@users.sourceforge.net Fri Apr 13 16:00:29 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 13 Apr 2001 08:00:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11989 Modified Files: pydoc.py Log Message: Use nturl2path to generate a file: URL to source files in Windows. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** pydoc.py 2001/04/13 13:57:31 1.36 --- pydoc.py 2001/04/13 15:00:27 1.37 *************** *** 485,489 **** try: path = inspect.getabsfile(object) ! filelink = '%s' % (path, path) except TypeError: filelink = '(built-in)' --- 485,493 ---- try: path = inspect.getabsfile(object) ! url = path ! if sys.platform == 'win32': ! import nturl2path ! url = nturl2path.pathname2url(path) ! filelink = '%s' % (url, path) except TypeError: filelink = '(built-in)' *************** *** 1474,1480 **** def isnewpackage(self, (dir, package)): ! inode = os.stat(dir)[1] # detect circular symbolic links if not (os.path.islink(dir) and inode in self.inodes): ! self.inodes.append(inode) return ispackage(dir) --- 1478,1484 ---- def isnewpackage(self, (dir, package)): ! inode = os.path.exists(dir) and os.stat(dir)[1] if not (os.path.islink(dir) and inode in self.inodes): ! self.inodes.append(inode) # detect circular symbolic links return ispackage(dir) From gvanrossum@users.sourceforge.net Fri Apr 13 16:04:02 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 13 Apr 2001 08:04:02 -0700 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv13708 Modified Files: LICENSE Log Message: - Inserted the (tentative) PSF license. - Removed the subsection numbering in section B (each time a new license is inserted in the front, the others have to be renumbered). - Changed the words in the intro to avoid implying that 1.6.1 is GPL-compatible. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** LICENSE 2001/04/10 03:37:31 1.12 --- LICENSE 2001/04/13 15:04:00 1.13 *************** *** 20,26 **** Foundation (FSF) interacted to develop enabling wording changes to the Python license. Python 1.6.1 is essentially the same as Python 1.6, ! with a few minor bug fixes, and with a GPL compatible open source ! license. Python 2.1 is a derivative work of Python 1.6.1, as well as ! of Python 2.0. After Python 2.0 was released by BeOpen.com, Guido van Rossum and the --- 20,26 ---- Foundation (FSF) interacted to develop enabling wording changes to the Python license. Python 1.6.1 is essentially the same as Python 1.6, ! with a few minor bug fixes, and with a different license that enables ! later versions to be GPL-compatible. Python 2.1 is a derivative work ! of Python 1.6.1, as well as of Python 2.0. After Python 2.0 was released by BeOpen.com, Guido van Rossum and the *************** *** 39,45 **** =============================================================== ! B.1. BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0 ! --------------------------------------------------- BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 --- 39,100 ---- =============================================================== ! PSF LICENSE AGREEMENT ! --------------------- + 1. This LICENSE AGREEMENT is between the Python Software Foundation + ("PSF"), and the Individual or Organization ("Licensee") accessing and + otherwise using Python 2.1 software in source or binary form and its + associated documentation. + + 2. Subject to the terms and conditions of this License Agreement, PSF + hereby grants Licensee a nonexclusive, royalty-free, world-wide + license to reproduce, analyze, test, perform and/or display publicly, + prepare derivative works, distribute, and otherwise use Python 2.1 + alone or in any derivative version, provided, however, that PSF's + License Agreement and PSF's notice of copyright, i.e., "Copyright (c) + 2001 Python Software Foundation; All Rights Reserved" are retained in + Python 2.1 alone or in any derivative version prepared by Licensee. + + 3. In the event Licensee prepares a derivative work that is based on + or incorporates Python 2.1 or any part thereof, and wants to make + the derivative work available to others as provided herein, then + Licensee hereby agrees to include in any such work a brief summary of + the changes made to Python 2.1. + + 4. PSF is making Python 2.1 available to Licensee on an "AS IS" + basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR + IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND + DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS + FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.1 WILL NOT + INFRINGE ANY THIRD PARTY RIGHTS. + + 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON + 2.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS + A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.1, + OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + + 6. This License Agreement will automatically terminate upon a material + breach of its terms and conditions. + + 7. This License Agreement shall be governed by the federal + intellectual property law of the United States, including without + limitation the federal copyright law, and, to the extent such + U.S. federal law does not apply, by the law of the Commonwealth of + Virginia, excluding Virginia's conflict of law provisions. + Notwithstanding the foregoing, with regard to derivative works based + on Python 2.1 that incorporate non-separable material that was + previously distributed under the GNU General Public License (GPL), the + law of the Commonwealth of Virginia shall govern this License + Agreement only as to issues arising under or with respect to + Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this + License Agreement shall be deemed to create any relationship of + agency, partnership, or joint venture between PSF and Licensee. This + License Agreement does not grant permission to use PSF trademarks or + trade name in a trademark sense to endorse or promote products or + services of Licensee, or any third party. + + BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0 + ---------------------------------------------- + BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 *************** *** 89,94 **** ! B.2. CNRI OPEN SOURCE GPL-COMPATIBLE LICENSE AGREEMENT ! ------------------------------------------------------ 1. This LICENSE AGREEMENT is between the Corporation for National --- 144,149 ---- ! CNRI OPEN SOURCE GPL-COMPATIBLE LICENSE AGREEMENT ! ------------------------------------------------- 1. This LICENSE AGREEMENT is between the Corporation for National *************** *** 160,165 **** ! B.3. CWI PERMISSIONS STATEMENT AND DISCLAIMER ! --------------------------------------------- Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, --- 215,220 ---- ! CWI PERMISSIONS STATEMENT AND DISCLAIMER ! ---------------------------------------- Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, From gvanrossum@users.sourceforge.net Fri Apr 13 16:04:33 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 13 Apr 2001 08:04:33 -0700 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv13904 Modified Files: LICENSE Log Message: Oops. Need an extra blank line after the PSF license. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** LICENSE 2001/04/13 15:04:00 1.13 --- LICENSE 2001/04/13 15:04:31 1.14 *************** *** 94,97 **** --- 94,98 ---- services of Licensee, or any third party. + BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0 ---------------------------------------------- From ping@users.sourceforge.net Fri Apr 13 16:04:34 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 13 Apr 2001 08:04:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13824 Modified Files: pydoc.py Log Message: One-character style change to appease Netscape stylesheets. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** pydoc.py 2001/04/13 15:00:27 1.37 --- pydoc.py 2001/04/13 15:04:32 1.38 *************** *** 319,323 **** Python: %s %s --- 319,323 ---- Python: %s %s From gvanrossum@users.sourceforge.net Fri Apr 13 16:26:02 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 13 Apr 2001 08:26:02 -0700 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.7,1.7.2.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv18367 Modified Files: Tag: release20-maint LICENSE Log Message: Updated the license situation. Basically, this is the exact same license as for 2.1. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -r1.7 -r1.7.2.1 *** LICENSE 2000/10/10 14:49:44 1.7 --- LICENSE 2001/04/13 15:26:00 1.7.2.1 *************** *** 1,4 **** ! HISTORY OF THE SOFTWARE ! ======================= Python was created in the early 1990s by Guido van Rossum at Stichting --- 1,4 ---- ! A. HISTORY OF THE SOFTWARE ! ========================== Python was created in the early 1990s by Guido van Rossum at Stichting *************** *** 10,25 **** Virginia where he released several versions of the software. Python 1.6 was the last of the versions released by CNRI. In 2000, Guido and ! the Python core developement team moved to BeOpen.com to form the ! BeOpen PythonLabs team (www.pythonlabs.com). Python 2.0 is the first ! release from PythonLabs. Thanks to the many outside volunteers who ! have worked under Guido's direction to make this release possible. BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0 ! ============================================== BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 - ----------------------------------------------------- 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an --- 10,102 ---- Virginia where he released several versions of the software. Python 1.6 was the last of the versions released by CNRI. In 2000, Guido and ! the Python core development team moved to BeOpen.com to form the ! BeOpen PythonLabs team. Python 2.0 was the first and only release ! from BeOpen.com. ! ! Following the release of Python 1.6, and after Guido van Rossum left ! CNRI to work with commercial software developers, it became clear that ! the ability to use Python with software available under the GNU Public ! License (GPL) was very desirable. CNRI and the Free Software ! Foundation (FSF) interacted to develop enabling wording changes to the ! Python license. Python 1.6.1 is essentially the same as Python 1.6, ! with a few minor bug fixes, and with a different license that enables ! later versions to be GPL-compatible. Python 2.1 is a derivative work ! of Python 1.6.1, as well as of Python 2.0. ! ! After Python 2.0 was released by BeOpen.com, Guido van Rossum and the ! other PythonLabs developers joined Digital Creations. All ! intellectual property added from this point on, including Python ! 2.0.1 and its alpha and beta releases, is owned by the Python Software ! Foundation (PSF), a non-profit modeled after the Apache Software ! Foundation. See http://www.python.org/psf/ for more information about ! the PSF. ! ! Thanks to the many outside volunteers who have worked under Guido's ! direction to make these releases possible. ! ! ! B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON ! =============================================================== ! ! PSF LICENSE AGREEMENT ! --------------------- ! ! 1. This LICENSE AGREEMENT is between the Python Software Foundation ! ("PSF"), and the Individual or Organization ("Licensee") accessing and ! otherwise using Python 2.0.1 software in source or binary form and its ! associated documentation. + 2. Subject to the terms and conditions of this License Agreement, PSF + hereby grants Licensee a nonexclusive, royalty-free, world-wide + license to reproduce, analyze, test, perform and/or display publicly, + prepare derivative works, distribute, and otherwise use Python 2.0.1 + alone or in any derivative version, provided, however, that PSF's + License Agreement and PSF's notice of copyright, i.e., "Copyright (c) + 2001 Python Software Foundation; All Rights Reserved" are retained in + Python 2.0.1 alone or in any derivative version prepared by Licensee. + + 3. In the event Licensee prepares a derivative work that is based on + or incorporates Python 2.0.1 or any part thereof, and wants to make + the derivative work available to others as provided herein, then + Licensee hereby agrees to include in any such work a brief summary of + the changes made to Python 2.0.1. + + 4. PSF is making Python 2.0.1 available to Licensee on an "AS IS" + basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR + IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND + DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS + FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.0.1 WILL NOT + INFRINGE ANY THIRD PARTY RIGHTS. + + 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON + 2.0.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS + A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.0.1, + OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + 6. This License Agreement will automatically terminate upon a material + breach of its terms and conditions. + + 7. This License Agreement shall be governed by the federal + intellectual property law of the United States, including without + limitation the federal copyright law, and, to the extent such + U.S. federal law does not apply, by the law of the Commonwealth of + Virginia, excluding Virginia's conflict of law provisions. + Notwithstanding the foregoing, with regard to derivative works based + on Python 2.0.1 that incorporate non-separable material that was + previously distributed under the GNU General Public License (GPL), the + law of the Commonwealth of Virginia shall govern this License + Agreement only as to issues arising under or with respect to + Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this + License Agreement shall be deemed to create any relationship of + agency, partnership, or joint venture between PSF and Licensee. This + License Agreement does not grant permission to use PSF trademarks or + trade name in a trademark sense to endorse or promote products or + services of Licensee, or any third party. + BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0 ! ---------------------------------------------- BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an *************** *** 68,142 **** ! CNRI OPEN SOURCE LICENSE AGREEMENT ! ---------------------------------- - Python 1.6 CNRI OPEN SOURCE LICENSE AGREEMENT - - IMPORTANT: PLEASE READ THE FOLLOWING AGREEMENT CAREFULLY. BY CLICKING - ON "ACCEPT" WHERE INDICATED BELOW, OR BY COPYING, INSTALLING OR - OTHERWISE USING PYTHON 1.6 SOFTWARE, YOU ARE DEEMED TO HAVE AGREED TO - THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT. - 1. This LICENSE AGREEMENT is between the Corporation for National Research Initiatives, having an office at 1895 Preston White Drive, Reston, VA 20191 ("CNRI"), and the Individual or Organization ! ("Licensee") accessing and otherwise using Python 1.6 software in ! source or binary form and its associated documentation, as released at ! the www.python.org Internet site on September 5, 2000 ("Python 1.6"). 2. Subject to the terms and conditions of this License Agreement, CNRI hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, ! prepare derivative works, distribute, and otherwise use Python 1.6 alone or in any derivative version, provided, however, that CNRI's License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) ! 1995-2000 Corporation for National Research Initiatives; All Rights ! Reserved" are retained in Python 1.6 alone or in any derivative ! version prepared by ! ! Licensee. Alternately, in lieu of CNRI's License Agreement, Licensee ! may substitute the following text (omitting the quotes): "Python 1.6 ! is made available subject to the terms and conditions in CNRI's ! License Agreement. This Agreement together with Python 1.6 may be ! located on the Internet using the following unique, persistent ! identifier (known as a handle): 1895.22/1012. This Agreement may also ! be obtained from a proxy server on the Internet using the following ! URL: http://hdl.handle.net/1895.22/1012". 3. In the event Licensee prepares a derivative work that is based on ! or incorporates Python 1.6 or any part thereof, and wants to make the ! derivative work available to others as provided herein, then Licensee ! hereby agrees to include in any such work a brief summary of the ! changes made to Python 1.6. ! ! 4. CNRI is making Python 1.6 available to Licensee on an "AS IS" ! basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR ! IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS ! FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON ! 1.6 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A ! RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6, OR ! ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material breach of its terms and conditions. ! 7. This License Agreement shall be governed by and interpreted in all ! respects by the law of the State of Virginia, excluding conflict of ! law provisions. Nothing in this License Agreement shall be deemed to ! create any relationship of agency, partnership, or joint venture ! between CNRI and Licensee. This License Agreement does not grant ! permission to use CNRI trademarks or trade name in a trademark sense ! to endorse or promote products or services of Licensee, or any third ! party. 8. By clicking on the "ACCEPT" button where indicated, or by copying, ! installing or otherwise using Python 1.6, Licensee agrees to be bound ! by the terms and conditions of this License Agreement. ! ACCEPT --- 145,217 ---- ! CNRI OPEN SOURCE GPL-COMPATIBLE LICENSE AGREEMENT ! ------------------------------------------------- 1. This LICENSE AGREEMENT is between the Corporation for National Research Initiatives, having an office at 1895 Preston White Drive, Reston, VA 20191 ("CNRI"), and the Individual or Organization ! ("Licensee") accessing and otherwise using Python 1.6.1 software in ! source or binary form and its associated documentation. 2. Subject to the terms and conditions of this License Agreement, CNRI hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, ! prepare derivative works, distribute, and otherwise use Python 1.6.1 alone or in any derivative version, provided, however, that CNRI's License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) ! 1995-2001 Corporation for National Research Initiatives; All Rights ! Reserved" are retained in Python 1.6.1 alone or in any derivative ! version prepared by Licensee. Alternately, in lieu of CNRI's License ! Agreement, Licensee may substitute the following text (omitting the ! quotes): "Python 1.6.1 is made available subject to the terms and ! conditions in CNRI's License Agreement. This Agreement together with ! Python 1.6.1 may be located on the Internet using the following ! unique, persistent identifier (known as a handle): 1895.22/1013. This ! Agreement may also be obtained from a proxy server on the Internet ! using the following URL: http://hdl.handle.net/1895.22/1013". 3. In the event Licensee prepares a derivative work that is based on ! or incorporates Python 1.6.1 or any part thereof, and wants to make ! the derivative work available to others as provided herein, then ! Licensee hereby agrees to include in any such work a brief summary of ! the changes made to Python 1.6.1. ! ! 4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" ! basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR ! IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS ! FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON ! 1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS ! A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, ! OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material breach of its terms and conditions. ! 7. This License Agreement shall be governed by the federal ! intellectual property law of the United States, including without ! limitation the federal copyright law, and, to the extent such ! U.S. federal law does not apply, by the law of the Commonwealth of ! Virginia, excluding Virginia's conflict of law provisions. ! Notwithstanding the foregoing, with regard to derivative works based ! on Python 1.6.1 that incorporate non-separable material that was ! previously distributed under the GNU General Public License (GPL), the ! law of the Commonwealth of Virginia shall govern this License ! Agreement only as to issues arising under or with respect to ! Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this ! License Agreement shall be deemed to create any relationship of ! agency, partnership, or joint venture between CNRI and Licensee. This ! License Agreement does not grant permission to use CNRI trademarks or ! trade name in a trademark sense to endorse or promote products or ! services of Licensee, or any third party. 8. By clicking on the "ACCEPT" button where indicated, or by copying, ! installing or otherwise using Python 1.6.1, Licensee agrees to be ! bound by the terms and conditions of this License Agreement. ! ACCEPT From gvanrossum@users.sourceforge.net Fri Apr 13 16:31:44 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 13 Apr 2001 08:31:44 -0700 Subject: [Python-checkins] CVS: python/dist/src README,1.104,1.104.2.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv19574 Modified Files: Tag: release20-maint README Log Message: Updated copyright situation; removed most BeOpen and all PythonLabs references; clarified the version. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.104 retrieving revision 1.104.2.1 diff -C2 -r1.104 -r1.104.2.1 *** README 2000/10/16 18:26:42 1.104 --- README 2001/04/13 15:31:42 1.104.2.1 *************** *** 1,9 **** ! This is Python version 2.0 ! ========================== Copyright (c) 2000 BeOpen.com. All rights reserved. ! Copyright (c) 1995-2000 Corporation for National Research Initiatives. All rights reserved. --- 1,12 ---- ! This is Python version 2.0.1, a bugfix release for Python 2.0 ! ============================================================= + Copyright (c) 2001 Python Software Foundation. + All rights reserved. + Copyright (c) 2000 BeOpen.com. All rights reserved. ! Copyright (c) 1995-2001 Corporation for National Research Initiatives. All rights reserved. *************** *** 31,36 **** --------------------------- ! See the file "Misc/NEWS"; see also this URL: ! http://www.pythonlabs.com/products/python2.0/ If you don't read instructions --- 34,38 ---- --------------------------- ! See the file "Misc/NEWS". If you don't read instructions *************** *** 53,64 **** compared to Tcl, Perl, Java, JavaScript, Visual Basic or Scheme. To find out more about what Python can do for you, point your browser to ! http://www.pythonlabs.com/. ! ! BeOpen.com offers corporate support, custom development and ! sponsorships for Python. Contact for more ! information. ! ! BeOpen Python releases include pre-built Python executables for major ! platforms and are available from PythonLabs. --- 55,59 ---- compared to Tcl, Perl, Java, JavaScript, Visual Basic or Scheme. To find out more about what Python can do for you, point your browser to ! http://www.python.org/. *************** *** 96,107 **** New Python releases and related technologies are published at ! http://www.pythonlabs.com/. Come visit us! ! The present Python community web site is http://www.python.org/. ! BeOpen.com is developing a next-generation community site for Python ! and is looking for volunteers to help make this an even better ! resource than the existing community site. If you know Python well ! and would like to volunteer to work with us on this project, please ! contact with a summary of your skills. --- 91,97 ---- New Python releases and related technologies are published at ! http://www.python.org/. Come visit us! ! There's also a Python community web site at http://starship.python.net/. *************** *** 145,151 **** best to post to the comp.lang.python or the Python mailing list (see above). If you specifically don't want to involve the newsgroup or ! mailing list, send questions to (a group of ! volunteers who answer questions as they can). The newsgroup is the ! most efficient way to ask public questions. --- 135,141 ---- best to post to the comp.lang.python or the Python mailing list (see above). If you specifically don't want to involve the newsgroup or ! mailing list, send questions to help@python.org (a group of volunteers ! who answer questions as they can). The newsgroup is the most ! efficient way to ask public questions. *************** *** 228,233 **** (Some of these may no longer apply. If you find you can build Python ! on these platforms without the special directions mentioned here, mail ! to so we can remove them!) 64-bit platforms: The modules audioop, imageop and rgbimg don't work. --- 218,224 ---- (Some of these may no longer apply. If you find you can build Python ! on these platforms without the special directions mentioned here, ! submit a documentation bug report to SourceForge (see Bug Reports ! above) so we can remove them!) 64-bit platforms: The modules audioop, imageop and rgbimg don't work. *************** *** 547,554 **** All subdirectories created will have Python's version number in their name, e.g. the library modules are installed in ! "/usr/local/lib/python2.0/" by default. The Python binary is ! installed as "python2.0" and a hard link named "python" is created. ! The only file not installed with a version number in its name is the ! manual page, installed as "/usr/local/man/man1/python.1" by default. If you have a previous installation of a pre-2.0 Python that you don't --- 538,547 ---- All subdirectories created will have Python's version number in their name, e.g. the library modules are installed in ! "/usr/local/lib/python/" by default, where is the ! . release number (i.e. "2.0", even though this is Python ! 2.0.1). The Python binary is installed as "python" and a ! hard link named "python" is created. The only file not installed with ! a version number in its name is the manual page, installed as ! "/usr/local/man/man1/python.1" by default. If you have a previous installation of a pre-2.0 Python that you don't *************** *** 558,563 **** This installs the same set of files as "make install" except it ! doesn't create the hard link to "python2.0" named "python" and it ! doesn't install the manual page at all. The only thing you may have to install manually is the Python mode for --- 551,556 ---- This installs the same set of files as "make install" except it ! doesn't create the hard link to "python" named "python" and ! it doesn't install the manual page at all. The only thing you may have to install manually is the Python mode for *************** *** 713,717 **** Of course, there are also binary distributions available for these ! platforms -- see http://www.pythonlabs.com/products/python2.0/. To port Python to a new non-UNIX system, you will have to fake the --- 706,710 ---- Of course, there are also binary distributions available for these ! platforms -- see http://www.python.org/. To port Python to a new non-UNIX system, you will have to fake the *************** *** 735,743 **** Misc/python-mode.el. Originally written by the famous Tim Peters, it is now maintained by the equally famous Barry Warsaw (it's no ! coincidence that they now both work at PythonLabs). The latest version, along with various other contributed Python-related Emacs ! goodies, is online at . And if you are planning to edit the Python C code, please pick up the ! latest version of CC Mode ; it contains a "python" style used throughout most of the Python C source files. (Newer versions of Emacs or XEmacs may already come with the --- 728,736 ---- Misc/python-mode.el. Originally written by the famous Tim Peters, it is now maintained by the equally famous Barry Warsaw (it's no ! coincidence that they now both work on the same team). The latest version, along with various other contributed Python-related Emacs ! goodies, is online at http://www.python.org/emacs/python-mode. And if you are planning to edit the Python C code, please pick up the ! latest version of CC Mode http://www.python.org/emacs/cc-mode; it contains a "python" style used throughout most of the Python C source files. (Newer versions of Emacs or XEmacs may already come with the *************** *** 827,831 **** config.status Status from last run of the configure script getbuildinfo.o Object file from Modules/getbuildinfo.c ! libpython2.0.a The library archive python The executable interpreter tags, TAGS Tags files for vi and Emacs --- 820,824 ---- config.status Status from last run of the configure script getbuildinfo.o Object file from Modules/getbuildinfo.c ! libpython.a The library archive python The executable interpreter tags, TAGS Tags files for vi and Emacs *************** *** 836,838 **** ! --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/) --- 829,831 ---- ! --Guido van Rossum (home page: http://www.python.org/~guido/) From gvanrossum@users.sourceforge.net Fri Apr 13 16:42:42 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 13 Apr 2001 08:42:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.236,2.237 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv21661 Modified Files: ceval.c Log Message: Patch by Ping (SF bug 415879, Exception.__init__() causes segfault): Calling an unbound method on a C extension class without providing an instance can yield a segfault. Try "Exception.__init__()" or "ValueError.__init__()". This is a simple fix. The error-reporting bits in call_method mistakenly treat the misleadingly-named variable "func" as a function, when in fact it is a method. If we let get_func_name take care of the work, all is fine. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.236 retrieving revision 2.237 diff -C2 -r2.236 -r2.237 *** ceval.c 2001/04/11 13:52:29 2.236 --- ceval.c 2001/04/13 15:42:40 2.237 *************** *** 2884,2893 **** } if (!ok) { ! PyObject* fn = ((PyFunctionObject*) func)->func_name; PyErr_Format(PyExc_TypeError, "unbound method %s%smust be " "called with instance as first argument", ! fn ? PyString_AsString(fn) : "", ! fn ? "() " : ""); return NULL; } --- 2884,2892 ---- } if (!ok) { ! char* fn = get_func_name(func); PyErr_Format(PyExc_TypeError, "unbound method %s%smust be " "called with instance as first argument", ! fn ? fn : "", fn ? "() " : ""); return NULL; } From moshez@users.sourceforge.net Fri Apr 13 16:52:42 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 13 Apr 2001 08:52:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/sax xmlreader.py,1.10,1.10.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory usw-pr-cvs1:/tmp/cvs-serv22656/Lib/xml/sax Modified Files: Tag: release20-maint xmlreader.py Log Message: Lib/xml/sax/xmlreader.py - import the exceptions this module can raise Index: xmlreader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/xmlreader.py,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -r1.10 -r1.10.2.1 *** xmlreader.py 2000/10/06 21:12:12 1.10 --- xmlreader.py 2001/04/13 15:52:39 1.10.2.1 *************** *** 4,7 **** --- 4,10 ---- import handler + from _exceptions import SAXNotSupportedException, SAXNotRecognizedException + + # ===== XMLREADER ===== From moshez@users.sourceforge.net Fri Apr 13 16:52:42 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 13 Apr 2001 08:52:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.40,1.81.2.41 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv22656/Misc Modified Files: Tag: release20-maint NEWS Log Message: Lib/xml/sax/xmlreader.py - import the exceptions this module can raise Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.40 retrieving revision 1.81.2.41 diff -C2 -r1.81.2.40 -r1.81.2.41 *** NEWS 2001/03/31 16:09:32 1.81.2.40 --- NEWS 2001/04/13 15:52:40 1.81.2.41 *************** *** 163,166 **** --- 163,172 ---- - #128930 - distutils/command/build_ext.py - split rpath argument + - #131064, #129584, #127722 - PC/getpathp.c + + - asynchat.py - now checking for empty buffer with ==, not "is" + + - Lib/xml/sax/xmlreader.py - import the exceptions this module can raise + What's New in Python 2.0? ========================= From fdrake@users.sourceforge.net Fri Apr 13 16:54:43 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 08:54:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.63,1.64 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv24224/ref Modified Files: ref3.tex Log Message: Work around the conversion of ">>" and "<<" to guillemets. Reported by Ping. Wrap some long lines and fix some markup nits. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -r1.63 -r1.64 *** ref3.tex 2001/03/23 17:23:50 1.63 --- ref3.tex 2001/04/13 15:54:41 1.64 *************** *** 1234,1239 **** Same notes for \var{i} and \var{j} as for \method{__getslice__()}. ! This method is deprecated. If no \method{__setslice__()} is found, a slice ! object is created instead, and passed to \method{__setitem__()} instead. \end{methoddesc} --- 1234,1240 ---- Same notes for \var{i} and \var{j} as for \method{__getslice__()}. ! This method is deprecated. If no \method{__setslice__()} is found, a ! slice object is created instead, and passed to \method{__setitem__()} ! instead. \end{methoddesc} *************** *** 1241,1253 **** Called to implement deletion of \code{\var{self}[\var{i}:\var{j}]}. Same notes for \var{i} and \var{j} as for \method{__getslice__()}. ! This method is deprecated. If no \method{__delslice__()} is found, a slice ! object is created instead, and passed to \method{__delitem__()} instead. \end{methoddesc} ! Notice that these methods are only invoked when a single slice with a single ! colon is used, and the slice method is available. For slice operations ! involving extended slice notation, or in absence of the slice methods, ! \method{__getitem__()}, \method{__setitem__()} or \method{__delitem__()} is ! called with a slice object as argument. The following example demonstrate how to make your program or module --- 1242,1255 ---- Called to implement deletion of \code{\var{self}[\var{i}:\var{j}]}. Same notes for \var{i} and \var{j} as for \method{__getslice__()}. ! This method is deprecated. If no \method{__delslice__()} is found, a ! slice object is created instead, and passed to \method{__delitem__()} ! instead. \end{methoddesc} ! Notice that these methods are only invoked when a single slice with a ! single colon is used, and the slice method is available. For slice ! operations involving extended slice notation, or in absence of the ! slice methods, \method{__getitem__()}, \method{__setitem__()} or ! \method{__delitem__()} is called with a slice object as argument. The following example demonstrate how to make your program or module *************** *** 1327,1334 **** \code{-}, \code{*}, \code{/}, \code{\%}, \function{divmod()}\bifuncindex{divmod}, ! \function{pow()}\bifuncindex{pow}, \code{**}, \code{<<}, \code{>>}, ! \code{\&}, \code{\^}, \code{|}). For instance, to evaluate the ! expression \var{x}\code{+}\var{y}, where \var{x} is an instance of a ! class that has an \method{__add__()} method, \code{\var{x}.__add__(\var{y})} is called. Note that \method{__pow__()} should be defined to accept an optional third --- 1329,1336 ---- \code{-}, \code{*}, \code{/}, \code{\%}, \function{divmod()}\bifuncindex{divmod}, ! \function{pow()}\bifuncindex{pow}, \code{**}, \code{<}\code{<}, ! \code{>}\code{>}, \code{\&}, \code{\^}, \code{|}). For instance, to ! evaluate the expression \var{x}\code{+}\var{y}, where \var{x} is an ! instance of a class that has an \method{__add__()} method, \code{\var{x}.__add__(\var{y})} is called. Note that \method{__pow__()} should be defined to accept an optional third *************** *** 1353,1364 **** \code{-}, \code{*}, \code{/}, \code{\%}, \function{divmod()}\bifuncindex{divmod}, ! \function{pow()}\bifuncindex{pow}, \code{**}, \code{<<}, \code{>>}, ! \code{\&}, \code{\^}, \code{|}) with reflected (swapped) operands. These ! functions are only called if the left operand does not support the ! corresponding operation. For instance, to evaluate the expression ! \var{x}\code{-}\var{y}, where \var{y} is an instance of a class that ! has an \method{__rsub__()} method, \code{\var{y}.__rsub__(\var{x})} is ! called. Note that ternary \function{pow()}\bifuncindex{pow} will not ! try calling \method{__rpow__()} (the coercion rules would become too complicated). \end{methoddesc} --- 1355,1367 ---- \code{-}, \code{*}, \code{/}, \code{\%}, \function{divmod()}\bifuncindex{divmod}, ! \function{pow()}\bifuncindex{pow}, \code{**}, \code{<}\code{<}, ! \code{>}\code{>}, \code{\&}, \code{\^}, \code{|}) with reflected ! (swapped) operands. These functions are only called if the left ! operand does not support the corresponding operation. For instance, ! to evaluate the expression \var{x}\code{-}\var{y}, where \var{y} is an ! instance of a class that has an \method{__rsub__()} method, ! \code{\var{y}.__rsub__(\var{x})} is called. Note that ternary ! \function{pow()}\bifuncindex{pow} will not try calling ! \method{__rpow__()} (the coercion rules would become too complicated). \end{methoddesc} *************** *** 1375,1391 **** \methodline[numeric object]{__ixor__}{self, other} \methodline[numeric object]{__ior__}{self, other} ! These methods are called to implement the augmented arithmetic operations ! (\code{+=}, \code{-=}, \code{*=}, \code{/=}, \code{\%=}, \code{**=}, ! \code{<<=}, \code{>>=}, \code{\&=}, \code{\^=}, \code{|=}). These methods ! should attempt to do the operation in-place (modifying \var{self}) and ! return the result (which could be, but does not have to be, \var{self}). If ! a specific method is not defined, the augmented operation falls back to the ! normal methods. For instance, to evaluate the expression ! \var{x}\code{+=}\var{y}, where \var{x} is an instance of a class that has an ! \method{__iadd__()} method, \code{\var{x}.__iadd__(\var{y})} is called. If ! \var{x} is an instance of a class that does not define a \method{__iadd()} ! method, \code{\var{x}.__add__(\var{y})} and \code{\var{y}.__radd__(\var{x})} ! are considered, as with the evaluation of \var{x}\code{+}\var{y}. ! \end{methoddesc} --- 1378,1395 ---- \methodline[numeric object]{__ixor__}{self, other} \methodline[numeric object]{__ior__}{self, other} ! These methods are called to implement the augmented arithmetic ! operations (\code{+=}, \code{-=}, \code{*=}, \code{/=}, \code{\%=}, ! \code{**=}, \code{<}\code{<=}, \code{>}\code{>=}, \code{\&=}, ! \code{\^=}, \code{|=}). These methods should attempt to do the ! operation in-place (modifying \var{self}) and return the result (which ! could be, but does not have to be, \var{self}). If a specific method ! is not defined, the augmented operation falls back to the normal ! methods. For instance, to evaluate the expression ! \var{x}\code{+=}\var{y}, where \var{x} is an instance of a class that ! has an \method{__iadd__()} method, \code{\var{x}.__iadd__(\var{y})} is ! called. If \var{x} is an instance of a class that does not define a ! \method{__iadd()} method, \code{\var{x}.__add__(\var{y})} and ! \code{\var{y}.__radd__(\var{x})} are considered, as with the ! evaluation of \var{x}\code{+}\var{y}. \end{methoddesc} *************** *** 1394,1399 **** \methodline[numeric object]{__abs__}{self} \methodline[numeric object]{__invert__}{self} ! Called to implement the unary arithmetic operations (\code{-}, \code{+}, ! \function{abs()}\bifuncindex{abs} and \code{\~{}}). \end{methoddesc} --- 1398,1403 ---- \methodline[numeric object]{__abs__}{self} \methodline[numeric object]{__invert__}{self} ! Called to implement the unary arithmetic operations (\code{-}, ! \code{+}, \function{abs()}\bifuncindex{abs} and \code{\~{}}). \end{methoddesc} *************** *** 1428,1434 **** \strong{Coercion rules}: to evaluate \var{x} \var{op} \var{y}, the ! following steps are taken (where \method{__op__()} and ! \method{__rop__()} are the method names corresponding to \var{op}, ! e.g., if var{op} is `\code{+}', \method{__add__()} and \method{__radd__()} are used). If an exception occurs at any point, the evaluation is abandoned and exception handling takes over. --- 1432,1438 ---- \strong{Coercion rules}: to evaluate \var{x} \var{op} \var{y}, the ! following steps are taken (where \method{__\var{op}__()} and ! \method{__r\var{op}__()} are the method names corresponding to ! \var{op}, e.g., if \var{op} is `\code{+}', \method{__add__()} and \method{__radd__()} are used). If an exception occurs at any point, the evaluation is abandoned and exception handling takes over. *************** *** 1436,1442 **** \begin{itemize} ! \item[0.] If \var{x} is a string object and op is the modulo operator (\%), ! the string formatting operation is invoked and the remaining steps are ! skipped. \item[1.] If \var{x} is a class instance: --- 1440,1446 ---- \begin{itemize} ! \item[0.] If \var{x} is a string object and \var{op} is the modulo ! operator (\%), the string formatting operation is invoked and ! the remaining steps are skipped. \item[1.] If \var{x} is a class instance: *************** *** 1452,1457 **** after coercion, go to step 3. ! \item[1c.] If \var{x} has a method \method{__op__()}, return ! \code{\var{x}.__op__(\var{y})}; otherwise, restore \var{x} and \var{y} to their value before step 1a. --- 1456,1461 ---- after coercion, go to step 3. ! \item[1c.] If \var{x} has a method \method{__\var{op}__()}, return ! \code{\var{x}.__\var{op}__(\var{y})}; otherwise, restore \var{x} and \var{y} to their value before step 1a. *************** *** 1470,1476 **** after coercion, go to step 3. ! \item[2b.] If \var{y} has a method \method{__rop__()}, return ! \code{\var{y}.__rop__(\var{x})}; otherwise, restore \var{x} ! and \var{y} to their value before step 2a. \end{itemize} --- 1474,1480 ---- after coercion, go to step 3. ! \item[2b.] If \var{y} has a method \method{__r\var{op}__()}, ! return \code{\var{y}.__r\var{op}__(\var{x})}; otherwise, ! restore \var{x} and \var{y} to their value before step 2a. \end{itemize} *************** *** 1481,1489 **** \begin{itemize} ! \item[3a.] If op is `\code{+}' and \var{x} is a sequence, ! sequence concatenation is invoked. ! \item[3b.] If op is `\code{*}' and one operand is a sequence ! and the other an integer, sequence repetition is invoked. \item[3c.] Otherwise, both operands must be numbers; they are --- 1485,1494 ---- \begin{itemize} ! \item[3a.] If \var{op} is `\code{+}' and \var{x} is a ! sequence, sequence concatenation is invoked. ! \item[3b.] If \var{op} is `\code{*}' and one operand is a ! sequence and the other an integer, sequence repetition is ! invoked. \item[3c.] Otherwise, both operands must be numbers; they are From fdrake@users.sourceforge.net Fri Apr 13 16:55:27 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 08:55:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref6.tex,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv24456/ref Modified Files: ref6.tex Log Message: Work around the conversion of ">>" and "<<" to guillemets. Reported by Ping. Index: ref6.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref6.tex,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** ref6.tex 2001/03/23 14:34:06 1.36 --- ref6.tex 2001/04/13 15:55:25 1.37 *************** *** 379,383 **** \end{verbatim} ! In this form, the first expression after the \keyword{>>} must evaluate to a ``file-like'' object, specifically an object that has a \method{write()} method as described above. With this extended form, --- 379,383 ---- \end{verbatim} ! In this form, the first expression after the \code{>}\code{>} must evaluate to a ``file-like'' object, specifically an object that has a \method{write()} method as described above. With this extended form, From jhylton@users.sourceforge.net Fri Apr 13 17:51:48 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 13 Apr 2001 09:51:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.237,2.238 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv4675/Python Modified Files: ceval.c Log Message: Change error message raised when free variable is not yet bound. It now raises NameError instead of UnboundLocalError, because the var in question is definitely not local. (This affects test_scope.py) Also update the recent fix by Ping using get_func_name(). Replace tests of get_func_name() return value with call to get_func_desc() to match all the other uses. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.237 retrieving revision 2.238 diff -C2 -r2.237 -r2.238 *** ceval.c 2001/04/13 15:42:40 2.237 --- ceval.c 2001/04/13 16:51:46 2.238 *************** *** 84,87 **** --- 84,90 ---- #define UNBOUNDLOCAL_ERROR_MSG \ "local variable '%.200s' referenced before assignment" + #define UNBOUNDFREE_ERROR_MSG \ + "free variable '%.200s' referenced before assignment" \ + " in enclosing scope" /* Dynamic execution profile */ *************** *** 1694,1709 **** w = PyCell_Get(x); if (w == NULL) { ! if (oparg < f->f_ncells) v = PyTuple_GetItem(co->co_cellvars, oparg); ! else v = PyTuple_GetItem( co->co_freevars, oparg - f->f_ncells); ! ! format_exc_check_arg( ! PyExc_UnboundLocalError, ! UNBOUNDLOCAL_ERROR_MSG, ! v); err = -1; break; --- 1697,1716 ---- w = PyCell_Get(x); if (w == NULL) { ! if (oparg < f->f_ncells) { v = PyTuple_GetItem(co->co_cellvars, oparg); ! format_exc_check_arg( ! PyExc_UnboundLocalError, ! UNBOUNDLOCAL_ERROR_MSG, ! v); ! } else { v = PyTuple_GetItem( co->co_freevars, oparg - f->f_ncells); ! format_exc_check_arg( ! PyExc_NameError, ! UNBOUNDFREE_ERROR_MSG, ! v); ! } err = -1; break; *************** *** 2884,2892 **** } if (!ok) { - char* fn = get_func_name(func); PyErr_Format(PyExc_TypeError, ! "unbound method %s%smust be " "called with instance as first argument", ! fn ? fn : "", fn ? "() " : ""); return NULL; } --- 2891,2898 ---- } if (!ok) { PyErr_Format(PyExc_TypeError, ! "unbound method %s%s must be " "called with instance as first argument", ! get_func_name(func), get_func_desc(func)); return NULL; } From jhylton@users.sourceforge.net Fri Apr 13 17:51:48 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 13 Apr 2001 09:51:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_scope.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4675/Lib/test Modified Files: test_scope.py Log Message: Change error message raised when free variable is not yet bound. It now raises NameError instead of UnboundLocalError, because the var in question is definitely not local. (This affects test_scope.py) Also update the recent fix by Ping using get_func_name(). Replace tests of get_func_name() return value with call to get_func_desc() to match all the other uses. Index: test_scope.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** test_scope.py 2001/03/21 16:44:39 1.13 --- test_scope.py 2001/04/13 16:51:46 1.14 *************** *** 292,296 **** try: errorInInner() ! except UnboundLocalError: pass else: --- 292,296 ---- try: errorInInner() ! except NameError: pass else: *************** *** 436,437 **** --- 436,438 ---- del d['h'] verify(d == {'x': 2, 'y': 7, 'w': 6}) + From gvanrossum@users.sourceforge.net Fri Apr 13 18:03:06 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 13 Apr 2001 10:03:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_capi.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8757 Modified Files: test_capi.py Log Message: Fix typo in comment (the module is now called _testcapi, not _test). Index: test_capi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_capi.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_capi.py 2001/02/04 03:09:52 1.2 --- test_capi.py 2001/04/13 17:03:04 1.3 *************** *** 1,4 **** # Run the _testcapi module tests (tests for the Python/C API): by defn, ! # these are all functions _test exports whose name begins with 'test_'. import sys --- 1,4 ---- # Run the _testcapi module tests (tests for the Python/C API): by defn, ! # these are all functions _testcapi exports whose name begins with 'test_'. import sys From gvanrossum@users.sourceforge.net Fri Apr 13 18:08:17 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 13 Apr 2001 10:08:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules _testcapimodule.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv10968 Modified Files: _testcapimodule.c Log Message: Slight adaptation of Michael Hudson's patch to test PyDict_Next() (with modification of existing dict elements!). This is part of SF patch #409864: lazy fix for Pings bizarre scoping crash. The adaptation I made to Michael's patch was to change the error handling to avoid masking other errors (moving the specific error message to inside test_dict_inner()), and to insert a test for dict==NULL at the start. Index: _testcapimodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_testcapimodule.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** _testcapimodule.c 2001/02/12 22:13:26 1.2 --- _testcapimodule.c 2001/04/13 17:08:15 1.3 *************** *** 96,102 **** --- 96,164 ---- } + static int + test_dict_inner(int count) + { + int pos = 0, iterations = 0, i; + PyObject *dict = PyDict_New(); + PyObject *v, *k; + + if (dict == NULL) + return -1; + + for (i = 0; i < count; i++) { + v = PyInt_FromLong(i); + PyDict_SetItem(dict, v, v); + Py_DECREF(v); + } + + while (PyDict_Next(dict, &pos, &k, &v)) { + PyObject *o; + iterations++; + + i = PyInt_AS_LONG(v) + 1; + o = PyInt_FromLong(i); + if (o == NULL) + return -1; + if (PyDict_SetItem(dict, k, o) < 0) { + Py_DECREF(o); + return -1; + } + Py_DECREF(o); + } + + Py_DECREF(dict); + + if (iterations != count) { + PyErr_SetString( + TestError, + "test_dict_iteration: dict iteration went wrong "); + return -1; + } else { + return 0; + } + } + + static PyObject* + test_dict_iteration(PyObject* self, PyObject* args) + { + int i; + + if (!PyArg_ParseTuple(args, ":test_dict_iteration")) + return NULL; + + for (i = 0; i < 200; i++) { + if (test_dict_inner(i) < 0) { + return NULL; + } + } + + Py_INCREF(Py_None); + return Py_None; + } + static PyMethodDef TestMethods[] = { {"test_config", test_config, METH_VARARGS}, {"test_list_api", test_list_api, METH_VARARGS}, + {"test_dict_iteration", test_dict_iteration, METH_VARARGS}, {NULL, NULL} /* sentinel */ }; From fdrake@users.sourceforge.net Fri Apr 13 18:15:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 10:15:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules _weakref.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13251 Modified Files: _weakref.c Log Message: cleanup_helper(): Make sure we invalidate all reference objects before calling any callbacks. This is important since the callback objects only look at themselves to determine that they are invalide. This change avoids a segfault when callbacks use a different reference to an object in the process of being deallocated. This fixes SF bug #415660. Index: _weakref.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_weakref.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** _weakref.c 2001/03/23 06:14:28 1.9 --- _weakref.c 2001/04/13 17:15:47 1.10 *************** *** 741,753 **** } list = GET_WEAKREFS_LISTPTR(object); ! while (*list != NULL) { ! PyWeakReference *current = *list; ! PyObject *callback = current->wr_callback; ! Py_XINCREF(callback); ! clear_weakref(current); ! if (callback != NULL) { PyObject *cbresult; cbresult = PyObject_CallFunction(callback, "O", current); if (cbresult == NULL) --- 741,760 ---- } list = GET_WEAKREFS_LISTPTR(object); ! /* Remove the callback-less basic and proxy references */ ! if (*list != NULL && (*list)->wr_callback == NULL) { ! clear_weakref(*list); ! if (*list != NULL && (*list)->wr_callback == NULL) ! clear_weakref(*list); ! } ! if (*list != NULL) { ! int count = getweakrefcount(*list); ! if (count == 1) { ! PyWeakReference *current = *list; ! PyObject *callback = current->wr_callback; PyObject *cbresult; + Py_INCREF(callback); + clear_weakref(current); cbresult = PyObject_CallFunction(callback, "O", current); if (cbresult == NULL) *************** *** 756,759 **** --- 763,794 ---- Py_DECREF(cbresult); Py_DECREF(callback); + } + else { + PyObject *tuple = PyTuple_New(count * 2); + PyWeakReference *current = *list; + int i = 0; + + for (i = 0; i < count; ++i) { + PyWeakReference *next = current->wr_next; + + Py_INCREF(current); + PyTuple_SET_ITEM(tuple, i * 2, (PyObject *) current); + PyTuple_SET_ITEM(tuple, i * 2 + 1, current->wr_callback); + current->wr_callback = NULL; + next = current->wr_next; + clear_weakref(current); + current = next; + } + for (i = 0; i < count; ++i) { + PyObject *current = PyTuple_GET_ITEM(tuple, i * 2); + PyObject *callback = PyTuple_GET_ITEM(tuple, i * 2 + 1); + PyObject *cbresult = PyObject_CallFunction(callback, "O", + current); + if (cbresult == NULL) + PyErr_WriteUnraisable(callback); + else + Py_DECREF(cbresult); + } + Py_DECREF(tuple); } } From fdrake@users.sourceforge.net Fri Apr 13 18:18:17 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 10:18:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13728/test Modified Files: test_weakref.py Log Message: Added regression test for SF bug #415660 (failure to invalidate all references to an object before calling registered callbacks). Change last uses of verify() to self.assert_(). Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** test_weakref.py 2001/04/10 19:09:35 1.5 --- test_weakref.py 2001/04/13 17:18:15 1.6 *************** *** 3,7 **** import weakref ! from test_support import run_unittest, verify --- 3,7 ---- import weakref ! from test_support import run_unittest *************** *** 64,67 **** --- 64,86 ---- "callback not called the right number of times") + def test_multiple_selfref_callbacks(self): + """Make sure all references are invalidated before callbacks + are called.""" + # + # What's important here is that we're using the first + # reference in the callback invoked on the second reference + # (the most recently created ref is cleaned up first). This + # tests that all references to the object are invalidated + # before any of the callbacks are invoked, so that we only + # have one invocation of _weakref.c:cleanup_helper() active + # for a particular object at a time. + # + def callback(object, self=self): + self.ref() + c = C() + self.ref = weakref.ref(c, callback) + ref1 = weakref.ref(c, callback) + del c + def test_proxy_ref(self): o = C() *************** *** 92,99 **** ref = weakref.ref(o, self.callback) del o ! verify(self.cbcalled == 1, ! "callback did not properly set 'cbcalled'") ! verify(ref() is None, ! "ref2 should be dead after deleting object reference") def test_ref_reuse(self): --- 111,118 ---- ref = weakref.ref(o, self.callback) del o ! self.assert_(self.cbcalled == 1, ! "callback did not properly set 'cbcalled'") ! self.assert_(ref() is None, ! "ref2 should be dead after deleting object reference") def test_ref_reuse(self): From fdrake@users.sourceforge.net Fri Apr 13 18:23:26 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 10:23:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/inst inst.tex,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/inst In directory usw-pr-cvs1:/tmp/cvs-serv14658/inst Modified Files: inst.tex Log Message: Work around the conversion of ">>" and "<<" to guillemets. Reported by Ping. Index: inst.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/inst/inst.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** inst.tex 2001/03/03 19:47:24 1.31 --- inst.tex 2001/04/13 17:23:24 1.32 *************** *** 365,369 **** run ``Python 2.0 (interpreter)'' \XXX{right?}; under MacOS, \XXX{???}. Once the interpreter is started, you type Python code at the ! \samp{>>> } prompt. For example, on my Linux system, I type the three Python statements shown below, and get the output as shown, to find out my \filevar{prefix} and \filevar{exec-prefix}: --- 365,369 ---- run ``Python 2.0 (interpreter)'' \XXX{right?}; under MacOS, \XXX{???}. Once the interpreter is started, you type Python code at the ! \samp{>\code{>}> } prompt. For example, on my Linux system, I type the three Python statements shown below, and get the output as shown, to find out my \filevar{prefix} and \filevar{exec-prefix}: From fdrake@users.sourceforge.net Fri Apr 13 18:25:40 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 10:25:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libdis.tex,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv15051/lib Modified Files: libdis.tex Log Message: Work around the conversion of ">>" and "<<" to guillemets. Reported by Ping. Index: libdis.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdis.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** libdis.tex 2001/03/23 17:23:49 1.31 --- libdis.tex 2001/04/13 17:25:38 1.32 *************** *** 57,61 **** \begin{enumerate} \item the current instruction, indicated as \samp{-->}, ! \item a labelled instruction, indicated with \samp{>>}, \item the address of the instruction, \item the operation code name, --- 57,61 ---- \begin{enumerate} \item the current instruction, indicated as \samp{-->}, ! \item a labelled instruction, indicated with \samp{>\code{>}}, \item the address of the instruction, \item the operation code name, From fdrake@users.sourceforge.net Fri Apr 13 18:32:51 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 10:32:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/mac using.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory usw-pr-cvs1:/tmp/cvs-serv16287/mac Modified Files: using.tex Log Message: Work around the conversion of ">>" and "<<" to guillemets. Reported by Ping. Index: using.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/using.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** using.tex 2000/10/14 05:24:20 1.2 --- using.tex 2001/04/13 17:32:49 1.3 *************** *** 28,33 **** \program{PythonInterpreter} icon, which looks like a 16-ton weight falling. You should see the version information and the ! \samp{>>>~} prompt. Use it exactly as described in the standard ! documentation. --- 28,33 ---- \program{PythonInterpreter} icon, which looks like a 16-ton weight falling. You should see the version information and the ! \samp{>\code{>}>~} prompt. Use it exactly as described in the ! standard documentation. From fdrake@users.sourceforge.net Fri Apr 13 18:37:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 10:37:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/mac libcolorpicker.tex,1.1,1.2 toolbox.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory usw-pr-cvs1:/tmp/cvs-serv17441/mac Modified Files: libcolorpicker.tex toolbox.tex Log Message: Fixup some platform annotations. Index: libcolorpicker.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libcolorpicker.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** libcolorpicker.tex 2001/04/13 04:49:30 1.1 --- libcolorpicker.tex 2001/04/13 17:37:00 1.2 *************** *** 3,6 **** --- 3,7 ---- \declaremodule{extension}{ColorPicker} + \platform{Mac} \modulesynopsis{} \moduleauthor{Just van Rossum}{just@letterror.com} Index: toolbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/toolbox.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** toolbox.tex 2000/10/14 05:08:34 1.1 --- toolbox.tex 2001/04/13 17:37:00 1.2 *************** *** 33,37 **** \section{\module{Cm} --- Component Manager} \declaremodule{standard}{Cm} ! \platform{Cm} \modulesynopsis{Interface to the Component Manager} --- 33,37 ---- \section{\module{Cm} --- Component Manager} \declaremodule{standard}{Cm} ! \platform{Mac} \modulesynopsis{Interface to the Component Manager} From jhylton@users.sourceforge.net Fri Apr 13 18:50:22 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 13 Apr 2001 10:50:22 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.174,2.175 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv20417/Python Modified Files: import.c Log Message: split long line Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.174 retrieving revision 2.175 diff -C2 -r2.174 -r2.175 *** import.c 2001/03/20 23:09:54 2.174 --- import.c 2001/04/13 17:50:20 2.175 *************** *** 730,734 **** } #endif ! cpathname = make_compiled_pathname(pathname, buf, (size_t)MAXPATHLEN+1); if (cpathname != NULL && (fpc = check_compiled_module(pathname, mtime, cpathname))) { --- 730,735 ---- } #endif ! cpathname = make_compiled_pathname(pathname, buf, ! (size_t)MAXPATHLEN + 1); if (cpathname != NULL && (fpc = check_compiled_module(pathname, mtime, cpathname))) { From gvanrossum@users.sourceforge.net Fri Apr 13 18:54:06 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 13 Apr 2001 10:54:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.139,1.140 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv21097 Modified Files: socketmodule.c Log Message: I am TENTATIVELY checking in Martin von Loewis's patch for the SSL problem reported by Neil Schemenauer on python-dev on 4/12/01, wth subject "Problem with SSL and socketmodule on Debian Potato?". It's tentative because Moshe objected, but Martin rebutted, and Moshe seems unavailable for comments. (Note that with OpenSSL 0.9.6a, I get a lot of compilation warnings for socketmodule.c -- I'm assuming I can safely ignore these until 2.1 is released.) Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -r1.139 -r1.140 *** socketmodule.c 2001/03/18 17:11:56 1.139 --- socketmodule.c 2001/04/13 17:54:04 1.140 *************** *** 196,199 **** --- 196,206 ---- #include "openssl/err.h" #include "openssl/rand.h" + + #if OPENSSL_VERSION_NUMBER < 0x0090510fL + /* RAND_status was added in OpenSSL 0.9.5. If it is not available, + we assume that seeding the RNG is necessary every time. */ + #define RAND_status() 0 + #endif + #endif /* USE_SSL */ From fdrake@users.sourceforge.net Fri Apr 13 18:55:04 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 10:55:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.116,1.117 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv21253/api Modified Files: api.tex Log Message: Michael Hudson: Update docs for PyDict_Next() based on the most recent changes to the dictionary code. This closes SF patch #409864. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -r1.116 -r1.117 *** api.tex 2001/04/13 14:52:39 1.116 --- api.tex 2001/04/13 17:55:02 1.117 *************** *** 3398,3402 **** \var{pvalue} should either point to \ctype{PyObject*} variables that will be filled in with each key and value, respectively, or may be ! \NULL. The dictionary \var{p} must not be mutated during iteration. For example: --- 3398,3403 ---- \var{pvalue} should either point to \ctype{PyObject*} variables that will be filled in with each key and value, respectively, or may be ! \NULL. ! For example: *************** *** 3408,3411 **** --- 3409,3433 ---- /* do something interesting with the values... */ ... + } + \end{verbatim} + + The dictionary \var{p} should not be mutated during iteration. It is + safe (since Python 2.1) to modify the values of the keys as you + iterate over the dictionary, for example: + + \begin{verbatim} + PyObject *key, *value; + int pos = 0; + + while (PyDict_Next(self->dict, &pos, &key, &value)) { + int i = PyInt_AS_LONG(value) + 1; + PyObject *o = PyInt_FromLong(i); + if (o == NULL) + return -1; + if (PyDict_SetItem(self->dict, key, o) < 0) { + Py_DECREF(o); + return -1; + } + Py_DECREF(o); } \end{verbatim} From fdrake@users.sourceforge.net Fri Apr 13 19:00:25 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 11:00:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.216,1.217 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv22367 Modified Files: Makefile Log Message: Add convenience targets that build all archive types for single formatting versions. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.216 retrieving revision 1.217 diff -C2 -r1.216 -r1.217 *** Makefile 2001/04/12 04:34:26 1.216 --- Makefile 2001/04/13 18:00:23 1.217 *************** *** 388,391 **** --- 388,397 ---- bzips: bzippdf bzipps bziphtml + disthtml: tarhtml bziphtml ziphtml + distinfo: tarinfo bzipinfo + distps: tarps bzipps zipps + distpdf: tarpdf bzippdf zippdf + distlatex: tarlatex bziplatex ziplatex + distfiles: tarballs zips bzips $(TOOLSDIR)/mksourcepkg --all $(RELEASE) From gvanrossum@users.sourceforge.net Fri Apr 13 19:14:29 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 13 Apr 2001 11:14:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules readline.c,2.34,2.35 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25767 Modified Files: readline.c Log Message: Clean up the unsightly mess around the readline header files. We now always: - #undef HAVE_CONFIG_H (because otherwise chardefs.h tries to include strings.h) - #include readline.h and history.h and we never declare any readline function prototypes ourselves. This makes it compile with readline 4.2, albeit with a few warnings. Some of the remaining warnings are about completion_matches(), which is renamed to rl_completion_matches(). I've tested it with various other versions, from 2.0 up, and they all seem to work (some with warnings) -- but only on Red Hat Linux 6.2. Fixing the warnings for readline 4.2 would break compatibility with 3.0 (and maybe even earlier versions), and readline doesn't seem to have a way to test for its version at compile time, so I'd rather leave the warnings in than break compilation with older versions. Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -r2.34 -r2.35 *** readline.c 2001/01/10 21:03:32 2.34 --- readline.c 2001/04/13 18:14:27 2.35 *************** *** 18,47 **** /* GNU readline definitions */ ! /* If you have string.h, you might need to add yourself to this #if... [cjh] */ ! #if defined(__BEOS__) ! #undef HAVE_CONFIG_H ! /* At max warnings, we need protos for everything. [cjh] */ #include #include - #include - #else - #include /* You may need to add an -I option to Setup */ - - #ifdef __CYGWIN__ - #include - #else /* !__CYGWIN__ */ - extern int rl_parse_and_bind(char *); - extern int rl_read_init_file(char *); - extern int rl_insert_text(char *); - extern int rl_bind_key(int, Function *); - extern int rl_bind_key_in_map(int, Function *, Keymap); - extern int rl_initialize(void); - extern int add_history(char *); - extern int read_history(char *); - extern int write_history(char *); - extern int history_truncate_file(char *, int); - extern Function *rl_event_hook; - #endif /* !__CYGWIN__ */ - #endif /* Pointers needed from outside (but not declared in a header file). */ --- 18,24 ---- /* GNU readline definitions */ ! #undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */ #include #include /* Pointers needed from outside (but not declared in a header file). */ From gvanrossum@users.sourceforge.net Fri Apr 13 20:41:30 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 13 Apr 2001 12:41:30 -0700 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12030 Modified Files: LICENSE Log Message: Tim convinced me to augment the PSF license with a final clause just like the one in the BeOpen license (and similar to the one in the CNRI license, but with the "click-to-accept" part elided). Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** LICENSE 2001/04/13 15:04:31 1.14 --- LICENSE 2001/04/13 19:41:28 1.15 *************** *** 94,97 **** --- 94,101 ---- services of Licensee, or any third party. + 8. By copying, installing or otherwise using Python 2.1, Licensee + agrees to be bound by the terms and conditions of this License + Agreement. + BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0 From gvanrossum@users.sourceforge.net Fri Apr 13 20:44:27 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 13 Apr 2001 12:44:27 -0700 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.7.2.1,1.7.2.2 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12757 Modified Files: Tag: release20-maint LICENSE Log Message: Add clause 8, as in the 2.1 version of the license. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -C2 -r1.7.2.1 -r1.7.2.2 *** LICENSE 2001/04/13 15:26:00 1.7.2.1 --- LICENSE 2001/04/13 19:44:25 1.7.2.2 *************** *** 94,97 **** --- 94,101 ---- services of Licensee, or any third party. + 8. By copying, installing or otherwise using Python 2.1, Licensee + agrees to be bound by the terms and conditions of this License + Agreement. + BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0 From esr@users.sourceforge.net Sat Apr 14 02:48:43 2001 From: esr@users.sourceforge.net (Eric S. Raymond) Date: Fri, 13 Apr 2001 18:48:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pstats.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29418 Modified Files: pstats.py Log Message: Import readline when possible to make the commaninterpreter UI nicer. Index: pstats.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pstats.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** pstats.py 2001/04/13 05:37:27 1.13 --- pstats.py 2001/04/14 01:48:41 1.14 *************** *** 532,535 **** --- 532,539 ---- if __name__ == '__main__': import cmd + try: + import readline + except: + pass class ProfileBrowser(cmd.Cmd): From fdrake@users.sourceforge.net Sat Apr 14 04:10:14 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 13 Apr 2001 20:10:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_sunaudiodev.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8259/Lib/test Modified Files: test_sunaudiodev.py Log Message: If the sunaudiodev module is available but we cannot find an audio device to use, skip this test instead of allowing an error to occur when we attempt to play sound on the absent device. Verified by Mark Favas. Index: test_sunaudiodev.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sunaudiodev.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** test_sunaudiodev.py 2001/01/17 21:51:36 1.9 --- test_sunaudiodev.py 2001/04/14 03:10:12 1.10 *************** *** 1,5 **** ! from test_support import verbose, findfile, TestFailed import sunaudiodev import os def play_sound_file(path): --- 1,13 ---- ! from test_support import verbose, findfile, TestFailed, TestSkipped import sunaudiodev import os + + try: + audiodev = os.environ["AUDIODEV"] + except KeyError: + audiodev = "/dev/audio" + + if not os.path.exists(audiodev): + raise TestSkipped("no audio device found!") def play_sound_file(path): From gvanrossum@users.sourceforge.net Sat Apr 14 14:09:55 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 14 Apr 2001 06:09:55 -0700 Subject: [Python-checkins] CVS: python/dist/src README,1.120,1.121 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv6225 Modified Files: README Log Message: Add more general warning against the SGI optimizer. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -r1.120 -r1.121 *** README 2001/04/12 20:52:23 1.120 --- README 2001/04/14 13:09:53 1.121 *************** *** 360,373 **** is supposed to build. This means that whenever you say "make" it will redo the link step. The remedy is to use SGI's much ! smarter "smake " utility (/usr/sbin/smake), or GNU make. If you set the first line of the Makefile to #!/usr/sbin/smake smake will be invoked by make (likewise for GNU make). ! There is a bug in the SGI compiler's optimization that causes a ! bus error in PyComplex_ImagAsDouble(); this has been reported to ! be triggered when importing Numeric Python and may be caused at ! other times. The work-around is to build Python, delete the ! Objects/complexobject.o file, and then recompile without ! optimization (use "make OPT="). OS/2: If you are running Warp3 or Warp4 and have IBM's VisualAge C/C++ --- 360,371 ---- is supposed to build. This means that whenever you say "make" it will redo the link step. The remedy is to use SGI's much ! smarter "smake" utility (/usr/sbin/smake), or GNU make. If you set the first line of the Makefile to #!/usr/sbin/smake smake will be invoked by make (likewise for GNU make). ! WARNING: There are bugs in the optimizer of some versions of ! SGI's compilers that can cause bus errors or other strange ! behavior, especially on numerical operations. To avoid this, ! try building with "make OPT=". OS/2: If you are running Warp3 or Warp4 and have IBM's VisualAge C/C++ From gvanrossum@users.sourceforge.net Sat Apr 14 15:35:46 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 14 Apr 2001 07:35:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_asynchat.py,1.2,1.3 test_threadedtempfile.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17379 Modified Files: test_asynchat.py test_threadedtempfile.py Log Message: Add "import thread" at the top of the module; this prevents us from failing later when Python is compiled without threading but a failing 'threading' module can be imported due to an earlier (caught) attempt. Index: test_asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_asynchat.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_asynchat.py 2001/04/06 16:43:49 1.2 --- test_asynchat.py 2001/04/14 14:35:43 1.3 *************** *** 1,4 **** --- 1,5 ---- # test asynchat -- requires threading + import thread # If this fails, we can't test this module import asyncore, asynchat, socket, threading, time Index: test_threadedtempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_threadedtempfile.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_threadedtempfile.py 2001/01/13 03:45:59 1.2 --- test_threadedtempfile.py 2001/04/14 14:35:43 1.3 *************** *** 21,24 **** --- 21,25 ---- FILES_PER_THREAD = 50 # change w/ -f option + import thread # If this fails, we can't test this module import threading from test_support import TestFailed From esr@users.sourceforge.net Sat Apr 14 16:16:07 2001 From: esr@users.sourceforge.net (Eric S. Raymond) Date: Sat, 14 Apr 2001 08:16:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pstats.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22920 Modified Files: pstats.py Log Message: Should resolve [ #416039 ] pstats browser crashes. Index: pstats.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pstats.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** pstats.py 2001/04/14 01:48:41 1.14 --- pstats.py 2001/04/14 15:16:05 1.15 *************** *** 577,586 **** def do_callees(self, line): ! return self.generic('callees', line) def help_callees(self): print "Print callees statistics from the current stat object." def do_callers(self, line): ! return self.generic('callers', line) def help_callers(self): print "Print callers statistics from the current stat object." --- 577,586 ---- def do_callees(self, line): ! return self.generic('print_callees', line) def help_callees(self): print "Print callees statistics from the current stat object." def do_callers(self, line): ! return self.generic('print_callers', line) def help_callers(self): print "Print callers statistics from the current stat object." *************** *** 631,635 **** def do_strip(self, line): ! self.stats.strip_order() return 0 def help_strip(self): --- 631,635 ---- def do_strip(self, line): ! self.stats.strip_dirs() return 0 def help_strip(self): From gvanrossum@users.sourceforge.net Sat Apr 14 17:17:03 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 14 Apr 2001 09:17:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils archive_util.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv30505 Modified Files: archive_util.py Log Message: Pete Shinners discovered that zipfile.ZipFile() is called with mode argument "wb", while the only valid modes are "r", "w" or "a". Fix this by changing the mode to "w". Index: archive_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/archive_util.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** archive_util.py 2000/09/26 02:13:49 1.9 --- archive_util.py 2001/04/14 16:17:00 1.10 *************** *** 101,105 **** if not dry_run: ! z = zipfile.ZipFile(zip_filename, "wb", compression=zipfile.ZIP_DEFLATED) --- 101,105 ---- if not dry_run: ! z = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) From gvanrossum@users.sourceforge.net Sat Apr 14 17:17:33 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 14 Apr 2001 09:17:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.92,1.93 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30580 Modified Files: ACKS Log Message: Another ACK. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -r1.92 -r1.93 *** ACKS 2001/04/11 21:03:32 1.92 --- ACKS 2001/04/14 16:17:31 1.93 *************** *** 349,352 **** --- 349,353 ---- Denis Severson Bruce Sherwood + Pete Shinners Michael Shiplett John W. Shipman From gvanrossum@users.sourceforge.net Sat Apr 14 17:45:16 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 14 Apr 2001 09:45:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib zipfile.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1503 Modified Files: zipfile.py Log Message: Mark Favas points out that there's an 'self.fp.flush()' call in the ZipFile.close() method that should be part of the preceding 'if' block. On some platforms (Mark noticed this on FreeBSD 4.2) doing a flush() on a file open for reading is not allowed. Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** zipfile.py 2001/04/10 15:37:12 1.12 --- zipfile.py 2001/04/14 16:45:14 1.13 *************** *** 469,473 **** 0, 0, count, count, pos2 - pos1, pos1, 0) self.fp.write(endrec) ! self.fp.flush() if not self._filePassed: self.fp.close() --- 469,473 ---- 0, 0, count, count, pos2 - pos1, pos1, 0) self.fp.write(endrec) ! self.fp.flush() if not self._filePassed: self.fp.close() From gvanrossum@users.sourceforge.net Sat Apr 14 18:49:43 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 14 Apr 2001 10:49:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.109,2.110 frameobject.c,2.47,2.48 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8561 Modified Files: fileobject.c frameobject.c Log Message: Make some private symbols static. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.109 retrieving revision 2.110 diff -C2 -r2.109 -r2.110 *** fileobject.c 2001/03/01 18:26:53 2.109 --- fileobject.c 2001/04/14 17:49:40 2.110 *************** *** 223,227 **** /* a portable fseek() function return 0 on success, non-zero on failure (with errno set) */ ! int _portable_fseek(FILE *fp, Py_off_t offset, int whence) { --- 223,227 ---- /* a portable fseek() function return 0 on success, non-zero on failure (with errno set) */ ! static int _portable_fseek(FILE *fp, Py_off_t offset, int whence) { *************** *** 258,262 **** Return -1 on failure with errno set appropriately, current file position on success */ ! Py_off_t _portable_ftell(FILE* fp) { --- 258,262 ---- Return -1 on failure with errno set appropriately, current file position on success */ ! static Py_off_t _portable_ftell(FILE* fp) { Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -r2.47 -r2.48 *** frameobject.c 2001/03/21 16:43:45 2.47 --- frameobject.c 2001/04/14 17:49:40 2.48 *************** *** 252,256 **** /* Convert between "fast" version of locals and dictionary version */ ! void map_to_dict(PyObject *map, int nmap, PyObject *dict, PyObject **values, int deref) --- 252,256 ---- /* Convert between "fast" version of locals and dictionary version */ ! static void map_to_dict(PyObject *map, int nmap, PyObject *dict, PyObject **values, int deref) From gvanrossum@users.sourceforge.net Sat Apr 14 18:51:50 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 14 Apr 2001 10:51:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.195,2.196 exceptions.c,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv8841 Modified Files: compile.c exceptions.c Log Message: Make some private symbols static. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.195 retrieving revision 2.196 diff -C2 -r2.195 -r2.196 *** compile.c 2001/04/09 16:07:59 2.195 --- compile.c 2001/04/14 17:51:48 2.196 *************** *** 375,379 **** }; ! int is_free(int v) { if ((v & (USE | DEF_FREE)) --- 375,380 ---- }; ! static int ! is_free(int v) { if ((v & (USE | DEF_FREE)) Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** exceptions.c 2001/02/28 21:52:10 1.22 --- exceptions.c 2001/04/14 17:51:48 1.23 *************** *** 421,425 **** ! PyMethodDef SystemExit_methods[] = { { "__init__", SystemExit__init__, METH_VARARGS}, {NULL, NULL} --- 421,425 ---- ! static PyMethodDef SystemExit_methods[] = { { "__init__", SystemExit__init__, METH_VARARGS}, {NULL, NULL} *************** *** 837,841 **** ! PyMethodDef SyntaxError_methods[] = { {"__init__", SyntaxError__init__, METH_VARARGS}, {"__str__", SyntaxError__str__, METH_VARARGS}, --- 837,841 ---- ! static PyMethodDef SyntaxError_methods[] = { {"__init__", SyntaxError__init__, METH_VARARGS}, {"__str__", SyntaxError__str__, METH_VARARGS}, From gvanrossum@users.sourceforge.net Sat Apr 14 18:55:11 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 14 Apr 2001 10:55:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.186,2.187 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv9332 Modified Files: posixmodule.c Log Message: Make some private symbols static. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.186 retrieving revision 2.187 diff -C2 -r2.186 -r2.187 *** posixmodule.c 2001/04/11 20:57:57 2.186 --- posixmodule.c 2001/04/14 17:55:09 2.187 *************** *** 3837,3841 **** Translate an error code to a message string."; ! PyObject * posix_strerror(PyObject *self, PyObject *args) { --- 3837,3841 ---- Translate an error code to a message string."; ! static PyObject * posix_strerror(PyObject *self, PyObject *args) { From gvanrossum@users.sourceforge.net Sat Apr 14 18:55:43 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 14 Apr 2001 10:55:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects frameobject.c,2.48,2.49 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9454 Modified Files: frameobject.c Log Message: Make one more private symbol static. Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.48 retrieving revision 2.49 diff -C2 -r2.48 -r2.49 *** frameobject.c 2001/04/14 17:49:40 2.48 --- frameobject.c 2001/04/14 17:55:41 2.49 *************** *** 274,278 **** } ! void dict_to_map(PyObject *map, int nmap, PyObject *dict, PyObject **values, int deref, int clear) --- 274,278 ---- } ! static void dict_to_map(PyObject *map, int nmap, PyObject *dict, PyObject **values, int deref, int clear) From gvanrossum@users.sourceforge.net Sat Apr 14 18:57:10 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 14 Apr 2001 10:57:10 -0700 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv9667 Modified Files: Makefile.pre.in Log Message: Remove shared libraries as part of "make clean" rather than in "make clobber". This is done so that after a "make clean", setup.py will also recompile all extensions. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** Makefile.pre.in 2001/04/11 20:56:18 1.34 --- Makefile.pre.in 2001/04/14 17:57:07 1.35 *************** *** 752,760 **** clean: find . -name '*.o' -exec rm -f {} ';' find $(srcdir) -name '*.py[co]' -exec rm -f {} ';' clobber: clean -rm -f $(PYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \ ! Modules/*.so Modules/*.sl tags TAGS \ config.cache config.log config.h Modules/config.c -rm -rf build --- 752,761 ---- clean: find . -name '*.o' -exec rm -f {} ';' + find . -name '*.s[ol]' -exec rm -f {} ';' find $(srcdir) -name '*.py[co]' -exec rm -f {} ';' clobber: clean -rm -f $(PYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \ ! tags TAGS \ config.cache config.log config.h Modules/config.c -rm -rf build From fdrake@users.sourceforge.net Sat Apr 14 19:36:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 14 Apr 2001 11:36:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.217,1.218 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv14710 Modified Files: Makefile Log Message: Bump version number and set date. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.217 retrieving revision 1.218 diff -C2 -r1.217 -r1.218 *** Makefile 2001/04/13 18:00:23 1.217 --- Makefile 2001/04/14 18:36:03 1.218 *************** *** 68,72 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1c1 PYTHON= python --- 68,72 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1 PYTHON= python From fdrake@users.sourceforge.net Sat Apr 14 19:36:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 14 Apr 2001 11:36:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs boilerplate.tex,1.57,1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv14710/texinputs Modified Files: boilerplate.tex Log Message: Bump version number and set date. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -r1.57 -r1.58 *** boilerplate.tex 2001/04/12 04:34:26 1.57 --- boilerplate.tex 2001/04/14 18:36:03 1.58 *************** *** 6,10 **** } ! \date{\today} % XXX update before release! ! \release{2.1c1} % software release, not documentation \setshortversion{2.1} % major.minor only for software --- 6,10 ---- } ! \date{April 15, 2001} % XXX update before release! ! \release{2.1} % software release, not documentation \setshortversion{2.1} % major.minor only for software From gvanrossum@users.sourceforge.net Sun Apr 15 01:42:16 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 14 Apr 2001 17:42:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_asynchat.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27917 Modified Files: test_asynchat.py Log Message: Set the SO_REUSEADDR socket option in the server thread -- this seems needed on some platforms (e.g. Solaris 8) when the test is run twice in quick succession. Index: test_asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_asynchat.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_asynchat.py 2001/04/14 14:35:43 1.3 --- test_asynchat.py 2001/04/15 00:42:13 1.4 *************** *** 11,14 **** --- 11,15 ---- def run(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind((HOST, PORT)) sock.listen(1) From purcell@users.sourceforge.net Sun Apr 15 10:18:35 2001 From: purcell@users.sourceforge.net (Steve Purcell) Date: Sun, 15 Apr 2001 02:18:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib unittest.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13782 Modified Files: unittest.py Log Message: - Typo in message for TestCase.failIfEqual() - Removed unused variable 'opts' in TestProgram.__init__ (thanks to PyChecker) Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** unittest.py 2001/04/13 05:37:27 1.6 --- unittest.py 2001/04/15 09:18:32 1.7 *************** *** 278,282 **** """ if first == second: ! raise self.failureException, (msg or '%s != %s' % (first, second)) assertEqual = assertEquals = failUnlessEqual --- 278,282 ---- """ if first == second: ! raise self.failureException, (msg or '%s == %s' % (first, second)) assertEqual = assertEquals = failUnlessEqual *************** *** 673,677 **** options, args = getopt.getopt(argv[1:], 'hHvq', ['help','verbose','quiet']) - opts = {} for opt, value in options: if opt in ('-h','-H','--help'): --- 673,676 ---- From gvanrossum@users.sourceforge.net Sun Apr 15 13:40:15 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 05:40:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib chunk.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31644 Modified Files: chunk.py Log Message: Fix typo in attribute name (chunk_size should be chunksize) found by Neil Norwitz's PyChecker. Index: chunk.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/chunk.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** chunk.py 2001/02/18 03:30:53 1.9 --- chunk.py 2001/04/15 12:40:13 1.10 *************** *** 107,111 **** pos = pos + self.size_read elif whence == 2: ! pos = pos + self.chunk_size if pos < 0 or pos > self.chunksize: raise RuntimeError --- 107,111 ---- pos = pos + self.size_read elif whence == 2: ! pos = pos + self.chunksize if pos < 0 or pos > self.chunksize: raise RuntimeError From gvanrossum@users.sourceforge.net Sun Apr 15 13:51:44 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 05:51:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib netrc.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv373 Modified Files: netrc.py Log Message: Fix typo in attribute name (file should be filename) found by Neil Norwitz's PyChecker. Index: netrc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/netrc.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** netrc.py 2001/03/06 06:33:08 1.11 --- netrc.py 2001/04/15 12:51:42 1.12 *************** *** 11,15 **** """Exception raised on syntax errors in the .netrc file.""" def __init__(self, msg, filename=None, lineno=None): ! self.filename = file self.lineno = lineno self.msg = msg --- 11,15 ---- """Exception raised on syntax errors in the .netrc file.""" def __init__(self, msg, filename=None, lineno=None): ! self.filename = filename self.lineno = lineno self.msg = msg From gvanrossum@users.sourceforge.net Sun Apr 15 14:01:43 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 06:01:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib sgmllib.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1389 Modified Files: sgmllib.py Log Message: Fix typo in exception name (SGMLParserError should be SGMLParseError) found by Neil Norwitz's PyChecker. Index: sgmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sgmllib.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** sgmllib.py 2001/03/16 20:04:57 1.29 --- sgmllib.py 2001/04/15 13:01:41 1.30 *************** *** 176,180 **** continue else: ! raise SGMLParserError('neither < nor & ??') # We get here only if incomplete matches but # nothing else --- 176,180 ---- continue else: ! raise SGMLParseError('neither < nor & ??') # We get here only if incomplete matches but # nothing else From gvanrossum@users.sourceforge.net Sun Apr 15 14:06:06 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 06:06:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib smtpd.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1779 Modified Files: smtpd.py Log Message: Fix typo in exception name (UnimplementedError should be NotImplementedError) found by Neil Norwitz's PyChecker. Index: smtpd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/smtpd.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** smtpd.py 2001/03/02 06:42:34 1.4 --- smtpd.py 2001/04/15 13:06:04 1.5 *************** *** 39,43 **** # smtpd. A number of classes are provided: # ! # SMTPServer - the base class for the backend. Raises an UnimplementedError # if you try to use it. # --- 39,43 ---- # smtpd. A number of classes are provided: # ! # SMTPServer - the base class for the backend. Raises NotImplementedError # if you try to use it. # *************** *** 310,314 **** """ ! raise UnimplementedError --- 310,314 ---- """ ! raise NotImplementedError From gvanrossum@users.sourceforge.net Sun Apr 15 14:08:03 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 06:08:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib2.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1908 Modified Files: urllib2.py Log Message: Fix typo (missing "req." prefix on error_302_dict) found by Neil Norwitz's PyChecker. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** urllib2.py 2001/04/11 07:44:53 1.12 --- urllib2.py 2001/04/15 13:08:01 1.13 *************** *** 448,452 **** new.error_302_dict = {} if hasattr(req, 'error_302_dict'): ! if len(error_302_dict)>10 or req.error_302_dict.has_key(newurl): raise HTTPError(req.get_full_url(), code, self.inf_msg + msg, headers) --- 448,453 ---- new.error_302_dict = {} if hasattr(req, 'error_302_dict'): ! if len(req.error_302_dict)>10 or \ ! req.error_302_dict.has_key(newurl): raise HTTPError(req.get_full_url(), code, self.inf_msg + msg, headers) From gvanrossum@users.sourceforge.net Sun Apr 15 14:15:58 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 06:15:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_locale.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2796 Modified Files: test_locale.py Log Message: In order to make this test work on Windows, the test locale has to be set to 'en' there -- Windows does not understand the 'en_US' locale. The test succeeds there. Index: test_locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_locale.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_locale.py 2001/04/13 08:09:50 1.1 --- test_locale.py 2001/04/15 13:15:56 1.2 *************** *** 1,11 **** from test_support import verbose import locale oldlocale = locale.setlocale(locale.LC_NUMERIC) try: ! locale.setlocale(locale.LC_NUMERIC, "en_US") except locale.Error: ! raise ImportError, "test locale en_US not supported" def testformat(formatstr, value, grouping = 0, output=None): --- 1,16 ---- from test_support import verbose import locale + import sys oldlocale = locale.setlocale(locale.LC_NUMERIC) + tloc = "en_US" + if sys.platform[:3] == "win": + tloc = "en" + try: ! locale.setlocale(locale.LC_NUMERIC, tloc) except locale.Error: ! raise ImportError, "test locale %s not supported" % tloc def testformat(formatstr, value, grouping = 0, output=None): From gvanrossum@users.sourceforge.net Sun Apr 15 14:32:30 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 06:32:30 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib mailbox.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4650 Modified Files: mailbox.py Log Message: Get rid of the seek() method on the _Mailbox class. This was a cut-and-paste copy of the seek() method on the _Subfile class, but it didn't make one bit of sense: it sets self.pos, which is not used in this class or its subclasses, and it uses self.start and self.stop, which aren't defined on this class or its subclasses. This is purely my own fault -- I added this in rev 1.4 and apparently never tried to use it. Since it's not documented, and of very questionable use given that there's no tell(), I'm ripping it out. This resolves SF bug 416199 by Andrew Dalke: mailbox.py seek problems. Index: mailbox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mailbox.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** mailbox.py 2001/01/31 22:13:15 1.29 --- mailbox.py 2001/04/15 13:32:27 1.30 *************** *** 15,26 **** self.factory = factory - def seek(self, pos, whence=0): - if whence==1: # Relative to current position - self.pos = self.pos + pos - if whence==2: # Relative to file's end - self.pos = self.stop + pos - else: # Default - absolute position - self.pos = self.start + pos - def next(self): while 1: --- 15,18 ---- From gvanrossum@users.sourceforge.net Sun Apr 15 16:16:14 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 08:16:14 -0700 Subject: [Python-checkins] CVS: python/dist/src setup.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv18669 Modified Files: setup.py Log Message: Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or later. This assumes that zlib.h has a line of the form #define ZLIB_VERSION "1.1.3" This solves the problem where a zlib installation is found but it is an older version -- this would break the build, while a better solution is to simply ignore that zlib installation. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** setup.py 2001/03/21 07:44:53 1.37 --- setup.py 2001/04/15 15:16:12 1.38 *************** *** 450,456 **** # This require zlib 1.1.3 (or later). # See http://www.cdrom.com/pub/infozip/zlib/ ! if (self.compiler.find_library_file(lib_dirs, 'z')): ! exts.append( Extension('zlib', ['zlibmodule.c'], ! libraries = ['z']) ) # Interface to the Expat XML parser --- 450,470 ---- # This require zlib 1.1.3 (or later). # See http://www.cdrom.com/pub/infozip/zlib/ ! zlib_inc = find_file('zlib.h', [], inc_dirs) ! if zlib_inc is not None: ! zlib_h = zlib_inc[0] + '/zlib.h' ! version = '"0.0.0"' ! version_req = '"1.1.3"' ! fp = open(zlib_h) ! while 1: ! line = fp.readline() ! if not line: ! break ! if line.find('#define ZLIB_VERSION', 0) == 0: ! version = line.split()[2] ! break ! if version >= version_req: ! if (self.compiler.find_library_file(lib_dirs, 'z')): ! exts.append( Extension('zlib', ['zlibmodule.c'], ! libraries = ['z']) ) # Interface to the Expat XML parser From thomas@xs4all.net Sun Apr 15 16:41:57 2001 From: thomas@xs4all.net (Thomas Wouters) Date: Sun, 15 Apr 2001 17:41:57 +0200 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_asynchat.py,1.3,1.4 In-Reply-To: ; from gvanrossum@users.sourceforge.net on Sat, Apr 14, 2001 at 05:42:16PM -0700 References: Message-ID: <20010415174157.O2820@xs4all.nl> On Sat, Apr 14, 2001 at 05:42:16PM -0700, Guido van Rossum wrote: > Modified Files: > test_asynchat.py > Log Message: > Set the SO_REUSEADDR socket option in the server thread -- this seems > needed on some platforms (e.g. Solaris 8) when the test is run twice > in quick succession. > def run(self): > sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) > sock.bind((HOST, PORT)) > sock.listen(1) I think this has to be protected by a hasattr() or try: block, because SO_REUSEADDR isn't always available. From socketmodule.c: #ifdef SO_REUSEADDR insint(d, "SO_REUSEADDR", SO_REUSEADDR); #endif -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From effbot@users.sourceforge.net Sun Apr 15 20:01:01 2001 From: effbot@users.sourceforge.net (Fredrik Lundh) Date: Sun, 15 Apr 2001 12:01:01 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules _sre.c,2.54,2.55 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv14779/Modules Modified Files: _sre.c Log Message: SRE: made "copyright" string static, to avoid potential linking conflicts. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.54 retrieving revision 2.55 diff -C2 -r2.54 -r2.55 *** _sre.c 2001/03/22 15:50:09 2.54 --- _sre.c 2001/04/15 19:00:58 2.55 *************** *** 28,31 **** --- 28,32 ---- * 2001-01-16 fl fixed memory leak in pattern destructor * 2001-03-20 fl lots of fixes for 2.1b2 + * 2001-04-15 fl export copyright as Python attribute, not global * * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. *************** *** 42,46 **** #ifndef SRE_RECURSIVE ! char copyright[] = " SRE 2.1b2 Copyright (c) 1997-2001 by Secret Labs AB "; #include "Python.h" --- 43,48 ---- #ifndef SRE_RECURSIVE ! static char copyright[] = ! " SRE 2.1b2 Copyright (c) 1997-2001 by Secret Labs AB "; #include "Python.h" *************** *** 2428,2431 **** --- 2430,2438 ---- d, "MAGIC", (PyObject*) PyInt_FromLong(SRE_MAGIC) ); + + PyDict_SetItemString( + d, "copyright", (PyObject*) PyString_FromString(copyright) + ); + } From gvanrossum@users.sourceforge.net Sun Apr 15 21:47:35 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 13:47:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.125,1.126 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2045 Modified Files: urllib.py Log Message: Fix SF bug [ #416231 ] urllib.basejoin fails to apply some ../. Reported by Juan M. Bello Rivas. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -r1.125 -r1.126 *** urllib.py 2001/04/09 14:54:21 1.125 --- urllib.py 2001/04/15 20:47:33 1.126 *************** *** 864,867 **** --- 864,869 ---- path = basepath + path + if host and path and path[0] != '/': + path = '/' + path if type and host: return type + '://' + host + path elif type: return type + ':' + path From gvanrossum@users.sourceforge.net Sun Apr 15 21:48:29 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 13:48:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.93,1.94 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2252 Modified Files: ACKS Log Message: SF bug reporters. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -r1.93 -r1.94 *** ACKS 2001/04/14 16:17:31 1.93 --- ACKS 2001/04/15 20:48:27 1.94 *************** *** 33,36 **** --- 33,37 ---- Reimer Behrends Thomas Bellman + Juan M. Bello Rivas Andy Bensky Eric Beser *************** *** 292,295 **** --- 293,297 ---- Piet van Oostrum Jason Orendorff + Douglas Orr Todd R. Palmer Harri Pasanen From gvanrossum@users.sourceforge.net Sun Apr 15 23:16:29 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 15:16:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.74,2.75 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18004 Modified Files: dictobject.c Log Message: Tentative fix for a problem that Tim discovered at the last moment, and reported to python-dev: because we were calling dict_resize() in PyDict_Next(), and because GC's dict_traverse() uses PyDict_Next(), and because PyTuple_New() can cause GC, and because dict_items() calls PyTuple_New(), it was possible for dict_items() to have the dict resized right under its nose. The solution is convoluted, and touches several places: keys(), values(), items(), popitem(), PyDict_Next(), and PyDict_SetItem(). There are two parts to it. First, we no longer call dict_resize() in PyDict_Next(), which seems to solve the immediate problem. But then PyDict_SetItem() must have a different policy about when *it* calls dict_resize(), because we want to guarantee (e.g. for an algorithm that Jeremy uses in the compiler) that you can loop over a dict using PyDict_Next() and make changes to the dict as long as those changes are only value replacements for existing keys using PyDict_SetItem(). This is done by resizing *after* the insertion instead of before, and by remembering the size before we insert the item, and if the size is still the same, we don't bother to even check if we might need to resize. An additional detail is that if the dict starts out empty, we must still resize it before the insertion. That was the first part. :-) The second part is to make keys(), values(), items(), and popitem() safe against side effects on the dict caused by allocations, under the assumption that if the GC can cause arbitrary Python code to run, it can cause other threads to run, and it's not inconceivable that our dict could be resized -- it would be insane to write code that relies on this, but not all code is sane. Now, I have this nagging feeling that the loops in lookdict probably are blissfully assuming that doing a simple key comparison does not change the dict's size. This is not necessarily true (the keys could be class instances after all). But that's a battle for another day. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.74 retrieving revision 2.75 diff -C2 -r2.74 -r2.75 *** dictobject.c 2001/03/21 19:23:56 2.74 --- dictobject.c 2001/04/15 22:16:26 2.75 *************** *** 243,248 **** PyErr_Restore(err_type, err_value, err_tb); return ep; ! } ! else if (ep->me_hash == hash) { if (!checked_error) { checked_error = 1; --- 243,248 ---- PyErr_Restore(err_type, err_value, err_tb); return ep; ! } ! else if (ep->me_hash == hash) { if (!checked_error) { checked_error = 1; *************** *** 290,294 **** dictentry *ep0 = mp->ma_table; register dictentry *ep; ! cmpfunc compare = PyString_Type.tp_compare; /* make sure this function doesn't have to handle non-string keys */ --- 290,294 ---- dictentry *ep0 = mp->ma_table; register dictentry *ep; ! cmpfunc compare = PyString_Type.tp_compare; /* make sure this function doesn't have to handle non-string keys */ *************** *** 313,317 **** else { if (ep->me_hash == hash ! && compare(ep->me_key, key) == 0) { return ep; } --- 313,317 ---- else { if (ep->me_hash == hash ! && compare(ep->me_key, key) == 0) { return ep; } *************** *** 339,343 **** && compare(ep->me_key, key) == 0)) { return ep; ! } /* Cycle through GF(2^n)-{0} */ incr = incr << 1; --- 339,343 ---- && compare(ep->me_key, key) == 0)) { return ep; ! } /* Cycle through GF(2^n)-{0} */ incr = incr << 1; *************** *** 455,458 **** --- 455,464 ---- } + /* CAUTION: PyDict_SetItem() must guarantee that it won't resize the + * dictionary if it is merely replacing the value for an existing key. + * This is means that it's safe to loop over a dictionary with + * PyDict_Next() and occasionally replace a value -- but you can't + * insert new keys or remove them. + */ int PyDict_SetItem(register PyObject *op, PyObject *key, PyObject *value) *************** *** 460,463 **** --- 466,471 ---- register dictobject *mp; register long hash; + register int n_used; + if (!PyDict_Check(op)) { PyErr_BadInternalCall(); *************** *** 486,502 **** if (hash == -1) return -1; } ! /* If fill >= 2/3 size, adjust size. Normally, this doubles the * size, but it's also possible for the dict to shrink (if ma_fill is * much larger than ma_used, meaning a lot of dict keys have been * deleted). - * CAUTION: this resize logic must match the logic in PyDict_Next. */ ! if (mp->ma_fill*3 >= mp->ma_size*2 && ! dictresize(mp, mp->ma_used*2) != 0) ! return -1; ! Py_INCREF(value); ! Py_INCREF(key); ! insertdict(mp, key, hash, value); return 0; } --- 494,522 ---- if (hash == -1) return -1; + } + if (mp->ma_fill >= mp->ma_size) { + /* No room for a new key. + * This only happens when the dict is empty. + * Let dictresize() create a minimal dict. + */ + assert(mp->ma_used == 0); + if (dictresize(mp, 0) != 0) + return -1; + assert(mp->ma_fill < mp->ma_size); } ! n_used = mp->ma_used; ! Py_INCREF(value); ! Py_INCREF(key); ! insertdict(mp, key, hash, value); ! /* If we added a key, we can safely resize. Otherwise skip this! ! * If fill >= 2/3 size, adjust size. Normally, this doubles the * size, but it's also possible for the dict to shrink (if ma_fill is * much larger than ma_used, meaning a lot of dict keys have been * deleted). */ ! if (mp->ma_used > n_used && mp->ma_fill*3 >= mp->ma_size*2) { ! if (dictresize(mp, mp->ma_used*2) != 0) ! return -1; ! } return 0; } *************** *** 581,601 **** if (i < 0) return 0; - - /* A hack to support loops that merely change values. - * The problem: PyDict_SetItem() can either grow or shrink the dict - * even when passed a key that's already in the dict. This was a - * repeated source of subtle bugs, bad enough to justify a hack here. - * Approach: If this is the first time PyDict_Next() is being called - * (i==0), first figure out whether PyDict_SetItem() *will* change the - * size, and if so get it changed before we start passing out internal - * indices. - */ - if (i == 0) { - /* This must be a clone of PyDict_SetItem's resize logic. */ - if (mp->ma_fill*3 >= mp->ma_size*2 && - dictresize(mp, mp->ma_used*2) != 0) - return -1; - } - while (i < mp->ma_size && mp->ma_table[i].me_value == NULL) i++; --- 601,604 ---- *************** *** 758,772 **** { register PyObject *v; ! register int i, j; if (!PyArg_NoArgs(args)) return NULL; ! v = PyList_New(mp->ma_used); if (v == NULL) return NULL; for (i = 0, j = 0; i < mp->ma_size; i++) { if (mp->ma_table[i].me_value != NULL) { PyObject *key = mp->ma_table[i].me_key; Py_INCREF(key); ! PyList_SetItem(v, j, key); j++; } --- 761,785 ---- { register PyObject *v; ! register int i, j, n; ! if (!PyArg_NoArgs(args)) return NULL; ! again: ! n = mp->ma_used; ! v = PyList_New(n); if (v == NULL) return NULL; + if (n != mp->ma_used) { + /* Durnit. The allocations caused the dict to resize. + * Just start over, this shouldn't normally happen. + */ + Py_DECREF(v); + goto again; + } for (i = 0, j = 0; i < mp->ma_size; i++) { if (mp->ma_table[i].me_value != NULL) { PyObject *key = mp->ma_table[i].me_key; Py_INCREF(key); ! PyList_SET_ITEM(v, j, key); j++; } *************** *** 779,793 **** { register PyObject *v; ! register int i, j; if (!PyArg_NoArgs(args)) return NULL; ! v = PyList_New(mp->ma_used); if (v == NULL) return NULL; for (i = 0, j = 0; i < mp->ma_size; i++) { if (mp->ma_table[i].me_value != NULL) { PyObject *value = mp->ma_table[i].me_value; Py_INCREF(value); ! PyList_SetItem(v, j, value); j++; } --- 792,816 ---- { register PyObject *v; ! register int i, j, n; ! if (!PyArg_NoArgs(args)) return NULL; ! again: ! n = mp->ma_used; ! v = PyList_New(n); if (v == NULL) return NULL; + if (n != mp->ma_used) { + /* Durnit. The allocations caused the dict to resize. + * Just start over, this shouldn't normally happen. + */ + Py_DECREF(v); + goto again; + } for (i = 0, j = 0; i < mp->ma_size; i++) { if (mp->ma_table[i].me_value != NULL) { PyObject *value = mp->ma_table[i].me_value; Py_INCREF(value); ! PyList_SET_ITEM(v, j, value); j++; } *************** *** 800,826 **** { register PyObject *v; ! register int i, j; if (!PyArg_NoArgs(args)) return NULL; ! v = PyList_New(mp->ma_used); if (v == NULL) return NULL; for (i = 0, j = 0; i < mp->ma_size; i++) { if (mp->ma_table[i].me_value != NULL) { ! PyObject *key = mp->ma_table[i].me_key; ! PyObject *value = mp->ma_table[i].me_value; ! PyObject *item = PyTuple_New(2); ! if (item == NULL) { ! Py_DECREF(v); ! return NULL; ! } Py_INCREF(key); ! PyTuple_SetItem(item, 0, key); Py_INCREF(value); ! PyTuple_SetItem(item, 1, value); ! PyList_SetItem(v, j, item); j++; } } return v; } --- 823,869 ---- { register PyObject *v; ! register int i, j, n; ! PyObject *item, *key, *value; ! if (!PyArg_NoArgs(args)) return NULL; ! /* Preallocate the list of tuples, to avoid allocations during ! * the loop over the items, which could trigger GC, which ! * could resize the dict. :-( ! */ ! again: ! n = mp->ma_used; ! v = PyList_New(n); if (v == NULL) return NULL; + for (i = 0; i < n; i++) { + item = PyTuple_New(2); + if (item == NULL) { + Py_DECREF(v); + return NULL; + } + PyList_SET_ITEM(v, i, item); + } + if (n != mp->ma_used) { + /* Durnit. The allocations caused the dict to resize. + * Just start over, this shouldn't normally happen. + */ + Py_DECREF(v); + goto again; + } + /* Nothing we do below makes any function calls. */ for (i = 0, j = 0; i < mp->ma_size; i++) { if (mp->ma_table[i].me_value != NULL) { ! key = mp->ma_table[i].me_key; ! value = mp->ma_table[i].me_value; ! item = PyList_GET_ITEM(v, j); Py_INCREF(key); ! PyTuple_SET_ITEM(item, 0, key); Py_INCREF(value); ! PyTuple_SET_ITEM(item, 1, value); j++; } } + assert(j == n); return v; } *************** *** 831,835 **** register int i; dictobject *other; ! dictentry *entry; if (!PyArg_Parse(args, "O!", &PyDict_Type, &other)) return NULL; --- 874,878 ---- register int i; dictobject *other; ! dictentry *entry; if (!PyArg_Parse(args, "O!", &PyDict_Type, &other)) return NULL; *************** *** 871,875 **** register int i; dictobject *copy; ! dictentry *entry; if (o == NULL || !PyDict_Check(o)) { --- 914,918 ---- register int i; dictobject *copy; ! dictentry *entry; if (o == NULL || !PyDict_Check(o)) { *************** *** 1118,1121 **** --- 1161,1173 ---- return NULL; } + /* Allocate the result tuple first. Believe it or not, + * this allocation could trigger a garbage collection which + * could resize the dict, which would invalidate the pointer + * (ep) into the dict calculated below. + * So we have to do this first. + */ + res = PyTuple_New(2); + if (res == NULL) + return NULL; /* Set ep to "the first" dict entry with a value. We abuse the hash * field of slot 0 to hold a search finger: *************** *** 1142,1156 **** } } ! res = PyTuple_New(2); ! if (res != NULL) { ! PyTuple_SET_ITEM(res, 0, ep->me_key); ! PyTuple_SET_ITEM(res, 1, ep->me_value); ! Py_INCREF(dummy); ! ep->me_key = dummy; ! ep->me_value = NULL; ! mp->ma_used--; ! assert(mp->ma_table[0].me_value == NULL); ! mp->ma_table[0].me_hash = i + 1; /* next place to start */ ! } return res; } --- 1194,1205 ---- } } ! PyTuple_SET_ITEM(res, 0, ep->me_key); ! PyTuple_SET_ITEM(res, 1, ep->me_value); ! Py_INCREF(dummy); ! ep->me_key = dummy; ! ep->me_value = NULL; ! mp->ma_used--; ! assert(mp->ma_table[0].me_value == NULL); ! mp->ma_table[0].me_hash = i + 1; /* next place to start */ return res; } From gvanrossum@users.sourceforge.net Mon Apr 16 01:02:35 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 17:02:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.75,2.76 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31193 Modified Files: dictobject.c Log Message: Tim pointed out a remaining vulnerability in popitem(): the PyTuple_New() could *conceivably* clear the dict, so move the test for an empty dict after the tuple allocation. It means that we waste time allocating and deallocating a 2-tuple when the dict is empty, but who cares. It also means that when the dict is empty *and* there's no memory to allocate a 2-tuple, we raise MemoryError, not KeyError -- but that may actually a good idea: if there's no room for a lousy 2-tuple, what are the chances that there's room for a KeyError instance? Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.75 retrieving revision 2.76 diff -C2 -r2.75 -r2.76 *** dictobject.c 2001/04/15 22:16:26 2.75 --- dictobject.c 2001/04/16 00:02:32 2.76 *************** *** 1156,1164 **** if (!PyArg_NoArgs(args)) return NULL; - if (mp->ma_used == 0) { - PyErr_SetString(PyExc_KeyError, - "popitem(): dictionary is empty"); - return NULL; - } /* Allocate the result tuple first. Believe it or not, * this allocation could trigger a garbage collection which --- 1156,1159 ---- *************** *** 1170,1173 **** --- 1165,1174 ---- if (res == NULL) return NULL; + if (mp->ma_used == 0) { + Py_DECREF(res); + PyErr_SetString(PyExc_KeyError, + "popitem(): dictionary is empty"); + return NULL; + } /* Set ep to "the first" dict entry with a value. We abuse the hash * field of slot 0 to hold a search finger: From gvanrossum@users.sourceforge.net Mon Apr 16 01:21:35 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 17:21:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.140,1.141 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv1391 Modified Files: socketmodule.c Log Message: Reverting Moshe's EGD patch *and* Martin's patch to make it work with OpenSSL versions beore 0.9.5. This just is too experimental to be worth it, especially since the user would have to do some severe hacking of the Modules/Setup file to even enable the EGD code, and without the EGD code it would always spit out a warning on some systems -- even when socket.ssl() is not used. Fixing that properly is not my job; the EGD patch is clearly not so important that it should hold up the 2.1 release. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -r1.140 -r1.141 *** socketmodule.c 2001/04/13 17:54:04 1.140 --- socketmodule.c 2001/04/16 00:21:33 1.141 *************** *** 195,206 **** #include "openssl/ssl.h" #include "openssl/err.h" - #include "openssl/rand.h" - - #if OPENSSL_VERSION_NUMBER < 0x0090510fL - /* RAND_status was added in OpenSSL 0.9.5. If it is not available, - we assume that seeding the RNG is necessary every time. */ - #define RAND_status() 0 - #endif - #endif /* USE_SSL */ --- 195,198 ---- *************** *** 2553,2582 **** (PyObject *)&SSL_Type) != 0) return; - if (RAND_status() == 0) { - #ifdef USE_EGD - char random_device[MAXPATHLEN+1]; - if (!RAND_file_name (random_device, MAXPATHLEN + 1)) { - PyErr_SetObject(SSLErrorObject, - PyString_FromString("RAND_file_name error")); - return; - } - if (RAND_egd (random_device) == -1) { - PyErr_SetObject(SSLErrorObject, - PyString_FromString("RAND_egd error")); - return; - } - #else /* USE_EGD not defined */ - char random_string[32]; - int i; - - PyErr_Warn(PyExc_RuntimeWarning, - "using insecure method to generate random numbers"); - srand(time(NULL)); - for(i=0; i Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2344 Modified Files: pickletester.py Log Message: Change the test data to ask for class C from module __main__ rather than from module pickletester. Using the latter turned out to cause the test to break when invoked as "import test.test_pickle" or "import test.autotest". Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** pickletester.py 2001/04/10 03:41:41 1.5 --- pickletester.py 2001/04/16 00:28:21 1.6 *************** *** 32,36 **** g4 """ + \ ! """(ipickletester C p5 --- 32,36 ---- g4 """ + \ ! """(i__main__ C p5 *************** *** 55,59 **** '\xff\xffK\xffJ\x01\xff\xff\xffJ\x00\xff\xff\xffM\xff\xff' + \ 'J\x01\x00\xff\xffJ\x00\x00\xff\xffJ\xff\xff\xff\x7fJ\x01\x00' + \ ! '\x00\x80J\x00\x00\x00\x80(U\x03abcq\x04h\x04(cpickletester\n' + \ 'C\nq\x05oq\x06}q\x07(U\x03fooq\x08K\x01U\x03barq\tK\x02ubh' + \ '\x06tq\nh\nK\x05e.' --- 55,59 ---- '\xff\xffK\xffJ\x01\xff\xff\xffJ\x00\xff\xff\xffM\xff\xff' + \ 'J\x01\x00\xff\xffJ\x00\x00\xff\xffJ\xff\xff\xff\x7fJ\x01\x00' + \ ! '\x00\x80J\x00\x00\x00\x80(U\x03abcq\x04h\x04(c__main__\n' + \ 'C\nq\x05oq\x06}q\x07(U\x03fooq\x08K\x01U\x03barq\tK\x02ubh' + \ '\x06tq\nh\nK\x05e.' *************** *** 65,68 **** --- 65,69 ---- import __main__ __main__.C = C + C.__module__ = "__main__" # Call this with the module to be tested (pickle or cPickle). From gvanrossum@users.sourceforge.net Mon Apr 16 01:33:31 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 17:33:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include patchlevel.h,2.47,2.48 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv3076 Modified Files: patchlevel.h Log Message: We need another release candidate after so many "small" changes. DO NOT CHECK ANYTHHING IN FROM NOW ON WITHOUT ASKING ME. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -r2.47 -r2.48 *** patchlevel.h 2001/04/12 04:11:51 2.47 --- patchlevel.h 2001/04/16 00:33:29 2.48 *************** *** 27,34 **** /* Version as a string */ ! #define PY_VERSION "2.1c1" /* Historic */ ! #define PATCHLEVEL "2.1c1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 27,34 ---- /* Version as a string */ ! #define PY_VERSION "2.1c2" /* Historic */ ! #define PATCHLEVEL "2.1c2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From tim_one@users.sourceforge.net Mon Apr 16 02:44:10 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 15 Apr 2001 18:44:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.9,1.10 python20.wse,1.37,1.38 pythoncore.dsp,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv10680/python/dist/src/PCbuild Modified Files: BUILDno.txt python20.wse pythoncore.dsp Log Message: Update Windows installer & build number to 2.1c2 release. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** BUILDno.txt 2001/04/12 04:01:39 1.9 --- BUILDno.txt 2001/04/16 01:44:08 1.10 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 14 2.1c2 + 15-Apr-2001 13 2.1c1 12-Apr-2001 Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** python20.wse 2001/04/12 04:01:39 1.37 --- python20.wse 2001/04/16 01:44:08 1.38 *************** *** 2,6 **** item: Global Version=5.0 ! Title=Python 2.1 release candidate 1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=5.0 ! Title=Python 2.1 release candidate 2 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 67,71 **** item: Set Variable Variable=APPTITLE ! Value=Python 2.1 release candidate 1 end item: Set Variable --- 67,71 ---- item: Set Variable Variable=APPTITLE ! Value=Python 2.1 release candidate 2 end item: Set Variable Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** pythoncore.dsp 2001/04/12 04:01:39 1.11 --- pythoncore.dsp 2001/04/16 01:44:08 1.12 *************** *** 740,748 **** !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=13 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=13 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" --- 740,748 ---- !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=14 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=14 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" From gvanrossum@users.sourceforge.net Mon Apr 16 03:05:25 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 19:05:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.144,1.145 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13027 Modified Files: NEWS Log Message: Added news for 2.1c2. Greatly updated news for 2.1c1 (!). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -r1.144 -r1.145 *** NEWS 2001/04/13 00:46:14 1.144 --- NEWS 2001/04/16 02:05:23 1.145 *************** *** 1,24 **** ! What's New in Python 2.1 final? ! =============================== ! - Eric Raymond extended the pstats module with a simple interactive ! statistics browser, invoked when the module is run as a script. ! - Ping added an interactive help browser to pydoc. ! - An updated python-mode.el version 4.0 which integrates Ken ! Manheimer's pdbtrack.el. This makes debugging Python code via pdb ! much nicer in XEmacs and Emacs. When stepping through your program ! with pdb, in either the shell window or the *Python* window, the ! source file and line will be tracked by an arrow. - After a public outcry, assignment to __debug__ is no longer illegal; instead, a warning is issued. It will become illegal in 2.2. - New port: SCO Unixware 7, by Billy G. Allie. ! - Updated the RISCOS port. What's New in Python 2.1 beta 2? ================================ --- 1,202 ---- ! What's New in Python 2.1c2? ! =========================== ! A flurry of small changes, and one showstopper fixed in the nick of ! time made it necessary to release another release candidate. The list ! here is the *complete* list of patches (except version updates): ! Core ! - Tim discovered a nasty bug in the dictionary code, caused by ! PyDict_Next() calling dict_resize(), and the GC code's use of ! PyDict_Next() violating an assumption in dict_items(). This was ! fixed with considerable amounts of band-aid, but the net effect is a ! saner and more robust implementation. ! ! - Made a bunch of symbols static that were accidentally global. ! ! Build and Ports ! ! - The setup.py script didn't check for a new enough version of zlib ! (1.1.3 is needed). Now it does. ! ! - Changed "make clean" target to also remove shared libraries. ! ! - Added a more general warning about the SGI Irix optimizer to README. ! ! Library ! ! - Fix a bug in urllib.basejoin("http://host", "../file.html") which ! omitted the slash between host and file.html. ! ! - The mailbox module's _Mailbox class contained a completely broken ! and undocumented seek() method. Ripped it out. ! ! - Fixed a bunch of typos in various library modules (urllib2, smtpd, ! sgmllib, netrc, chunk) found by Neil Norwitz's PyChecker. ! ! - Fixed a few last-minute bugs in unittest. ! ! Extensions ! ! - Reverted the patch to the OpenSSL code in socketmodule.c to support ! RAND_status() and the EGD, and the subsequent patch that tried to ! fix it for pre-0.9.5 versions; the problem with the patch is that on ! some systems it issues a warning whenever socket is imported, and ! that's unacceptable. ! ! Tests ! ! - Fixed the pickle tests to work with "import test.test_pickle". ! ! - Tweaked test_locale.py to actually run the test Windows. ! ! - In distutils/archive_util.py, call zipfile.ZipFile() with mode "w", ! not "wb" (which is not a valid mode at all). + - Fix pstats browser crashes. Import readline if it exists to make + the user interface nicer. + + - Add "import thread" to the top of test modules that import the + threading module (test_asynchat and test_threadedtempfile). This + prevents test failures caused by a broken threading module resulting + from a previously caught failed import. + + - Changed test_asynchat.py to set the SO_REUSEADDR option; this was + needed on some platforms (e.g. Solaris 8) when the tests are run + twice in succession. + + - Skip rather than fail test_sunaudiodev if no audio device is found. + + + What's New in Python 2.1c1? + =========================== + + This list was significantly updated when 2.1c2 was released; the 2.1c1 + release didn't mention most changes that were actually part of 2.1c1: + + Legal + + - Copyright was assigned to the Python Software Foundation (PSF) and a + PSF license (very similar to the CNRI license) was added. + + - The CNRI copyright notice was updated to include 2001. + + Core + - After a public outcry, assignment to __debug__ is no longer illegal; instead, a warning is issued. It will become illegal in 2.2. + - Fixed a core dump with "%#x" % 0, and changed the semantics so that + "%#x" now always prepends "0x", even if the value is zero. + + - Fixed some nits in the bytecode compiler. + + - Fixed core dumps when calling certain kinds of non-functions. + + - Fixed various core dumps caused by reference count bugs. + + Build and Ports + + - Use INSTALL_SCRIPT to install script files. + - New port: SCO Unixware 7, by Billy G. Allie. + + - Updated RISCOS port. ! - Updated BeOS port and notes. + - Various other porting problems resolved. + Library + + - The TERMIOS and SOCKET modules are now truly obsolete and + unnecessary. Their symbols are incorporated in the termios and + socket modules. + + - Fixed some 64-bit bugs in pickle, cPickle, and struct, and added + better tests for pickling. + + - threading: make Condition.wait() robust against KeyboardInterrupt. + + - zipfile: add support to zipfile to support opening an archive + represented by an open file rather than a file name. Fix bug where + the archive was not properly closed. Fixed a bug in this bugfix + where flush() was called for a read-only file. + + - imputil: added an uninstall() method to the ImportManager. + + - Canvas: fixed bugs in lower() and tkraise() methods. + + - SocketServer: API change (added overridable close_request() method) + so that the TCP server can explicitly close the request. + + - pstats: Eric Raymond added a simple interactive statistics browser, + invoked when the module is run as a script. + + - locale: fixed a problem in format(). + + - webbrowser: made it work when the BROWSER environment variable has a + value like "/usr/bin/netscape". Made it auto-detect Konqueror for + KDE 2. Fixed some other nits. + + - unittest: changes to allow using a different exception than + AssertionError, and added a few more function aliases. Some other + small changes. + + - urllib, urllib2: fixed redirect problems and a coupleof other nits. + + - asynchat: fixed a critical bug in asynchat that slipped through the + 2.1b2 release. Fixed another rare bug. + + - Fix some unqualified except: clauses (always a bad code example). + + XML + + - pyexpat: new API get_version_string(). + + - Fixed some minidom bugs. + + Extensions + + - Fixed a core dump in _weakref. Removed the weakref.mapping() + function (it adds nothing to the API). + + - Rationalized the use of header files in the readline module, to make + it compile (albeit with some warnings) with the very recent readline + 4.2, without breaking for earlier versions. + + - Hopefully fixed a buffering problem in linuxaudiodev. + + - Attempted a fix to make the OpenSSL support in the socket module + work again with pre-0.9.5 versions of OpenSSL. + + Tests + + - Added a test case for asynchat and asyncore. + + - Removed coupling between tests where one test failing could break + another. + + Tools + + - Ping added an interactive help browser to pydoc, fixed some nits + in the rest of the pydoc code, and added some features to his + inspect module. + + - An updated python-mode.el version 4.1 which integrates Ken + Manheimer's pdbtrack.el. This makes debugging Python code via pdb + much nicer in XEmacs and Emacs. When stepping through your program + with pdb, in either the shell window or the *Python* window, the + source file and line will be tracked by an arrow. Very cool! + + - IDLE: syntax warnings in interactive mode are changed into errors. + + - Some improvements to Tools/webchecker (ignore some more URL types, + follow some more links). + + - Brought the Tools/compiler package up to date. + + What's New in Python 2.1 beta 2? ================================ *************** *** 936,939 **** --- 1114,1120 ---- Standard library and extensions + + - socket module: the OpenSSL code now adds support for RAND_status() + and EGD (Entropy Gathering Device). - array: reverse() method of array now works. buffer_info() now does From gvanrossum@users.sourceforge.net Mon Apr 16 03:07:10 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 15 Apr 2001 19:07:10 -0700 Subject: [Python-checkins] CVS: python/dist/src README,1.121,1.122 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv13306 Modified Files: README Log Message: This is (hopefully) last checkin before releasing 2.1c2 -- get rid of trailing whitespace. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -r1.121 -r1.122 *** README 2001/04/14 13:09:53 1.121 --- README 2001/04/16 02:07:08 1.122 *************** *** 267,271 **** AIX: A complete overhaul of the shared library support is now in ! place. See Misc/AIX-NOTES for some notes on how it's done. (The optimizer bug reported at this place in previous releases has been worked around by a minimal code change.) If you get --- 267,271 ---- AIX: A complete overhaul of the shared library support is now in ! place. See Misc/AIX-NOTES for some notes on how it's done. (The optimizer bug reported at this place in previous releases has been worked around by a minimal code change.) If you get *************** *** 322,329 **** syslog, termios, time, timing, zlib, audioop, imageop, rgbimg ! 3) make SHELL=/usr/local/bin/bash ! or, if you feel the need for speed: ! make SHELL=/usr/local/bin/bash OPT="-5 -Oil+nrt" --- 322,329 ---- syslog, termios, time, timing, zlib, audioop, imageop, rgbimg ! 3) make SHELL=/usr/local/bin/bash ! or, if you feel the need for speed: ! make SHELL=/usr/local/bin/bash OPT="-5 -Oil+nrt" *************** *** 401,405 **** configure --with-threads=no ! assuming Cygwin 1.1.8-2 and gcc 2.95.3-1 or later. At the time of this writing, Cygwin pthread support is being significantly --- 401,405 ---- configure --with-threads=no ! assuming Cygwin 1.1.8-2 and gcc 2.95.3-1 or later. At the time of this writing, Cygwin pthread support is being significantly *************** *** 409,423 **** Cygwin Python supports the building of shared extensions via the traditional Misc/Makefile.pre.in and the newer distutils methods. ! On NT/2000, the following regression tests fail: test_poll (hang) test_strftime ! Due to the test_poll hang on NT/2000, one should run the regression test using the following: PYTHONPATH= ./python.exe -tt ./Lib/test/regrtest.py -l -x test_poll ! On 9X/Me, in addition the above NT/2000 failures, it has been reported that the following regression tests also fail: --- 409,423 ---- Cygwin Python supports the building of shared extensions via the traditional Misc/Makefile.pre.in and the newer distutils methods. ! On NT/2000, the following regression tests fail: test_poll (hang) test_strftime ! Due to the test_poll hang on NT/2000, one should run the regression test using the following: PYTHONPATH= ./python.exe -tt ./Lib/test/regrtest.py -l -x test_poll ! On 9X/Me, in addition the above NT/2000 failures, it has been reported that the following regression tests also fail: *************** *** 434,439 **** Help trying to track down the root causes for these known problems will be greatly appreciated. - Configuring threads ------------------- --- 434,439 ---- Help trying to track down the root causes for these known problems will be greatly appreciated. + Configuring threads ------------------- *************** *** 463,477 **** SunOS 5.{1-5}/{gcc,SunPro cc}/solaris -mt SunOS 5.5/{gcc,SunPro cc}/POSIX (nothing) ! DEC OSF/1 3.x/cc/DCE -threads (butenhof@zko.dec.com) ! Digital UNIX 4.x/cc/DCE -threads (butenhof@zko.dec.com) ! Digital UNIX 4.x/cc/POSIX -pthread (butenhof@zko.dec.com) ! AIX 4.1.4/cc_r/d7 (nothing) (buhrt@iquest.net) ! AIX 4.1.4/cc_r4/DCE (nothing) (buhrt@iquest.net) ! IRIX 6.2/cc/POSIX (nothing) (robertl@cwi.nl) --- 463,477 ---- SunOS 5.{1-5}/{gcc,SunPro cc}/solaris -mt SunOS 5.5/{gcc,SunPro cc}/POSIX (nothing) ! DEC OSF/1 3.x/cc/DCE -threads (butenhof@zko.dec.com) ! Digital UNIX 4.x/cc/DCE -threads (butenhof@zko.dec.com) ! Digital UNIX 4.x/cc/POSIX -pthread (butenhof@zko.dec.com) ! AIX 4.1.4/cc_r/d7 (nothing) (buhrt@iquest.net) ! AIX 4.1.4/cc_r4/DCE (nothing) (buhrt@iquest.net) ! IRIX 6.2/cc/POSIX (nothing) (robertl@cwi.nl) *************** *** 484,496 **** SunOS 5.{1-5}/solaris -lthread SunOS 5.5/POSIX -lpthread ! DEC OSF/1 3.x/DCE -lpthreads -lmach -lc_r -lc (butenhof@zko.dec.com) Digital UNIX 4.x/DCE -lpthreads -lpthread -lmach -lexc -lc (butenhof@zko.dec.com) ! Digital UNIX 4.x/POSIX -lpthread -lmach -lexc -lc (butenhof@zko.dec.com) ! AIX 4.1.4/{draft7,DCE} (nothing) (buhrt@iquest.net) ! IRIX 6.2/POSIX -lpthread (jph@emilia.engr.sgi.com) --- 484,496 ---- SunOS 5.{1-5}/solaris -lthread SunOS 5.5/POSIX -lpthread ! DEC OSF/1 3.x/DCE -lpthreads -lmach -lc_r -lc (butenhof@zko.dec.com) Digital UNIX 4.x/DCE -lpthreads -lpthread -lmach -lexc -lc (butenhof@zko.dec.com) ! Digital UNIX 4.x/POSIX -lpthread -lmach -lexc -lc (butenhof@zko.dec.com) ! AIX 4.1.4/{draft7,DCE} (nothing) (buhrt@iquest.net) ! IRIX 6.2/POSIX -lpthread (jph@emilia.engr.sgi.com) *************** *** 684,688 **** can be found at ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z). To ! enable this, ftp and compile both libraries, then call configure, passing it the option --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY where DL_DIRECTORY is --- 684,688 ---- can be found at ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z). To ! enable this, ftp and compile both libraries, then call configure, passing it the option --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY where DL_DIRECTORY is *************** *** 701,705 **** --with-libc=-lc_s. These libraries are passed after all other libraries, the C library last. ! --with-next-archs='arch1 arch2': Under NEXTSTEP, this will build all compiled binaries with the architectures listed. This will --- 701,705 ---- --with-libc=-lc_s. These libraries are passed after all other libraries, the C library last. ! --with-next-archs='arch1 arch2': Under NEXTSTEP, this will build all compiled binaries with the architectures listed. This will From tim_one@users.sourceforge.net Mon Apr 16 04:01:38 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 15 Apr 2001 20:01:38 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0226.txt,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv20537 Modified Files: pep-0226.txt Log Message: Update schedule for the releases of 2.1c1 and 2.1c2. Index: pep-0226.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0226.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** pep-0226.txt 2001/04/12 20:29:48 1.9 --- pep-0226.txt 2001/04/16 03:01:36 1.10 *************** *** 22,30 **** Tentative future release dates - 13-Apr-2001: 2.1 release candidate 1 17-Apr-2001: 2.1 final release Past release dates: 23-Mar-2001: Python 2.1 beta 2 release 02-Mar-2001: First 2.1 beta release --- 22,31 ---- Tentative future release dates 17-Apr-2001: 2.1 final release Past release dates: + 15-Apr-2001: 2.1 release candidate 2 + 13-Apr-2001: 2.1 release candidate 1 23-Mar-2001: Python 2.1 beta 2 release 02-Mar-2001: First 2.1 beta release From gvanrossum@users.sourceforge.net Mon Apr 16 17:04:12 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 16 Apr 2001 09:04:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib locale.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12783 Modified Files: locale.py Log Message: Implement Mark Favas's suggestion. There's a clear bug in _group(): its first return statement returns a single value while its caller always expects it to return a tuple of two items. Fix this by returning (s, 0) instead. This won't make the locale test on Irix succeed, but now it will fail because of a bug in the platform's en_US locale rather than because of a bug in the locale module. Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** locale.py 2001/04/13 08:09:50 1.17 --- locale.py 2001/04/16 16:04:10 1.18 *************** *** 94,98 **** conv=localeconv() grouping=conv['grouping'] ! if not grouping:return s result="" seps = 0 --- 94,98 ---- conv=localeconv() grouping=conv['grouping'] ! if not grouping:return (s, 0) result="" seps = 0 From fdrake@users.sourceforge.net Mon Apr 16 18:34:50 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 16 Apr 2001 10:34:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib weakref.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30615 Modified Files: weakref.py Log Message: Weak*Dictionary.update(): Fix calls to [].append() to only have one parameter. Weak*Dictionary.get(): Make the second parameter optional. WeakKeyDictionary.has_key(), .keys(): Make these actually work! Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** weakref.py 2001/04/10 19:11:23 1.7 --- weakref.py 2001/04/16 17:34:48 1.8 *************** *** 55,59 **** return new ! def get(self, key, default): try: ref = self.data[key] --- 55,59 ---- return new ! def get(self, key, default=None): try: ref = self.data[key] *************** *** 101,105 **** def remove(o, data=d, key=key): del data[key] ! L.append(key, ref(o, remove)) for key, r in L: d[key] = r --- 101,105 ---- def remove(o, data=d, key=key): del data[key] ! L.append((key, ref(o, remove))) for key, r in L: d[key] = r *************** *** 140,146 **** return new ! def get(self, key, default): return self.data.get(ref(key),default) def items(self): L = [] --- 140,149 ---- return new ! def get(self, key, default=None): return self.data.get(ref(key),default) + def has_key(self, key): + return self.data.has_key(ref(key)) + def items(self): L = [] *************** *** 151,154 **** --- 154,165 ---- return L + def keys(self): + L = [] + for ref in self.data.keys(): + o = ref() + if o is not None: + L.append(o) + return L + def popitem(self): while 1: *************** *** 165,169 **** L = [] for key, value in dict.items(): ! L.append(ref(key, self._remove), value) for key, r in L: d[key] = r --- 176,180 ---- L = [] for key, value in dict.items(): ! L.append((ref(key, self._remove), value)) for key, r in L: d[key] = r From fdrake@users.sourceforge.net Mon Apr 16 18:37:29 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 16 Apr 2001 10:37:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31466 Modified Files: test_weakref.py Log Message: Add a test case for Weak*Dictionary.update() that would have caught a recently reported bug; also exposed some other bugs in the implementation. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** test_weakref.py 2001/04/13 17:18:15 1.6 --- test_weakref.py 2001/04/16 17:37:27 1.7 *************** *** 281,284 **** --- 281,309 ---- "deleting the keys did not clear the dictionary") + def check_update(self, klass, dict): + weakdict = klass() + weakdict.update(dict) + self.assert_(len(weakdict) == len(dict)) + for k in weakdict.keys(): + self.assert_(dict.has_key(k), + "mysterious new key appeared in weak dict") + v = dict.get(k) + self.assert_(v is weakdict[k]) + self.assert_(v is weakdict.get(k)) + for k in dict.keys(): + self.assert_(weakdict.has_key(k), + "original key disappeared in weak dict") + v = dict[k] + self.assert_(v is weakdict[k]) + self.assert_(v is weakdict.get(k)) + + def test_weak_valued_dict_update(self): + self.check_update(weakref.WeakValueDictionary, + {1: C(), 'a': C(), C(): C()}) + + def test_weak_keyed_dict_update(self): + self.check_update(weakref.WeakKeyDictionary, + {C(): 1, C(): 2, C(): 3}) + run_unittest(ReferencesTestCase) From gvanrossum@users.sourceforge.net Mon Apr 16 18:51:45 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 16 Apr 2001 10:51:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include patchlevel.h,2.48,2.49 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv1773 Modified Files: patchlevel.h Log Message: Update the version to 2.1final (again :-). Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.48 retrieving revision 2.49 diff -C2 -r2.48 -r2.49 *** patchlevel.h 2001/04/16 00:33:29 2.48 --- patchlevel.h 2001/04/16 17:51:43 2.49 *************** *** 23,34 **** #define PY_MINOR_VERSION 1 #define PY_MICRO_VERSION 0 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA ! #define PY_RELEASE_SERIAL 2 /* Version as a string */ ! #define PY_VERSION "2.1c2" /* Historic */ ! #define PATCHLEVEL "2.1c2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 23,34 ---- #define PY_MINOR_VERSION 1 #define PY_MICRO_VERSION 0 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL ! #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.1" /* Historic */ ! #define PATCHLEVEL "2.1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From gvanrossum@users.sourceforge.net Mon Apr 16 19:12:07 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 16 Apr 2001 11:12:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib posixpath.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5687 Modified Files: posixpath.py Log Message: In walk(), don't die when os.lstat() raises os.error, e.g. because a file was deleted by a previous call to the visitor function. This used to be the behavior in 1.5.2 and before, but a patch to avoid making two stat() calls accidentally broke this in 2.0. Moshe, this would be a good one for 2.0.1 too! Index: posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -r1.42 -r1.43 *** posixpath.py 2001/02/12 02:00:42 1.42 --- posixpath.py 2001/04/16 18:12:04 1.43 *************** *** 270,274 **** for name in names: name = join(top, name) ! st = os.lstat(name) if stat.S_ISDIR(st[stat.ST_MODE]): walk(name, func, arg) --- 270,277 ---- for name in names: name = join(top, name) ! try: ! st = os.lstat(name) ! except os.error: ! continue if stat.S_ISDIR(st[stat.ST_MODE]): walk(name, func, arg) From tim_one@users.sourceforge.net Mon Apr 16 19:20:32 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 16 Apr 2001 11:20:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.10,1.11 python20.wse,1.38,1.39 pythoncore.dsp,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv7061/python/dist/src/PCbuild Modified Files: BUILDno.txt python20.wse pythoncore.dsp Log Message: Update Windows installer & buildno for 2.1 final. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** BUILDno.txt 2001/04/16 01:44:08 1.10 --- BUILDno.txt 2001/04/16 18:20:30 1.11 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 15 2.1 + 16-Apr-2001 14 2.1c2 15-Apr-2001 Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -r1.38 -r1.39 *** python20.wse 2001/04/16 01:44:08 1.38 --- python20.wse 2001/04/16 18:20:30 1.39 *************** *** 2,6 **** item: Global Version=5.0 ! Title=Python 2.1 release candidate 2 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=5.0 ! Title=Python 2.1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 67,71 **** item: Set Variable Variable=APPTITLE ! Value=Python 2.1 release candidate 2 end item: Set Variable --- 67,71 ---- item: Set Variable Variable=APPTITLE ! Value=Python 2.1 end item: Set Variable Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** pythoncore.dsp 2001/04/16 01:44:08 1.12 --- pythoncore.dsp 2001/04/16 18:20:30 1.13 *************** *** 740,748 **** !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=14 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=14 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" --- 740,748 ---- !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=15 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=15 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" From jhylton@users.sourceforge.net Mon Apr 16 19:42:15 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 16 Apr 2001 11:42:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules symtablemodule.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv10846/Modules Modified Files: symtablemodule.c Log Message: Export three optimization (fast locals) flags Index: symtablemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/symtablemodule.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** symtablemodule.c 2001/03/22 23:10:44 1.3 --- symtablemodule.c 2001/04/16 18:42:13 1.4 *************** *** 66,69 **** --- 66,73 ---- PyModule_AddIntConstant(m, "TYPE_MODULE", TYPE_MODULE); + PyModule_AddIntConstant(m, "OPT_IMPORT_STAR", OPT_IMPORT_STAR); + PyModule_AddIntConstant(m, "OPT_EXEC", OPT_EXEC); + PyModule_AddIntConstant(m, "OPT_BARE_EXEC", OPT_BARE_EXEC); + PyModule_AddIntConstant(m, "LOCAL", LOCAL); PyModule_AddIntConstant(m, "GLOBAL_EXPLICIT", GLOBAL_EXPLICIT); From jhylton@users.sourceforge.net Mon Apr 16 19:43:20 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 16 Apr 2001 11:43:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib symtable.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11008/Lib Modified Files: symtable.py Log Message: Fix three PyChecker-detected gotchas. Import OPT_ symbols from _symtable. Define has_exec() and has_import_star(). Index: symtable.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/symtable.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** symtable.py 2001/03/29 04:36:08 1.3 --- symtable.py 2001/04/16 18:43:18 1.4 *************** *** 5,9 **** from _symtable import USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, \ DEF_STAR, DEF_DOUBLESTAR, DEF_INTUPLE, DEF_FREE, \ ! DEF_FREE_GLOBAL, DEF_FREE_CLASS, DEF_IMPORT, DEF_BOUND import weakref --- 5,10 ---- from _symtable import USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, \ DEF_STAR, DEF_DOUBLESTAR, DEF_INTUPLE, DEF_FREE, \ ! DEF_FREE_GLOBAL, DEF_FREE_CLASS, DEF_IMPORT, DEF_BOUND, \ ! OPT_IMPORT_STAR, OPT_EXEC, OPT_BARE_EXEC import weakref *************** *** 98,103 **** def has_exec(self): ! return bool() def get_identifiers(self): return self._table.symbols.keys() --- 99,109 ---- def has_exec(self): ! """Return true if the scope uses exec""" ! return bool(self._table.optimized & (OPT_EXEC | OPT_BARE_EXEC)) + def has_import_star(self): + """Return true if the scope uses import *""" + return bool(self._table.optimized & OPT_IMPORT_STAR) + def get_identifiers(self): return self._table.symbols.keys() *************** *** 191,198 **** def is_vararg(self): ! return bool(self.flag & DEF_STAR) def is_keywordarg(self): ! return bool(self.__flags & DEF_STARSTAR) def is_local(self): --- 197,204 ---- def is_vararg(self): ! return bool(self.__flags & DEF_STAR) def is_keywordarg(self): ! return bool(self.__flags & DEF_DOUBLESTAR) def is_local(self): From gvanrossum@users.sourceforge.net Mon Apr 16 19:46:48 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 16 Apr 2001 11:46:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.145,1.146 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv11744 Modified Files: NEWS Log Message: Noted what's new in 2.1 (final). Hopefully this is the last checkin for 2.1! Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.145 retrieving revision 1.146 diff -C2 -r1.145 -r1.146 *** NEWS 2001/04/16 02:05:23 1.145 --- NEWS 2001/04/16 18:46:45 1.146 *************** *** 1,2 **** --- 1,23 ---- + What's New in Python 2.1 (final)? + ================================= + + We only changed a few things since the last release candidate, all in + Python library code: + + - A bug in the locale module was fixed that affected locales which + define no grouping for numeric formatting. + + - A few bugs in the weakref module's implementations of weak + dictionaries (WeakValueDictionary and WeakKeyDictionary) were fixed, + and the test suite was updated to check for these bugs. + + - An old bug in the os.path.walk() function (introduced in Python + 2.0!) was fixed: a non-existent file would cause an exception + instead of being ignored. + + - Fixed a few bugs in the new symtable module found by Neil Norwitz's + PyChecker. + + What's New in Python 2.1c2? =========================== From gvanrossum@users.sourceforge.net Tue Apr 17 16:19:31 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 17 Apr 2001 08:19:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include patchlevel.h,2.49,2.49.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv9320 Modified Files: Tag: release21-maint patchlevel.h Log Message: Set the version number to 2.1.1a1. This checkin inaugurates the release21-maint branch. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.49 retrieving revision 2.49.2.1 diff -C2 -r2.49 -r2.49.2.1 *** patchlevel.h 2001/04/16 17:51:43 2.49 --- patchlevel.h 2001/04/17 15:19:29 2.49.2.1 *************** *** 22,34 **** #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 1 ! #define PY_MICRO_VERSION 0 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL ! #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.1" /* Historic */ ! #define PATCHLEVEL "2.1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 22,34 ---- #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 1 ! #define PY_MICRO_VERSION 1 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA ! #define PY_RELEASE_SERIAL 1 /* Version as a string */ ! #define PY_VERSION "2.1.1a1" /* Historic */ ! #define PATCHLEVEL "2.1.1a1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From bwarsaw@users.sourceforge.net Tue Apr 17 17:31:16 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 17 Apr 2001 09:31:16 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0242.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv24784 Modified Files: pep-0242.txt Log Message: Paul's latest revision, with some formatting and spell-checking corrections by Barry. Index: pep-0242.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0242.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0242.txt 2001/03/20 05:29:16 1.1 --- pep-0242.txt 2001/04/17 16:31:14 1.2 *************** *** 40,78 **** ! Supported Kinds Each Python compiler may define as many "kinds" of integer and floating point numbers as it likes, except that it must support at least two kinds of integer corresponding to the existing int and long, and must support at least one kind of floating point number, ! equivalent to the present float. The range and precision of the ! these kinds are processor dependent, as at present, except for the ! "long integer" kind, which can hold an arbitrary integer. The ! built-in functions int(), float(), long() and complex() convert ! inputs to these default kinds as they do at present. (Note that a Unicode string is actually a different "kind" of string and that a sufficiently knowledgeable person might be able to expand this PEP to cover that case.) ! Within each type (integer, floating, and complex) the compiler ! supports a linearly-ordered set of kinds, with the ordering ! determined by the ability to hold numbers of an increased range ! and/or precision. Kind Objects ! Three new standard functions are defined in a module named ! "kinds". They return callable objects called kind objects. Each ! int or floating kind object f has the signature result = f(x), and ! each complex kind object has the signature result = f(x, y=0.). int_kind(n) ! For n >= 1, return a callable object whose result is an ! integer kind that will hold an integer number in the open ! interval (-10**n,10**n). This function always succeeds, since ! it can return the 'long' kind if it has to. The kind object ! accepts arguments that are integers including longs. If n == ! 0, returns the kind object corresponding to long. float_kind(nd, n) --- 40,82 ---- ! Supported Kinds of Ints and Floats + Complex numbers are treated separately below, since Python can be + built without them. + Each Python compiler may define as many "kinds" of integer and floating point numbers as it likes, except that it must support at least two kinds of integer corresponding to the existing int and long, and must support at least one kind of floating point number, ! equivalent to the present float. ! ! The range and precision of the these required kinds are processor ! dependent, as at present, except for the "long integer" kind, ! which can hold an arbitrary integer. ! ! The built-in functions int(), long(), and float() convert inputs ! to these default kinds as they do at present. (Note that a Unicode string is actually a different "kind" of string and that a sufficiently knowledgeable person might be able to expand this PEP to cover that case.) ! Within each type (integer, floating) the compiler supports a ! linearly-ordered set of kinds, with the ordering determined by the ! ability to hold numbers of an increased range and/or precision. Kind Objects ! Two new standard functions are defined in a module named "kinds". ! They return callable objects called kind objects. Each int or ! floating kind object f has the signature result = f(x), and each ! complex kind object has the signature result = f(x, y=0.). int_kind(n) ! For an integer argument n >= 1, return a callable object whose ! result is an integer kind that will hold an integer number in ! the open interval (-10**n,10**n). The kind object accepts ! arguments that are integers including longs. If n == 0, ! returns the kind object corresponding to the Python literal 0. float_kind(nd, n) *************** *** 80,92 **** is a floating point kind that will hold a floating-point number with at least nd digits of precision and a base-10 ! exponent in the open interval (-n, n). The kind object ! accepts arguments that are integer or real. ! complex_kind(nd, n) ! Return a callable object whose result is a complex kind that ! will will hold a complex number each of whose components ! (.real, .imag) is of kind float_kind(nd, n). The kind object ! will accept one argument that is integer, real, or complex, or ! two arguments, each integer or real. The compiler will return a kind object corresponding to the least --- 84,92 ---- is a floating point kind that will hold a floating-point number with at least nd digits of precision and a base-10 ! exponent in the closed interval [-n, n]. The kind object ! accepts arguments that are integer or float. ! If nd and n are both zero, returns the kind object ! corresponding to the Python literal 0.0. The compiler will return a kind object corresponding to the least *************** *** 98,151 **** exception is thrown. - Kind objects also accept a string argument for conversion of - literal notation to their kind. - Besides their callable behavior, kind objects have attributes ! giving the traits of the kind in question. The list of traits ! needs to be completed. ! The Meaning of Literal Values ! Literal integer values without a trailing L are of the least ! integer kind required to represent them. An integer literal with ! a trailing L is a long. Literal decimal values are of the ! greatest available binary floating-point kind. - Concerning Infinite Floating Precision ! This section makes no proposals and can be omitted from ! consideration. It is for illuminating an intentionally ! unimplemented 'corner' of the design. ! ! This PEP does not propose the creation of an infinite precision ! floating point type, just leaves room for it. Just as int_kind(0) ! returns the long kind object, if in the future an infinitely ! precise decimal kind is available, float_kind(0,0) could return a ! function that converts to that type. Since such a kind function ! accepts string arguments, programs could then be written that are ! completely precise. Perhaps in analogy to r'a raw string', 1.3r ! might be available as syntactic sugar for calling the infinite ! floating kind object with argument '1.3'. r could be thought of ! as meaning 'rational'. ! ! ! Complex numbers and kinds ! ! Complex numbers are always pairs of floating-point numbers with ! the same kind. A Python compiler must support a complex analog of ! each floating point kind it supports, if it supports complex ! numbers at all. ! ! ! Coercion ! ! In an expression, coercion between different kinds is to the ! greater kind. For this purpose, all complex kinds are "greater ! than" all floating-point kinds, and all floating-point kinds are ! "greater than" all integer kinds. Examples --- 98,175 ---- exception is thrown. Besides their callable behavior, kind objects have attributes ! giving the traits of the kind in question. + 1. name is the name of the kind. The standard kinds are called + int, long, double. ! 2. typecode is a single-letter string that would be appropriate ! for use with Numeric or module array to form an array of this ! kind. The standard types' typecodes are 'i', 'O', 'd' ! respectively. ! 3. Integer kinds have these additional attributes: MAX, equal to ! the maximum permissible integer of this kind, or None for the ! long kind. MIN, equal to the most negative permissible integer ! of this kind, or None for the long kind. + 4. Float kinds have these additional attributes whose properties + are equal to the corresponding value for the corresponding C + type in the standard header file "float.h". MAX, MIN, DIG, + MANT_DIG, EPSILON, MAX_EXP, MAX_10_EXP, MIN_EXP, MIN_10_EXP, + RADIX, ROUNDS (== FLT_RADIX, FLT_ROUNDS in float.h). These + values are of type integer except for MAX, MIN, and EPSILON, + which are of the Python floating type to which the kind + corresponds. ! Attributes of Module kinds ! ! int_kinds is a list of the available integer kinds, sorted from lowest ! to highest kind. By definition, int_kinds[-1] is the ! long kind. ! ! float_kinds is a list of the available floating point kinds, sorted ! from lowest to highest kind. ! ! default_int_kind is the kind object corresponding to the Python ! literal 0 ! ! default_long_kind is the kind object corresponding to the Python ! literal 0L + default_float_kind is the kind object corresponding to the Python + literal 0.0 + + Complex Numbers + + If supported, complex numbers have real and imaginary parts that + are floating-point numbers with the same kind. A Python compiler + must support a complex analog of each floating point kind it + supports, if it supports complex numbers at all. + + If complex numbers are supported, the following are available in + module kinds: + + complex_kind(nd, n) + Return a callable object whose result is a complex kind that + will hold a complex number each of whose components (.real, + .imag) is of kind float_kind(nd, n). The kind object will + accept one argument that is of any integer, real, or complex + kind, or two arguments, each integer or real. + + complex_kinds is a list of the available complex kinds, sorted + from lowest to highest kind. + + default_complex_kind is the kind object corresponding to the + Python literal 0.0j. The name of this kind + is doublecomplex, and its typecode is 'D'. + + Complex kind objects have these addition attributes: + + floatkind is the kind object of the corresponding float type. + + Examples *************** *** 166,170 **** --- 190,196 ---- # builtin float gets you the default float kind, properties unknown w = x * float(x) + # but in the following case we know w has kind "double". w = x * double(z) + u = csingle(x + z * 1.0j) u2 = csingle(x+z, 1.0) *************** *** 180,195 **** Open Issues - - The assertion that a decimal literal means a binary floating-point - value of the largest available kind is in conflict with other - proposals about Python's numeric model. This PEP asserts that - these other proposals are wrong and that part of them should not - be implemented. - - Determine the exact list of traits for integer and floating point - numbers. There are some standard Fortran routines that do this - but I have to track them down. Also there should be information - sufficient to create a Numeric array of an equal or greater kind. Copyright --- 206,211 ---- Open Issues + No open issues have been raised at this time. Copyright From bwarsaw@users.sourceforge.net Tue Apr 17 17:46:53 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 17 Apr 2001 09:46:53 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0160.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv28097 Modified Files: pep-0160.txt Log Message: Cleaned up formatting and marked as finished. Index: pep-0160.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0160.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** pep-0160.txt 2000/11/28 22:23:25 1.8 --- pep-0160.txt 2001/04/17 16:46:51 1.9 *************** *** 1,11 **** ! PEP: 160 ! Title: Python 1.6 Release Schedule ! Version: $Revision$ ! Author: Fred L. Drake, Jr. Python-Version: 1.6 ! Status: Complete ! Type: Informational ! Created: 25-Jul-2000 Introduction --- 1,13 ---- ! PEP: 160 ! Title: Python 1.6 Release Schedule ! Version: $Revision$ ! Author: Fred L. Drake, Jr. ! Status: Finished ! Type: Informational ! Created: 25-Jul-2000 Python-Version: 1.6 ! Post-History: + Introduction *************** *** 17,21 **** --- 19,25 ---- Corporation for National Research Initiatives (CNRI). + Schedule + August 1 1.6 beta 1 release (planned). August 3 1.6 beta 1 release (actual). *************** *** 23,26 **** --- 27,31 ---- September 5 1.6 final release (actual). + Features *************** *** 41,44 **** --- 46,50 ---- package, so the final form was adopted. + Mechanism *************** *** 58,65 **** --- 64,74 ---- final Python 1.6 release is tagged "release16" in the repository. + Copyright This document has been placed in the public domain. + + Local Variables: mode: indented-text From bwarsaw@users.sourceforge.net Tue Apr 17 17:55:13 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 17 Apr 2001 09:55:13 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0006.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv29925 Modified Files: pep-0006.txt Log Message: Aahz's latest version, with small formatting changes by Barry. Index: pep-0006.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0006.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** pep-0006.txt 2001/03/15 14:11:16 1.2 --- pep-0006.txt 2001/04/17 16:55:11 1.3 *************** *** 1,4 **** PEP: 6 ! Title: Patch and Bug Fix Releases Version: $Revision$ Author: aahz@pobox.com (Aahz) --- 1,4 ---- PEP: 6 ! Title: Bug Fix Releases Version: $Revision$ Author: aahz@pobox.com (Aahz) *************** *** 32,137 **** have been added, sometimes late in the development cycle. ! One solution for this issue is to maintain old feature releases, ! providing bug fixes and (minimal!) feature additions. This will ! make Python more attractive for enterprise development, where ! Python may need to be installed on hundreds or thousands of machines. - At the same time, many of the core Python developers are - understandably reluctant to devote a significant fraction of their - time and energy to what they perceive as grunt work. On the - gripping hand, people are likely to feel discomfort around - installing releases that are not certified by PythonLabs. - Prohibitions ! Patch releases are required to adhere to the following ! restrictions: 1. There must be zero syntax changes. All .pyc and .pyo files must work (no regeneration needed) with all patch releases forked off from a feature release. ! 2. There must be no incompatible C API changes. All extensions must continue to work without recompiling in all patch releases in the same fork as a feature release. - ! Bug Fix Releases - Bug fix releases are a subset of all patch releases; it is - prohibited to add any features to the core in a bug fix release. - A patch release that is not a bug fix release may contain minor - feature enhancements, subject to the Prohibitions section. - - The standard for patches to extensions and modules is a bit more - lenient, to account for the possible desirability of including a - module from a future version that contains mostly bug fixes but - may also have some small feature changes. (E.g. Fredrik Lundh - making available the 2.1 sre module for 2.0 and 1.5.2.) - Version Numbers Starting with Python 2.0, all feature releases are required to ! have the form X.Y; patch releases will always be of the form ! X.Y.Z. To clarify the distinction between a bug fix release and a ! patch release, all non-bug fix patch releases will have the suffix ! "p" added. For example, "2.1" is a feature release; "2.1.1" is a ! bug fix release; and "2.1.2p" is a patch release that contains ! minor feature enhancements. Procedure ! XXX This section is still a little light (and probably ! controversial!) The Patch Czar is the counterpart to the BDFL for patch releases. However, the BDFL and designated appointees retain veto power over ! individual patches and the decision of whether to label a patch ! release as a bug fix release. As individual patches get contributed to the feature release fork, ! each patch contributor is requested to consider whether the patch ! is a bug fix suitable for inclusion in a patch release. If the ! patch is considered suitable, the patch contributor will mail the ! SourceForge patch (bug fix?) number to the maintainers' mailing ! list. In addition, anyone from the Python community is free to suggest patches for inclusion. Patches may be submitted specifically for ! patch releases; they should follow the guidelines in PEP 3[1]. The Patch Czar decides when there are a sufficient number of patches to warrant a release. The release gets packaged up, ! including a Windows installer, and made public as a beta release. ! If any new bugs are found, they must be fixed and a new beta ! release publicized. Once a beta cycle completes with no new bugs ! found, the package is sent to PythonLabs for certification and ! publication on python.org. ! ! Each beta cycle must last a minimum of one month. - Issues To Be Resolved ! Should the first patch release following any feature release be ! required to be a bug fix release? (Aahz proposes "yes".) ! Is it allowed to do multiple forks (e.g. is it permitted to have ! both 2.0.2 and 2.0.2p)? (Aahz proposes "no".) - Does it makes sense for a bug fix release to follow a patch - release? (E.g., 2.0.1, 2.0.2p, 2.0.3.) ! Exactly how does a candidate patch release get submitted to ! PythonLabs for certification? And what does "certification" mean, ! anyway? ;-) ! ! Who is the Patch Czar? Is the Patch Czar a single person? (Aahz ! says "not me alone". Aahz is willing to do a lot of the ! non-technical work, but Aahz is not a C programmer.) What is the equivalent of python-dev for people who are --- 32,107 ---- have been added, sometimes late in the development cycle. ! One solution for this issue is to maintain the previous feature ! release, providing bug fixes until the next feature release. This ! should make Python more attractive for enterprise development, ! where Python may need to be installed on hundreds or thousands of machines. Prohibitions ! Patch releases are required to adhere to the following restrictions: 1. There must be zero syntax changes. All .pyc and .pyo files must work (no regeneration needed) with all patch releases forked off from a feature release. + + 2. There must be zero pickle changes. ! 3. There must be no incompatible C API changes. All extensions must continue to work without recompiling in all patch releases in the same fork as a feature release. ! Breaking any of these prohibitions requires a BDFL proclamation ! (and a prominent warning in the release notes). Version Numbers Starting with Python 2.0, all feature releases are required to ! have a version number the form X.Y; patch releases will always be ! of the form X.Y.Z. ! ! The current feature release under development is referred to as ! release N; the just-released feature version is referred to as ! N-1. Procedure ! The process for managing patch releases is modeled in part on the ! Tcl system [1]. The Patch Czar is the counterpart to the BDFL for patch releases. However, the BDFL and designated appointees retain veto power over ! individual patches. As individual patches get contributed to the feature release fork, ! each patch contributor is requested to consider whether the patch is ! a bug fix suitable for inclusion in a patch release. If the patch is ! considered suitable, the patch contributor will mail the SourceForge ! patch (bug fix?) number to the maintainers' mailing list. In addition, anyone from the Python community is free to suggest patches for inclusion. Patches may be submitted specifically for ! patch releases; they should follow the guidelines in PEP 3 [2]. The Patch Czar decides when there are a sufficient number of patches to warrant a release. The release gets packaged up, ! including a Windows installer, and made public. If any new bugs ! are found, they must be fixed immediately and a new patch release ! publicized (with an incremented version number). + Patch releases are expected to occur at an interval of roughly one + month. In general, only the N-1 release will be under active + maintenance at any time. ! Patch Czar History ! Moshe Zadka (moshez@zadka.site.co.il) is the Patch Czar for 2.0.1. ! Issues To Be Resolved What is the equivalent of python-dev for people who are *************** *** 147,153 **** References ! [1] PEP 3, Hylton, http://python.sourceforge.net/peps/pep-0003.html --- 117,147 ---- + History + + This PEP started life as a proposal on comp.lang.python. The + original version suggested a single patch for the N-1 release to + be released concurrently with the N release. The original version + also argued for sticking with a strict bug fix policy. + + Following feedback from the BDFL and others, the draft PEP was + written containing an expanded patch release cycle that permitted + any previous feature release to obtain patches and also relaxed + the strict bug fix requirement (mainly due to the example of PEP + 235 [3], which could be argued as either a bug fix or a feature). + + Discussion then mostly moved to python-dev, where BDFL finally + issued a proclamation basing the Python patch release process on + Tcl's, which essentially returned to the original proposal in + terms of being only the N-1 release and only bug fixes, but + allowing multiple patch releases until release N is published. + + References + + [1] http://dev.scriptics.com:8080/cgi-bin/tct/tip/28.html + + [2] http://python.sourceforge.net/peps/pep-0003.html ! [3] http://python.sourceforge.net/peps/pep-0235.html From esr@users.sourceforge.net Tue Apr 17 18:20:21 2001 From: esr@users.sourceforge.net (Eric S. Raymond) Date: Tue, 17 Apr 2001 10:20:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib shlex.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3918 Modified Files: shlex.py Log Message: Unused variable (caught by PyChecker) removed. Index: shlex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shlex.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** shlex.py 2001/02/15 22:15:13 1.15 --- shlex.py 2001/04/17 17:20:19 1.16 *************** *** 97,101 **** def read_token(self): "Read a token from the input stream (no pushback or inclusions)" - tok = '' while 1: nextchar = self.instream.read(1) --- 97,100 ---- From bwarsaw@users.sourceforge.net Tue Apr 17 23:12:48 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 17 Apr 2001 15:12:48 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0242.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv16579 Modified Files: pep-0242.txt Log Message: Updated Post-History: Index: pep-0242.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0242.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** pep-0242.txt 2001/04/17 16:31:14 1.2 --- pep-0242.txt 2001/04/17 22:12:46 1.3 *************** *** 7,11 **** Created: 17-Mar-2001 Python-Version: 2.2 ! Post-History: --- 7,11 ---- Created: 17-Mar-2001 Python-Version: 2.2 ! Post-History: 17-Apr-2001 From jhylton@users.sourceforge.net Wed Apr 18 02:19:30 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Tue, 17 Apr 2001 18:19:30 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test badsyntax_future3.py,NONE,1.1 badsyntax_future4.py,NONE,1.1 badsyntax_future5.py,NONE,1.1 badsyntax_future6.py,NONE,1.1 badsyntax_future7.py,NONE,1.1 badsyntax_nocaret.py,NONE,1.1 regrtest.py,1.32,1.33 test_future.py,1.2,1.3 test_traceback.py,1.2,1.3 nocaret.py,1.1,NONE test_future3.py,1.1,NONE test_future4.py,1.1,NONE test_future5.py,1.1,NONE test_future6.py,1.1,NONE test_future7.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23878 Modified Files: regrtest.py test_future.py test_traceback.py Added Files: badsyntax_future3.py badsyntax_future4.py badsyntax_future5.py badsyntax_future6.py badsyntax_future7.py badsyntax_nocaret.py Removed Files: nocaret.py test_future3.py test_future4.py test_future5.py test_future6.py test_future7.py Log Message: Fix compileall.py so that it fails on SyntaxErrors The changes cause compilation failures in any file in the Python installation lib directory to cause the install to fail. It looks like compileall.py intended to behave this way, but a change to py_compile.py and a separate bug defeated it. Fixes SF bug #412436 This change affects the test suite, which contains several files that contain intentional errors. The solution is to extend compileall.py with the ability to skip compilation of selected files. In the test suite, rename nocaret.py and test_future[3..7].py to start with badsyntax_nocaret.py and badsyntax_future[3..7].py. Update the makefile to skip compilation of these files. Update the tests to use the name names for imports. NB compileall.py is changed so that compile_dir() returns success only if all recursive calls to compile_dir() also check success. --- NEW FILE: badsyntax_future3.py --- """This is a test""" from __future__ import nested_scopes from __future__ import rested_snopes def f(x): def g(y): return x + y return g print f(2)(4) --- NEW FILE: badsyntax_future4.py --- """This is a test""" import __future__ from __future__ import nested_scopes def f(x): def g(y): return x + y return g print f(2)(4) --- NEW FILE: badsyntax_future5.py --- """This is a test""" from __future__ import nested_scopes import foo from __future__ import nested_scopes def f(x): def g(y): return x + y return g print f(2)(4) --- NEW FILE: badsyntax_future6.py --- """This is a test""" "this isn't a doc string" from __future__ import nested_scopes def f(x): def g(y): return x + y return g print f(2)(4) --- NEW FILE: badsyntax_future7.py --- """This is a test""" from __future__ import nested_scopes; import string; from __future__ import \ nested_scopes def f(x): def g(y): return x + y return g print f(2)(4) --- NEW FILE: badsyntax_nocaret.py --- def f(x): [x for x in x] = x Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** regrtest.py 2001/02/28 17:48:06 1.32 --- regrtest.py 2001/04/18 01:19:27 1.33 *************** *** 200,208 **** 'test_future1', 'test_future2', - 'test_future3', - 'test_future4', - 'test_future5', - 'test_future6', - 'test_future7', ] --- 200,203 ---- Index: test_future.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_future.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_future.py 2001/03/01 08:31:39 1.2 --- test_future.py 2001/04/18 01:19:27 1.3 *************** *** 20,44 **** # The remaining tests should fail try: ! import test_future3 except SyntaxError, msg: check_error_location(str(msg)) try: ! import test_future4 except SyntaxError, msg: check_error_location(str(msg)) try: ! import test_future5 except SyntaxError, msg: check_error_location(str(msg)) try: ! import test_future6 except SyntaxError, msg: check_error_location(str(msg)) try: ! import test_future7 except SyntaxError, msg: check_error_location(str(msg)) --- 20,44 ---- # The remaining tests should fail try: ! import badsyntax_future3 except SyntaxError, msg: check_error_location(str(msg)) try: ! import badsyntax_future4 except SyntaxError, msg: check_error_location(str(msg)) try: ! import badsyntax_future5 except SyntaxError, msg: check_error_location(str(msg)) try: ! import badsyntax_future6 except SyntaxError, msg: check_error_location(str(msg)) try: ! import badsyntax_future7 except SyntaxError, msg: check_error_location(str(msg)) Index: test_traceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_traceback.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_traceback.py 2001/04/08 07:44:07 1.2 --- test_traceback.py 2001/04/18 01:19:27 1.3 *************** *** 23,27 **** def syntax_error_without_caret(self): # XXX why doesn't compile raise the same traceback? ! import nocaret def test_caret(self): --- 23,27 ---- def syntax_error_without_caret(self): # XXX why doesn't compile raise the same traceback? ! import badsyntax_nocaret def test_caret(self): --- nocaret.py DELETED --- --- test_future3.py DELETED --- --- test_future4.py DELETED --- --- test_future5.py DELETED --- --- test_future6.py DELETED --- --- test_future7.py DELETED --- From jhylton@users.sourceforge.net Wed Apr 18 02:19:30 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Tue, 17 Apr 2001 18:19:30 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_future,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv23878/output Modified Files: test_future Log Message: Fix compileall.py so that it fails on SyntaxErrors The changes cause compilation failures in any file in the Python installation lib directory to cause the install to fail. It looks like compileall.py intended to behave this way, but a change to py_compile.py and a separate bug defeated it. Fixes SF bug #412436 This change affects the test suite, which contains several files that contain intentional errors. The solution is to extend compileall.py with the ability to skip compilation of selected files. In the test suite, rename nocaret.py and test_future[3..7].py to start with badsyntax_nocaret.py and badsyntax_future[3..7].py. Update the makefile to skip compilation of these files. Update the tests to use the name names for imports. NB compileall.py is changed so that compile_dir() returns success only if all recursive calls to compile_dir() also check success. Index: test_future =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_future,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_future 2001/02/28 17:48:06 1.1 --- test_future 2001/04/18 01:19:28 1.2 *************** *** 2,8 **** 6 6 ! SyntaxError test_future3 3 ! SyntaxError test_future4 3 ! SyntaxError test_future5 4 ! SyntaxError test_future6 3 ! SyntaxError test_future7 3 --- 2,8 ---- 6 6 ! SyntaxError badsyntax_future3 3 ! SyntaxError badsyntax_future4 3 ! SyntaxError badsyntax_future5 4 ! SyntaxError badsyntax_future6 3 ! SyntaxError badsyntax_future7 3 From jhylton@users.sourceforge.net Wed Apr 18 02:20:23 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Tue, 17 Apr 2001 18:20:23 -0700 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv24014 Modified Files: Makefile.pre.in Log Message: Fix compileall.py so that it fails on SyntaxErrors The changes cause compilation failures in any file in the Python installation lib directory to cause the install to fail. It looks like compileall.py intended to behave this way, but a change to py_compile.py and a separate bug defeated it. Fixes SF bug #412436 This change affects the test suite, which contains several files that contain intentional errors. The solution is to extend compileall.py with the ability to skip compilation of selected files. NB compileall.py is changed so that compile_dir() returns success only if all recursive calls to compile_dir() also check success. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** Makefile.pre.in 2001/04/14 17:57:07 1.35 --- Makefile.pre.in 2001/04/18 01:20:21 1.36 *************** *** 617,623 **** $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt PYTHONPATH=$(LIBDEST) \ ! ./$(PYTHON) -tt $(LIBDEST)/compileall.py $(LIBDEST) PYTHONPATH=$(LIBDEST) \ ! ./$(PYTHON) -O $(LIBDEST)/compileall.py $(LIBDEST) # Create the PLATDIR source directory, if one wasn't distributed.. --- 617,624 ---- $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt PYTHONPATH=$(LIBDEST) \ ! ./$(PYTHON) -tt $(LIBDEST)/compileall.py -x badsyntax \ ! $(LIBDEST) PYTHONPATH=$(LIBDEST) \ ! ./$(PYTHON) -O $(LIBDEST)/compileall.py -x badsyntax $(LIBDEST) # Create the PLATDIR source directory, if one wasn't distributed.. From jhylton@users.sourceforge.net Wed Apr 18 02:20:23 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Tue, 17 Apr 2001 18:20:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib compileall.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv24014/Lib Modified Files: compileall.py Log Message: Fix compileall.py so that it fails on SyntaxErrors The changes cause compilation failures in any file in the Python installation lib directory to cause the install to fail. It looks like compileall.py intended to behave this way, but a change to py_compile.py and a separate bug defeated it. Fixes SF bug #412436 This change affects the test suite, which contains several files that contain intentional errors. The solution is to extend compileall.py with the ability to skip compilation of selected files. NB compileall.py is changed so that compile_dir() returns success only if all recursive calls to compile_dir() also check success. Index: compileall.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compileall.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** compileall.py 2001/01/20 19:54:20 1.8 --- compileall.py 2001/04/18 01:20:21 1.9 *************** *** 20,24 **** __all__ = ["compile_dir","compile_path"] ! def compile_dir(dir, maxlevels=10, ddir=None, force=0): """Byte-compile all modules in the given directory tree. --- 20,24 ---- __all__ = ["compile_dir","compile_path"] ! def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None): """Byte-compile all modules in the given directory tree. *************** *** 46,49 **** --- 46,53 ---- else: dfile = None + if rx: + mo = rx.search(fullname) + if mo: + continue if os.path.isfile(fullname): head, tail = name[:-3], name[-3:] *************** *** 56,63 **** print 'Compiling', fullname, '...' try: ! py_compile.compile(fullname, None, dfile) except KeyboardInterrupt: raise KeyboardInterrupt except: if type(sys.exc_type) == type(''): exc_type_name = sys.exc_type --- 60,68 ---- print 'Compiling', fullname, '...' try: ! ok = py_compile.compile(fullname, None, dfile) except KeyboardInterrupt: raise KeyboardInterrupt except: + # XXX py_compile catches SyntaxErrors if type(sys.exc_type) == type(''): exc_type_name = sys.exc_type *************** *** 66,74 **** print sys.exc_value success = 0 elif maxlevels > 0 and \ name != os.curdir and name != os.pardir and \ os.path.isdir(fullname) and \ not os.path.islink(fullname): ! compile_dir(fullname, maxlevels - 1, dfile, force) return success --- 71,83 ---- print sys.exc_value success = 0 + else: + if ok == 0: + success = 0 elif maxlevels > 0 and \ name != os.curdir and name != os.pardir and \ os.path.isdir(fullname) and \ not os.path.islink(fullname): ! if not compile_dir(fullname, maxlevels - 1, dfile, force, rx): ! success = 0 return success *************** *** 95,114 **** import getopt try: ! opts, args = getopt.getopt(sys.argv[1:], 'lfd:') except getopt.error, msg: print msg ! print "usage: compileall [-l] [-f] [-d destdir] [directory ...]" print "-l: don't recurse down" print "-f: force rebuild even if timestamps are up-to-date" print "-d destdir: purported directory name for error messages" ! print "if no directory arguments, -l sys.path is assumed" sys.exit(2) maxlevels = 10 ddir = None force = 0 for o, a in opts: if o == '-l': maxlevels = 0 if o == '-d': ddir = a if o == '-f': force = 1 if ddir: if len(args) != 1: --- 104,130 ---- import getopt try: ! opts, args = getopt.getopt(sys.argv[1:], 'lfd:x:') except getopt.error, msg: print msg ! print "usage: python compileall.py [-l] [-f] [-d destdir] " \ ! "[-s regexp] [directory ...]" print "-l: don't recurse down" print "-f: force rebuild even if timestamps are up-to-date" print "-d destdir: purported directory name for error messages" ! print " if no directory arguments, -l sys.path is assumed" ! print "-x regexp: skip files matching the regular expression regexp" ! print " the regexp is search for in the full path of the file" sys.exit(2) maxlevels = 10 ddir = None force = 0 + rx = None for o, a in opts: if o == '-l': maxlevels = 0 if o == '-d': ddir = a if o == '-f': force = 1 + if o == '-x': + import re + rx = re.compile(a) if ddir: if len(args) != 1: *************** *** 119,123 **** if args: for dir in args: ! success = success and compile_dir(dir, maxlevels, ddir, force) else: success = compile_path() --- 135,140 ---- if args: for dir in args: ! if not compile_dir(dir, maxlevels, ddir, force, rx): ! success = 0 else: success = compile_path() *************** *** 128,130 **** if __name__ == '__main__': ! sys.exit(not main()) --- 145,148 ---- if __name__ == '__main__': ! exit_status = not main() ! sys.exit(exit_status) From fdrake@users.sourceforge.net Wed Apr 18 04:08:57 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 17 Apr 2001 20:08:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs python.sty,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv14554/texinputs Modified Files: python.sty Log Message: \versionadded: Add support for including an explanatory note along with the versioning information, similar to \versionchanged. Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -r1.73 -r1.74 *** python.sty 2001/04/10 15:53:06 1.73 --- python.sty 2001/04/18 03:08:54 1.74 *************** *** 873,878 **** % \versionchanged[short explanation]{2.0} % ! \newcommand{\versionadded}[1]{% ! { New in version #1. }} \newcommand{\versionchanged}[2][\py@badkey]{% \ifx#1\@undefined% --- 873,883 ---- % \versionchanged[short explanation]{2.0} % ! \newcommand{\versionadded}[2][\py@badkey]{% ! \ifx#1\@undefined% ! { New in version #2. }% ! \else% ! { New in version #2:\ #1. }% ! \fi% ! } \newcommand{\versionchanged}[2][\py@badkey]{% \ifx#1\@undefined% From fdrake@users.sourceforge.net Wed Apr 18 04:11:06 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 17 Apr 2001 20:11:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.98,1.99 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv15038/perl Modified Files: python.perl Log Message: Added support for optional explanation parameter to the \versionadded macro. Refactored do_cmd_versionadded() and do_cmd_versionchanged() to do most of the work in a helper function, with the do_cmd_*() wrappers just supplying a portion of the replacement text. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -r1.98 -r1.99 *** python.perl 2001/04/12 04:03:22 1.98 --- python.perl 2001/04/18 03:11:04 1.99 *************** *** 345,366 **** } ! sub do_cmd_versionadded{ ! # one parameter: \versionadded{version} ! local($_) = @_; ! my $release = next_argument(); ! return ("\nNew in version $release.\n" ! . $_); ! } ! ! sub do_cmd_versionchanged{ ! # one parameter: \versionchanged{version} ! local($_) = @_; my $explanation = next_optional_argument(); my $release = next_argument(); ! my $text = "Changed in version $release."; if ($explanation) { ! $text = "Changed in version $release:\n$explanation."; } return "\n$text\n" . $_; } --- 345,367 ---- } ! sub versionnote{ ! # one or two parameters: \versionnote[explanation]{version} ! my $type = @_[0]; ! local $_ = @_[1]; my $explanation = next_optional_argument(); my $release = next_argument(); ! my $text = "$type in version $release."; if ($explanation) { ! $text = "$type in version $release:\n$explanation."; } return "\n$text\n" . $_; + } + + sub do_cmd_versionadded{ + return versionnote('New', @_); + } + + sub do_cmd_versionchanged{ + return versionnote('Changed', @_); } From fdrake@users.sourceforge.net Wed Apr 18 04:18:59 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 17 Apr 2001 20:18:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libgetopt.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv16693/lib Modified Files: libgetopt.tex Log Message: Add note about the version in which GetoptError was added -- this can bite people interested in 1.5.2 compatibility. Index: libgetopt.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgetopt.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** libgetopt.tex 2001/04/11 07:33:08 1.17 --- libgetopt.tex 2001/04/18 03:18:57 1.18 *************** *** 65,68 **** --- 65,71 ---- related option; if there is no specific option to which the exception relates, \member{opt} is an empty string. + + \versionchanged[Introduced \exception{GetoptError} as a synonym for + \exception{error}]{1.6} \end{excdesc} From fdrake@users.sourceforge.net Wed Apr 18 04:27:15 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 17 Apr 2001 20:27:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libgetopt.tex,1.17,1.17.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18193 Modified Files: Tag: release21-maint libgetopt.tex Log Message: Add note about the version in which GetoptError was added -- this can bite people interested in 1.5.2 compatibility. Index: libgetopt.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgetopt.tex,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -C2 -r1.17 -r1.17.2.1 *** libgetopt.tex 2001/04/11 07:33:08 1.17 --- libgetopt.tex 2001/04/18 03:27:13 1.17.2.1 *************** *** 65,68 **** --- 65,71 ---- related option; if there is no specific option to which the exception relates, \member{opt} is an empty string. + + \versionchanged[Introduced \exception{GetoptError} as a synonym for + \exception{error}]{1.6} \end{excdesc} From bwarsaw@users.sourceforge.net Wed Apr 18 04:48:43 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 17 Apr 2001 20:48:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/pynche README,2.13,2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/pynche In directory usw-pr-cvs1:/tmp/cvs-serv22437 Modified Files: README Log Message: There have been a few new Python releases in the 2 years since this tool was last touched! Update some of the introductory material and bump the version to 1.1. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/pynche/README,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** README 1999/04/27 18:57:00 2.13 --- README 2001/04/18 03:48:41 2.14 *************** *** 3,7 **** Contact: Barry A. Warsaw Email: bwarsaw@python.org ! Version: 1.0 Introduction --- 3,7 ---- Contact: Barry A. Warsaw Email: bwarsaw@python.org ! Version: 1.1 Introduction *************** *** 17,27 **** the acronym `ICE'. ! Pynche has been tested with Python 1.5.x using Tk 8.0.x. It ! probably works with Python 1.5. I've tested it on both Solaris ! 2.6 and Windows NT. There are some funky things that happen on ! Windows but I think they are primarily Tk problems. You'll want ! to be sure to have at least Tk 8.0.3 for Windows. Also, Pynche is ! very colormap intensive, so it doesn't work very well on 8-bit ! graphics cards. I'll probably fix that in the future. Pynche must find a text database of colors names in order to --- 17,26 ---- the acronym `ICE'. ! Pynche should work with Python 1.5.2, 2.0, or 2.1, using Tk 8.0.x. ! It's been tested on Solaris 2.6, Windows NT 4, and various Linux ! distros. You'll want to be sure to have at least Tk 8.0.3 for ! Windows. Also, Pynche is very colormap intensive, so it doesn't ! work very well on 8-bit graphics cards; 24bit+ graphics cards are ! so cheap these days, I'll probably never "fix" that. Pynche must find a text database of colors names in order to *************** *** 359,364 **** - Better support for resizing the top level windows - - - Better support on 8-bit screens - More output views, e.g. color solids --- 358,361 ---- From bwarsaw@users.sourceforge.net Wed Apr 18 04:49:02 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 17 Apr 2001 20:49:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/pynche Main.py,2.18,2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/pynche In directory usw-pr-cvs1:/tmp/cvs-serv22513 Modified Files: Main.py Log Message: Bump the version to 1.1 Index: Main.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/pynche/Main.py,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -r2.18 -r2.19 *** Main.py 1999/04/27 18:43:47 2.18 --- Main.py 2001/04/18 03:49:00 2.19 *************** *** 50,54 **** """ ! __version__ = '1.0' import sys --- 50,54 ---- """ ! __version__ = '1.1' import sys From bwarsaw@users.sourceforge.net Wed Apr 18 04:50:09 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 17 Apr 2001 20:50:09 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/pynche PyncheWidget.py,2.25,2.26 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/pynche In directory usw-pr-cvs1:/tmp/cvs-serv22950 Modified Files: PyncheWidget.py Log Message: Helpwin.__init__(): Removed an unused local variable (via import) reported by PyChecker. Index: PyncheWidget.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/pynche/PyncheWidget.py,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -r2.25 -r2.26 *** PyncheWidget.py 1999/07/06 22:00:52 2.25 --- PyncheWidget.py 2001/04/18 03:50:07 2.26 *************** *** 204,208 **** class Helpwin: def __init__(self, master, quitfunc): ! from Main import __version__, docstring self.__root = root = Toplevel(master, class_='Pynche') root.protocol('WM_DELETE_WINDOW', self.__withdraw) --- 204,208 ---- class Helpwin: def __init__(self, master, quitfunc): ! from Main import docstring self.__root = root = Toplevel(master, class_='Pynche') root.protocol('WM_DELETE_WINDOW', self.__withdraw) From bwarsaw@users.sourceforge.net Wed Apr 18 04:51:57 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 17 Apr 2001 20:51:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/pynche StripViewer.py,2.13,2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/pynche In directory usw-pr-cvs1:/tmp/cvs-serv23355 Modified Files: StripViewer.py Log Message: StripWidget.__init__(), update_yourself(): Removed some unused local variables reported by PyChecker. __togglegentype(): PyChecker accurately reported that the variable __gentypevar was unused -- actually this whole method is currently unused so comment it out. Index: StripViewer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/pynche/StripViewer.py,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** StripViewer.py 1999/04/27 15:56:02 2.13 --- StripViewer.py 2001/04/18 03:51:55 2.14 *************** *** 209,213 **** for c in range(self.__numchips): color = 'grey' ! rect = canvas.create_rectangle( x, y, x+chipwidth, y+chipheight, fill=color, outline=color, --- 209,213 ---- for c in range(self.__numchips): color = 'grey' ! canvas.create_rectangle( x, y, x+chipwidth, y+chipheight, fill=color, outline=color, *************** *** 292,296 **** chip = 0 chips = self.__chips = [] - tclcmd = [] tk = self.__canvas.tk # get the red, green, and blue components for all chips --- 292,295 ---- *************** *** 402,424 **** self.update_yourself(red, green, blue) ! def __togglegentype(self, event=None): ! which = self.__gentypevar.get() ! if which == 0: ! self.__reds.set(label='Red Variations', ! generator=constant_cyan_generator) ! self.__greens.set(label='Green Variations', ! generator=constant_magenta_generator) ! self.__blues.set(label='Blue Variations', ! generator=constant_yellow_generator) ! elif which == 1: ! self.__reds.set(label='Red Constant', ! generator=constant_red_generator) ! self.__greens.set(label='Green Constant', ! generator=constant_green_generator) ! self.__blues.set(label='Blue Constant', ! generator=constant_blue_generator) ! else: ! assert 0 ! self.__sb.update_views_current() def __toblack(self, event=None): --- 401,423 ---- self.update_yourself(red, green, blue) ! ## def __togglegentype(self, event=None): ! ## which = self.__gentypevar.get() ! ## if which == 0: ! ## self.__reds.set(label='Red Variations', ! ## generator=constant_cyan_generator) ! ## self.__greens.set(label='Green Variations', ! ## generator=constant_magenta_generator) ! ## self.__blues.set(label='Blue Variations', ! ## generator=constant_yellow_generator) ! ## elif which == 1: ! ## self.__reds.set(label='Red Constant', ! ## generator=constant_red_generator) ! ## self.__greens.set(label='Green Constant', ! ## generator=constant_green_generator) ! ## self.__blues.set(label='Blue Constant', ! ## generator=constant_blue_generator) ! ## else: ! ## assert 0 ! ## self.__sb.update_views_current() def __toblack(self, event=None): From bwarsaw@users.sourceforge.net Wed Apr 18 04:52:56 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 17 Apr 2001 20:52:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/pynche TextViewer.py,2.10,2.11 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/pynche In directory usw-pr-cvs1:/tmp/cvs-serv23542 Modified Files: TextViewer.py Log Message: __init__(): Removed unused local variable reported by PyChecker. Index: TextViewer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/pynche/TextViewer.py,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -r2.10 -r2.11 *** TextViewer.py 1999/04/27 18:54:12 2.10 --- TextViewer.py 2001/04/18 03:52:54 2.11 *************** *** 102,106 **** # radios self.__radios = [] - val = 0 for col in (1, 2): for row in (2, 3, 4): --- 102,105 ---- From bwarsaw@users.sourceforge.net Wed Apr 18 04:53:31 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 17 Apr 2001 20:53:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/pynche ListViewer.py,2.12,2.13 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/pynche In directory usw-pr-cvs1:/tmp/cvs-serv23665 Modified Files: ListViewer.py Log Message: update_yourself(): Removed unused local variable reported by PyChecker. Index: ListViewer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/pynche/ListViewer.py,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -r2.12 -r2.13 *** ListViewer.py 1999/04/27 18:54:12 2.12 --- ListViewer.py 2001/04/18 03:53:29 2.13 *************** *** 163,167 **** self.__dontcenter = 0 else: - height = canvas['height'] ig, ig, ig, y1 = canvas.coords(colortag) ig, ig, ig, y2 = canvas.coords(self.__bboxes[-1]) --- 163,166 ---- From gvanrossum@users.sourceforge.net Wed Apr 18 05:31:03 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 17 Apr 2001 21:31:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include patchlevel.h,2.49,2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv32347 Modified Files: patchlevel.h Log Message: Change the version to 2.2a0. This may look strange, but indicates it's 2.2 before the first alpha release. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -r2.49 -r2.50 *** patchlevel.h 2001/04/16 17:51:43 2.49 --- patchlevel.h 2001/04/18 04:31:01 2.50 *************** *** 21,34 **** /* Version parsed out into numeric values */ #define PY_MAJOR_VERSION 2 ! #define PY_MINOR_VERSION 1 #define PY_MICRO_VERSION 0 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.1" /* Historic */ ! #define PATCHLEVEL "2.1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 21,34 ---- /* Version parsed out into numeric values */ #define PY_MAJOR_VERSION 2 ! #define PY_MINOR_VERSION 2 #define PY_MICRO_VERSION 0 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.2a0" /* Historic */ ! #define PATCHLEVEL "2.2a0" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From gvanrossum@users.sourceforge.net Wed Apr 18 05:37:59 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 17 Apr 2001 21:37:59 -0700 Subject: [Python-checkins] CVS: python/dist/src README,1.122,1.123 config.h.in,2.91,2.92 configure,1.207,1.208 configure.in,1.215,1.216 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv961 Modified Files: README config.h.in configure configure.in Log Message: Bump the version number in more places Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -r1.122 -r1.123 *** README 2001/04/16 02:07:08 1.122 --- README 2001/04/18 04:37:57 1.123 *************** *** 1,3 **** ! This is Python version 2.1 ========================== --- 1,3 ---- ! This is Python version 2.2 ========================== Index: config.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/config.h.in,v retrieving revision 2.91 retrieving revision 2.92 diff -C2 -r2.91 -r2.92 *** config.h.in 2001/04/11 20:56:18 2.91 --- config.h.in 2001/04/18 04:37:57 2.92 *************** *** 270,273 **** --- 270,276 ---- #undef SIZEOF_VOID_P + /* Define if you have the _getpty function. */ + #undef HAVE__GETPTY + /* Define if you have the alarm function. */ #undef HAVE_ALARM *************** *** 357,363 **** #undef HAVE_GETPID - /* Define if you have the _getpty function. */ - #undef HAVE__GETPTY - /* Define if you have the getpwent function. */ #undef HAVE_GETPWENT --- 360,363 ---- *************** *** 519,530 **** #undef HAVE_WAITPID ! /* Define if you have the header file. */ ! #undef HAVE_DB_185_H /* Define if you have the header file. */ #undef HAVE_DB1_NDBM_H ! /* Define if you have the header file. */ ! #undef HAVE_DB_H /* Define if you have the header file. */ --- 519,530 ---- #undef HAVE_WAITPID ! /* Define if you have the header file. */ ! #undef HAVE_DB_H /* Define if you have the header file. */ #undef HAVE_DB1_NDBM_H ! /* Define if you have the header file. */ ! #undef HAVE_DB_185_H /* Define if you have the header file. */ Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.207 retrieving revision 1.208 diff -C2 -r1.207 -r1.208 *** configure 2001/04/11 20:56:18 1.207 --- configure 2001/04/18 04:37:57 1.208 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.215 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.216 # Guess values for system-dependent variables and create Makefiles. *************** *** 570,574 **** # Set VERSION so we only need to edit in one place (i.e., here) ! VERSION=2.1 # Arguments passed to configure. --- 570,574 ---- # Set VERSION so we only need to edit in one place (i.e., here) ! VERSION=2.2 # Arguments passed to configure. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.215 retrieving revision 1.216 diff -C2 -r1.215 -r1.216 *** configure.in 2001/04/11 20:56:19 1.215 --- configure.in 2001/04/18 04:37:57 1.216 *************** *** 7,11 **** # Set VERSION so we only need to edit in one place (i.e., here) AC_SUBST(VERSION) ! VERSION=2.1 # Arguments passed to configure. --- 7,11 ---- # Set VERSION so we only need to edit in one place (i.e., here) AC_SUBST(VERSION) ! VERSION=2.2 # Arguments passed to configure. From fdrake@users.sourceforge.net Wed Apr 18 06:02:03 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 17 Apr 2001 22:02:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs boilerplate.tex,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv4842/texinputs Modified Files: boilerplate.tex Log Message: Sync version number with the current CVS version. (Note that the docs are also being maintained on the 2.1.1 maintenance branch, so users interested only in corrections and clarifications can get that.) Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -r1.58 -r1.59 *** boilerplate.tex 2001/04/14 18:36:03 1.58 --- boilerplate.tex 2001/04/18 05:02:01 1.59 *************** *** 6,10 **** } ! \date{April 15, 2001} % XXX update before release! ! \release{2.1} % software release, not documentation ! \setshortversion{2.1} % major.minor only for software --- 6,10 ---- } ! \date{\today} % XXX update before release! ! \release{2.2a0} % software release, not documentation ! \setshortversion{2.2} % major.minor only for software From fdrake@users.sourceforge.net Wed Apr 18 06:12:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 17 Apr 2001 22:12:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/doc doc.tex,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv5930/doc Modified Files: doc.tex Log Message: Make a number of small clarifications and correct a whole bunch of typos, all reported by Bruce Smith. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -r1.38 -r1.39 *** doc.tex 2001/03/28 16:51:20 1.38 --- doc.tex 2001/04/18 05:12:47 1.39 *************** *** 193,202 **** The document body follows the preamble. This contains all the printed components of the document marked up structurally. Generic ! \LaTeX{} structures include hierarchical sections \subsection{Syntax} ! There are a things that an author of Python documentation needs to ! know about \LaTeX{} syntax. A \dfn{comment} is started by the ``percent'' character --- 193,204 ---- The document body follows the preamble. This contains all the printed components of the document marked up structurally. Generic ! \LaTeX{} structures include hierarchical sections, numbered and ! bulleted lists, and special structures for the document abstract and ! indexes. \subsection{Syntax} ! There are some things that an author of Python documentation needs ! to know about \LaTeX{} syntax. A \dfn{comment} is started by the ``percent'' character *************** *** 236,240 **** \end{verbatim} ! An alternate syntax for a group using brackets (\code{[...]}) is used by macros and environment constructors which take optional parameters; brackets do not normally hold syntactic significance. --- 238,242 ---- \end{verbatim} ! An alternate syntax for a group using brackets, \code{[...]}, is used by macros and environment constructors which take optional parameters; brackets do not normally hold syntactic significance. *************** *** 247,251 **** for their use in marking parameters to macros and environments. ! A \dfn{macro} is usually simple construct which is identified by name and can take some number of parameters. In normal \LaTeX{} usage, one of these can be optional. The markup is introduced --- 249,253 ---- for their use in marking parameters to macros and environments. ! A \dfn{macro} is usually a simple construct which is identified by name and can take some number of parameters. In normal \LaTeX{} usage, one of these can be optional. The markup is introduced *************** *** 280,284 **** between the macro name and any parameters will be consumed, but this usage is not practiced in the Python documentation. Such a ! space is still consumed if there are no parameters to the marco, in which case inserting an empty group (\code{\{\}}) or explicit word space (\samp{\e\ }) immediately after the macro name helps to --- 282,286 ---- between the macro name and any parameters will be consumed, but this usage is not practiced in the Python documentation. Such a ! space is still consumed if there are no parameters to the macro, in which case inserting an empty group (\code{\{\}}) or explicit word space (\samp{\e\ }) immediately after the macro name helps to *************** *** 287,291 **** by a word space do not need special treatment if the following character in the document source if not a name character (such as ! puctuation). Each line of this example shows an appropriate way to write text --- 289,293 ---- by a word space do not need special treatment if the following character in the document source if not a name character (such as ! punctuation). Each line of this example shows an appropriate way to write text *************** *** 299,308 **** An \dfn{environment} is a larger construct than a macro, and can ! be used for things with more content that would conveniently fit in a macro parameter. They are primarily used when formatting parameters need to be changed before and after a large chunk of content, but the content itself needs to be highly flexible. Code samples are presented using an environment, and descriptions of ! functions, methods, and classes are also marked using envionments. Since the content of an environment is free-form and can consist --- 301,310 ---- An \dfn{environment} is a larger construct than a macro, and can ! be used for things with more content than would conveniently fit in a macro parameter. They are primarily used when formatting parameters need to be changed before and after a large chunk of content, but the content itself needs to be highly flexible. Code samples are presented using an environment, and descriptions of ! functions, methods, and classes are also marked using environments. Since the content of an environment is free-form and can consist *************** *** 334,342 **** \end{verbatim} ! There are a number of less-used marks in \LaTeX{} are used to ! enter non-\ASCII{} characters, especially those used in European ! names. Given that these are often used adjacent to other characters, the markup required to produce the proper character ! may need to be followed by a space or an empty group, or the the markup can be enclosed in a group. Some which are found in Python documentation are: --- 336,344 ---- \end{verbatim} ! There are a number of less-used marks in \LaTeX{} which are used ! to enter non-\ASCII{} characters, especially those used in ! European names. Given that these are often used adjacent to other characters, the markup required to produce the proper character ! may need to be followed by a space or an empty group, or the markup can be enclosed in a group. Some which are found in Python documentation are: *************** *** 358,363 **** There are six ``levels'' of sectioning in the document classes ! used for Python documentation, and the lowest two levels are not ! used. The levels are: \begin{tableiii}{c|l|c}{textrm}{Level}{Macro Name}{Notes} --- 360,366 ---- There are six ``levels'' of sectioning in the document classes ! used for Python documentation, and the deepest two ! levels\footnote{The deepest levels have the highest numbers in the ! table.} are not used. The levels are: \begin{tableiii}{c|l|c}{textrm}{Level}{Macro Name}{Notes} From fdrake@users.sourceforge.net Wed Apr 18 06:14:34 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 17 Apr 2001 22:14:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/doc doc.tex,1.38,1.38.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv6216/doc Modified Files: Tag: release21-maint doc.tex Log Message: Make a number of small clarifications and correct a whole bunch of typos, all reported by Bruce Smith. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.38 retrieving revision 1.38.2.1 diff -C2 -r1.38 -r1.38.2.1 *** doc.tex 2001/03/28 16:51:20 1.38 --- doc.tex 2001/04/18 05:14:32 1.38.2.1 *************** *** 193,202 **** The document body follows the preamble. This contains all the printed components of the document marked up structurally. Generic ! \LaTeX{} structures include hierarchical sections \subsection{Syntax} ! There are a things that an author of Python documentation needs to ! know about \LaTeX{} syntax. A \dfn{comment} is started by the ``percent'' character --- 193,204 ---- The document body follows the preamble. This contains all the printed components of the document marked up structurally. Generic ! \LaTeX{} structures include hierarchical sections, numbered and ! bulleted lists, and special structures for the document abstract and ! indexes. \subsection{Syntax} ! There are some things that an author of Python documentation needs ! to know about \LaTeX{} syntax. A \dfn{comment} is started by the ``percent'' character *************** *** 236,240 **** \end{verbatim} ! An alternate syntax for a group using brackets (\code{[...]}) is used by macros and environment constructors which take optional parameters; brackets do not normally hold syntactic significance. --- 238,242 ---- \end{verbatim} ! An alternate syntax for a group using brackets, \code{[...]}, is used by macros and environment constructors which take optional parameters; brackets do not normally hold syntactic significance. *************** *** 247,251 **** for their use in marking parameters to macros and environments. ! A \dfn{macro} is usually simple construct which is identified by name and can take some number of parameters. In normal \LaTeX{} usage, one of these can be optional. The markup is introduced --- 249,253 ---- for their use in marking parameters to macros and environments. ! A \dfn{macro} is usually a simple construct which is identified by name and can take some number of parameters. In normal \LaTeX{} usage, one of these can be optional. The markup is introduced *************** *** 280,284 **** between the macro name and any parameters will be consumed, but this usage is not practiced in the Python documentation. Such a ! space is still consumed if there are no parameters to the marco, in which case inserting an empty group (\code{\{\}}) or explicit word space (\samp{\e\ }) immediately after the macro name helps to --- 282,286 ---- between the macro name and any parameters will be consumed, but this usage is not practiced in the Python documentation. Such a ! space is still consumed if there are no parameters to the macro, in which case inserting an empty group (\code{\{\}}) or explicit word space (\samp{\e\ }) immediately after the macro name helps to *************** *** 287,291 **** by a word space do not need special treatment if the following character in the document source if not a name character (such as ! puctuation). Each line of this example shows an appropriate way to write text --- 289,293 ---- by a word space do not need special treatment if the following character in the document source if not a name character (such as ! punctuation). Each line of this example shows an appropriate way to write text *************** *** 299,308 **** An \dfn{environment} is a larger construct than a macro, and can ! be used for things with more content that would conveniently fit in a macro parameter. They are primarily used when formatting parameters need to be changed before and after a large chunk of content, but the content itself needs to be highly flexible. Code samples are presented using an environment, and descriptions of ! functions, methods, and classes are also marked using envionments. Since the content of an environment is free-form and can consist --- 301,310 ---- An \dfn{environment} is a larger construct than a macro, and can ! be used for things with more content than would conveniently fit in a macro parameter. They are primarily used when formatting parameters need to be changed before and after a large chunk of content, but the content itself needs to be highly flexible. Code samples are presented using an environment, and descriptions of ! functions, methods, and classes are also marked using environments. Since the content of an environment is free-form and can consist *************** *** 334,342 **** \end{verbatim} ! There are a number of less-used marks in \LaTeX{} are used to ! enter non-\ASCII{} characters, especially those used in European ! names. Given that these are often used adjacent to other characters, the markup required to produce the proper character ! may need to be followed by a space or an empty group, or the the markup can be enclosed in a group. Some which are found in Python documentation are: --- 336,344 ---- \end{verbatim} ! There are a number of less-used marks in \LaTeX{} which are used ! to enter non-\ASCII{} characters, especially those used in ! European names. Given that these are often used adjacent to other characters, the markup required to produce the proper character ! may need to be followed by a space or an empty group, or the markup can be enclosed in a group. Some which are found in Python documentation are: *************** *** 358,363 **** There are six ``levels'' of sectioning in the document classes ! used for Python documentation, and the lowest two levels are not ! used. The levels are: \begin{tableiii}{c|l|c}{textrm}{Level}{Macro Name}{Notes} --- 360,366 ---- There are six ``levels'' of sectioning in the document classes ! used for Python documentation, and the deepest two ! levels\footnote{The deepest levels have the highest numbers in the ! table.} are not used. The levels are: \begin{tableiii}{c|l|c}{textrm}{Level}{Macro Name}{Notes} From fdrake@users.sourceforge.net Wed Apr 18 06:19:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 17 Apr 2001 22:19:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/doc doc.tex,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv7002/doc Modified Files: doc.tex Log Message: Add description of the "explanation" optional parameter added to the \versionadded macro. Note: this should not be merged into the 2.1 maintenance branch. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -r1.39 -r1.40 *** doc.tex 2001/04/18 05:12:47 1.39 --- doc.tex 2001/04/18 05:19:06 1.40 *************** *** 841,850 **** \end{macrodesc} ! \begin{macrodesc}{versionadded}{\p{version}} The version of Python which added the described feature to the ! library or C API. This is typically added to the end of the ! first paragraph of the description before any availability ! notes. The location should be selected so the explanation makes ! sense and may vary as needed. \end{macrodesc} --- 841,853 ---- \end{macrodesc} ! \begin{macrodesc}{versionadded}{\op{explanation}\p{version}} The version of Python which added the described feature to the ! library or C API. \var{explanation} should be a \emph{brief} ! explanation of the change consisting of a capitalized sentence ! fragment; a period will be appended by the formatting process. ! This is typically added to the end of the first paragraph of the ! description before any availability notes. The location should ! be selected so the explanation makes sense and may vary as ! needed. \end{macrodesc} From fdrake@users.sourceforge.net Wed Apr 18 06:22:26 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 17 Apr 2001 22:22:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.218,1.219 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv7605 Modified Files: Makefile Log Message: Sync version number with the current CVS version. (Note that the docs are also being maintained on the 2.1.1 maintenance branch, so users interested only in corrections and clarifications can get that.) Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.218 retrieving revision 1.219 diff -C2 -r1.218 -r1.219 *** Makefile 2001/04/14 18:36:03 1.218 --- Makefile 2001/04/18 05:22:24 1.219 *************** *** 68,72 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1 PYTHON= python --- 68,72 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.2a0 PYTHON= python From fdrake@users.sourceforge.net Wed Apr 18 06:24:32 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 17 Apr 2001 22:24:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.218,1.218.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv7951 Modified Files: Tag: release21-maint Makefile Log Message: Update version numbers for the maintenance branch of the documentation. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.218 retrieving revision 1.218.2.1 diff -C2 -r1.218 -r1.218.2.1 *** Makefile 2001/04/14 18:36:03 1.218 --- Makefile 2001/04/18 05:24:30 1.218.2.1 *************** *** 68,72 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1 PYTHON= python --- 68,72 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1.1a0 PYTHON= python From fdrake@users.sourceforge.net Wed Apr 18 06:24:32 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 17 Apr 2001 22:24:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs boilerplate.tex,1.58,1.58.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv7951/texinputs Modified Files: Tag: release21-maint boilerplate.tex Log Message: Update version numbers for the maintenance branch of the documentation. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.58 retrieving revision 1.58.2.1 diff -C2 -r1.58 -r1.58.2.1 *** boilerplate.tex 2001/04/14 18:36:03 1.58 --- boilerplate.tex 2001/04/18 05:24:30 1.58.2.1 *************** *** 6,10 **** } ! \date{April 15, 2001} % XXX update before release! ! \release{2.1} % software release, not documentation \setshortversion{2.1} % major.minor only for software --- 6,10 ---- } ! \date{\today} % XXX update before release! ! \release{2.1.1a0} % software release, not documentation \setshortversion{2.1} % major.minor only for software From tim_one@users.sourceforge.net Wed Apr 18 09:23:03 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 18 Apr 2001 01:23:03 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0226.txt,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4957 Modified Files: pep-0226.txt Log Message: Record 2.1 final release. Index: pep-0226.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0226.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** pep-0226.txt 2001/04/16 03:01:36 1.10 --- pep-0226.txt 2001/04/18 08:23:01 1.11 *************** *** 22,29 **** Tentative future release dates ! 17-Apr-2001: 2.1 final release Past release dates: 15-Apr-2001: 2.1 release candidate 2 13-Apr-2001: 2.1 release candidate 1 --- 22,30 ---- Tentative future release dates ! [bugfix release dates go here] Past release dates: + 17-Apr-2001: 2.1 final release 15-Apr-2001: 2.1 release candidate 2 13-Apr-2001: 2.1 release candidate 1 From bwarsaw@users.sourceforge.net Wed Apr 18 11:20:06 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 18 Apr 2001 03:20:06 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0235.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv32757 Modified Files: pep-0235.txt Log Message: Tim says this one's done. Index: pep-0235.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0235.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** pep-0235.txt 2001/02/21 03:41:08 1.2 --- pep-0235.txt 2001/04/18 10:20:04 1.3 *************** *** 3,7 **** Version: $Revision$ Author: Tim Peters ! Status: Draft Type: Standards Track Python-Version: 2.1 --- 3,7 ---- Version: $Revision$ Author: Tim Peters ! Status: Final Type: Standards Track Python-Version: 2.1 From bwarsaw@users.sourceforge.net Wed Apr 18 11:27:05 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 18 Apr 2001 03:27:05 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.86,1.87 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv1740 Modified Files: pep-0000.txt Log Message: PEP 6 is (slightly) renamed to "Bug Fix Releases" Active PEPs are now those under consideration for Python 2.2 Future PEPs category removed (for now) PEPs 205, 226, 227, 229, 235, 236 moved to Finished (although not all are marked Final yet; waiting for confirmation from PEP owners). PEP 243 moved to Active PEPs PEP 233 moved to Deferred, but this will probably change to Finished once Paul updates the text. Added PEP 250, Using site-packages on All Platforms, Moore Added PEP 251, Python 2.2 Release Schedule, Warsaw (for now) PEP 160 marked as Final Rejected PEPs category expanded to Deferred, Abandoned, and Rejected Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -r1.86 -r1.87 *** pep-0000.txt 2001/03/30 16:29:44 1.86 --- pep-0000.txt 2001/04/18 10:27:03 1.87 *************** *** 28,32 **** I 4 pep-0004.txt Deprecation of Standard Modules von Loewis I 5 pep-0005.txt Guidelines for Language Evolution Prescod ! I 6 pep-0006.txt Patch and Bug Fix Releases Aahz Other Informational PEPs --- 28,32 ---- I 4 pep-0004.txt Deprecation of Standard Modules von Loewis I 5 pep-0005.txt Guidelines for Language Evolution Prescod ! I 6 pep-0006.txt Bug Fix Releases Aahz Other Informational PEPs *************** *** 36,53 **** I 249 pep-0249.txt Python Database API Specification v2.0 Lemburg ! Active PEPs (under serious consideration for Python 2.1 - even if empty) I 42 pep-0042.txt Small Feature Requests Hylton - S 205 pep-0205.txt Weak References Drake - I 226 pep-0226.txt Python 2.1 Release Schedule Hylton - S 227 pep-0227.txt Statically Nested Scopes Hylton - S 229 pep-0229.txt Using Distutils to Build Python Kuchling - S 233 pep-0233.txt Python Online Help Prescod - S 235 pep-0235.txt Import on Case-Insensitive Platforms Peters - S 236 pep-0236.txt Back to the __future__ Peters - S 243 pep-0243.txt Module Repository Upload Mechanism Reifschneider - - Future PEPs (in consideration for Python 2.2) - S 234 pep-0234.txt Iterators Yee S 237 pep-0237.txt Unifying Long Integers and Integers Zadka --- 36,42 ---- I 249 pep-0249.txt Python Database API Specification v2.0 Lemburg ! Active PEPs (under consideration for Python 2.2) I 42 pep-0042.txt Small Feature Requests Hylton S 234 pep-0234.txt Iterators Yee S 237 pep-0237.txt Unifying Long Integers and Integers Zadka *************** *** 57,63 **** --- 46,55 ---- S 241 pep-0241.txt Metadata for Python Software Packages Kuchling S 242 pep-0242.txt Numeric Kinds Dubois + S 243 pep-0243.txt Module Repository Upload Mechanism Reifschneider S 244 pep-0244.txt The `directive' Statement von Loewis S 245 pep-0245.txt Python Interface Syntax Pelletier S 246 pep-0246.txt Object Adaptation Evans + S 250 pep-0250.txt Using site-packages on All Platforms Moore + I 251 pep-0251.txt Python 2.2 Release Schedule Warsaw Py-in-the-sky PEPs (not ready; may become active yet) *************** *** 78,86 **** Finished PEPs (done, implemented) ! I 160 pep-0160.txt Python 1.6 Release Schedule Drake IF 200 pep-0200.txt Python 2.0 Release Schedule Hylton SF 201 pep-0201.txt Lockstep Iteration Warsaw S 202 pep-0202.txt List Comprehensions Peters SF 203 pep-0203.txt Augmented Assignments Wouters SF 207 pep-0207.txt Rich Comparisons van Rossum, Ascher SF 208 pep-0208.txt Reworking the Coercion Model Schemenauer, Lemburg --- 70,79 ---- Finished PEPs (done, implemented) ! IF 160 pep-0160.txt Python 1.6 Release Schedule Drake IF 200 pep-0200.txt Python 2.0 Release Schedule Hylton SF 201 pep-0201.txt Lockstep Iteration Warsaw S 202 pep-0202.txt List Comprehensions Peters SF 203 pep-0203.txt Augmented Assignments Wouters + S 205 pep-0205.txt Weak References Drake SF 207 pep-0207.txt Rich Comparisons van Rossum, Ascher SF 208 pep-0208.txt Reworking the Coercion Model Schemenauer, Lemburg *************** *** 89,94 **** --- 82,92 ---- SF 221 pep-0221.txt Import As Wouters SF 223 pep-0223.txt Change the Meaning of \x Escapes Peters + I 226 pep-0226.txt Python 2.1 Release Schedule Hylton + S 227 pep-0227.txt Statically Nested Scopes Hylton + S 229 pep-0229.txt Using Distutils to Build Python Kuchling SF 230 pep-0230.txt Warning Framework van Rossum SF 232 pep-0232.txt Function Attributes Warsaw + SF 235 pep-0235.txt Import on Case-Insensitive Platforms Peters + S 236 pep-0236.txt Back to the __future__ Peters Empty PEPs (or containing only an abstract) *************** *** 98,106 **** ID 220 pep-0220.txt Coroutines, Generators, Continuations McMillan ! Rejected PEPs SR 204 pep-0204.txt Range Literals Wouters SR 224 pep-0224.txt Attribute Docstrings Lemburg SR 231 pep-0231.txt __findattr__() Warsaw --- 96,105 ---- ID 220 pep-0220.txt Coroutines, Generators, Continuations McMillan ! Deferred, Abandoned, and Rejected PEPs SR 204 pep-0204.txt Range Literals Wouters SR 224 pep-0224.txt Attribute Docstrings Lemburg SR 231 pep-0231.txt __findattr__() Warsaw + S 233 pep-0233.txt Python Online Help Prescod *************** *** 115,122 **** I 4 pep-0004.txt Deprecation of Standard Modules von Loewis I 5 pep-0005.txt Guidelines for Language Evolution Prescod ! I 6 pep-0006.txt Patch and Bug Fix Releases Aahz I 42 pep-0042.txt Small Feature Requests Hylton ! I 160 pep-0160.txt Python 1.6 Release Schedule Drake IF 200 pep-0200.txt Python 2.0 Release Schedule Hylton --- 114,121 ---- I 4 pep-0004.txt Deprecation of Standard Modules von Loewis I 5 pep-0005.txt Guidelines for Language Evolution Prescod ! I 6 pep-0006.txt Bug Fix Releases Aahz I 42 pep-0042.txt Small Feature Requests Hylton ! IF 160 pep-0160.txt Python 1.6 Release Schedule Drake IF 200 pep-0200.txt Python 2.0 Release Schedule Hylton *************** *** 155,159 **** S 233 pep-0233.txt Python Online Help Prescod S 234 pep-0234.txt Iterators Yee ! S 235 pep-0235.txt Import on Case-Insensitive Platforms Peters S 236 pep-0236.txt Back to the __future__ Peters S 237 pep-0237.txt Unifying Long Integers and Integers Zadka --- 154,158 ---- S 233 pep-0233.txt Python Online Help Prescod S 234 pep-0234.txt Iterators Yee ! SF 235 pep-0235.txt Import on Case-Insensitive Platforms Peters S 236 pep-0236.txt Back to the __future__ Peters S 237 pep-0237.txt Unifying Long Integers and Integers Zadka *************** *** 170,173 **** --- 169,174 ---- I 248 pep-0248.txt Python Database API Specification v1.0 Lemburg I 249 pep-0249.txt Python Database API Specification v2.0 Lemburg + S 250 pep-0250.txt Using site-packages on All Platforms Moore + I 251 pep-0251.txt Python 2.2 Release Schedule Warsaw *************** *** 198,201 **** --- 199,203 ---- von Loewis, Martin loewis@informatik.hu-berlin.de McMillan, Gordon gmcm@hypernet.com + Moore, Paul gustav@morpheus.demon.co.uk Oliphant, Travis oliphant@ee.byu.edu Pelletier, Michel michel@digicool.com From bwarsaw@users.sourceforge.net Wed Apr 18 11:28:13 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 18 Apr 2001 03:28:13 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0250.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv1982 Added Files: pep-0250.txt Log Message: PEP 250, Using site-packages on All Platforms, Paul Moore --- NEW FILE: pep-0250.txt --- PEP: 250 Title: Using site-packages on All Platforms Version $Revision: 1.1 $ Author: gustav@morpheus.demon.co.uk (Paul Moore) Status: Draft Type: Standards Track Created: 2001-03-30 Python-Version: 2.2 Post-History: Abstract The standard Python distribution includes a directory Lib/site-packages, which is used on Unix platforms to hold locally-installed modules and packages. The site.py module distributed with Python includes support for locating other modules in the site-packages directory. This PEP proposes that the site-packages directory should be used uniformly across all platforms for locally installed modules. Motivation On Windows platforms, the default setting for sys.path does not include a directory suitable for users to install locally developed modules. The "expected" location appears to be the directory containing the Python executable itself. Including locally developed code in the same directory as installed executables is not good practice. Clearly, users can manipulate sys.path, either in a locally modified site.py, or in a suitable sitecustomize.py, or even via .pth files. However, there should be a standard location for such files, rather than relying on every individual site having to set their own policy. In addition, with distutils becoming more prevalent as a means of distributing modules, the need for a standard install location for distributed modules will become more common. It would be better to define such a standard now, rather than later when more distutils-based packages exist which will need rebuilding. It is relevant to note that prior to Python 2.1, the site-packages directory was not included in sys.path for Macintosh platforms. This has been changed in 2.1, and Macintosh includes sys.path now, leaving Windows as the only major platform with no site-specific modules directory. Implementation The implementation of this feature is fairly trivial. All that would be required is a change to site.py, to change the section setting sitedirs. The Python 2.1 version has if os.sep == '/': sitedirs = [makepath(prefix, "lib", "python" + sys.version[:3], "site-packages"), makepath(prefix, "lib", "site-python")] elif os.sep == ':': sitedirs = [makepath(prefix, "lib", "site-packages")] else: sitedirs = [prefix] A suitable change would be to simply replace the last 4 lines with else: sitedirs == [makepath(prefix, "lib", "site-packages")] Changes would also be required to distutils, in the sysconfig.py file. It is worth noting that this file does not seem to have been updated in line with the change of policy on the Macintosh, as of this writing. Notes 1. It would be better if this change could be included in Python 2.1, as changing something of this nature is better done sooner, rather than later, to reduce the backward-compatibility burden. This is extremely unlikely to happen at this late stage in the release cycle, however. 2. This change does not preclude packages using the current location -- the change only adds a directory to sys.path, it does not remove anything. 3. In the Windows distribution of Python 2.1 (beta 1), the Lib\site-packages directory has been removed. It would need to be reinstated. Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil End: From bwarsaw@users.sourceforge.net Wed Apr 18 11:28:45 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 18 Apr 2001 03:28:45 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0251.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv2066 Added Files: pep-0251.txt Log Message: PEP 251, Python 2.2 Release Schedule, Warsaw (for now) --- NEW FILE: pep-0251.txt --- PEP: 251 Title: Python 2.2 Release Schedule Version: $Revision: 1.1 $ Author: Barry Warsaw Status: Incomplete Type: Informational Created: 17-Apr-2001 Python-Version: 2.2 Post-History: Abstract This document describes the post-Python 2.1 development and release schedule. The schedule primarily concerns itself with PEP-sized items. Small bug fixes and changes will occur up until the first beta release. Release Schedule Python 2.2 is in the very early planning stages, and Guido expressed a desire to release Python 2.2 in October of 2001. Tentative future release dates October-2001: 2.2 final release Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil End: From bwarsaw@users.sourceforge.net Wed Apr 18 11:32:45 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 18 Apr 2001 03:32:45 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0233.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv3778 Modified Files: pep-0233.txt Log Message: Changing status to Deferred until Paul updates the text Index: pep-0233.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0233.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0233.txt 2000/12/13 02:12:45 1.1 --- pep-0233.txt 2001/04/18 10:32:43 1.2 *************** *** 3,7 **** Version: $Revision$ Author: paul@prescod.net, paulp@activestate.com (Paul Prescod) ! Status: Draft Type: Standards Track Created: 11-Dec-2000 --- 3,7 ---- Version: $Revision$ Author: paul@prescod.net, paulp@activestate.com (Paul Prescod) ! Status: Deferred Type: Standards Track Created: 11-Dec-2000 From loewis@users.sourceforge.net Wed Apr 18 13:49:17 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Wed, 18 Apr 2001 05:49:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.82,2.83 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv32029 Modified Files: unicodeobject.c Log Message: Patch #416953: Cache ASCII characters to speed up ASCII decoding. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.82 retrieving revision 2.83 diff -C2 -r2.82 -r2.83 *** unicodeobject.c 2001/04/12 18:38:48 2.82 --- unicodeobject.c 2001/04/18 12:49:15 2.83 *************** *** 91,94 **** --- 91,96 ---- static int unicode_freelist_size; + static PyUnicodeObject *unicode_ascii[128]; + /* Default encoding to use and assume when NULL is passed as encoding parameter; it is initialized by _PyUnicode_Init(). *************** *** 252,255 **** --- 254,270 ---- PyUnicodeObject *unicode; + if (size == 1 && *u < 128) { + unicode = unicode_ascii[*u]; + if (!unicode) { + unicode = _PyUnicode_New(1); + unicode->str[0] = *u; + if (!unicode) + return NULL; + unicode_ascii[*u] = unicode; + } + Py_INCREF(unicode); + return (PyObject*)unicode; + } + unicode = _PyUnicode_New(size); if (!unicode) *************** *** 1656,1659 **** --- 1671,1679 ---- PyUnicodeObject *v; Py_UNICODE *p; + + if (size == 1 && *(unsigned char*)s < 128) { + Py_UNICODE r = *(unsigned char*)s; + return PyUnicode_FromUnicode(&r, 1); + } /* ASCII is equivalent to the first 128 ordinals in Unicode. */ *************** *** 5190,5193 **** --- 5210,5215 ---- void _PyUnicode_Init(void) { + int i; + /* Doublecheck the configuration... */ if (sizeof(Py_UNICODE) != 2) *************** *** 5200,5203 **** --- 5222,5228 ---- unicode_empty = _PyUnicode_New(0); strcpy(unicode_default_encoding, "ascii"); + + for (i = 0; i < 128; i++) + unicode_ascii[i] = NULL; } *************** *** 5208,5214 **** --- 5233,5247 ---- { PyUnicodeObject *u; + int i; Py_XDECREF(unicode_empty); unicode_empty = NULL; + + for (i = 0; i < 128; i++) { + if (unicode_ascii[i]) { + Py_DECREF(unicode_ascii[i]); + unicode_ascii[i] = NULL; + } + } for (u = unicode_freelist; u != NULL;) { From fdrake@users.sourceforge.net Wed Apr 18 18:27:12 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 18 Apr 2001 10:27:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libre.tex,1.60,1.60.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv21683/lib Modified Files: Tag: release21-maint libre.tex Log Message: Suggestion from Keith Briggs: refer to RE objects consistently instead of introducing a new term ("regex") without defining it. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.60 retrieving revision 1.60.2.1 diff -C2 -r1.60 -r1.60.2.1 *** libre.tex 2001/04/12 16:47:17 1.60 --- libre.tex 2001/04/18 17:27:10 1.60.2.1 *************** *** 392,396 **** expression will be used several times in a single program. %(The compiled version of the last pattern passed to ! %\function{regex.match()} or \function{regex.search()} is cached, so %programs that use only a single regular expression at a time needn't %worry about compiling regular expressions.) --- 392,396 ---- expression will be used several times in a single program. %(The compiled version of the last pattern passed to ! %\function{re.match()} or \function{re.search()} is cached, so %programs that use only a single regular expression at a time needn't %worry about compiling regular expressions.) *************** *** 515,521 **** \end{verbatim} ! The pattern may be a string or a ! regex object; if you need to specify ! regular expression flags, you must use a regex object, or use embedded modifiers in a pattern; e.g. \samp{sub("(?i)b+", "x", "bbbb BBBB")} returns \code{'x x'}. --- 515,520 ---- \end{verbatim} ! The pattern may be a string or an RE object; if you need to specify ! regular expression flags, you must use a RE object, or use embedded modifiers in a pattern; e.g. \samp{sub("(?i)b+", "x", "bbbb BBBB")} returns \code{'x x'}. *************** *** 624,628 **** \begin{memberdesc}[RegexObject]{flags} ! The flags argument used when the regex object was compiled, or \code{0} if no flags were provided. \end{memberdesc} --- 623,627 ---- \begin{memberdesc}[RegexObject]{flags} ! The flags argument used when the RE object was compiled, or \code{0} if no flags were provided. \end{memberdesc} *************** *** 635,639 **** \begin{memberdesc}[RegexObject]{pattern} ! The pattern string from which the regex object was compiled. \end{memberdesc} --- 634,638 ---- \begin{memberdesc}[RegexObject]{pattern} ! The pattern string from which the RE object was compiled. \end{memberdesc} *************** *** 733,744 **** \begin{memberdesc}[MatchObject]{pos} The value of \var{pos} which was passed to the ! \function{search()} or \function{match()} function. This is the index into ! the string at which the regex engine started looking for a match. \end{memberdesc} \begin{memberdesc}[MatchObject]{endpos} The value of \var{endpos} which was passed to the ! \function{search()} or \function{match()} function. This is the index into ! the string beyond which the regex engine will not go. \end{memberdesc} --- 732,743 ---- \begin{memberdesc}[MatchObject]{pos} The value of \var{pos} which was passed to the ! \function{search()} or \function{match()} function. This is the index ! into the string at which the RE engine started looking for a match. \end{memberdesc} \begin{memberdesc}[MatchObject]{endpos} The value of \var{endpos} which was passed to the ! \function{search()} or \function{match()} function. This is the index ! into the string beyond which the RE engine will not go. \end{memberdesc} From fdrake@users.sourceforge.net Wed Apr 18 18:26:22 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 18 Apr 2001 10:26:22 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libre.tex,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv21504/lib Modified Files: libre.tex Log Message: Suggestion from Keith Briggs: refer to RE objects consistently instead of introducing a new term ("regex") without defining it. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -r1.60 -r1.61 *** libre.tex 2001/04/12 16:47:17 1.60 --- libre.tex 2001/04/18 17:26:20 1.61 *************** *** 392,396 **** expression will be used several times in a single program. %(The compiled version of the last pattern passed to ! %\function{regex.match()} or \function{regex.search()} is cached, so %programs that use only a single regular expression at a time needn't %worry about compiling regular expressions.) --- 392,396 ---- expression will be used several times in a single program. %(The compiled version of the last pattern passed to ! %\function{re.match()} or \function{re.search()} is cached, so %programs that use only a single regular expression at a time needn't %worry about compiling regular expressions.) *************** *** 515,521 **** \end{verbatim} ! The pattern may be a string or a ! regex object; if you need to specify ! regular expression flags, you must use a regex object, or use embedded modifiers in a pattern; e.g. \samp{sub("(?i)b+", "x", "bbbb BBBB")} returns \code{'x x'}. --- 515,520 ---- \end{verbatim} ! The pattern may be a string or an RE object; if you need to specify ! regular expression flags, you must use a RE object, or use embedded modifiers in a pattern; e.g. \samp{sub("(?i)b+", "x", "bbbb BBBB")} returns \code{'x x'}. *************** *** 624,628 **** \begin{memberdesc}[RegexObject]{flags} ! The flags argument used when the regex object was compiled, or \code{0} if no flags were provided. \end{memberdesc} --- 623,627 ---- \begin{memberdesc}[RegexObject]{flags} ! The flags argument used when the RE object was compiled, or \code{0} if no flags were provided. \end{memberdesc} *************** *** 635,639 **** \begin{memberdesc}[RegexObject]{pattern} ! The pattern string from which the regex object was compiled. \end{memberdesc} --- 634,638 ---- \begin{memberdesc}[RegexObject]{pattern} ! The pattern string from which the RE object was compiled. \end{memberdesc} *************** *** 733,744 **** \begin{memberdesc}[MatchObject]{pos} The value of \var{pos} which was passed to the ! \function{search()} or \function{match()} function. This is the index into ! the string at which the regex engine started looking for a match. \end{memberdesc} \begin{memberdesc}[MatchObject]{endpos} The value of \var{endpos} which was passed to the ! \function{search()} or \function{match()} function. This is the index into ! the string beyond which the regex engine will not go. \end{memberdesc} --- 732,743 ---- \begin{memberdesc}[MatchObject]{pos} The value of \var{pos} which was passed to the ! \function{search()} or \function{match()} function. This is the index ! into the string at which the RE engine started looking for a match. \end{memberdesc} \begin{memberdesc}[MatchObject]{endpos} The value of \var{endpos} which was passed to the ! \function{search()} or \function{match()} function. This is the index ! into the string beyond which the RE engine will not go. \end{memberdesc} From fdrake@users.sourceforge.net Wed Apr 18 18:29:16 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 18 Apr 2001 10:29:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.98,1.98.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv22091/perl Modified Files: Tag: release21-maint python.perl Log Message: Added support for optional explanation parameter to the \versionadded macro. Refactored do_cmd_versionadded() and do_cmd_versionchanged() to do most of the work in a helper function, with the do_cmd_*() wrappers just supplying a portion of the replacement text. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.98 retrieving revision 1.98.2.1 diff -C2 -r1.98 -r1.98.2.1 *** python.perl 2001/04/12 04:03:22 1.98 --- python.perl 2001/04/18 17:29:14 1.98.2.1 *************** *** 345,366 **** } ! sub do_cmd_versionadded{ ! # one parameter: \versionadded{version} ! local($_) = @_; ! my $release = next_argument(); ! return ("\nNew in version $release.\n" ! . $_); ! } ! ! sub do_cmd_versionchanged{ ! # one parameter: \versionchanged{version} ! local($_) = @_; my $explanation = next_optional_argument(); my $release = next_argument(); ! my $text = "Changed in version $release."; if ($explanation) { ! $text = "Changed in version $release:\n$explanation."; } return "\n$text\n" . $_; } --- 345,367 ---- } ! sub versionnote{ ! # one or two parameters: \versionnote[explanation]{version} ! my $type = @_[0]; ! local $_ = @_[1]; my $explanation = next_optional_argument(); my $release = next_argument(); ! my $text = "$type in version $release."; if ($explanation) { ! $text = "$type in version $release:\n$explanation."; } return "\n$text\n" . $_; + } + + sub do_cmd_versionadded{ + return versionnote('New', @_); + } + + sub do_cmd_versionchanged{ + return versionnote('Changed', @_); } From fdrake@users.sourceforge.net Wed Apr 18 18:30:28 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 18 Apr 2001 10:30:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs python.sty,1.73,1.73.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv22382/texinputs Modified Files: Tag: release21-maint python.sty Log Message: \versionadded: Add support for including an explanatory note along with the versioning information, similar to \versionchanged. Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.73 retrieving revision 1.73.2.1 diff -C2 -r1.73 -r1.73.2.1 *** python.sty 2001/04/10 15:53:06 1.73 --- python.sty 2001/04/18 17:30:26 1.73.2.1 *************** *** 873,878 **** % \versionchanged[short explanation]{2.0} % ! \newcommand{\versionadded}[1]{% ! { New in version #1. }} \newcommand{\versionchanged}[2][\py@badkey]{% \ifx#1\@undefined% --- 873,883 ---- % \versionchanged[short explanation]{2.0} % ! \newcommand{\versionadded}[2][\py@badkey]{% ! \ifx#1\@undefined% ! { New in version #2. }% ! \else% ! { New in version #2:\ #1. }% ! \fi% ! } \newcommand{\versionchanged}[2][\py@badkey]{% \ifx#1\@undefined% From fdrake@users.sourceforge.net Wed Apr 18 18:32:48 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 18 Apr 2001 10:32:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/doc doc.tex,1.38.2.1,1.38.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv22894/doc Modified Files: Tag: release21-maint doc.tex Log Message: Add description of the "explanation" optional parameter added to the \versionadded macro. I originally thought this should not be merged into the 2.1 maintenance branch, but reconsidered: documentation changes may actually *use* the new version of the markup, so the lack of this markup variant can reasonably be considered a bug. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.38.2.1 retrieving revision 1.38.2.2 diff -C2 -r1.38.2.1 -r1.38.2.2 *** doc.tex 2001/04/18 05:14:32 1.38.2.1 --- doc.tex 2001/04/18 17:32:45 1.38.2.2 *************** *** 841,850 **** \end{macrodesc} ! \begin{macrodesc}{versionadded}{\p{version}} The version of Python which added the described feature to the ! library or C API. This is typically added to the end of the ! first paragraph of the description before any availability ! notes. The location should be selected so the explanation makes ! sense and may vary as needed. \end{macrodesc} --- 841,853 ---- \end{macrodesc} ! \begin{macrodesc}{versionadded}{\op{explanation}\p{version}} The version of Python which added the described feature to the ! library or C API. \var{explanation} should be a \emph{brief} ! explanation of the change consisting of a capitalized sentence ! fragment; a period will be appended by the formatting process. ! This is typically added to the end of the first paragraph of the ! description before any availability notes. The location should ! be selected so the explanation makes sense and may vary as ! needed. \end{macrodesc} From fdrake@users.sourceforge.net Wed Apr 18 19:42:50 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 18 Apr 2001 11:42:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle EditorWindow.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv4966 Modified Files: EditorWindow.py Log Message: Remove legacy support for the BrowserControl module; the webbrowser module has been included since Python 2.0, and that is the preferred interface. Index: EditorWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/EditorWindow.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** EditorWindow.py 2000/09/22 10:05:54 1.37 --- EditorWindow.py 2001/04/18 18:42:48 1.38 *************** *** 7,16 **** import tkSimpleDialog import tkMessageBox ! try: ! import webbrowser ! except ImportError: ! import BrowserControl ! webbrowser = BrowserControl ! del BrowserControl import idlever import WindowList --- 7,12 ---- import tkSimpleDialog import tkMessageBox ! ! import webbrowser import idlever import WindowList *************** *** 299,303 **** if sys.platform[:3] == "win": fn = os.path.dirname(__file__) ! fn = os.path.join(fn, "../../Doc/index.html") fn = os.path.normpath(fn) if os.path.isfile(fn): --- 295,299 ---- if sys.platform[:3] == "win": fn = os.path.dirname(__file__) ! fn = os.path.join(fn, os.pardir, os.pardir, "Doc", "index.html") fn = os.path.normpath(fn) if os.path.isfile(fn): From fdrake@users.sourceforge.net Wed Apr 18 19:43:36 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 18 Apr 2001 11:43:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle BrowserControl.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv5191 Removed Files: BrowserControl.py Log Message: Remove BrowserControl module; this had been left in for Python 1.5.2 support. --- BrowserControl.py DELETED --- From fdrake@users.sourceforge.net Wed Apr 18 21:16:53 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 18 Apr 2001 13:16:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libzlib.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23388/lib Modified Files: libzlib.tex Log Message: Cut-&-paste-o noted by Wolfgang Teschner: decompressobj() returns *DE*compression objects, not compression objects! Index: libzlib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libzlib.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** libzlib.tex 2000/10/18 17:43:06 1.23 --- libzlib.tex 2001/04/18 20:16:51 1.24 *************** *** 88,92 **** \begin{funcdesc}{decompressobj}{\optional{wbits}} ! Returns a compression object, to be used for decompressing data streams that won't fit into memory at once. The \var{wbits} parameter controls the size of the window buffer. --- 88,92 ---- \begin{funcdesc}{decompressobj}{\optional{wbits}} ! Returns a decompression object, to be used for decompressing data streams that won't fit into memory at once. The \var{wbits} parameter controls the size of the window buffer. From fdrake@users.sourceforge.net Wed Apr 18 21:17:25 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 18 Apr 2001 13:17:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libzlib.tex,1.23,1.23.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23526/lib Modified Files: Tag: release21-maint libzlib.tex Log Message: Cut-&-paste-o noted by Wolfgang Teschner: decompressobj() returns *DE*compression objects, not compression objects! Index: libzlib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libzlib.tex,v retrieving revision 1.23 retrieving revision 1.23.4.1 diff -C2 -r1.23 -r1.23.4.1 *** libzlib.tex 2000/10/18 17:43:06 1.23 --- libzlib.tex 2001/04/18 20:17:23 1.23.4.1 *************** *** 88,92 **** \begin{funcdesc}{decompressobj}{\optional{wbits}} ! Returns a compression object, to be used for decompressing data streams that won't fit into memory at once. The \var{wbits} parameter controls the size of the window buffer. --- 88,92 ---- \begin{funcdesc}{decompressobj}{\optional{wbits}} ! Returns a decompression object, to be used for decompressing data streams that won't fit into memory at once. The \var{wbits} parameter controls the size of the window buffer. From tim_one@users.sourceforge.net Wed Apr 18 22:12:27 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 18 Apr 2001 14:12:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/PC config.h,1.49,1.50 python_nt.rc,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv2242/python/dist/src/PC Modified Files: config.h python_nt.rc Log Message: Move Windows stuff to 2.2, so CVS builds won't interfere with 2.1 installations. Index: config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/config.h,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -r1.49 -r1.50 *** config.h 2001/02/28 08:15:16 1.49 --- config.h 2001/04/18 21:12:25 1.50 *************** *** 328,334 **** of by the Distutils, so it's not a problem). */ #ifdef _DEBUG ! #pragma comment(lib,"python21_d.lib") #else ! #pragma comment(lib,"python21.lib") #endif #endif /* USE_DL_EXPORT */ --- 328,334 ---- of by the Distutils, so it's not a problem). */ #ifdef _DEBUG ! #pragma comment(lib,"python22_d.lib") #else ! #pragma comment(lib,"python22.lib") #endif #endif /* USE_DL_EXPORT */ Index: python_nt.rc =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/python_nt.rc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** python_nt.rc 2001/03/11 04:30:35 1.13 --- python_nt.rc 2001/04/18 21:12:25 1.14 *************** *** 14,21 **** * MS_DLL_ID must match PY_VERSION in the Windows install script. */ ! #define MS_DLL_ID "2.1" #ifndef PYTHON_DLL_NAME ! #define PYTHON_DLL_NAME "python21.dll" #endif --- 14,21 ---- * MS_DLL_ID must match PY_VERSION in the Windows install script. */ ! #define MS_DLL_ID "2.2" #ifndef PYTHON_DLL_NAME ! #define PYTHON_DLL_NAME "python22.dll" #endif From tim_one@users.sourceforge.net Wed Apr 18 22:12:27 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 18 Apr 2001 14:12:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.11,1.12 python20.wse,1.39,1.40 pythoncore.dsp,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv2242/python/dist/src/PCbuild Modified Files: BUILDno.txt python20.wse pythoncore.dsp Log Message: Move Windows stuff to 2.2, so CVS builds won't interfere with 2.1 installations. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** BUILDno.txt 2001/04/16 18:20:30 1.11 --- BUILDno.txt 2001/04/18 21:12:25 1.12 *************** *** 34,38 **** Windows Python BUILD numbers ---------------------------- ! 15 2.1 16-Apr-2001 14 2.1c2 --- 34,40 ---- Windows Python BUILD numbers ---------------------------- ! 16 CVS development ! 18-Apr-2001 ! 15 2.1 final 16-Apr-2001 14 2.1c2 Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -r1.39 -r1.40 *** python20.wse 2001/04/16 18:20:30 1.39 --- python20.wse 2001/04/18 21:12:25 1.40 *************** *** 2,6 **** item: Global Version=5.0 ! Title=Python 2.1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=5.0 ! Title=Python 2.2 pre-alpha Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 67,75 **** item: Set Variable Variable=APPTITLE ! Value=Python 2.1 end item: Set Variable Variable=GROUP ! Value=Python 2.1 end item: Remark --- 67,75 ---- item: Set Variable Variable=APPTITLE ! Value=Python 2.2 pre-alpha end item: Set Variable Variable=GROUP ! Value=Python 2.2 end item: Remark *************** *** 78,86 **** item: Set Variable Variable=PY_VERSION ! Value=2.1 end item: Set Variable Variable=MAINDIR ! Value=Python21 end item: Get Registry Key Value --- 78,86 ---- item: Set Variable Variable=PY_VERSION ! Value=2.2 end item: Set Variable Variable=MAINDIR ! Value=Python22 end item: Get Registry Key Value *************** *** 829,834 **** end item: Install File ! Source=%_SRC_%\PCbuild\python21.lib ! Destination=%MAINDIR%\libs\python21.lib Flags=0000000000000010 end --- 829,834 ---- end item: Install File ! Source=%_SRC_%\PCbuild\python22.lib ! Destination=%MAINDIR%\libs\python22.lib Flags=0000000000000010 end *************** *** 852,857 **** end item: Install File ! Source=%_SRC_%\pcbuild\python21.dll ! Destination=%DLLDEST%\python21.dll Flags=0000000000000010 end --- 852,857 ---- end item: Install File ! Source=%_SRC_%\pcbuild\python22.dll ! Destination=%DLLDEST%\python22.dll Flags=0000000000000010 end Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** pythoncore.dsp 2001/04/16 18:20:30 1.13 --- pythoncore.dsp 2001/04/18 21:12:25 1.14 *************** *** 58,62 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python21.dll" # SUBTRACT LINK32 /pdb:none --- 58,62 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python22.dll" # SUBTRACT LINK32 /pdb:none *************** *** 89,93 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python21_d.dll" /pdbtype:sept # SUBTRACT LINK32 /pdb:none --- 89,93 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python22_d.dll" /pdbtype:sept # SUBTRACT LINK32 /pdb:none *************** *** 119,125 **** # ADD BSC32 /nologo LINK32=link.exe ! # ADD BASE LINK32 wsock32.lib largeint.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:ALPHA /nodefaultlib:"libc" /out:"./python21_d.dll" /pdbtype:sept # SUBTRACT BASE LINK32 /pdb:none ! # ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:ALPHA /nodefaultlib:"libc" /out:"./python21_d.dll" /pdbtype:sept # SUBTRACT LINK32 /pdb:none --- 119,125 ---- # ADD BSC32 /nologo LINK32=link.exe ! # ADD BASE LINK32 wsock32.lib largeint.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:ALPHA /nodefaultlib:"libc" /out:"./python22_d.dll" /pdbtype:sept # SUBTRACT BASE LINK32 /pdb:none ! # ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:ALPHA /nodefaultlib:"libc" /out:"./python22_d.dll" /pdbtype:sept # SUBTRACT LINK32 /pdb:none *************** *** 740,748 **** !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=15 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=15 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" --- 740,748 ---- !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=16 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=16 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" From mal@lemburg.com Wed Apr 18 22:57:15 2001 From: mal@lemburg.com (M.-A. Lemburg) Date: Wed, 18 Apr 2001 23:57:15 +0200 Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.82,2.83 References: Message-ID: <3ADE0DBB.BE794660@lemburg.com> "Martin v. L?wis" wrote: > > Update of /cvsroot/python/python/dist/src/Objects > In directory usw-pr-cvs1:/tmp/cvs-serv32029 > > Modified Files: > unicodeobject.c > Log Message: > Patch #416953: Cache ASCII characters to speed up ASCII decoding. Hmm, why didn't you post the modified patch to SF first ? There are some things which need tweaking before going prime time... BTW, please use 4 space indents for the unicodeobject.c file. > Index: unicodeobject.c > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v > retrieving revision 2.82 > retrieving revision 2.83 > diff -C2 -r2.82 -r2.83 > *** unicodeobject.c 2001/04/12 18:38:48 2.82 > --- unicodeobject.c 2001/04/18 12:49:15 2.83 > *************** > *** 91,94 **** > --- 91,96 ---- > static int unicode_freelist_size; > > + static PyUnicodeObject *unicode_ascii[128]; > + > /* Default encoding to use and assume when NULL is passed as encoding > parameter; it is initialized by _PyUnicode_Init(). > *************** > *** 252,255 **** > --- 254,270 ---- > PyUnicodeObject *unicode; Note that u can be NULL here ! > + if (size == 1 && *u < 128) { > ... Please also check why test_unicodedata fails with the patch applied. Thanks, -- Marc-Andre Lemburg ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Pages: http://www.lemburg.com/python/ From fdrake@users.sourceforge.net Thu Apr 19 05:55:25 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 18 Apr 2001 21:55:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libtime.tex,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv7547/lib Modified Files: libtime.tex Log Message: Add versioning notes: many of the signatures changed to allow the time used to be omitted (meaning use the current time) as of Python 2.1. Users who need cross-version portability need to know things like this. Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** libtime.tex 2001/02/03 14:35:38 1.37 --- libtime.tex 2001/04/19 04:55:23 1.38 *************** *** 123,126 **** --- 123,127 ---- current time as returned by \function{localtime()} is used. Note: unlike the C function of the same name, there is no trailing newline. + \versionchanged[Allowed \var{tuple} to be omitted]{2.1} \end{funcdesc} *************** *** 138,141 **** --- 139,143 ---- as returned by \function{time()} is used. \code{ctime(\var{secs})} is equivalent to \code{asctime(localtime(\var{secs}))}. + \versionchanged[Allowed \var{secs} to be omitted]{2.1} \end{funcdesc} *************** *** 150,153 **** --- 152,156 ---- Fractions of a second are ignored. See above for a description of the tuple lay-out. + \versionchanged[Allowed \var{secs} to be omitted]{2.1} \end{funcdesc} *************** *** 155,158 **** --- 158,162 ---- Like \function{gmtime()} but converts to local time. The dst flag is set to \code{1} when DST applies to the given time. + \versionchanged[Allowed \var{secs} to be omitted]{2.1} \end{funcdesc} *************** *** 181,184 **** --- 185,189 ---- argument. If \var{tuple} is not provided, the current time as returned by \function{localtime()} is used. \var{format} must be a string. + \versionchanged[Allowed \var{tuple} to be omitted]{2.1} The following directives can be embedded in the \var{format} string. From fdrake@users.sourceforge.net Thu Apr 19 05:55:59 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 18 Apr 2001 21:55:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libtime.tex,1.37,1.37.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv7625/lib Modified Files: Tag: release21-maint libtime.tex Log Message: Add versioning notes: many of the signatures changed to allow the time used to be omitted (meaning use the current time) as of Python 2.1. Users who need cross-version portability need to know things like this. Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.37 retrieving revision 1.37.4.1 diff -C2 -r1.37 -r1.37.4.1 *** libtime.tex 2001/02/03 14:35:38 1.37 --- libtime.tex 2001/04/19 04:55:57 1.37.4.1 *************** *** 123,126 **** --- 123,127 ---- current time as returned by \function{localtime()} is used. Note: unlike the C function of the same name, there is no trailing newline. + \versionchanged[Allowed \var{tuple} to be omitted]{2.1} \end{funcdesc} *************** *** 138,141 **** --- 139,143 ---- as returned by \function{time()} is used. \code{ctime(\var{secs})} is equivalent to \code{asctime(localtime(\var{secs}))}. + \versionchanged[Allowed \var{secs} to be omitted]{2.1} \end{funcdesc} *************** *** 150,153 **** --- 152,156 ---- Fractions of a second are ignored. See above for a description of the tuple lay-out. + \versionchanged[Allowed \var{secs} to be omitted]{2.1} \end{funcdesc} *************** *** 155,158 **** --- 158,162 ---- Like \function{gmtime()} but converts to local time. The dst flag is set to \code{1} when DST applies to the given time. + \versionchanged[Allowed \var{secs} to be omitted]{2.1} \end{funcdesc} *************** *** 181,184 **** --- 185,189 ---- argument. If \var{tuple} is not provided, the current time as returned by \function{localtime()} is used. \var{format} must be a string. + \versionchanged[Allowed \var{tuple} to be omitted]{2.1} The following directives can be embedded in the \var{format} string. From fdrake@users.sourceforge.net Thu Apr 19 17:26:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 19 Apr 2001 09:26:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib weakref.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv519 Modified Files: weakref.py Log Message: Weak*Dictionary: Added docstrings to the classes. Weak*Dictionary.update(): No longer create a temporary list to hold the things that will be stuffed into the underlying dictionary. This had been done so that if any of the objects used as the weakly-held value was not weakly-referencable, no updates would take place (TypeError would be raised). With this change, TypeError will still be raised but a partial update could occur. This is more like other .update() implementations. Thoughout, use of the name "ref" as a local variable has been removed. The original use of the name occurred when the function to create a weak reference was called "new"; the overloaded use of the name could be confusing for someone reading the code. "ref" used as a variable name has been replaced with "wr" (for 'weak reference'). Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** weakref.py 2001/04/16 17:34:48 1.8 --- weakref.py 2001/04/19 16:26:06 1.9 *************** *** 6,9 **** --- 6,13 ---- """ + # Naming convention: Variables named "wr" are weak reference objects; + # they are called this instead of "ref" to avoid name collisions with + # the module-global ref() function imported from _weakref. + import UserDict *************** *** 24,29 **** --- 28,38 ---- "CallableProxyType", "ProxyTypes", "WeakValueDictionary"] + class WeakValueDictionary(UserDict.UserDict): + """Mapping class that references values weakly. + Entries in the dictionary will be discarded when no strong + reference to the value exists anymore + """ # We inherit the constructor without worrying about the input # dictionary; since it uses our .update() method, we get the right *************** *** 49,54 **** def copy(self): new = WeakValueDictionary() ! for key, ref in self.data.items(): ! o = ref() if o is not None: new[key] = o --- 58,63 ---- def copy(self): new = WeakValueDictionary() ! for key, wr in self.data.items(): ! o = wr() if o is not None: new[key] = o *************** *** 57,65 **** def get(self, key, default=None): try: ! ref = self.data[key] except KeyError: return default else: ! o = ref() if o is None: # This should only happen --- 66,74 ---- def get(self, key, default=None): try: ! wr = self.data[key] except KeyError: return default else: ! o = wr() if o is None: # This should only happen *************** *** 70,75 **** def items(self): L = [] ! for key, ref in self.data.items(): ! o = ref() if o is not None: L.append((key, o)) --- 79,84 ---- def items(self): L = [] ! for key, wr in self.data.items(): ! o = wr() if o is not None: L.append((key, o)) *************** *** 78,83 **** def popitem(self): while 1: ! key, ref = self.data.popitem() ! o = ref() if o is not None: return key, o --- 87,92 ---- def popitem(self): while 1: ! key, wr = self.data.popitem() ! o = wr() if o is not None: return key, o *************** *** 85,112 **** def setdefault(self, key, default): try: ! ref = self.data[key] except KeyError: def remove(o, data=self.data, key=key): del data[key] ! ref = ref(default, remove) ! self.data[key] = ref return default else: ! return ref() def update(self, dict): d = self.data - L = [] for key, o in dict.items(): def remove(o, data=d, key=key): del data[key] ! L.append((key, ref(o, remove))) ! for key, r in L: ! d[key] = r def values(self): L = [] ! for ref in self.data.values(): ! o = ref() if o is not None: L.append(o) --- 94,117 ---- def setdefault(self, key, default): try: ! wr = self.data[key] except KeyError: def remove(o, data=self.data, key=key): del data[key] ! self.data[key] = ref(default, remove) return default else: ! return wr() def update(self, dict): d = self.data for key, o in dict.items(): def remove(o, data=d, key=key): del data[key] ! d[key] = ref(o, remove) def values(self): L = [] ! for wr in self.data.values(): ! o = wr() if o is not None: L.append(o) *************** *** 115,119 **** --- 120,133 ---- class WeakKeyDictionary(UserDict.UserDict): + """ Mapping class that references keys weakly. + Entries in the dictionary will be discarded when there is no + longer a strong reference to the key. This can be used to + associate additional data with an object owned by other parts of + an application without adding attributes to those objects. This + can be especially useful with objects that override attribute + accesses. + """ + def __init__(self, dict=None): self.data = {} *************** *** 156,161 **** def keys(self): L = [] ! for ref in self.data.keys(): ! o = ref() if o is not None: L.append(o) --- 170,175 ---- def keys(self): L = [] ! for wr in self.data.keys(): ! o = wr() if o is not None: L.append(o) *************** *** 174,182 **** def update(self, dict): d = self.data - L = [] for key, value in dict.items(): ! L.append((ref(key, self._remove), value)) ! for key, r in L: ! d[key] = r # no longer needed --- 188,194 ---- def update(self, dict): d = self.data for key, value in dict.items(): ! d[ref(key, self._remove)] = value ! # no longer needed From jhylton@users.sourceforge.net Thu Apr 19 17:43:51 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 19 Apr 2001 09:43:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.83,2.84 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4038 Modified Files: unicodeobject.c Log Message: Revert previous checkin, which caused test_unicodedata to fail. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.83 retrieving revision 2.84 diff -C2 -r2.83 -r2.84 *** unicodeobject.c 2001/04/18 12:49:15 2.83 --- unicodeobject.c 2001/04/19 16:43:49 2.84 *************** *** 91,96 **** static int unicode_freelist_size; - static PyUnicodeObject *unicode_ascii[128]; - /* Default encoding to use and assume when NULL is passed as encoding parameter; it is initialized by _PyUnicode_Init(). --- 91,94 ---- *************** *** 254,270 **** PyUnicodeObject *unicode; - if (size == 1 && *u < 128) { - unicode = unicode_ascii[*u]; - if (!unicode) { - unicode = _PyUnicode_New(1); - unicode->str[0] = *u; - if (!unicode) - return NULL; - unicode_ascii[*u] = unicode; - } - Py_INCREF(unicode); - return (PyObject*)unicode; - } - unicode = _PyUnicode_New(size); if (!unicode) --- 252,255 ---- *************** *** 1671,1679 **** PyUnicodeObject *v; Py_UNICODE *p; - - if (size == 1 && *(unsigned char*)s < 128) { - Py_UNICODE r = *(unsigned char*)s; - return PyUnicode_FromUnicode(&r, 1); - } /* ASCII is equivalent to the first 128 ordinals in Unicode. */ --- 1656,1659 ---- *************** *** 5210,5215 **** void _PyUnicode_Init(void) { - int i; - /* Doublecheck the configuration... */ if (sizeof(Py_UNICODE) != 2) --- 5190,5193 ---- *************** *** 5222,5228 **** unicode_empty = _PyUnicode_New(0); strcpy(unicode_default_encoding, "ascii"); - - for (i = 0; i < 128; i++) - unicode_ascii[i] = NULL; } --- 5200,5203 ---- *************** *** 5233,5247 **** { PyUnicodeObject *u; - int i; Py_XDECREF(unicode_empty); unicode_empty = NULL; - - for (i = 0; i < 128; i++) { - if (unicode_ascii[i]) { - Py_DECREF(unicode_ascii[i]); - unicode_ascii[i] = NULL; - } - } for (u = unicode_freelist; u != NULL;) { --- 5208,5214 ---- From gvanrossum@users.sourceforge.net Thu Apr 19 20:36:15 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 19 Apr 2001 12:36:15 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0227.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv3876 Modified Files: pep-0227.txt Log Message: Updated for clarity and to reflect reality. Jeremy, there are still XXX bits in here. Also, shouldn't the status be updated to Final? Index: pep-0227.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0227.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** pep-0227.txt 2001/02/26 20:08:05 1.7 --- pep-0227.txt 2001/04/19 19:36:13 1.8 *************** *** 11,26 **** Abstract ! This PEP proposes the addition of statically nested scoping ! (lexical scoping) for Python 2.1. The current language definition ! defines exactly three namespaces that are used to resolve names -- ! the local, global, and built-in namespaces. The addition of ! nested scopes would allow resolution of unbound local names in ! enclosing functions' namespaces. ! ! One consequence of this change that will be most visible to Python ! programs is that lambda statements could reference variables in ! the namespaces where the lambda is defined. Currently, a lambda ! statement uses default arguments to explicitly creating bindings ! in the lambda's namespace. Introduction --- 11,30 ---- Abstract ! This PEP describes the addition of statically nested scoping ! (lexical scoping) for Python 2.2, and as an source level option ! for python 2.1. In addition, Python 2.1 will issue warnings about ! constructs whose meaning may change when this feature is enabled. ! ! The old language definition (2.0 and before) defines exactly three ! namespaces that are used to resolve names -- the local, global, ! and built-in namespaces. The addition of nested scopes allows ! resolution of unbound local names in enclosing functions' ! namespaces. ! ! The most visible consequence of this change is that lambdas (and ! other nested functions) can reference variables defined in the ! surrounding namespace. Currently, lambdas must often use default ! arguments to explicitly creating bindings in the lambda's ! namespace. Introduction *************** *** 30,34 **** effect with Python 2.2. These semantics will also be available in Python 2.1 by adding "from __future__ import nested_scopes" to the ! top of a module. The Python 2.0 definition specifies exactly three namespaces to --- 34,38 ---- effect with Python 2.2. These semantics will also be available in Python 2.1 by adding "from __future__ import nested_scopes" to the ! top of a module. (See PEP 236.) The Python 2.0 definition specifies exactly three namespaces to *************** *** 40,44 **** binding that hides the binding in B). ! The specification introduces rules for lexical scoping that are common in Algol-like languages. The combination of lexical scoping and existing support for first-class functions is --- 44,48 ---- binding that hides the binding in B). ! This specification introduces rules for lexical scoping that are common in Algol-like languages. The combination of lexical scoping and existing support for first-class functions is *************** *** 46,69 **** The changed scoping rules address two problems -- the limited ! utility of lambda statements and the frequent confusion of new ! users familiar with other languages that support lexical scoping, ! e.g. the inability to define recursive functions except at the ! module level. ! The lambda statement introduces an unnamed function that contains ! a single statement. It is often used for callback functions. In the example below (written using the Python 2.0 rules), any name used in the body of the lambda must be explicitly passed as a default argument to the lambda. ! from Tkinter import * ! root = Tk() ! Button(root, text="Click here", ! command=lambda root=root: root.test.configure(text="...")) This approach is cumbersome, particularly when there are several names used in the body of the lambda. The long list of default ! arguments obscure the purpose of the code. The proposed solution, ! in crude terms, implements the default argument approach automatically. The "root=root" argument can be omitted. --- 50,73 ---- The changed scoping rules address two problems -- the limited ! utility of lambda expressions (and nested functions in general), ! and the frequent confusion of new users familiar with other ! languages that support nested lexical scopes, e.g. the inability ! to define recursive functions except at the module level. ! The lambda expression yields an unnamed function that evaluates a ! single expression. It is often used for callback functions. In the example below (written using the Python 2.0 rules), any name used in the body of the lambda must be explicitly passed as a default argument to the lambda. ! from Tkinter import * ! root = Tk() ! Button(root, text="Click here", ! command=lambda root=root: root.test.configure(text="...")) This approach is cumbersome, particularly when there are several names used in the body of the lambda. The long list of default ! arguments obscures the purpose of the code. The proposed ! solution, in crude terms, implements the default argument approach automatically. The "root=root" argument can be omitted. *************** *** 73,78 **** previously resolved using the global namespace will be resolved using the local namespace of an enclosing function. In Python ! 2.1, warnings will be issued for all program statement that will ! behave differently. Specification --- 77,82 ---- previously resolved using the global namespace will be resolved using the local namespace of an enclosing function. In Python ! 2.1, warnings will be issued for all statements that will behave ! differently. Specification *************** *** 88,110 **** block containing the use. ! The name binding operations are assignment, class and function ! definition, and import statements. Each assignment or import ! statement occurs within a block defined by a class or function ! definition or at the module level (the top-level code block). ! ! If a name binding operation occurs anywhere within a code block, ! all uses of the name within the block are treated as references to ! the current block. (Note: This can lead to errors when a name is ! used within a block before it is bound.) If the global statement occurs within a block, all uses of the name specified in the statement refer to the binding of that name in the top-level namespace. Names are resolved in the top-level ! namespace by searching the global namespace, the namespace of the ! module containing the code block, and the builtin namespace, the ! namespace of the module __builtin__. The global namespace is ! searched first. If the name is not found there, the builtin ! namespace is searched. The global statement must precede all uses ! of the name. If a name is used within a code block, but it is not bound there --- 92,115 ---- block containing the use. ! The name binding operations are argument declaration, assignment, ! class and function definition, import statements, for statements, ! and except clauses. Each name binding occurs within a block ! defined by a class or function definition or at the module level ! (the top-level code block). ! ! If a name is bound anywhere within a code block, all uses of the ! name within the block are treated as references to the current ! block. (Note: This can lead to errors when a name is used within ! a block before it is bound.) If the global statement occurs within a block, all uses of the name specified in the statement refer to the binding of that name in the top-level namespace. Names are resolved in the top-level ! namespace by searching the global namespace, i.e. the namespace of ! the module containing the code block, and in the builtin ! namespace, i.e. the namespace of the __builtin__ module. The ! global namespace is searched first. If the name is not found ! there, the builtin namespace is searched. The global statement ! must precede all uses of the name. If a name is used within a code block, but it is not bound there *************** *** 124,127 **** --- 129,133 ---- Function definition: def name ... + Argument declaration: def f(...name...), lambda ...name... Class definition: class name ... Assignment statement: name = ... *************** *** 131,141 **** clauses - The arguments of a function are also local. - There are several cases where Python statements are illegal when used in conjunction with nested scopes that contain free variables. ! If a variable is referenced in an enclosing scope, it is an error to delete the name. The compiler will raise a SyntaxError for 'del name'. --- 137,145 ---- clauses There are several cases where Python statements are illegal when used in conjunction with nested scopes that contain free variables. ! If a variable is referenced in an enclosed scope, it is an error to delete the name. The compiler will raise a SyntaxError for 'del name'. *************** *** 152,158 **** If a name bound in a function scope is also the name of a module ! global name or a standard builtin name and the function contains a ! nested function scope that references the name, the compiler will ! issue a warning. The name resolution rules will result in different bindings under Python 2.0 than under Python 2.2. The warning indicates that the program may not run correctly with all --- 156,162 ---- If a name bound in a function scope is also the name of a module ! global name or a standard builtin name, and the function contains ! a nested function scope that references the name, the compiler ! will issue a warning. The name resolution rules will result in different bindings under Python 2.0 than under Python 2.2. The warning indicates that the program may not run correctly with all *************** *** 190,195 **** The global statement short-circuits the normal rules. Under the proposal, the global statement has exactly the same effect that it ! does for Python 2.0. Its behavior is preserved for backwards ! compatibility. It is also noteworthy because it allows name binding operations performed in one block to change bindings in another block (the module). --- 194,198 ---- The global statement short-circuits the normal rules. Under the proposal, the global statement has exactly the same effect that it ! does for Python 2.0. It is also noteworthy because it allows name binding operations performed in one block to change bindings in another block (the module). *************** *** 306,312 **** standard library during the implementation of nested scopes. ! To address this problem, which is unlikely to occur often, a ! static analysis tool that detects affected code will be written. ! The detection problem is straightforward. The other compatibility problem is caused by the use of 'import *' --- 309,315 ---- standard library during the implementation of nested scopes. ! To address this problem, which is unlikely to occur often, the ! Python 2.1 compiler (when nested scopes are not enabled) issues a ! warning. The other compatibility problem is caused by the use of 'import *' *************** *** 342,346 **** Since each interpretation is problematic and the exact meaning ! ambiguous, the compiler raises an exception. A brief review of three Python projects (the standard library, --- 345,350 ---- Since each interpretation is problematic and the exact meaning ! ambiguous, the compiler raises an exception. The Python 2.1 ! compiler issues a warning when nested scopes are not enabled. A brief review of three Python projects (the standard library, *************** *** 421,429 **** rebinding of names in enclosing scopes, but the primary reason that it is not allowed in the current proposal is that Guido is ! opposed to it. It is difficult to support, because it would ! require a new mechanism that would allow the programmer to specify ! that an assignment in a block is supposed to rebind the name in an ! enclosing block; presumably a keyword or special syntax (x := 3) ! would make this possible. The proposed rules allow programmers to achieve the effect of --- 425,436 ---- rebinding of names in enclosing scopes, but the primary reason that it is not allowed in the current proposal is that Guido is ! opposed to it. His motivation: it is difficult to support, ! because it would require a new mechanism that would allow the ! programmer to specify that an assignment in a block is supposed to ! rebind the name in an enclosing block; presumably a keyword or ! special syntax (x := 3) would make this possible. Given that this ! would encourage the use of local variables to hold state that is ! better stored in a class instance, it's not worth adding new ! syntax to make this possible (in Guido's opinion). The proposed rules allow programmers to achieve the effect of *************** *** 451,456 **** Implementation The implementation for C Python uses flat closures [1]. Each def ! or lambda statement that is executed will create a closure if the body of the function or any contained function has free variables. Using flat closures, the creation of closures is --- 458,465 ---- Implementation + XXX Jeremy, is this still the case? + The implementation for C Python uses flat closures [1]. Each def ! or lambda expression that is executed will create a closure if the body of the function or any contained function has free variables. Using flat closures, the creation of closures is From gvanrossum@users.sourceforge.net Thu Apr 19 22:27:27 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 19 Apr 2001 14:27:27 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0252.txt,NONE,1.1 pep-0000.txt,1.87,1.88 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26125 Modified Files: pep-0000.txt Added Files: pep-0252.txt Log Message: Add the first bits of PEP 252, Making Types Look More Like Classes. --- NEW FILE: pep-0252.txt --- PEP: 252 Title: Making Types Look More Like Classes Version: $Revision: 1.1 $ Author: guido@python.org (Jeremy Hylton) Status: Draft Type: Standards Track Python-Version: 2.2 Created: 19-Apr-2001 Post-History: Abstract This PEP proposes changes to the introspection API for types that makes them look more like classes. For example, type(x) will be equivalent to x.__class__ for most built-in types. When C is x.__class__, x.meth(a) will be equivalent to C.meth(x, a), and C.__dict__ contains descriptors for x's methods and other attributes. The PEP also introduces a new approach to specifying attributes, using attribute descriptors, or descriptors for short. Descriptors unify and generalize several different common mechanisms used for describing attributes: a descriptor can be an unbound method, a typed field in the object structure, or a generalized attribute represented by getter and setter functions (or just a getter function, for read-only attributes). Introduction One of Python's oldest language warts is the difference between classes and types. For example, you can't directly subclass the dictionary type, and the introspection interface for finding out what methods and instance variables an object has is different for types and for classes. Healing the class/type split is a big effort, because it affects many aspects of how Python is implemented. This PEP concerns itself with making the introspection API for types look the same as that for classes. Other PEPs will propose making classes look more like types, and subclassing from built-in types; these topics are not on the table for this PEP. Introspection APIs Introspection concerns itself with finding out what attributes an object has. Python's very general getattr/setattr API makes it impossible to guarantee that there always is a way to get a list of all attributes supported by a specific object, but in practice two conventions have appeared that together work for almost all objects. The first API is used primarily for class instances; it is also used by Digital Creations's ExtensionClasses. It assumes that all data attributes of an object x are stored in the dictionary x.__dict__, and that all methods and class variables can be found by inspection of x's class, written as x.__class__. Classes have a __dict__ attribute, which yields a dictionary containing methods and class variables defined by the class itself, and a __bases__ attribute, which is a tuple of base classes that must be inspected recursively. Some assumption here are: - attributes defined in the instance dict override attributes defined by the object's class; - attributes defined in a derived class override attributes defined in a base class; - attributes in an earlier base class (meaning occurring earlier in __bases__) override attributes in a later base class. (The last two rules together are often summarized as the left-to-right, depth-first rule for attribute search.) The second introspection API is supported in one form or another by most built-in objects. It uses two special attributes, __members__ and __methods__. The __members__ attribute, if present, is a list of method names supported by the object. The __methods__ attribute, if present, is a list of data attribute names supported by the object. This API is sometimes combined by a __dict__ that works the same was as for instances (e.g., for function objects in Python 2.1, f.__dict__ contains f's dynamic attributes, while f.__members__ lists the names of f's statically defined attributes). Some caution must be exercised: some objects don't list theire "intrinsic" attributes (e.g. __dict__ and __doc__) in __members__, while others do; sometimes attribute names that occur both in __members__ or __methods__ and as keys in __dict__, in which case it's anybody's guess whether the value found in __dict__ is used or not. This second introspection API has never been carefully specified. It is part of folklore, and most 3rd party extensions support it because they follow examples that support it. Also, any type that uses Py_FindMethod() and/or PyMember_Get() in its tp_getattr handler supports it, because these two functions special-case the attribute names __methods__ and __members__, respectively. Digital Creations's ExtensionClasses ignore the second introspection API, and instead emulate the class instance introspection API, which is more powerful. In this PEP, I propose to phase out the second API in favor of supporting the class instance introspection API for all types. One argument in favor of the class instance introspection API is that it doesn't require you to create an instance in order to find out which attributes a type supports; this in turn is useful for documentation processors. For example, the socket module exports the SocketType object, but this currently doesn't tell us what methods are defined on socket objects. Specification XXX Discussion XXX Examples XXX Backwards compatibility XXX Compatibility of C API XXX Warnings and Errors XXX Implementation XXX References XXX Local Variables: mode: indented-text indent-tabs-mode: nil End: Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -r1.87 -r1.88 *** pep-0000.txt 2001/04/18 10:27:03 1.87 --- pep-0000.txt 2001/04/19 21:27:25 1.88 *************** *** 52,55 **** --- 52,56 ---- S 250 pep-0250.txt Using site-packages on All Platforms Moore I 251 pep-0251.txt Python 2.2 Release Schedule Warsaw + S 252 pep-0252.txt Making Types Look More Like Classes van Rossum Py-in-the-sky PEPs (not ready; may become active yet) *************** *** 171,174 **** --- 172,176 ---- S 250 pep-0250.txt Using site-packages on All Platforms Moore I 251 pep-0251.txt Python 2.2 Release Schedule Warsaw + S 252 pep-0252.txt Making Types Look More Like Classes van Rossum From tim_one@users.sourceforge.net Thu Apr 19 22:55:16 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 19 Apr 2001 14:55:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.84,2.85 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30795/python/dist/src/Objects Modified Files: unicodeobject.c Log Message: CVS patch 416248: 2.1c1 unicodeobject: unused vrbl cleanup, from Mark Favas. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.84 retrieving revision 2.85 diff -C2 -r2.84 -r2.85 *** unicodeobject.c 2001/04/19 16:43:49 2.84 --- unicodeobject.c 2001/04/19 21:55:14 2.85 *************** *** 4794,4798 **** int width = -1; int prec = -1; - int size = 0; Py_UNICODE c = '\0'; Py_UNICODE fill; --- 4794,4797 ---- *************** *** 4932,4936 **** if (fmtcnt >= 0) { if (c == 'h' || c == 'l' || c == 'L') { - size = c; if (--fmtcnt >= 0) c = *fmt++; --- 4931,4934 ---- From gvanrossum@users.sourceforge.net Fri Apr 20 03:21:09 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 19 Apr 2001 19:21:09 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0227.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv6244 Modified Files: pep-0227.txt Log Message: This PEP still needs a Copyright note. I've added an XXX (I can't very well place it in the public domain for Jeremy :-). Index: pep-0227.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0227.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** pep-0227.txt 2001/04/19 19:36:13 1.8 --- pep-0227.txt 2001/04/20 02:21:07 1.9 *************** *** 492,495 **** --- 492,499 ---- http://citeseer.nj.nec.com/cardelli84compiling.html + Copyright + + XXX + Local Variables: From gvanrossum@users.sourceforge.net Fri Apr 20 05:02:00 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 19 Apr 2001 21:02:00 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0252.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv17416 Modified Files: pep-0252.txt Log Message: Some more writing, specifying the core elements of the class-based introspection API. I'll add attribute descriptors tomorrow. Index: pep-0252.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0252.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0252.txt 2001/04/19 21:27:25 1.1 --- pep-0252.txt 2001/04/20 04:01:57 1.2 *************** *** 2,6 **** Title: Making Types Look More Like Classes Version: $Revision$ ! Author: guido@python.org (Jeremy Hylton) Status: Draft Type: Standards Track --- 2,6 ---- Title: Making Types Look More Like Classes Version: $Revision$ ! Author: guido@python.org (Guido van Rossum) Status: Draft Type: Standards Track *************** *** 48,62 **** of all attributes supported by a specific object, but in practice two conventions have appeared that together work for almost all ! objects. ! The first API is used primarily for class instances; it is also ! used by Digital Creations's ExtensionClasses. It assumes that all ! data attributes of an object x are stored in the dictionary ! x.__dict__, and that all methods and class variables can be found ! by inspection of x's class, written as x.__class__. Classes have ! a __dict__ attribute, which yields a dictionary containing methods ! and class variables defined by the class itself, and a __bases__ ! attribute, which is a tuple of base classes that must be inspected ! recursively. Some assumption here are: - attributes defined in the instance dict override attributes --- 48,64 ---- of all attributes supported by a specific object, but in practice two conventions have appeared that together work for almost all ! objects. I'll call them the class-based introspection API and the ! type-based introspection API; class API and type API for short. ! The class-based introspection API is used primarily for class ! instances; it is also used by Digital Creations's ! ExtensionClasses. It assumes that all data attributes of an ! object x are stored in the dictionary x.__dict__, and that all ! methods and class variables can be found by inspection of x's ! class, written as x.__class__. Classes have a __dict__ attribute, ! which yields a dictionary containing methods and class variables ! defined by the class itself, and a __bases__ attribute, which is a ! tuple of base classes that must be inspected recursively. Some ! assumption here are: - attributes defined in the instance dict override attributes *************** *** 72,77 **** left-to-right, depth-first rule for attribute search.) ! The second introspection API is supported in one form or another ! by most built-in objects. It uses two special attributes, __members__ and __methods__. The __members__ attribute, if present, is a list of method names supported by the object. The --- 74,79 ---- left-to-right, depth-first rule for attribute search.) ! The type-based introspection API is supported in one form or ! another by most built-in objects. It uses two special attributes, __members__ and __methods__. The __members__ attribute, if present, is a list of method names supported by the object. The *************** *** 79,86 **** names supported by the object. ! This API is sometimes combined by a __dict__ that works the same ! was as for instances (e.g., for function objects in Python 2.1, ! f.__dict__ contains f's dynamic attributes, while f.__members__ ! lists the names of f's statically defined attributes). Some caution must be exercised: some objects don't list theire --- 81,89 ---- names supported by the object. ! The type API is sometimes combined by a __dict__ that works the ! same was as for instances (e.g., for function objects in Python ! 2.1, f.__dict__ contains f's dynamic attributes, while ! f.__members__ lists the names of f's statically defined ! attributes). Some caution must be exercised: some objects don't list theire *************** *** 91,96 **** or not. ! This second introspection API has never been carefully specified. ! It is part of folklore, and most 3rd party extensions support it because they follow examples that support it. Also, any type that uses Py_FindMethod() and/or PyMember_Get() in its tp_getattr --- 94,99 ---- or not. ! The type API has never been carefully specified. It is part of ! Python folklore, and most third party extensions support it because they follow examples that support it. Also, any type that uses Py_FindMethod() and/or PyMember_Get() in its tp_getattr *************** *** 98,118 **** attribute names __methods__ and __members__, respectively. ! Digital Creations's ExtensionClasses ignore the second ! introspection API, and instead emulate the class instance ! introspection API, which is more powerful. In this PEP, I propose ! to phase out the second API in favor of supporting the class ! instance introspection API for all types. ! ! One argument in favor of the class instance introspection API is ! that it doesn't require you to create an instance in order to find ! out which attributes a type supports; this in turn is useful for ! documentation processors. For example, the socket module exports ! the SocketType object, but this currently doesn't tell us what ! methods are defined on socket objects. - Specification - - XXX - Discussion --- 101,253 ---- attribute names __methods__ and __members__, respectively. ! Digital Creations's ExtensionClasses ignore the type API, and ! instead emulate the class API, which is more powerful. In this ! PEP, I propose to phase out the type API in favor of supporting ! the class API for all types. ! ! One argument in favor of the class API is that it doesn't require ! you to create an instance in order to find out which attributes a ! type supports; this in turn is useful for documentation ! processors. For example, the socket module exports the SocketType ! object, but this currently doesn't tell us what methods are ! defined on socket objects. Using the class API, SocketType shows ! us exactly what the methods for socket objects are, and we can ! even extract their docstrings, without creating a socket. (Since ! this is a C extension module, the source-scanning approach to ! docstring extraction isn't feasible in this case.) ! ! Specification of the class-based introspection API ! ! Objects may have two kinds of attributes: static and dynamic. The ! names and sometimes other properties of static attributes are ! knowable by inspection of the object's type or class, which is ! accessible through obj.__class__ or type(obj). (I'm using type ! and class interchangeably, because that's the goal of the ! exercise.) ! ! (XXX static and dynamic are lousy names, because the "static" ! attributes may actually behave quite dynamically.) ! ! The names and values of dynamic properties are typically stored in ! a dictionary, and this dictionary is typically accessible as ! obj.__dict__. The rest of this specification is more concerned ! with discovering the names and properties of static attributes ! than with dynamic attributes. ! ! Examples of dynamic attributes are instance variables of class ! instances, module attributes, etc. Examples of static attributes ! are the methods of built-in objects like lists and dictionaries, ! and the attributes of frame and code objects (c.co_code, ! c.co_filename, etc.). When an object with dynamic attributes ! exposes these through its __dict__ attribute, __dict__ is a static ! attribute. ! ! In the discussion below, I distinguish two kinds of objects: ! regular objects (e.g. lists, ints, functions) and meta-objects. ! Meta-objects are types and classes. Meta-objects are also regular ! objects, but we're mostly interested in them because they are ! referenced by the __class__ attribute of regular objects (or by ! the __bases__ attribute of meta-objects). ! ! The class introspection API consists of the following elements: ! ! - the __class__ and __dict__ attributes on regular objects; ! ! - the __bases__ and __dict__ attributes on meta-objects; ! ! - precedence rules; ! ! - attribute descriptors. ! ! 1. The __dict__ attribute on regular objects ! ! A regular object may have a __dict__ attribute. If it does, ! this should be a mapping (not necessarily a dictionary) ! supporting at least __getitem__, keys(), and has_item(). This ! gives the dynamic attributes of the object. The keys in the ! mapping give attribute names, and the corresponding values give ! their values. ! ! Typically, the value of an attribute with a given name is the ! same object as the value corresponding to that name as a key in ! the __dict__. In othe words, obj.__dict__['spam'] is obj.spam. ! (But see the precedence rules below; a static attribute with ! the same name *may* override the dictionary item.) ! ! 2. The __class__ attribute on regular objects ! ! A regular object may have a __class__ attributes. If it does, ! this references a meta-object. A meta-object can define static ! attributes for the regular object whose __class__ it is. ! ! 3. The __dict__ attribute on meta-objects ! ! A meta-object may have a __dict__ attribute, of the same form ! as the __dict__ attribute for regular objects (mapping, etc). ! If it does, the keys of the meta-object's __dict__ are names of ! static attributes for the corresponding regular object. The ! values are attribute descriptors; we'll explain these later. ! (An unbound method is a special case of an attribute ! descriptor.) ! ! Becase a meta-object is also a regular object, the items in a ! meta-object's __dict__ correspond to attributes of the ! meta-object; however, some transformation may be applied, and ! bases (see below) may define additional dynamic attributes. In ! other words, mobj.spam is not always mobj.__dict__['spam']. ! (This rule contains a loophole because for classes, if ! C.__dict__['spam'] is a function, C.spam is an unbound method ! object.) ! ! 4. The __bases__ attribute on meta-objects ! ! A meta-object may have a __bases__ attribute. If it does, this ! should be a sequence (not necessarily a tuple) of other ! meta-objects, the bases. An absent __bases__ is equivalent to ! an empty sequece of bases. There must never be a cycle in the ! relationship between meta objects defined by __bases__ ! attributes; in other words, the __bases__ attributes define an ! inheritance tree, where the root of the tree is the __class__ ! attribute of a regular object, and the leaves of the trees are ! meta-objects without bases. The __dict__ attributes of the ! meta-objects in the inheritance tree supply attribute ! descriptors for the regular object whose __class__ is at the ! top of the inheritance tree. ! ! 5. Precedence rules ! ! When two meta-objects in the inheritance tree both define an ! attribute descriptor with the same name, the left-to-right ! depth-first rule applies. (XXX define rigorously.) ! ! When a dynamic attribute (one defined in a regular object's ! __dict__) has the same name as a static attribute (one defined ! by a meta-object in the inheritance tree rooted at the regular ! object's __class__), the dynamic attribute *usually* wins, but ! for some attributes the meta-object may specify that the static ! attribute overrides the dynamic attribute. ! ! (We can't have a simples rule like "static overrides dynamic" ! or "dynamic overrides static", because some static attributes ! indeed override dynamic attributes, e.g. a key '__class__' in ! an instance's __dict__ is ignored in favor of the statically ! defined __class__ pointer, but on the other hand most keys in ! inst.__dict__ override attributes defined in inst.__class__. ! The mechanism whereby a meta-object can specify that a ! particular attribute has precedence is not yet specified.) ! ! 6. Attribute descriptors ! ! XXX ! ! The introspection API is a read-only API. We don't define the ! effect of assignment to any of the special attributes (__dict__, ! __class__ and __bases__), nor the effect of assignment to the ! items of a __dict__. Generally, such assignments should be ! considered off-limits. An extension of this PEP may define some ! semantics for some such assignments. (Especially because ! currently instances support assignment to __class__ and __dict__, ! and classes support assignment to __bases__ and __dict__.) Discussion *************** *** 142,145 **** --- 277,284 ---- XXX + + Copyright + + This document has been placed in the public domain. From gvanrossum@users.sourceforge.net Fri Apr 20 14:46:20 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 06:46:20 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0252.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4502 Modified Files: pep-0252.txt Log Message: Correct typo found by Thomas Heller (swapped __methods__ and __members__). Index: pep-0252.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0252.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** pep-0252.txt 2001/04/20 04:01:57 1.2 --- pep-0252.txt 2001/04/20 13:46:17 1.3 *************** *** 76,82 **** The type-based introspection API is supported in one form or another by most built-in objects. It uses two special attributes, ! __members__ and __methods__. The __members__ attribute, if present, is a list of method names supported by the object. The ! __methods__ attribute, if present, is a list of data attribute names supported by the object. --- 76,82 ---- The type-based introspection API is supported in one form or another by most built-in objects. It uses two special attributes, ! __members__ and __methods__. The __methods__ attribute, if present, is a list of method names supported by the object. The ! __members__ attribute, if present, is a list of data attribute names supported by the object. From gvanrossum@users.sourceforge.net Fri Apr 20 16:53:30 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 08:53:30 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.173,2.173.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv27587 Modified Files: Tag: iter-branch import.c Log Message: Change the PYC magic number, since we're emitting different opcodes. (This is in the iter-branch.) Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.173 retrieving revision 2.173.2.1 diff -C2 -r2.173 -r2.173.2.1 *** import.c 2001/03/06 06:31:15 2.173 --- import.c 2001/04/20 15:53:28 2.173.2.1 *************** *** 44,48 **** added to the .pyc file header? */ /* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */ ! #define MAGIC (60202 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the --- 44,48 ---- added to the .pyc file header? */ /* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */ ! #define MAGIC (60420 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the From gvanrossum@users.sourceforge.net Fri Apr 20 17:50:42 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 09:50:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_types.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7993/Lib/test Modified Files: test_types.py Log Message: Implement, test and document "key in dict" and "key not in dict". I know some people don't like this -- if it's really controversial, I'll take it out again. (If it's only Alex Martelli who doesn't like it, that doesn't count as "real controversial" though. :-) That's why this is a separate checkin from the iterators stuff I'm about to check in next. Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** test_types.py 2000/12/12 23:11:42 1.19 --- test_types.py 2001/04/20 16:50:40 1.20 *************** *** 222,225 **** --- 222,227 ---- if d.keys() != []: raise TestFailed, '{}.keys()' if d.has_key('a') != 0: raise TestFailed, '{}.has_key(\'a\')' + if ('a' in d) != 0: raise TestFailed, "'a' in {}" + if ('a' not in d) != 1: raise TestFailed, "'a' not in {}" if len(d) != 0: raise TestFailed, 'len({})' d = {'a': 1, 'b': 2} *************** *** 230,233 **** --- 232,237 ---- if d.has_key('a') and d.has_key('b') and not d.has_key('c'): pass else: raise TestFailed, 'dict keys()' + if 'a' in d and 'b' in d and 'c' not in d: pass + else: raise TestFailed, 'dict keys() # in/not in version' if d['a'] != 1 or d['b'] != 2: raise TestFailed, 'dict item' d['c'] = 3 From gvanrossum@users.sourceforge.net Fri Apr 20 17:50:42 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 09:50:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.64,1.65 ref5.tex,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv7993/Doc/ref Modified Files: ref3.tex ref5.tex Log Message: Implement, test and document "key in dict" and "key not in dict". I know some people don't like this -- if it's really controversial, I'll take it out again. (If it's only Alex Martelli who doesn't like it, that doesn't count as "real controversial" though. :-) That's why this is a separate checkin from the iterators stuff I'm about to check in next. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -r1.64 -r1.65 *** ref3.tex 2001/04/13 15:54:41 1.64 --- ref3.tex 2001/04/20 16:50:40 1.65 *************** *** 1135,1139 **** \method{__mul__()}, \method{__rmul__()} and \method{__imul__()} described below; they should not define \method{__coerce__()} or other numerical ! operators. \withsubitem{(mapping object method)}{ \ttindex{keys()} --- 1135,1142 ---- \method{__mul__()}, \method{__rmul__()} and \method{__imul__()} described below; they should not define \method{__coerce__()} or other numerical ! operators. It is recommended that both mappings and sequences ! implement the \method{__contains__}, to allow efficient use of the ! \code{in} operator; for mappings, \code{in} should be equivalent of ! \method{has_key()}; for sequences, it should search through the values. \withsubitem{(mapping object method)}{ \ttindex{keys()} *************** *** 1144,1148 **** \ttindex{clear()} \ttindex{copy()} ! \ttindex{update()}} \withsubitem{(sequence object method)}{ \ttindex{append()} --- 1147,1152 ---- \ttindex{clear()} \ttindex{copy()} ! \ttindex{update()} ! \ttindex{__contains__()}} \withsubitem{(sequence object method)}{ \ttindex{append()} *************** *** 1159,1163 **** \ttindex{__mul__()} \ttindex{__rmul__()} ! \ttindex{__imul__()}} \withsubitem{(numeric object method)}{\ttindex{__coerce__()}} --- 1163,1168 ---- \ttindex{__mul__()} \ttindex{__rmul__()} ! \ttindex{__imul__()} ! \ttindex{__contains__()}} \withsubitem{(numeric object method)}{\ttindex{__coerce__()}} Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -r1.43 -r1.44 *** ref5.tex 2001/04/12 12:37:03 1.43 --- ref5.tex 2001/04/20 16:50:40 1.44 *************** *** 769,773 **** object is a member of a set if the set is a sequence and contains an element equal to that object. However, it is possible for an object ! to support membership tests without being a sequence. For the list and tuple types, \code{\var{x} in \var{y}} is true if and --- 769,775 ---- object is a member of a set if the set is a sequence and contains an element equal to that object. However, it is possible for an object ! to support membership tests without being a sequence. In particular, ! dictionaries support memership testing as a nicer way of spelling ! \code{\var{key} in \var{dict}}; other mapping types may follow suit. For the list and tuple types, \code{\var{x} in \var{y}} is true if and From gvanrossum@users.sourceforge.net Fri Apr 20 17:50:42 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 09:50:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.76,2.77 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7993/Objects Modified Files: dictobject.c Log Message: Implement, test and document "key in dict" and "key not in dict". I know some people don't like this -- if it's really controversial, I'll take it out again. (If it's only Alex Martelli who doesn't like it, that doesn't count as "real controversial" though. :-) That's why this is a separate checkin from the iterators stuff I'm about to check in next. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.76 retrieving revision 2.77 diff -C2 -r2.76 -r2.77 *** dictobject.c 2001/04/16 00:02:32 2.76 --- dictobject.c 2001/04/20 16:50:40 2.77 *************** *** 1293,1296 **** --- 1293,1330 ---- } + static int + dict_contains(dictobject *mp, PyObject *key) + { + long hash; + + #ifdef CACHE_HASH + if (!PyString_Check(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) + #endif + { + hash = PyObject_Hash(key); + if (hash == -1) + return -1; + } + return (mp->ma_size != 0 + && (mp->ma_lookup)(mp, key, hash)->me_value != NULL); + } + + staticforward PyObject *dictiter_new(dictobject *); + + /* Hack to implement "key in dict" */ + static PySequenceMethods dict_as_sequence = { + 0, /* sq_length */ + 0, /* sq_concat */ + 0, /* sq_repeat */ + 0, /* sq_item */ + 0, /* sq_slice */ + 0, /* sq_ass_item */ + 0, /* sq_ass_slice */ + (objobjproc)dict_contains, /* sq_contains */ + 0, /* sq_inplace_concat */ + 0, /* sq_inplace_repeat */ + }; + PyTypeObject PyDict_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 1306,1310 **** (reprfunc)dict_repr, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ &dict_as_mapping, /* tp_as_mapping */ 0, /* tp_hash */ --- 1340,1344 ---- (reprfunc)dict_repr, /* tp_repr */ 0, /* tp_as_number */ ! &dict_as_sequence, /* tp_as_sequence */ &dict_as_mapping, /* tp_as_mapping */ 0, /* tp_hash */ From gvanrossum@users.sourceforge.net Fri Apr 20 17:50:42 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 09:50:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv7993/Doc/lib Modified Files: libstdtypes.tex Log Message: Implement, test and document "key in dict" and "key not in dict". I know some people don't like this -- if it's really controversial, I'll take it out again. (If it's only Alex Martelli who doesn't like it, that doesn't count as "real controversial" though. :-) That's why this is a separate checkin from the iterators stuff I'm about to check in next. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -r1.52 -r1.53 *** libstdtypes.tex 2001/02/27 03:32:35 1.52 --- libstdtypes.tex 2001/04/20 16:50:40 1.53 *************** *** 868,874 **** \lineiii{\var{a}.clear()}{remove all items from \code{a}}{} \lineiii{\var{a}.copy()}{a (shallow) copy of \code{a}}{} ! \lineiii{\var{a}.has_key(\var{k})} {\code{1} if \var{a} has a key \var{k}, else \code{0}} {} \lineiii{\var{a}.items()} {a copy of \var{a}'s list of (\var{key}, \var{value}) pairs} --- 868,880 ---- \lineiii{\var{a}.clear()}{remove all items from \code{a}}{} \lineiii{\var{a}.copy()}{a (shallow) copy of \code{a}}{} ! \lineiii{\var{k} \code{in} \var{a}} {\code{1} if \var{a} has a key \var{k}, else \code{0}} {} + \lineiii{\var{k} not in \var{a}} + {\code{0} if \var{a} has a key \var{k}, else \code{1}} + {} + \lineiii{\var{a}.has_key(\var{k})} + {Equivalent to \var{k} \code{in} \var{a}} + {} \lineiii{\var{a}.items()} {a copy of \var{a}'s list of (\var{key}, \var{value}) pairs} *************** *** 880,888 **** \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{a}.has_key(\var{k})}, else \var{x}} {(4)} \lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{a}.has_key(\var{k})}, else \var{x} (also setting it)} {(5)} --- 886,894 ---- \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}}, else \var{x}} {(4)} \lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}}, else \var{x} (also setting it)} {(5)} From gvanrossum@users.sourceforge.net Fri Apr 20 17:52:08 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 09:52:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.77,2.78 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8681 Modified Files: dictobject.c Log Message: Oops. Removed dictiter_new decl that wasn't supposed to go in yet. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.77 retrieving revision 2.78 diff -C2 -r2.77 -r2.78 *** dictobject.c 2001/04/20 16:50:40 2.77 --- dictobject.c 2001/04/20 16:52:06 2.78 *************** *** 1311,1316 **** } - staticforward PyObject *dictiter_new(dictobject *); - /* Hack to implement "key in dict" */ static PySequenceMethods dict_as_sequence = { --- 1311,1314 ---- From akuchling@users.sourceforge.net Fri Apr 20 19:29:02 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Fri, 20 Apr 2001 11:29:02 -0700 Subject: [Python-checkins] CVS: distutils setup.py,1.29,1.30 Message-ID: Update of /cvsroot/python/distutils In directory usw-pr-cvs1:/tmp/cvs-serv25092 Modified Files: setup.py Log Message: Bump version number to 1.0.2 final Index: setup.py =================================================================== RCS file: /cvsroot/python/distutils/setup.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** setup.py 2001/03/23 17:30:56 1.29 --- setup.py 2001/04/20 18:28:59 1.30 *************** *** 12,16 **** setup (name = "Distutils", ! version = "1.0.2pre", description = "Python Distribution Utilities", author = "Greg Ward", --- 12,16 ---- setup (name = "Distutils", ! version = "1.0.2", description = "Python Distribution Utilities", author = "Greg Ward", From akuchling@users.sourceforge.net Fri Apr 20 19:29:33 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Fri, 20 Apr 2001 11:29:33 -0700 Subject: [Python-checkins] CVS: distutils TODO,1.9,1.10 Message-ID: Update of /cvsroot/python/distutils In directory usw-pr-cvs1:/tmp/cvs-serv25207 Modified Files: TODO Log Message: Add more TODO items Index: TODO =================================================================== RCS file: /cvsroot/python/distutils/TODO,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** TODO 2001/04/05 15:50:58 1.9 --- TODO 2001/04/20 18:29:31 1.10 *************** *** 2,5 **** --- 2,6 ---- ------------------- + [MAL] * binary packages should include the Python version in their filename *************** *** 10,17 **** we could use a new setup() keyword "release" for this * Konrad's suggested fixes (allowing single directories in MANIFEST, etc.) ! * Additional install_ subcommands: for DTDs and SGML catalogs, for TeX files. * extend the install_* commands so that they write uninstall information --- 11,27 ---- we could use a new setup() keyword "release" for this + Filename format suggestion: + packagename-pkgversion-binaryrevision-pythonversion[.platform]. + + [AMK] * Konrad's suggested fixes (allowing single directories in MANIFEST, etc.) + + * Additional install_ subcommands: for DTDs and SGML catalogs, for TeX files, + any others that people suggest. ! * think about a database of installed packages (perhaps the simple ! directory/file structure mentioned at IPC9) + [Thomas Heller] * extend the install_* commands so that they write uninstall information *************** *** 25,29 **** extend (maybe this will also unify the CCompiler classes) ! * fix the *_clib commands * implement test command: often requested (but low priority IMO) --- 35,39 ---- extend (maybe this will also unify the CCompiler classes) ! * fix the *_clib commands (bug #414032 on SF) * implement test command: often requested (but low priority IMO) *************** *** 31,34 **** --- 41,52 ---- * docs, docs, docs (Thomas Heller promises to completely document the windows installer, but nothing more) + + [Paul Moore] + * Change default install location for Mac to site-packages + (to match what site.py in 2.1 does) [I have no personal + interest in Macs, this just seems sensible] + + * Change default install location on Windows to site-packages + (if Paul Moore's PEP on this subject - unnumbered as yet - gets accepted) From akuchling@users.sourceforge.net Fri Apr 20 19:30:38 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Fri, 20 Apr 2001 11:30:38 -0700 Subject: [Python-checkins] CVS: distutils CHANGES.txt,1.19,1.20 README.txt,1.23,1.24 Message-ID: Update of /cvsroot/python/distutils In directory usw-pr-cvs1:/tmp/cvs-serv25305 Modified Files: CHANGES.txt README.txt Log Message: Bump version number, and specify release date Various updates to the README.txt file Index: CHANGES.txt =================================================================== RCS file: /cvsroot/python/distutils/CHANGES.txt,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** CHANGES.txt 2001/03/22 03:36:48 1.19 --- CHANGES.txt 2001/04/20 18:30:36 1.20 *************** *** 1,4 **** ! Relase 1.0.2pre(XXX, 2001): ! -------------------------------- * fixes to accommodate the major revisions made to Python's build system for 2.1. (This will break the Distutils for 1.5.2 and 2.0, though; --- 1,4 ---- ! Relase 1.0.2 (20 April, 2001): ! ------------------------------ * fixes to accommodate the major revisions made to Python's build system for 2.1. (This will break the Distutils for 1.5.2 and 2.0, though; Index: README.txt =================================================================== RCS file: /cvsroot/python/distutils/README.txt,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** README.txt 2000/10/15 19:20:56 1.23 --- README.txt 2001/04/20 18:30:36 1.24 *************** *** 1,5 **** Python Distribution Utilities ! release 1.0.1 ! October 15, 2000 --- 1,5 ---- Python Distribution Utilities ! release 1.0.2 ! April 20th, 2001 *************** *** 14,24 **** distributions.) ! The Distutils are a standard part of Python 1.6/2.0; if you are running ! 1.6/2.0, you don't need to install the Distutils separately. (But you ! might want to upgrade to Distutils 1.0 if you are using Python 1.6; see ! below.) This release is primarily so that you can add the Distutils to ! a Python 1.5.2 installation -- you will then be able to install modules ! that require the Distutils, or use the Distutils to distribute your own ! modules. More information is available at the Distutils web page: --- 14,23 ---- distributions.) ! The Distutils are a standard part of Python versions 1.6 and higher; ! if you are running 1.6/2.0/2.1, you don't need to install the ! Distutils separately. This release is primarily so that you can add ! the Distutils to a Python 1.5.2 installation -- you will then be able ! to install modules that require the Distutils, or use the Distutils to ! distribute your own modules. More information is available at the Distutils web page: *************** *** 122,131 **** 2.0b2 0.9.3 2.0 1.0.1 ! There's generally no need to install the Distutils under Python 1.6/2.0. ! However, if you'd like to upgrade the Distutils in your Python 1.6 ! installation, or if future Distutils releases get ahead of the Distutils ! included with Python 2.0, you might want to install a newer Distutils ! release into your Python 1.6/2.0 library. To do this, you'll need to hide the original Distutils package directory --- 121,131 ---- 2.0b2 0.9.3 2.0 1.0.1 + 2.1 1.0.2 ! There's generally no need to install the Distutils under Python ! 1.6/2.0/2.1. However, if you'd like to upgrade the Distutils in your ! Python 1.6 installation, or if future Distutils releases get ahead of ! the Distutils included with Python, you might want to install a newer ! Distutils release into your Python installation's library. To do this, you'll need to hide the original Distutils package directory *************** *** 173,177 **** set; Fred Drake maintains a copy of the complete Python documentation at ! http://www.pythonlabs.com/doc/manuals/ Sometimes Fred's version is more recent, and sometimes my version is. --- 173,177 ---- set; Fred Drake maintains a copy of the complete Python documentation at ! http://python.sourceforge.net/devel-docs/ Sometimes Fred's version is more recent, and sometimes my version is. From jhylton@users.sourceforge.net Fri Apr 20 20:04:58 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 20 Apr 2001 12:04:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib asyncore.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32506 Modified Files: asyncore.py Log Message: dispatcher.__repr__() was unprepared to handle the address for a Unix domain socket. Fix that and make the error message for failures a little more helpful by including the class name. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** asyncore.py 2001/02/09 05:03:15 1.10 --- asyncore.py 2001/04/20 19:04:55 1.11 *************** *** 51,54 **** --- 51,55 ---- import socket import sys + import types import os *************** *** 216,232 **** status.append ('connected') if self.addr: ! status.append ('%s:%d' % self.addr) ! return '<%s %s at %x>' % ( ! self.__class__.__name__, ! ' '.join (status), ! id(self) ! ) except: ! try: ! ar = repr(self.addr) ! except: ! ar = 'no self.addr!' ! return '<__repr__ (self) failed for object at %x (addr=%s)>' % (id(self),ar) def add_channel (self, map=None): --- 217,236 ---- status.append ('connected') if self.addr: ! if self.addr == types.TupleType: ! status.append ('%s:%d' % self.addr) ! else: ! status.append (self.addr) ! return '<%s %s at %x>' % (self.__class__.__name__, ! ' '.join (status), id (self)) except: ! pass ! ! try: ! ar = repr (self.addr) ! except AttributeError: ! ar = 'no self.addr!' ! return '<__repr__() failed for %s instance at %x (addr=%s)>' % \ ! (self.__class__.__name__, id (self), ar) def add_channel (self, map=None): *************** *** 300,303 **** --- 304,308 ---- def connect (self, address): self.connected = 0 + # XXX why not use connect_ex? try: self.socket.connect (address) From gvanrossum@users.sourceforge.net Fri Apr 20 20:13:03 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 12:13:03 -0700 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv31661 Modified Files: Makefile.pre.in Log Message: Iterators phase 1. This comprises: new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER new C API PyObject_GetIter(), calls tp_iter new builtin iter(), with two forms: iter(obj), and iter(function, sentinel) new internal object types iterobject and calliterobject new exception StopIteration new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py) new magic number for .pyc files new special method for instances: __iter__() returns an iterator iteration over dictionaries: "for x in dict" iterates over the keys iteration over files: "for x in file" iterates over lines TODO: documentation test suite decide whether to use a different way to spell iter(function, sentinal) decide whether "for key in dict" is a good idea use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?) speed tuning (make next() a slot tp_next???) Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** Makefile.pre.in 2001/04/18 01:20:21 1.36 --- Makefile.pre.in 2001/04/20 19:13:01 1.37 *************** *** 239,242 **** --- 239,243 ---- Objects/funcobject.o \ Objects/intobject.o \ + Objects/iterobject.o \ Objects/listobject.o \ Objects/longobject.o \ *************** *** 434,437 **** --- 435,439 ---- Include/tupleobject.h \ Include/listobject.h \ + Include/iterobject.h \ Include/dictobject.h \ Include/methodobject.h \ From gvanrossum@users.sourceforge.net Fri Apr 20 20:13:04 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 12:13:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib dis.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31661/Lib Modified Files: dis.py Log Message: Iterators phase 1. This comprises: new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER new C API PyObject_GetIter(), calls tp_iter new builtin iter(), with two forms: iter(obj), and iter(function, sentinel) new internal object types iterobject and calliterobject new exception StopIteration new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py) new magic number for .pyc files new special method for instances: __iter__() returns an iterator iteration over dictionaries: "for x in dict" iterates over the keys iteration over files: "for x in file" iterates over lines TODO: documentation test suite decide whether to use a different way to spell iter(function, sentinal) decide whether "for key in dict" is a good idea use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?) speed tuning (make next() a slot tp_next???) Index: dis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dis.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** dis.py 2001/02/09 08:17:37 1.33 --- dis.py 2001/04/20 19:13:01 1.34 *************** *** 206,209 **** --- 206,210 ---- def_op('BINARY_OR', 66) def_op('INPLACE_POWER', 67) + def_op('GET_ITER', 68) def_op('PRINT_EXPR', 70) *************** *** 233,236 **** --- 234,238 ---- name_op('DELETE_NAME', 91) # "" def_op('UNPACK_SEQUENCE', 92) # Number of tuple items + def_op('FOR_ITER', 93) name_op('STORE_ATTR', 95) # Index in name list From gvanrossum@users.sourceforge.net Fri Apr 20 20:13:04 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 12:13:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.58,2.59 classobject.c,2.125,2.126 dictobject.c,2.78,2.79 stringobject.c,2.102,2.103 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31661/Objects Modified Files: abstract.c classobject.c dictobject.c stringobject.c Log Message: Iterators phase 1. This comprises: new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER new C API PyObject_GetIter(), calls tp_iter new builtin iter(), with two forms: iter(obj), and iter(function, sentinel) new internal object types iterobject and calliterobject new exception StopIteration new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py) new magic number for .pyc files new special method for instances: __iter__() returns an iterator iteration over dictionaries: "for x in dict" iterates over the keys iteration over files: "for x in file" iterates over lines TODO: documentation test suite decide whether to use a different way to spell iter(function, sentinal) decide whether "for key in dict" is a good idea use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?) speed tuning (make next() a slot tp_next???) Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -r2.58 -r2.59 *** abstract.c 2001/03/21 18:40:58 2.58 --- abstract.c 2001/04/20 19:13:02 2.59 *************** *** 1739,1740 **** --- 1739,1757 ---- return retval; } + + PyObject * + PyObject_GetIter(PyObject *o) + { + PyTypeObject *t = o->ob_type; + getiterfunc f = NULL; + if (PyType_HasFeature(t, Py_TPFLAGS_HAVE_ITER)) + f = t->tp_iter; + if (f == NULL) { + if (PySequence_Check(o)) + return PyIter_New(o); + PyErr_SetString(PyExc_TypeError, "iter() of non-sequence"); + return NULL; + } + else + return (*f)(o); + } Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.125 retrieving revision 2.126 diff -C2 -r2.125 -r2.126 *** classobject.c 2001/03/23 04:19:27 2.125 --- classobject.c 2001/04/20 19:13:02 2.126 *************** *** 849,853 **** } ! static PyObject *getitemstr, *setitemstr, *delitemstr, *lenstr; static int --- 849,853 ---- } ! static PyObject *getitemstr, *setitemstr, *delitemstr, *lenstr, *iterstr; static int *************** *** 1713,1716 **** --- 1713,1742 ---- + /* Get the iterator */ + static PyObject * + instance_getiter(PyInstanceObject *self) + { + PyObject *func; + + if (iterstr == NULL) + iterstr = PyString_InternFromString("__iter__"); + if (getitemstr == NULL) + getitemstr = PyString_InternFromString("__getitem__"); + + if ((func = instance_getattr(self, iterstr)) != NULL) { + PyObject *res = PyEval_CallObject(func, (PyObject *)NULL); + Py_DECREF(func); + return res; + } + PyErr_Clear(); + if ((func = instance_getattr(self, getitemstr)) == NULL) { + PyErr_SetString(PyExc_TypeError, "iter() of non-sequence"); + return NULL; + } + Py_DECREF(func); + return PyIter_New((PyObject *)self); + } + + static PyNumberMethods instance_as_number = { (binaryfunc)instance_add, /* nb_add */ *************** *** 1776,1780 **** 0, /* tp_clear */ instance_richcompare, /* tp_richcompare */ ! offsetof(PyInstanceObject, in_weakreflist) /* tp_weaklistoffset */ }; --- 1802,1807 ---- 0, /* tp_clear */ instance_richcompare, /* tp_richcompare */ ! offsetof(PyInstanceObject, in_weakreflist), /* tp_weaklistoffset */ ! (getiterfunc)instance_getiter, /* tp_iter */ }; Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.78 retrieving revision 2.79 diff -C2 -r2.78 -r2.79 *** dictobject.c 2001/04/20 16:52:06 2.78 --- dictobject.c 2001/04/20 19:13:02 2.79 *************** *** 1325,1328 **** --- 1325,1330 ---- }; + staticforward PyObject *dictiter_new(dictobject *); + PyTypeObject PyDict_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 1351,1354 **** --- 1353,1358 ---- (inquiry)dict_tp_clear, /* tp_clear */ 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)dictiter_new, /* tp_iter */ }; *************** *** 1393,1394 **** --- 1397,1497 ---- return err; } + + /* Dictionary iterator type */ + + extern PyTypeObject PyDictIter_Type; /* Forward */ + + typedef struct { + PyObject_HEAD + dictobject *di_dict; + int di_size; + int di_pos; + } dictiterobject; + + static PyObject * + dictiter_new(dictobject *dict) + { + dictiterobject *di; + di = PyObject_NEW(dictiterobject, &PyDictIter_Type); + if (di == NULL) + return NULL; + Py_INCREF(dict); + di->di_dict = dict; + di->di_size = dict->ma_size; + di->di_pos = 0; + return (PyObject *)di; + } + + static void + dictiter_dealloc(dictiterobject *di) + { + Py_DECREF(di->di_dict); + PyObject_DEL(di); + } + + static PyObject * + dictiter_next(dictiterobject *di, PyObject *args) + { + PyObject *key; + if (di->di_size != di->di_dict->ma_size) { + PyErr_SetString(PyExc_RuntimeError, + "dictionary changed size during iteration"); + return NULL; + } + if (PyDict_Next((PyObject *)(di->di_dict), &di->di_pos, &key, NULL)) { + Py_INCREF(key); + return key; + } + PyErr_SetObject(PyExc_StopIteration, Py_None); + return NULL; + } + + static PyObject * + dictiter_getiter(PyObject *it) + { + Py_INCREF(it); + return it; + } + + static PyMethodDef dictiter_methods[] = { + {"next", (PyCFunction)dictiter_next, METH_VARARGS, + "it.next() -- get the next value, or raise StopIteration"}, + {NULL, NULL} /* sentinel */ + }; + + static PyObject * + dictiter_getattr(dictiterobject *it, char *name) + { + return Py_FindMethod(dictiter_methods, (PyObject *)it, name); + } + + PyTypeObject PyDictIter_Type = { + PyObject_HEAD_INIT(&PyType_Type) + 0, /* ob_size */ + "dictionary-iterator", /* tp_name */ + sizeof(dictiterobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)dictiter_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + (getattrfunc)dictiter_getattr, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)dictiter_getiter, /* tp_iter */ + }; Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.102 retrieving revision 2.103 diff -C2 -r2.102 -r2.103 *** stringobject.c 2001/04/12 18:38:48 2.102 --- stringobject.c 2001/04/20 19:13:02 2.103 *************** *** 3233,3236 **** --- 3233,3238 ---- { if (interned) { + fprintf(stderr, "releasing interned strings\n"); + PyDict_Clear(interned); Py_DECREF(interned); interned = NULL; From gvanrossum@users.sourceforge.net Fri Apr 20 20:13:04 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 12:13:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include Python.h,2.31,2.32 abstract.h,2.29,2.30 object.h,2.77,2.78 opcode.h,2.34,2.35 pyerrors.h,2.44,2.45 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv31661/Include Modified Files: Python.h abstract.h object.h opcode.h pyerrors.h Log Message: Iterators phase 1. This comprises: new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER new C API PyObject_GetIter(), calls tp_iter new builtin iter(), with two forms: iter(obj), and iter(function, sentinel) new internal object types iterobject and calliterobject new exception StopIteration new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py) new magic number for .pyc files new special method for instances: __iter__() returns an iterator iteration over dictionaries: "for x in dict" iterates over the keys iteration over files: "for x in file" iterates over lines TODO: documentation test suite decide whether to use a different way to spell iter(function, sentinal) decide whether "for key in dict" is a good idea use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?) speed tuning (make next() a slot tp_next???) Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -r2.31 -r2.32 *** Python.h 2001/01/25 20:04:14 2.31 --- Python.h 2001/04/20 19:13:01 2.32 *************** *** 83,86 **** --- 83,87 ---- #include "sliceobject.h" #include "cellobject.h" + #include "iterobject.h" #include "codecs.h" Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -r2.29 -r2.30 *** abstract.h 2001/03/21 18:40:58 2.29 --- abstract.h 2001/04/20 19:13:01 2.30 *************** *** 471,474 **** --- 471,479 ---- */ + DL_IMPORT(PyObject *) PyObject_GetIter(PyObject *); + /* Takes an object and returns an iterator for it. + This is typically a new iterator but if the argument + is an iterator, this returns itself. */ + /* Number Protocol:*/ Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.77 retrieving revision 2.78 diff -C2 -r2.77 -r2.78 *** object.h 2001/02/26 18:56:37 2.77 --- object.h 2001/04/20 19:13:01 2.78 *************** *** 201,204 **** --- 201,205 ---- typedef long (*hashfunc)(PyObject *); typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int); + typedef PyObject *(*getiterfunc) (PyObject *); typedef struct _typeobject { *************** *** 250,255 **** long tp_weaklistoffset; #ifdef COUNT_ALLOCS ! /* these must be last */ int tp_alloc; int tp_free; --- 251,259 ---- long tp_weaklistoffset; + /* Iterators */ + getiterfunc tp_iter; + #ifdef COUNT_ALLOCS ! /* these must be last and never explicitly initialized */ int tp_alloc; int tp_free; *************** *** 343,354 **** #define Py_TPFLAGS_CHECKTYPES (1L<<4) #define Py_TPFLAGS_HAVE_RICHCOMPARE (1L<<5) /* Objects which are weakly referencable if their tp_weaklistoffset is >0 */ - /* XXX Should this have the same value as Py_TPFLAGS_HAVE_RICHCOMPARE? - * These both indicate a feature that appeared in the same alpha release. - */ #define Py_TPFLAGS_HAVE_WEAKREFS (1L<<6) #define Py_TPFLAGS_DEFAULT ( \ Py_TPFLAGS_HAVE_GETCHARBUFFER | \ --- 347,359 ---- #define Py_TPFLAGS_CHECKTYPES (1L<<4) + /* tp_richcompare is defined */ #define Py_TPFLAGS_HAVE_RICHCOMPARE (1L<<5) /* Objects which are weakly referencable if their tp_weaklistoffset is >0 */ #define Py_TPFLAGS_HAVE_WEAKREFS (1L<<6) + /* tp_iter is defined */ + #define Py_TPFLAGS_HAVE_ITER (1L<<7) + #define Py_TPFLAGS_DEFAULT ( \ Py_TPFLAGS_HAVE_GETCHARBUFFER | \ *************** *** 357,360 **** --- 362,366 ---- Py_TPFLAGS_HAVE_RICHCOMPARE | \ Py_TPFLAGS_HAVE_WEAKREFS | \ + Py_TPFLAGS_HAVE_ITER | \ 0) Index: opcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/opcode.h,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -r2.34 -r2.35 *** opcode.h 2001/02/01 22:48:12 2.34 --- opcode.h 2001/04/20 19:13:01 2.35 *************** *** 54,57 **** --- 54,58 ---- #define BINARY_OR 66 #define INPLACE_POWER 67 + #define GET_ITER 68 #define PRINT_EXPR 70 *************** *** 81,84 **** --- 82,86 ---- #define DELETE_NAME 91 /* "" */ #define UNPACK_SEQUENCE 92 /* Number of sequence items */ + #define FOR_ITER 93 #define STORE_ATTR 95 /* Index in name list */ Index: pyerrors.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -r2.44 -r2.45 *** pyerrors.h 2001/02/28 21:44:20 2.44 --- pyerrors.h 2001/04/20 19:13:01 2.45 *************** *** 25,28 **** --- 25,29 ---- extern DL_IMPORT(PyObject *) PyExc_Exception; + extern DL_IMPORT(PyObject *) PyExc_StopIteration; extern DL_IMPORT(PyObject *) PyExc_StandardError; extern DL_IMPORT(PyObject *) PyExc_ArithmeticError; From gvanrossum@users.sourceforge.net Fri Apr 20 20:13:04 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 12:13:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.197,2.198 ceval.c,2.238,2.239 compile.c,2.196,2.197 exceptions.c,1.23,1.24 import.c,2.175,2.176 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv31661/Python Modified Files: bltinmodule.c ceval.c compile.c exceptions.c import.c Log Message: Iterators phase 1. This comprises: new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER new C API PyObject_GetIter(), calls tp_iter new builtin iter(), with two forms: iter(obj), and iter(function, sentinel) new internal object types iterobject and calliterobject new exception StopIteration new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py) new magic number for .pyc files new special method for instances: __iter__() returns an iterator iteration over dictionaries: "for x in dict" iterates over the keys iteration over files: "for x in file" iterates over lines TODO: documentation test suite decide whether to use a different way to spell iter(function, sentinal) decide whether "for key in dict" is a good idea use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?) speed tuning (make next() a slot tp_next???) Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.197 retrieving revision 2.198 diff -C2 -r2.197 -r2.198 *** bltinmodule.c 2001/04/07 20:34:48 2.197 --- bltinmodule.c 2001/04/20 19:13:02 2.198 *************** *** 1313,1316 **** --- 1313,1342 ---- static PyObject * + builtin_iter(PyObject *self, PyObject *args) + { + PyObject *v, *w = NULL; + + if (!PyArg_ParseTuple(args, "O|O:iter", &v, &w)) + return NULL; + if (w == NULL) + return PyObject_GetIter(v); + if (!PyCallable_Check(v)) { + PyErr_SetString(PyExc_TypeError, + "iter(v, w): v must be callable"); + return NULL; + } + return PyCallIter_New(v, w); + } + + static char iter_doc[] = + "iter(collection) -> iterator\n\ + iter(callable, sentinel) -> iterator\n\ + \n\ + Get an iterator from an object. In the first form, the argument must\n\ + supply its own iterator, or be a sequence.\n\ + In the second form, the callable is called until it returns the sentinel."; + + + static PyObject * builtin_len(PyObject *self, PyObject *args) { *************** *** 2149,2152 **** --- 2175,2179 ---- {"isinstance", builtin_isinstance, 1, isinstance_doc}, {"issubclass", builtin_issubclass, 1, issubclass_doc}, + {"iter", builtin_iter, 1, iter_doc}, {"len", builtin_len, 1, len_doc}, {"list", builtin_list, 1, list_doc}, Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.238 retrieving revision 2.239 diff -C2 -r2.238 -r2.239 *** ceval.c 2001/04/13 16:51:46 2.238 --- ceval.c 2001/04/20 19:13:02 2.239 *************** *** 382,385 **** --- 382,386 ---- char *filename = PyString_AsString(co->co_filename); #endif + static PyObject *nextstr; /* Code access macros */ *************** *** 417,420 **** --- 418,426 ---- /* Start of code */ + if (nextstr == NULL) { + nextstr = PyString_InternFromString("next"); + if (nextstr == NULL) + return NULL; + } #ifdef USE_STACKCHECK *************** *** 1874,1877 **** --- 1880,1918 ---- case JUMP_ABSOLUTE: JUMPTO(oparg); + continue; + + case GET_ITER: + /* before: [obj]; after [getiter(obj)] */ + v = POP(); + x = PyObject_GetIter(v); + Py_DECREF(v); + if (x != NULL) { + w = x; + x = PyObject_GetAttr(w, nextstr); + Py_DECREF(w); + if (x != NULL) { + PUSH(x); + continue; + } + } + break; + + case FOR_ITER: + /* before: [iter]; after: [iter, iter()] *or* [] */ + v = TOP(); + x = PyObject_CallObject(v, NULL); + if (x == NULL) { + if (PyErr_ExceptionMatches( + PyExc_StopIteration)) + { + PyErr_Clear(); + x = v = POP(); + Py_DECREF(v); + JUMPBY(oparg); + continue; + } + break; + } + PUSH(x); continue; Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.196 retrieving revision 2.197 diff -C2 -r2.196 -r2.197 *** compile.c 2001/04/14 17:51:48 2.196 --- compile.c 2001/04/20 19:13:02 2.197 *************** *** 1233,1237 **** com_list_for(struct compiling *c, node *n, node *e, char *t) { - PyObject *v; int anchor = 0; int save_begin = c->c_begin; --- 1233,1236 ---- *************** *** 1239,1251 **** /* list_iter: for v in expr [list_iter] */ com_node(c, CHILD(n, 3)); /* expr */ ! v = PyInt_FromLong(0L); ! if (v == NULL) ! c->c_errors++; ! com_addoparg(c, LOAD_CONST, com_addconst(c, v)); ! com_push(c, 1); ! Py_XDECREF(v); c->c_begin = c->c_nexti; com_addoparg(c, SET_LINENO, n->n_lineno); ! com_addfwref(c, FOR_LOOP, &anchor); com_push(c, 1); com_assign(c, CHILD(n, 1), OP_ASSIGN, NULL); --- 1238,1245 ---- /* list_iter: for v in expr [list_iter] */ com_node(c, CHILD(n, 3)); /* expr */ ! com_addbyte(c, GET_ITER); c->c_begin = c->c_nexti; com_addoparg(c, SET_LINENO, n->n_lineno); ! com_addfwref(c, FOR_ITER, &anchor); com_push(c, 1); com_assign(c, CHILD(n, 1), OP_ASSIGN, NULL); *************** *** 1256,1260 **** c->c_begin = save_begin; com_backpatch(c, anchor); ! com_pop(c, 2); /* FOR_LOOP has popped these */ } --- 1250,1254 ---- c->c_begin = save_begin; com_backpatch(c, anchor); ! com_pop(c, 1); /* FOR_ITER has popped this */ } *************** *** 2874,2878 **** com_for_stmt(struct compiling *c, node *n) { - PyObject *v; int break_anchor = 0; int anchor = 0; --- 2868,2871 ---- *************** *** 2883,2895 **** block_push(c, SETUP_LOOP); com_node(c, CHILD(n, 3)); ! v = PyInt_FromLong(0L); ! if (v == NULL) ! c->c_errors++; ! com_addoparg(c, LOAD_CONST, com_addconst(c, v)); ! com_push(c, 1); ! Py_XDECREF(v); c->c_begin = c->c_nexti; com_addoparg(c, SET_LINENO, n->n_lineno); ! com_addfwref(c, FOR_LOOP, &anchor); com_push(c, 1); com_assign(c, CHILD(n, 1), OP_ASSIGN, NULL); --- 2876,2883 ---- block_push(c, SETUP_LOOP); com_node(c, CHILD(n, 3)); ! com_addbyte(c, GET_ITER); c->c_begin = c->c_nexti; com_addoparg(c, SET_LINENO, n->n_lineno); ! com_addfwref(c, FOR_ITER, &anchor); com_push(c, 1); com_assign(c, CHILD(n, 1), OP_ASSIGN, NULL); *************** *** 2900,2904 **** c->c_begin = save_begin; com_backpatch(c, anchor); ! com_pop(c, 2); /* FOR_LOOP has popped these */ com_addbyte(c, POP_BLOCK); block_pop(c, SETUP_LOOP); --- 2888,2892 ---- c->c_begin = save_begin; com_backpatch(c, anchor); ! com_pop(c, 1); /* FOR_ITER has popped this */ com_addbyte(c, POP_BLOCK); block_pop(c, SETUP_LOOP); Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** exceptions.c 2001/04/14 17:51:48 1.23 --- exceptions.c 2001/04/20 19:13:02 1.24 *************** *** 53,56 **** --- 53,57 ---- |\n\ +-- SystemExit\n\ + +-- StopIteration\n\ +-- StandardError\n\ | |\n\ *************** *** 370,373 **** --- 371,377 ---- TypeError__doc__[] = "Inappropriate argument type."; + static char + StopIteration__doc__[] = "Signal the end from iterator.next()."; + *************** *** 925,928 **** --- 929,933 ---- PyObject *PyExc_Exception; + PyObject *PyExc_StopIteration; PyObject *PyExc_StandardError; PyObject *PyExc_ArithmeticError; *************** *** 986,989 **** --- 991,996 ---- */ {"Exception", &PyExc_Exception}, + {"StopIteration", &PyExc_StopIteration, &PyExc_Exception, + StopIteration__doc__}, {"StandardError", &PyExc_StandardError, &PyExc_Exception, StandardError__doc__}, Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.175 retrieving revision 2.176 diff -C2 -r2.175 -r2.176 *** import.c 2001/04/13 17:50:20 2.175 --- import.c 2001/04/20 19:13:02 2.176 *************** *** 44,48 **** added to the .pyc file header? */ /* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */ ! #define MAGIC (60202 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the --- 44,48 ---- added to the .pyc file header? */ /* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */ ! #define MAGIC (60420 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the From gvanrossum@users.sourceforge.net Fri Apr 20 22:06:48 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 14:06:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include iterobject.h,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv23314/Include Added Files: iterobject.h Log Message: Adding iterobject.[ch], which were accidentally not added. Sorry\! From gvanrossum@users.sourceforge.net Fri Apr 20 22:06:48 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 20 Apr 2001 14:06:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects iterobject.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23314/Objects Added Files: iterobject.c Log Message: Adding iterobject.[ch], which were accidentally not added. Sorry\! From tim_one@users.sourceforge.net Fri Apr 20 22:21:31 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 20 Apr 2001 14:21:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild pythoncore.dsp,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv26083/python/dist/src/PCbuild Modified Files: pythoncore.dsp Log Message: Teach Windows about new iterobject.c. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** pythoncore.dsp 2001/04/18 21:12:25 1.14 --- pythoncore.dsp 2001/04/20 21:21:28 1.15 *************** *** 969,972 **** --- 969,987 ---- # Begin Source File + SOURCE=..\Objects\iterobject.c + + !IF "$(CFG)" == "pythoncore - Win32 Release" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Release" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=..\Parser\listnode.c From tim_one@users.sourceforge.net Sat Apr 21 03:46:13 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 20 Apr 2001 19:46:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.239,2.240 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv9515/python/dist/src/Python Modified Files: ceval.c Log Message: SF but #417587: compiler warnings compiling 2.1. Repaired *some* of the SGI compiler warnings Sjoerd Mullender reported. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.239 retrieving revision 2.240 diff -C2 -r2.239 -r2.240 *** ceval.c 2001/04/20 19:13:02 2.239 --- ceval.c 2001/04/21 02:46:11 2.240 *************** *** 2147,2151 **** oparg = oparg<<16 | NEXTARG(); goto dispatch_opcode; - break; default: --- 2147,2150 ---- From tim_one@users.sourceforge.net Sat Apr 21 03:46:13 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 20 Apr 2001 19:46:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Parser tokenizer.c,2.49,2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv9515/python/dist/src/Parser Modified Files: tokenizer.c Log Message: SF but #417587: compiler warnings compiling 2.1. Repaired *some* of the SGI compiler warnings Sjoerd Mullender reported. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -r2.49 -r2.50 *** tokenizer.c 2000/09/01 23:29:28 2.49 --- tokenizer.c 2001/04/21 02:46:11 2.50 *************** *** 446,450 **** case '=': return LEFTSHIFTEQUAL; - break; } break; --- 446,449 ---- *************** *** 457,461 **** case '=': return RIGHTSHIFTEQUAL; - break; } break; --- 456,459 ---- *************** *** 468,472 **** case '=': return DOUBLESTAREQUAL; - break; } break; --- 466,469 ---- From tim_one@users.sourceforge.net Sat Apr 21 03:46:13 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 20 Apr 2001 19:46:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules mmapmodule.c,2.27,2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv9515/python/dist/src/Modules Modified Files: mmapmodule.c Log Message: SF but #417587: compiler warnings compiling 2.1. Repaired *some* of the SGI compiler warnings Sjoerd Mullender reported. Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -r2.27 -r2.28 *** mmapmodule.c 2001/01/14 05:05:51 2.27 --- mmapmodule.c 2001/04/21 02:46:11 2.28 *************** *** 819,823 **** prot, flags, fd, 0); ! if (m_obj->data == (void *)-1) { Py_DECREF(m_obj); --- 819,823 ---- prot, flags, fd, 0); ! if (m_obj->data == (char *)-1) { Py_DECREF(m_obj); From tim_one@users.sourceforge.net Sat Apr 21 03:46:13 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 20 Apr 2001 19:46:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.85,2.86 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9515/python/dist/src/Objects Modified Files: unicodeobject.c Log Message: SF but #417587: compiler warnings compiling 2.1. Repaired *some* of the SGI compiler warnings Sjoerd Mullender reported. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.85 retrieving revision 2.86 diff -C2 -r2.85 -r2.86 *** unicodeobject.c 2001/04/19 21:55:14 2.85 --- unicodeobject.c 2001/04/21 02:46:11 2.86 *************** *** 672,681 **** errmsg = "unexpected code byte"; goto utf8Error; - break; case 1: errmsg = "internal error"; goto utf8Error; - break; case 2: --- 672,679 ---- *************** *** 741,745 **** errmsg = "unsupported Unicode code range"; goto utf8Error; - break; } s += n; --- 739,742 ---- From tim_one@users.sourceforge.net Sat Apr 21 04:20:49 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 20 Apr 2001 20:20:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.94,1.95 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13487/python/dist/src/Misc Modified Files: ACKS Log Message: SF bug #417508: 'hypot' not found with Borland C++Build. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -r1.94 -r1.95 *** ACKS 2001/04/15 20:48:27 1.94 --- ACKS 2001/04/21 03:20:47 1.95 *************** *** 154,157 **** --- 154,158 ---- Manus Hand Milton L. Hankins + Stephen Hansen Barry Hantman Lynda Hardman From tim_one@users.sourceforge.net Sat Apr 21 04:20:49 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 20 Apr 2001 20:20:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/PC config.h,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv13487/python/dist/src/PC Modified Files: config.h Log Message: SF bug #417508: 'hypot' not found with Borland C++Build. Index: config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/config.h,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -r1.50 -r1.51 *** config.h 2001/04/18 21:12:25 1.50 --- config.h 2001/04/21 03:20:47 1.51 *************** *** 177,180 **** --- 177,182 ---- #define LONG_LONG __int64 + #undef HAVE_HYPOT + #else /* !_WIN32 */ #error "Only Win32 and later are supported" From fdrake@users.sourceforge.net Sat Apr 21 06:48:09 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 20 Apr 2001 22:48:09 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.99,1.100 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv28190/perl Modified Files: python.perl Log Message: The (fairly recent) \textasciicircum is not supported by LaTeX2HTML; add support for it here. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -r1.99 -r1.100 *** python.perl 2001/04/18 03:11:04 1.99 --- python.perl 2001/04/21 05:48:07 1.100 *************** *** 87,90 **** --- 87,91 ---- sub do_cmd_textasciitilde{ '~' . @_[0]; } + sub do_cmd_textasciicircum{ '^' . @_[0]; } From fdrake@users.sourceforge.net Sat Apr 21 06:56:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 20 Apr 2001 22:56:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libcurses.tex,1.31,1.32 librandom.tex,1.24,1.25 libstdtypes.tex,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv29109/lib Modified Files: libcurses.tex librandom.tex libstdtypes.tex Log Message: Fix a number of minor markup errors. Index: libcurses.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcurses.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** libcurses.tex 2001/04/10 18:49:09 1.31 --- libcurses.tex 2001/04/21 05:56:06 1.32 *************** *** 511,516 **** Returns a string which is a printable representation of the character \var{ch}. Control characters are displayed as a caret followed by the ! character, for example as \verb|^C|. Printing characters are left as they ! are. \end{funcdesc} --- 511,516 ---- Returns a string which is a printable representation of the character \var{ch}. Control characters are displayed as a caret followed by the ! character, for example as \code{\textasciicircum C}. Printing ! characters are left as they are. \end{funcdesc} Index: librandom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librandom.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** librandom.tex 2001/02/02 02:42:31 1.24 --- librandom.tex 2001/04/21 05:56:06 1.25 *************** *** 99,106 **** Initialize the basic random number generator. Optional argument \var{x} can be any hashable object. ! If \var(x) is omitted or \code{None}, current system time is used; current system time is also used to initialize the generator when the module is first imported. ! If \var(x) is not \code{None} or an int or long, \code{hash(\var{x})} is used instead. If \var{x} is an int or long, \var{x} is used directly. --- 99,106 ---- Initialize the basic random number generator. Optional argument \var{x} can be any hashable object. ! If \var{x} is omitted or \code{None}, current system time is used; current system time is also used to initialize the generator when the module is first imported. ! If \var{x} is not \code{None} or an int or long, \code{hash(\var{x})} is used instead. If \var{x} is an int or long, \var{x} is used directly. *************** *** 138,142 **** were called \var{n} times, but do so quickly. \var{n} is a non-negative integer. This is most useful in multi-threaded ! programs, in conjuction with multiple instances of the \var{Random} class: \method{setstate()} or \method{seed()} can be used to force all instances into the same internal state, and then --- 138,142 ---- were called \var{n} times, but do so quickly. \var{n} is a non-negative integer. This is most useful in multi-threaded ! programs, in conjuction with multiple instances of the \class{Random} class: \method{setstate()} or \method{seed()} can be used to force all instances into the same internal state, and then Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -r1.53 -r1.54 *** libstdtypes.tex 2001/04/20 16:50:40 1.53 --- libstdtypes.tex 2001/04/21 05:56:06 1.54 *************** *** 886,894 **** \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}}, else \var{x}} {(4)} \lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}}, else \var{x} (also setting it)} {(5)} --- 886,894 ---- \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, else \var{x}} {(4)} \lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, else \var{x} (also setting it)} {(5)} From fdrake@users.sourceforge.net Sat Apr 21 06:56:30 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 20 Apr 2001 22:56:30 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.98.2.1,1.98.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv29173/perl Modified Files: Tag: release21-maint python.perl Log Message: The (fairly recent) \textasciicircum is not supported by LaTeX2HTML; add support for it here. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.98.2.1 retrieving revision 1.98.2.2 diff -C2 -r1.98.2.1 -r1.98.2.2 *** python.perl 2001/04/18 17:29:14 1.98.2.1 --- python.perl 2001/04/21 05:56:28 1.98.2.2 *************** *** 87,90 **** --- 87,91 ---- sub do_cmd_textasciitilde{ '~' . @_[0]; } + sub do_cmd_textasciicircum{ '^' . @_[0]; } From fdrake@users.sourceforge.net Sat Apr 21 06:56:41 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 20 Apr 2001 22:56:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libcurses.tex,1.31,1.31.2.1 librandom.tex,1.24,1.24.4.1 libstdtypes.tex,1.52,1.52.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv29193/lib Modified Files: Tag: release21-maint libcurses.tex librandom.tex libstdtypes.tex Log Message: Fix a number of minor markup errors. Index: libcurses.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcurses.tex,v retrieving revision 1.31 retrieving revision 1.31.2.1 diff -C2 -r1.31 -r1.31.2.1 *** libcurses.tex 2001/04/10 18:49:09 1.31 --- libcurses.tex 2001/04/21 05:56:39 1.31.2.1 *************** *** 511,516 **** Returns a string which is a printable representation of the character \var{ch}. Control characters are displayed as a caret followed by the ! character, for example as \verb|^C|. Printing characters are left as they ! are. \end{funcdesc} --- 511,516 ---- Returns a string which is a printable representation of the character \var{ch}. Control characters are displayed as a caret followed by the ! character, for example as \code{\textasciicircum C}. Printing ! characters are left as they are. \end{funcdesc} Index: librandom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librandom.tex,v retrieving revision 1.24 retrieving revision 1.24.4.1 diff -C2 -r1.24 -r1.24.4.1 *** librandom.tex 2001/02/02 02:42:31 1.24 --- librandom.tex 2001/04/21 05:56:39 1.24.4.1 *************** *** 99,106 **** Initialize the basic random number generator. Optional argument \var{x} can be any hashable object. ! If \var(x) is omitted or \code{None}, current system time is used; current system time is also used to initialize the generator when the module is first imported. ! If \var(x) is not \code{None} or an int or long, \code{hash(\var{x})} is used instead. If \var{x} is an int or long, \var{x} is used directly. --- 99,106 ---- Initialize the basic random number generator. Optional argument \var{x} can be any hashable object. ! If \var{x} is omitted or \code{None}, current system time is used; current system time is also used to initialize the generator when the module is first imported. ! If \var{x} is not \code{None} or an int or long, \code{hash(\var{x})} is used instead. If \var{x} is an int or long, \var{x} is used directly. *************** *** 138,142 **** were called \var{n} times, but do so quickly. \var{n} is a non-negative integer. This is most useful in multi-threaded ! programs, in conjuction with multiple instances of the \var{Random} class: \method{setstate()} or \method{seed()} can be used to force all instances into the same internal state, and then --- 138,142 ---- were called \var{n} times, but do so quickly. \var{n} is a non-negative integer. This is most useful in multi-threaded ! programs, in conjuction with multiple instances of the \class{Random} class: \method{setstate()} or \method{seed()} can be used to force all instances into the same internal state, and then Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.52 retrieving revision 1.52.4.1 diff -C2 -r1.52 -r1.52.4.1 *** libstdtypes.tex 2001/02/27 03:32:35 1.52 --- libstdtypes.tex 2001/04/21 05:56:39 1.52.4.1 *************** *** 868,874 **** \lineiii{\var{a}.clear()}{remove all items from \code{a}}{} \lineiii{\var{a}.copy()}{a (shallow) copy of \code{a}}{} ! \lineiii{\var{a}.has_key(\var{k})} {\code{1} if \var{a} has a key \var{k}, else \code{0}} {} \lineiii{\var{a}.items()} {a copy of \var{a}'s list of (\var{key}, \var{value}) pairs} --- 868,880 ---- \lineiii{\var{a}.clear()}{remove all items from \code{a}}{} \lineiii{\var{a}.copy()}{a (shallow) copy of \code{a}}{} ! \lineiii{\var{k} \code{in} \var{a}} {\code{1} if \var{a} has a key \var{k}, else \code{0}} {} + \lineiii{\var{k} not in \var{a}} + {\code{0} if \var{a} has a key \var{k}, else \code{1}} + {} + \lineiii{\var{a}.has_key(\var{k})} + {Equivalent to \var{k} \code{in} \var{a}} + {} \lineiii{\var{a}.items()} {a copy of \var{a}'s list of (\var{key}, \var{value}) pairs} *************** *** 880,888 **** \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{a}.has_key(\var{k})}, else \var{x}} {(4)} \lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{a}.has_key(\var{k})}, else \var{x} (also setting it)} {(5)} --- 886,894 ---- \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, else \var{x}} {(4)} \lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, else \var{x} (also setting it)} {(5)} From fdrake@users.sourceforge.net Sat Apr 21 07:00:53 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 20 Apr 2001 23:00:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv conversion.xml,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv29606 Modified Files: conversion.xml Log Message: Add support for (needs markup improvement!). Update to recent addition of optional explanatory text; make the explanation text take the same attribute name for both and . Index: conversion.xml =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/conversion.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** conversion.xml 2001/04/10 19:59:31 1.12 --- conversion.xml 2001/04/21 06:00:51 1.13 *************** *** 54,57 **** --- 54,58 ---- + *************** *** 61,65 **** --> ! --- 62,66 ---- --> ! *************** *** 136,139 **** --- 137,143 ---- + + + From fdrake@users.sourceforge.net Sat Apr 21 07:01:55 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 20 Apr 2001 23:01:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv esistools.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv29783 Modified Files: esistools.py Log Message: encode(): Handle Latin-1 input characters better. Index: esistools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/esistools.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** esistools.py 2001/03/23 17:09:02 1.6 --- esistools.py 2001/04/21 06:01:53 1.7 *************** *** 36,41 **** _charmap = {} ! for c in map(chr, range(256)): ! _charmap[c] = c _charmap["\n"] = r"\n" _charmap["\\"] = r"\\" --- 36,42 ---- _charmap = {} ! for c in range(128): ! _charmap[chr(c)] = chr(c) ! _charmap[unichr(c + 128)] = chr(c + 128) _charmap["\n"] = r"\n" _charmap["\\"] = r"\\" *************** *** 44,48 **** _null_join = ''.join def encode(s): ! return _null_join(map(_charmap.get, s)) --- 45,52 ---- _null_join = ''.join def encode(s): ! try: ! return _null_join(map(_charmap.get, s)) ! except TypeError: ! raise Exception("could not encode %r: %r" % (s, map(_charmap.get, s))) From tim_one@users.sourceforge.net Sat Apr 21 10:13:18 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 21 Apr 2001 02:13:18 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_userdict.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17897/python/dist/src/Lib/test Modified Files: test_userdict.py Log Message: Give UserDict new __contains__ and __iter__ methods. Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_userdict.py 2001/01/17 19:11:13 1.2 --- test_userdict.py 2001/04/21 09:13:15 1.3 *************** *** 82,91 **** verify(u2.values() == d2.values()) ! # Test has_key for i in u2.keys(): verify(u2.has_key(i) == 1) verify(u1.has_key(i) == d1.has_key(i)) verify(u0.has_key(i) == d0.has_key(i)) # Test update --- 82,94 ---- verify(u2.values() == d2.values()) ! # Test has_key and "in". for i in u2.keys(): verify(u2.has_key(i) == 1) + verify((i in u2) == 1) verify(u1.has_key(i) == d1.has_key(i)) + verify((i in u1) == (i in d1)) verify(u0.has_key(i) == d0.has_key(i)) + verify((i in u0) == (i in d0)) # Test update *************** *** 101,102 **** --- 104,116 ---- verify(u1.get(i) == d1.get(i)) verify(u0.get(i) == d0.get(i)) + + # Test "in" iteration. + for i in xrange(20): + u2[i] = str(i) + ikeys = [] + for k in u2: + ikeys.append(k) + ikeys.sort() + keys = u2.keys() + keys.sort() + verify(ikeys == keys) From tim_one@users.sourceforge.net Sat Apr 21 10:13:17 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 21 Apr 2001 02:13:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib UserDict.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17897/python/dist/src/Lib Modified Files: UserDict.py Log Message: Give UserDict new __contains__ and __iter__ methods. Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** UserDict.py 2001/02/18 03:30:53 1.11 --- UserDict.py 2001/04/21 09:13:15 1.12 *************** *** 41,42 **** --- 41,46 ---- def popitem(self): return self.data.popitem() + def __contains__(self, key): + return key in self.data + def __iter__(self): + return iter(self.data) From gvanrossum@users.sourceforge.net Sat Apr 21 14:20:20 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 21 Apr 2001 06:20:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.110,2.111 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13379 Modified Files: fileobject.c Log Message: Oops, forgot to merge this from the iter-branch to the trunk. This adds "for line in file" iteration, as promised. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.110 retrieving revision 2.111 diff -C2 -r2.110 -r2.111 *** fileobject.c 2001/04/14 17:49:40 2.110 --- fileobject.c 2001/04/21 13:20:18 2.111 *************** *** 1298,1301 **** --- 1298,1316 ---- } + static PyObject * + file_getiter(PyFileObject *f) + { + static PyObject *es; + PyObject *iter; + PyObject *rl = Py_FindMethod(file_methods, (PyObject *)f, "readline"); + if (rl == NULL) + return NULL; + if (es == NULL) + es = PyString_FromString(""); + iter = PyCallIter_New(rl, es); + Py_DECREF(rl); + return iter; + } + PyTypeObject PyFile_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 1304,1313 **** sizeof(PyFileObject), 0, ! (destructor)file_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! (getattrfunc)file_getattr, /*tp_getattr*/ ! (setattrfunc)file_setattr, /*tp_setattr*/ ! 0, /*tp_compare*/ ! (reprfunc)file_repr, /*tp_repr*/ }; --- 1319,1344 ---- sizeof(PyFileObject), 0, ! (destructor)file_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! (getattrfunc)file_getattr, /* tp_getattr */ ! (setattrfunc)file_setattr, /* tp_setattr */ ! 0, /* tp_compare */ ! (reprfunc)file_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! (getiterfunc)file_getiter, /* tp_iter */ }; *************** *** 1478,1482 **** return fd; } - - - --- 1509,1510 ---- From gvanrossum@users.sourceforge.net Sat Apr 21 14:33:56 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 21 Apr 2001 06:33:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15464/test Added Files: test_iter.py Log Message: Add test suite for iterators. From gvanrossum@users.sourceforge.net Sat Apr 21 14:33:56 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 21 Apr 2001 06:33:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_iter,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv15464/test/output Added Files: test_iter Log Message: Add test suite for iterators. From nascheme@users.sourceforge.net Sat Apr 21 18:41:18 2001 From: nascheme@users.sourceforge.net (Neil Schemenauer) Date: Sat, 21 Apr 2001 10:41:18 -0700 Subject: [Python-checkins] CVS: python/dist/src configure,1.208,1.209 configure.in,1.216,1.217 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv16026 Modified Files: configure configure.in Log Message: Process Setup* files with makesetup in the same order as the makefile. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.208 retrieving revision 1.209 diff -C2 -r1.208 -r1.209 *** configure 2001/04/18 04:37:57 1.208 --- configure 2001/04/21 17:41:16 1.209 *************** *** 5107,5111 **** /* Ultrix mips cc rejects this. */ ! typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; --- 5107,5111 ---- /* Ultrix mips cc rejects this. */ ! typedef int charset[2]; const charset x = {0,0}; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; *************** *** 6643,6646 **** $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ -s Modules Modules/Setup.config \ ! Modules/Setup Modules/Setup.local mv config.c Modules --- 6643,6646 ---- $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ -s Modules Modules/Setup.config \ ! Modules/Setup.local Modules/Setup mv config.c Modules Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.216 retrieving revision 1.217 diff -C2 -r1.216 -r1.217 *** configure.in 2001/04/18 04:37:57 1.216 --- configure.in 2001/04/21 17:41:16 1.217 *************** *** 1386,1389 **** $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ -s Modules Modules/Setup.config \ ! Modules/Setup Modules/Setup.local mv config.c Modules --- 1386,1389 ---- $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ -s Modules Modules/Setup.config \ ! Modules/Setup.local Modules/Setup mv config.c Modules From fdrake@users.sourceforge.net Sun Apr 22 02:56:53 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 21 Apr 2001 18:56:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv17090/lib Modified Files: libstdtypes.tex Log Message: Only document .xreadlines() once; added version annotation. This closes SF bug #417943. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -r1.54 -r1.55 *** libstdtypes.tex 2001/04/21 05:56:06 1.54 --- libstdtypes.tex 2001/04/22 01:56:51 1.55 *************** *** 1193,1197 **** \begin{methoddesc}[file]{xreadlines}{} ! Equivalent to \function{xreadlines.xreadlines(file)}.\refstmodindex{xreadlines} \end{methoddesc} --- 1193,1200 ---- \begin{methoddesc}[file]{xreadlines}{} ! Equivalent to ! \function{xreadlines.xreadlines(\var{file})}.\refstmodindex{xreadlines} ! (See the \refmodule{xreadlines} module for more information.) ! \versionadded{2.1} \end{methoddesc} *************** *** 1232,1241 **** (The name is intended to match \method{readlines()}; \method{writelines()} does not add line separators.) - \end{methoddesc} - - \begin{methoddesc}[file]{xreadlines}{} - Equivalent to - \function{xreadlines.xreadlines(\var{file})}.\refstmodindex{xreadlines} - (See the \refmodule{xreadlines} module for more information.) \end{methoddesc} --- 1235,1238 ---- From fdrake@users.sourceforge.net Sun Apr 22 02:58:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 21 Apr 2001 18:58:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.52.4.1,1.52.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv17210/lib Modified Files: Tag: release21-maint libstdtypes.tex Log Message: Only document .xreadlines() once; added version annotation. This closes SF bug #417943 (in the maintenance branch). Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.52.4.1 retrieving revision 1.52.4.2 diff -C2 -r1.52.4.1 -r1.52.4.2 *** libstdtypes.tex 2001/04/21 05:56:39 1.52.4.1 --- libstdtypes.tex 2001/04/22 01:58:00 1.52.4.2 *************** *** 1193,1197 **** \begin{methoddesc}[file]{xreadlines}{} ! Equivalent to \function{xreadlines.xreadlines(file)}.\refstmodindex{xreadlines} \end{methoddesc} --- 1193,1200 ---- \begin{methoddesc}[file]{xreadlines}{} ! Equivalent to ! \function{xreadlines.xreadlines(\var{file})}.\refstmodindex{xreadlines} ! (See the \refmodule{xreadlines} module for more information.) ! \versionadded{2.1} \end{methoddesc} *************** *** 1232,1241 **** (The name is intended to match \method{readlines()}; \method{writelines()} does not add line separators.) - \end{methoddesc} - - \begin{methoddesc}[file]{xreadlines}{} - Equivalent to - \function{xreadlines.xreadlines(\var{file})}.\refstmodindex{xreadlines} - (See the \refmodule{xreadlines} module for more information.) \end{methoddesc} --- 1235,1238 ---- From fdrake@users.sourceforge.net Sun Apr 22 07:19:31 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 21 Apr 2001 23:19:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.6,1.6.2.1 update-docs.sh,1.6,1.6.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv16005 Modified Files: Tag: release21-maint push-docs.sh update-docs.sh Log Message: Update publish-to-SourceForge scripts to automatically determine if the branch is the head (development) branch or a maintenance brach, and use the appropriate target directory for each. Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -r1.6 -r1.6.2.1 *** push-docs.sh 2001/04/13 05:13:55 1.6 --- push-docs.sh 2001/04/22 06:19:29 1.6.2.1 *************** *** 8,11 **** --- 8,21 ---- ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' + VERSION=`echo '$Revision$' | sed 's/[$]Revision: \(.*\) [$]/\1/'` + EXTRA=`echo "$VERSION" | sed 's/^[0-9][0-9]*\.[0-9][0-9]*//'` + if [ "$EXTRA" ] ; then + DOCLABEL="maintenance" + DOCTYPE="maint" + else + DOCLABEL="development" + DOCTYPE="devel" + fi + EXPLANATION='' *************** *** 31,40 **** PACKAGE="html-$RELEASE.tar.bz2" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ! ssh python.sourceforge.net tmp/update-docs.sh $PACKAGE '&&' rm tmp/update-docs.sh || exit $? ! Mail -s '[development doc updates]' $ADDRESSES < Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv16167 Modified Files: push-docs.sh update-docs.sh Log Message: Update publish-to-SourceForge scripts to automatically determine if the branch is the head (development) branch or a maintenance brach, and use the appropriate target directory for each. Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** push-docs.sh 2001/04/13 05:13:55 1.6 --- push-docs.sh 2001/04/22 06:20:31 1.7 *************** *** 8,11 **** --- 8,21 ---- ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' + VERSION=`echo '$Revision$' | sed 's/[$]Revision: \(.*\) [$]/\1/'` + EXTRA=`echo "$VERSION" | sed 's/^[0-9][0-9]*\.[0-9][0-9]*//'` + if [ "$EXTRA" ] ; then + DOCLABEL="maintenance" + DOCTYPE="maint" + else + DOCLABEL="development" + DOCTYPE="devel" + fi + EXPLANATION='' *************** *** 31,40 **** PACKAGE="html-$RELEASE.tar.bz2" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ! ssh python.sourceforge.net tmp/update-docs.sh $PACKAGE '&&' rm tmp/update-docs.sh || exit $? ! Mail -s '[development doc updates]' $ADDRESSES < Update of /cvsroot/python/python/nondist/sf-html In directory usw-pr-cvs1:/tmp/cvs-serv16376 Modified Files: index.html Log Message: Add link to the maintenance version of the Python documentation. Index: index.html =================================================================== RCS file: /cvsroot/python/python/nondist/sf-html/index.html,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** index.html 2001/02/15 16:14:36 1.11 --- index.html 2001/04/22 06:22:21 1.12 *************** *** 36,43 ****
  • Development version of the documentation - Straight from Fred's working files.
  • -
  • --- 36,47 ----
  • + Maintenance version of the documentation + - Built from Python's bug-fix branch. +
  • + +
  • Development version of the documentation - Straight from Fred's working files.
  • From loewis@informatik.hu-berlin.de Mon Apr 23 09:02:47 2001 From: loewis@informatik.hu-berlin.de (Martin von Loewis) Date: Mon, 23 Apr 2001 10:02:47 +0200 (MEST) Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.82,2.83 In-Reply-To: <3ADE0DBB.BE794660@lemburg.com> (mal@lemburg.com) References: <3ADE0DBB.BE794660@lemburg.com> Message-ID: <200104230802.KAA19576@pandora.informatik.hu-berlin.de> > Hmm, why didn't you post the modified patch to SF first ? > There are some things which need tweaking before going prime time... Your comment "The patch looks OK, but please also add proper init and finalize code" indicated that the patch would be ok after those changes are applied; there was no indication that further tweaking is necessary. I have re-opened the patch now > Please also check why test_unicodedata fails with the patch > applied. I did; please see the revised patch. Regards, Martin From gvanrossum@users.sourceforge.net Mon Apr 23 14:23:01 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 06:23:01 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv19391 Modified Files: libstdtypes.tex Log Message: At the suggestion of Peter Funk, document 'key in dict' and 'key not in dict' after has_key(), with a \versionadded{2.2} note. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -r1.55 -r1.56 *** libstdtypes.tex 2001/04/22 01:56:51 1.55 --- libstdtypes.tex 2001/04/23 13:22:59 1.56 *************** *** 868,880 **** \lineiii{\var{a}.clear()}{remove all items from \code{a}}{} \lineiii{\var{a}.copy()}{a (shallow) copy of \code{a}}{} ! \lineiii{\var{k} \code{in} \var{a}} {\code{1} if \var{a} has a key \var{k}, else \code{0}} {} \lineiii{\var{k} not in \var{a}} ! {\code{0} if \var{a} has a key \var{k}, else \code{1}} ! {} ! \lineiii{\var{a}.has_key(\var{k})} ! {Equivalent to \var{k} \code{in} \var{a}} ! {} \lineiii{\var{a}.items()} {a copy of \var{a}'s list of (\var{key}, \var{value}) pairs} --- 868,880 ---- \lineiii{\var{a}.clear()}{remove all items from \code{a}}{} \lineiii{\var{a}.copy()}{a (shallow) copy of \code{a}}{} ! \lineiii{\var{a}.has_key(\var{k})} {\code{1} if \var{a} has a key \var{k}, else \code{0}} {} + \lineiii{\var{k} \code{in} \var{a}} + {Equivalent to \var{a}.has_key(\var{k})} + {\versionadded{2.2}} \lineiii{\var{k} not in \var{a}} ! {Equivalent to \code{not} \var{a}.has_key(\var{k})} ! {\versionadded{2.2}} \lineiii{\var{a}.items()} {a copy of \var{a}'s list of (\var{key}, \var{value}) pairs} From gvanrossum@users.sourceforge.net Mon Apr 23 15:08:51 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 07:08:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include abstract.h,2.30,2.31 iterobject.h,1.2,1.3 object.h,2.78,2.79 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv26282/Include Modified Files: abstract.h iterobject.h object.h Log Message: Mondo changes to the iterator stuff, without changing how Python code sees it (test_iter.py is unchanged). - Added a tp_iternext slot, which calls the iterator's next() method; this is much faster for built-in iterators over built-in types such as lists and dicts, speeding up pybench's ForLoop with about 25% compared to Python 2.1. (Now there's a good argument for iterators. ;-) - Renamed the built-in sequence iterator SeqIter, affecting the C API functions for it. (This frees up the PyIter prefix for generic iterator operations.) - Added PyIter_Check(obj), which checks that obj's type has a tp_iternext slot and that the proper feature flag is set. - Added PyIter_Next(obj) which calls the tp_iternext slot. It has a somewhat complex return condition due to the need for speed: when it returns NULL, it may not have set an exception condition, meaning the iterator is exhausted; when the exception StopIteration is set (or a derived exception class), it means the same thing; any other exception means some other error occurred. Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -r2.30 -r2.31 *** abstract.h 2001/04/20 19:13:01 2.30 --- abstract.h 2001/04/23 14:08:49 2.31 *************** *** 471,478 **** --- 471,491 ---- */ + /* Iterators */ + DL_IMPORT(PyObject *) PyObject_GetIter(PyObject *); /* Takes an object and returns an iterator for it. This is typically a new iterator but if the argument is an iterator, this returns itself. */ + + #define PyIter_Check(obj) \ + (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_ITER) && \ + (obj)->ob_type->tp_iternext != NULL) + + DL_IMPORT(PyObject *) PyIter_Next(PyObject *); + /* Takes an iterator object and calls its tp_iternext slot, + returning the next value. If the iterator is exhausted, + this can return NULL without setting an exception, *or* + NULL with a StopIteration exception. + NULL with any other exception means an error occurred. */ /* Number Protocol:*/ Index: iterobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/iterobject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iterobject.h 2001/04/20 21:06:45 1.2 --- iterobject.h 2001/04/23 14:08:49 1.3 *************** *** 1,9 **** /* Iterators (the basic kind, over a sequence) */ ! extern DL_IMPORT(PyTypeObject) PyIter_Type; ! #define PyIter_Check(op) ((op)->ob_type == &PyIter_Type) ! extern DL_IMPORT(PyObject *) PyIter_New(PyObject *); extern DL_IMPORT(PyTypeObject) PyCallIter_Type; --- 1,9 ---- /* Iterators (the basic kind, over a sequence) */ ! extern DL_IMPORT(PyTypeObject) PySeqIter_Type; ! #define PySeqIter_Check(op) ((op)->ob_type == &PySeqIter_Type) ! extern DL_IMPORT(PyObject *) PySeqIter_New(PyObject *); extern DL_IMPORT(PyTypeObject) PyCallIter_Type; Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.78 retrieving revision 2.79 diff -C2 -r2.78 -r2.79 *** object.h 2001/04/20 19:13:01 2.78 --- object.h 2001/04/23 14:08:49 2.79 *************** *** 202,205 **** --- 202,206 ---- typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int); typedef PyObject *(*getiterfunc) (PyObject *); + typedef PyObject *(*iternextfunc) (PyObject *); typedef struct _typeobject { *************** *** 253,256 **** --- 254,258 ---- /* Iterators */ getiterfunc tp_iter; + iternextfunc tp_iternext; #ifdef COUNT_ALLOCS From gvanrossum@users.sourceforge.net Mon Apr 23 15:08:51 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 07:08:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.59,2.60 classobject.c,2.126,2.127 dictobject.c,2.79,2.80 fileobject.c,2.111,2.112 iterobject.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv26282/Objects Modified Files: abstract.c classobject.c dictobject.c fileobject.c iterobject.c Log Message: Mondo changes to the iterator stuff, without changing how Python code sees it (test_iter.py is unchanged). - Added a tp_iternext slot, which calls the iterator's next() method; this is much faster for built-in iterators over built-in types such as lists and dicts, speeding up pybench's ForLoop with about 25% compared to Python 2.1. (Now there's a good argument for iterators. ;-) - Renamed the built-in sequence iterator SeqIter, affecting the C API functions for it. (This frees up the PyIter prefix for generic iterator operations.) - Added PyIter_Check(obj), which checks that obj's type has a tp_iternext slot and that the proper feature flag is set. - Added PyIter_Next(obj) which calls the tp_iternext slot. It has a somewhat complex return condition due to the need for speed: when it returns NULL, it may not have set an exception condition, meaning the iterator is exhausted; when the exception StopIteration is set (or a derived exception class), it means the same thing; any other exception means some other error occurred. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.59 retrieving revision 2.60 diff -C2 -r2.59 -r2.60 *** abstract.c 2001/04/20 19:13:02 2.59 --- abstract.c 2001/04/23 14:08:49 2.60 *************** *** 1749,1757 **** if (f == NULL) { if (PySequence_Check(o)) ! return PyIter_New(o); PyErr_SetString(PyExc_TypeError, "iter() of non-sequence"); return NULL; } ! else ! return (*f)(o); } --- 1749,1779 ---- if (f == NULL) { if (PySequence_Check(o)) ! return PySeqIter_New(o); PyErr_SetString(PyExc_TypeError, "iter() of non-sequence"); return NULL; } ! else { ! PyObject *res = (*f)(o); ! if (res != NULL && !PyIter_Check(res)) { ! PyErr_Format(PyExc_TypeError, ! "iter() returned non-iterator " ! "of type '%.100s'", ! res->ob_type->tp_name); ! Py_DECREF(res); ! res = NULL; ! } ! return res; ! } ! } ! ! PyObject * ! PyIter_Next(PyObject *iter) ! { ! if (!PyIter_Check(iter)) { ! PyErr_Format(PyExc_TypeError, ! "'%.100s' object is not an iterator", ! iter->ob_type->tp_name); ! return NULL; ! } ! return (*iter->ob_type->tp_iternext)(iter); } Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.126 retrieving revision 2.127 diff -C2 -r2.126 -r2.127 *** classobject.c 2001/04/20 19:13:02 2.126 --- classobject.c 2001/04/23 14:08:49 2.127 *************** *** 849,853 **** } ! static PyObject *getitemstr, *setitemstr, *delitemstr, *lenstr, *iterstr; static int --- 849,854 ---- } ! static PyObject *getitemstr, *setitemstr, *delitemstr, *lenstr; ! static PyObject *iterstr, *nextstr; static int *************** *** 1727,1730 **** --- 1728,1739 ---- PyObject *res = PyEval_CallObject(func, (PyObject *)NULL); Py_DECREF(func); + if (res != NULL && !PyIter_Check(res)) { + PyErr_Format(PyExc_TypeError, + "__iter__ returned non-iterator " + "of type '%.100s'", + res->ob_type->tp_name); + Py_DECREF(res); + res = NULL; + } return res; } *************** *** 1735,1739 **** } Py_DECREF(func); ! return PyIter_New((PyObject *)self); } --- 1744,1774 ---- } Py_DECREF(func); ! return PySeqIter_New((PyObject *)self); ! } ! ! ! /* Call the iterator's next */ ! static PyObject * ! instance_iternext(PyInstanceObject *self) ! { ! PyObject *func; ! ! if (nextstr == NULL) ! nextstr = PyString_InternFromString("next"); ! ! if ((func = instance_getattr(self, nextstr)) != NULL) { ! PyObject *res = PyEval_CallObject(func, (PyObject *)NULL); ! Py_DECREF(func); ! if (res != NULL) { ! return res; ! } ! if (PyErr_ExceptionMatches(PyExc_StopIteration)) { ! PyErr_Clear(); ! return NULL; ! } ! return NULL; ! } ! PyErr_SetString(PyExc_TypeError, "instance has no next() method"); ! return NULL; } *************** *** 1804,1807 **** --- 1839,1843 ---- offsetof(PyInstanceObject, in_weakreflist), /* tp_weaklistoffset */ (getiterfunc)instance_getiter, /* tp_iter */ + (iternextfunc)instance_iternext, /* tp_iternext */ }; Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.79 retrieving revision 2.80 diff -C2 -r2.79 -r2.80 *** dictobject.c 2001/04/20 19:13:02 2.79 --- dictobject.c 2001/04/23 14:08:49 2.80 *************** *** 1355,1358 **** --- 1355,1359 ---- 0, /* tp_weaklistoffset */ (getiterfunc)dictiter_new, /* tp_iter */ + 0, /* tp_iternext */ }; *************** *** 1434,1437 **** --- 1435,1439 ---- { PyObject *key; + if (di->di_size != di->di_dict->ma_size) { PyErr_SetString(PyExc_RuntimeError, *************** *** 1461,1467 **** static PyObject * ! dictiter_getattr(dictiterobject *it, char *name) { ! return Py_FindMethod(dictiter_methods, (PyObject *)it, name); } --- 1463,1485 ---- static PyObject * ! dictiter_getattr(dictiterobject *di, char *name) ! { ! return Py_FindMethod(dictiter_methods, (PyObject *)di, name); ! } ! ! static PyObject *dictiter_iternext(dictiterobject *di) { ! PyObject *key; ! ! if (di->di_size != di->di_dict->ma_size) { ! PyErr_SetString(PyExc_RuntimeError, ! "dictionary changed size during iteration"); ! return NULL; ! } ! if (PyDict_Next((PyObject *)(di->di_dict), &di->di_pos, &key, NULL)) { ! Py_INCREF(key); ! return key; ! } ! return NULL; } *************** *** 1495,1497 **** --- 1513,1516 ---- 0, /* tp_weaklistoffset */ (getiterfunc)dictiter_getiter, /* tp_iter */ + (iternextfunc)dictiter_iternext, /* tp_iternext */ }; Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.111 retrieving revision 2.112 diff -C2 -r2.111 -r2.112 *** fileobject.c 2001/04/21 13:20:18 2.111 --- fileobject.c 2001/04/23 14:08:49 2.112 *************** *** 1341,1344 **** --- 1341,1345 ---- 0, /* tp_weaklistoffset */ (getiterfunc)file_getiter, /* tp_iter */ + 0, /* tp_iternext */ }; Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iterobject.c 2001/04/20 21:06:46 1.2 --- iterobject.c 2001/04/23 14:08:49 1.3 *************** *** 7,17 **** long it_index; PyObject *it_seq; ! } iterobject; PyObject * ! PyIter_New(PyObject *seq) { ! iterobject *it; ! it = PyObject_NEW(iterobject, &PyIter_Type); if (it == NULL) return NULL; --- 7,17 ---- long it_index; PyObject *it_seq; ! } seqiterobject; PyObject * ! PySeqIter_New(PyObject *seq) { ! seqiterobject *it; ! it = PyObject_NEW(seqiterobject, &PySeqIter_Type); if (it == NULL) return NULL; *************** *** 22,26 **** } static void ! iter_dealloc(iterobject *it) { Py_DECREF(it->it_seq); --- 22,26 ---- } static void ! iter_dealloc(seqiterobject *it) { Py_DECREF(it->it_seq); *************** *** 29,40 **** static PyObject * ! iter_next(iterobject *it, PyObject *args) { PyObject *seq = it->it_seq; if (PyList_Check(seq)) { PyObject *item; if (it->it_index >= PyList_GET_SIZE(seq)) { - PyErr_SetObject(PyExc_StopIteration, Py_None); return NULL; } --- 29,63 ---- static PyObject * ! iter_next(seqiterobject *it, PyObject *args) { PyObject *seq = it->it_seq; + PyObject *result = PySequence_GetItem(seq, it->it_index++); + if (result == NULL && PyErr_ExceptionMatches(PyExc_IndexError)) + PyErr_SetObject(PyExc_StopIteration, Py_None); + return result; + } + + static PyObject * + iter_getiter(PyObject *it) + { + Py_INCREF(it); + return it; + } + + /* Return (value, 0) if OK; (NULL, 0) at end; (NULL, -1) if exception */ + static PyObject * + iter_iternext(PyObject *iterator) + { + seqiterobject *it; + PyObject *seq; + + assert(PySeqIter_Check(iterator)); + it = (seqiterobject *)iterator; + seq = it->it_seq; + if (PyList_Check(seq)) { PyObject *item; if (it->it_index >= PyList_GET_SIZE(seq)) { return NULL; } *************** *** 46,63 **** else { PyObject *result = PySequence_GetItem(seq, it->it_index++); ! if (result == NULL && ! PyErr_ExceptionMatches(PyExc_IndexError)) ! PyErr_SetObject(PyExc_StopIteration, Py_None); ! return result; } } - static PyObject * - iter_getiter(PyObject *it) - { - Py_INCREF(it); - return it; - } - static PyMethodDef iter_methods[] = { {"next", (PyCFunction)iter_next, METH_VARARGS, --- 69,86 ---- else { PyObject *result = PySequence_GetItem(seq, it->it_index++); ! if (result != NULL) { ! return result; ! } ! if (PyErr_ExceptionMatches(PyExc_IndexError) || ! PyErr_ExceptionMatches(PyExc_StopIteration)) { ! PyErr_Clear(); ! return NULL; ! } ! else { ! return NULL; ! } } } static PyMethodDef iter_methods[] = { {"next", (PyCFunction)iter_next, METH_VARARGS, *************** *** 67,80 **** static PyObject * ! iter_getattr(iterobject *it, char *name) { return Py_FindMethod(iter_methods, (PyObject *)it, name); } ! PyTypeObject PyIter_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ "iterator", /* tp_name */ ! sizeof(iterobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ --- 90,103 ---- static PyObject * ! iter_getattr(seqiterobject *it, char *name) { return Py_FindMethod(iter_methods, (PyObject *)it, name); } ! PyTypeObject PySeqIter_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ "iterator", /* tp_name */ ! sizeof(seqiterobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ *************** *** 101,104 **** --- 124,128 ---- 0, /* tp_weaklistoffset */ (getiterfunc)iter_getiter, /* tp_iter */ + (iternextfunc)iter_iternext, /* tp_iternext */ }; *************** *** 131,134 **** --- 155,159 ---- PyObject_DEL(it); } + static PyObject * calliter_next(calliterobject *it, PyObject *args) *************** *** 157,160 **** --- 182,201 ---- } + static PyObject * + calliter_iternext(calliterobject *it) + { + PyObject *result = PyObject_CallObject(it->it_callable, NULL); + if (result != NULL) { + if (PyObject_RichCompareBool(result, it->it_sentinel, Py_EQ)) { + Py_DECREF(result); + result = NULL; + } + } + else if (PyErr_ExceptionMatches(PyExc_StopIteration)) { + PyErr_Clear(); + } + return result; + } + PyTypeObject PyCallIter_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 186,188 **** --- 227,230 ---- 0, /* tp_weaklistoffset */ (getiterfunc)iter_getiter, /* tp_iter */ + (iternextfunc)calliter_iternext, /* tp_iternext */ }; From gvanrossum@users.sourceforge.net Mon Apr 23 15:08:51 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 07:08:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.240,2.241 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv26282/Python Modified Files: ceval.c Log Message: Mondo changes to the iterator stuff, without changing how Python code sees it (test_iter.py is unchanged). - Added a tp_iternext slot, which calls the iterator's next() method; this is much faster for built-in iterators over built-in types such as lists and dicts, speeding up pybench's ForLoop with about 25% compared to Python 2.1. (Now there's a good argument for iterators. ;-) - Renamed the built-in sequence iterator SeqIter, affecting the C API functions for it. (This frees up the PyIter prefix for generic iterator operations.) - Added PyIter_Check(obj), which checks that obj's type has a tp_iternext slot and that the proper feature flag is set. - Added PyIter_Next(obj) which calls the tp_iternext slot. It has a somewhat complex return condition due to the need for speed: when it returns NULL, it may not have set an exception condition, meaning the iterator is exhausted; when the exception StopIteration is set (or a derived exception class), it means the same thing; any other exception means some other error occurred. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.240 retrieving revision 2.241 diff -C2 -r2.240 -r2.241 *** ceval.c 2001/04/21 02:46:11 2.240 --- ceval.c 2001/04/23 14:08:49 2.241 *************** *** 382,386 **** char *filename = PyString_AsString(co->co_filename); #endif - static PyObject *nextstr; /* Code access macros */ --- 382,385 ---- *************** *** 418,426 **** /* Start of code */ - if (nextstr == NULL) { - nextstr = PyString_InternFromString("next"); - if (nextstr == NULL) - return NULL; - } #ifdef USE_STACKCHECK --- 417,420 ---- *************** *** 1888,1898 **** Py_DECREF(v); if (x != NULL) { ! w = x; ! x = PyObject_GetAttr(w, nextstr); ! Py_DECREF(w); ! if (x != NULL) { ! PUSH(x); ! continue; ! } } break; --- 1882,1887 ---- Py_DECREF(v); if (x != NULL) { ! PUSH(x); ! continue; } break; *************** *** 1901,1919 **** /* before: [iter]; after: [iter, iter()] *or* [] */ v = TOP(); ! x = PyObject_CallObject(v, NULL); ! if (x == NULL) { ! if (PyErr_ExceptionMatches( ! PyExc_StopIteration)) ! { ! PyErr_Clear(); ! x = v = POP(); ! Py_DECREF(v); ! JUMPBY(oparg); ! continue; ! } ! break; } ! PUSH(x); ! continue; case FOR_LOOP: --- 1890,1908 ---- /* before: [iter]; after: [iter, iter()] *or* [] */ v = TOP(); ! x = PyIter_Next(v); ! if (x != NULL) { ! PUSH(x); ! continue; } ! if (!PyErr_Occurred() || ! PyErr_ExceptionMatches( ! PyExc_StopIteration)) ! { ! x = v = POP(); ! Py_DECREF(v); ! JUMPBY(oparg); ! continue; ! } ! break; case FOR_LOOP: From lemburg@users.sourceforge.net Mon Apr 23 15:44:23 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Mon, 23 Apr 2001 07:44:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.117,1.118 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv1593/Doc/api Modified Files: api.tex Log Message: This patch originated from an idea by Martin v. Loewis who submitted a patch for sharing single character Unicode objects. Martin's patch had to be reworked in a number of ways to take Unicode resizing into consideration as well. Here's what the updated patch implements: * Single character Unicode strings in the Latin-1 range are shared (not only ASCII chars as in Martin's original patch). * The ASCII and Latin-1 codecs make use of this optimization, providing a noticable speedup for single character strings. Most Unicode methods can use the optimization as well (by virtue of using PyUnicode_FromUnicode()). * Some code cleanup was done (replacing memcpy with Py_UNICODE_COPY) * The PyUnicode_Resize() can now also handle the case of resizing unicode_empty which previously resulted in an error. * Modified the internal API _PyUnicode_Resize() and the public PyUnicode_Resize() API to handle references to shared objects correctly. The _PyUnicode_Resize() signature changed due to this. * Callers of PyUnicode_FromUnicode() may now only modify the Unicode object contents of the returned object in case they called the API with NULL as content template. Note that even though this patch passes the regression tests, there may still be subtle bugs in the sharing code. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -r1.117 -r1.118 *** api.tex 2001/04/13 17:55:02 1.117 --- api.tex 2001/04/23 14:44:21 1.118 *************** *** 2458,2462 **** given size. \var{u} may be \NULL{} which causes the contents to be undefined. It is the user's responsibility to fill in the needed data. ! The buffer is copied into the new object. \end{cfuncdesc} --- 2458,2464 ---- given size. \var{u} may be \NULL{} which causes the contents to be undefined. It is the user's responsibility to fill in the needed data. ! The buffer is copied into the new object. If the buffer is not \NULL{}, ! the return value might be a shared object. Therefore, modification of ! the resulting Unicode Object is only allowed when \var{u} is \NULL{}. \end{cfuncdesc} From lemburg@users.sourceforge.net Mon Apr 23 15:44:23 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Mon, 23 Apr 2001 07:44:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include unicodeobject.h,2.19,2.20 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv1593/Include Modified Files: unicodeobject.h Log Message: This patch originated from an idea by Martin v. Loewis who submitted a patch for sharing single character Unicode objects. Martin's patch had to be reworked in a number of ways to take Unicode resizing into consideration as well. Here's what the updated patch implements: * Single character Unicode strings in the Latin-1 range are shared (not only ASCII chars as in Martin's original patch). * The ASCII and Latin-1 codecs make use of this optimization, providing a noticable speedup for single character strings. Most Unicode methods can use the optimization as well (by virtue of using PyUnicode_FromUnicode()). * Some code cleanup was done (replacing memcpy with Py_UNICODE_COPY) * The PyUnicode_Resize() can now also handle the case of resizing unicode_empty which previously resulted in an error. * Modified the internal API _PyUnicode_Resize() and the public PyUnicode_Resize() API to handle references to shared objects correctly. The _PyUnicode_Resize() signature changed due to this. * Callers of PyUnicode_FromUnicode() may now only modify the Unicode object contents of the returned object in case they called the API with NULL as content template. Note that even though this patch passes the regression tests, there may still be subtle bugs in the sharing code. Index: unicodeobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -r2.19 -r2.20 *** unicodeobject.h 2000/08/11 11:43:10 2.19 --- unicodeobject.h 2001/04/23 14:44:21 2.20 *************** *** 240,245 **** /* Create a Unicode Object from the Py_UNICODE buffer u of the given ! size. u may be NULL which causes the contents to be undefined. It ! is the user's responsibility to fill in the needed data. The buffer is copied into the new object. */ --- 240,249 ---- /* Create a Unicode Object from the Py_UNICODE buffer u of the given ! size. ! ! u may be NULL which causes the contents to be undefined. It is the ! user's responsibility to fill in the needed data afterwards. Note ! that modifying the Unicode object contents after construction is ! only allowed if u was set to NULL. The buffer is copied into the new object. */ From lemburg@users.sourceforge.net Mon Apr 23 15:44:23 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Mon, 23 Apr 2001 07:44:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.86,2.87 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1593/Objects Modified Files: unicodeobject.c Log Message: This patch originated from an idea by Martin v. Loewis who submitted a patch for sharing single character Unicode objects. Martin's patch had to be reworked in a number of ways to take Unicode resizing into consideration as well. Here's what the updated patch implements: * Single character Unicode strings in the Latin-1 range are shared (not only ASCII chars as in Martin's original patch). * The ASCII and Latin-1 codecs make use of this optimization, providing a noticable speedup for single character strings. Most Unicode methods can use the optimization as well (by virtue of using PyUnicode_FromUnicode()). * Some code cleanup was done (replacing memcpy with Py_UNICODE_COPY) * The PyUnicode_Resize() can now also handle the case of resizing unicode_empty which previously resulted in an error. * Modified the internal API _PyUnicode_Resize() and the public PyUnicode_Resize() API to handle references to shared objects correctly. The _PyUnicode_Resize() signature changed due to this. * Callers of PyUnicode_FromUnicode() may now only modify the Unicode object contents of the returned object in case they called the API with NULL as content template. Note that even though this patch passes the regression tests, there may still be subtle bugs in the sharing code. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.86 retrieving revision 2.87 diff -C2 -r2.86 -r2.87 *** unicodeobject.c 2001/04/21 02:46:11 2.86 --- unicodeobject.c 2001/04/23 14:44:21 2.87 *************** *** 84,94 **** */ - /* The empty Unicode object */ - static PyUnicodeObject *unicode_empty; - /* Free list for Unicode objects */ static PyUnicodeObject *unicode_freelist; static int unicode_freelist_size; /* Default encoding to use and assume when NULL is passed as encoding parameter; it is initialized by _PyUnicode_Init(). --- 84,98 ---- */ /* Free list for Unicode objects */ static PyUnicodeObject *unicode_freelist; static int unicode_freelist_size; + /* The empty Unicode object is shared to improve performance. */ + static PyUnicodeObject *unicode_empty; + + /* Single character Unicode strings in the Latin-1 range are being + shared as well. */ + static PyUnicodeObject *unicode_latin1[256]; + /* Default encoding to use and assume when NULL is passed as encoding parameter; it is initialized by _PyUnicode_Init(). *************** *** 98,102 **** */ - static char unicode_default_encoding[100]; --- 102,105 ---- *************** *** 104,108 **** static ! int _PyUnicode_Resize(register PyUnicodeObject *unicode, int length) { --- 107,111 ---- static ! int unicode_resize(register PyUnicodeObject *unicode, int length) { *************** *** 113,120 **** goto reset; ! /* Resizing unicode_empty is not allowed. */ ! if (unicode == unicode_empty) { PyErr_SetString(PyExc_SystemError, ! "can't resize empty unicode object"); return -1; } --- 116,128 ---- goto reset; ! /* Resizing shared object (unicode_empty or single character ! objects) in-place is not allowed. Use PyUnicode_Resize() ! instead ! */ ! if (unicode == unicode_empty || ! (unicode->length == 1 && ! unicode->str[0] < 256 && ! unicode_latin1[unicode->str[0]] == unicode)) { PyErr_SetString(PyExc_SystemError, ! "can't resize shared unicode objects"); return -1; } *************** *** 143,163 **** } - int PyUnicode_Resize(PyObject **unicode, - int length) - { - PyUnicodeObject *v; - - if (unicode == NULL) { - PyErr_BadInternalCall(); - return -1; - } - v = (PyUnicodeObject *)*unicode; - if (v == NULL || !PyUnicode_Check(v) || v->ob_refcnt != 1) { - PyErr_BadInternalCall(); - return -1; - } - return _PyUnicode_Resize(v, length); - } - /* We allocate one more byte to make sure the string is Ux0000 terminated -- XXX is this needed ? --- 151,154 ---- *************** *** 188,192 **** never downsize it. */ if ((unicode->length < length) && ! _PyUnicode_Resize(unicode, length)) { PyMem_DEL(unicode->str); goto onError; --- 179,183 ---- never downsize it. */ if ((unicode->length < length) && ! unicode_resize(unicode, length)) { PyMem_DEL(unicode->str); goto onError; *************** *** 247,250 **** --- 238,280 ---- } + int PyUnicode_Resize(PyObject **unicode, + int length) + { + register PyUnicodeObject *v; + + /* Argument checks */ + if (unicode == NULL) { + PyErr_BadInternalCall(); + return -1; + } + v = (PyUnicodeObject *)*unicode; + if (v == NULL || !PyUnicode_Check(v) || v->ob_refcnt != 1) { + PyErr_BadInternalCall(); + return -1; + } + + /* Resizing unicode_empty and single character objects is not + possible since these are being shared. We simply return a fresh + copy with the same Unicode content. */ + if (v->length != length && + (v == unicode_empty || v->length == 1)) { + PyUnicodeObject *w = _PyUnicode_New(length); + if (w == NULL) + return -1; + Py_UNICODE_COPY(w->str, v->str, + length < v->length ? length : v->length); + *unicode = (PyObject *)w; + return 0; + } + + /* Note that we don't have to modify *unicode for unshared Unicode + objects, since we can modify them in-place. */ + return unicode_resize(v, length); + } + + /* Internal API for use in unicodeobject.c only ! */ + #define _PyUnicode_Resize(unicodevar, length) \ + PyUnicode_Resize(((PyObject **)(unicodevar)), length) + PyObject *PyUnicode_FromUnicode(const Py_UNICODE *u, int size) *************** *** 252,255 **** --- 282,311 ---- PyUnicodeObject *unicode; + /* If the Unicode data is known at construction time, we can apply + some optimizations which share commonly used objects. */ + if (u != NULL) { + + /* Optimization for empty strings */ + if (size == 0 && unicode_empty != NULL) { + Py_INCREF(unicode_empty); + return (PyObject *)unicode_empty; + } + + /* Single character Unicode objects in the Latin-1 range are + shared when using this constructor */ + if (size == 1 && *u < 256) { + unicode = unicode_latin1[*u]; + if (!unicode) { + unicode = _PyUnicode_New(1); + unicode->str[0] = *u; + if (!unicode) + return NULL; + unicode_latin1[*u] = unicode; + } + Py_INCREF(unicode); + return (PyObject *)unicode; + } + } + unicode = _PyUnicode_New(size); if (!unicode) *************** *** 258,262 **** /* Copy the Unicode data into the new object */ if (u != NULL) ! memcpy(unicode->str, u, size * sizeof(Py_UNICODE)); return (PyObject *)unicode; --- 314,318 ---- /* Copy the Unicode data into the new object */ if (u != NULL) ! Py_UNICODE_COPY(unicode->str, u, size); return (PyObject *)unicode; *************** *** 749,753 **** /* Adjust length */ ! if (_PyUnicode_Resize(unicode, p - unicode->str)) goto onError; --- 805,809 ---- /* Adjust length */ ! if (_PyUnicode_Resize(&unicode, p - unicode->str)) goto onError; *************** *** 1009,1013 **** /* Adjust length */ ! if (_PyUnicode_Resize(unicode, p - unicode->str)) goto onError; --- 1065,1069 ---- /* Adjust length */ ! if (_PyUnicode_Resize(&unicode, p - unicode->str)) goto onError; *************** *** 1049,1053 **** #endif ) ! memcpy(p, s, size * sizeof(Py_UNICODE)); else while (size-- > 0) { --- 1105,1109 ---- #endif ) ! Py_UNICODE_COPY(p, s, size); else while (size-- > 0) { *************** *** 1264,1268 **** } } ! if (_PyUnicode_Resize(v, (int)(p - buf))) goto onError; return (PyObject *)v; --- 1320,1324 ---- } } ! if (_PyUnicode_Resize(&v, (int)(p - buf))) goto onError; return (PyObject *)v; *************** *** 1452,1456 **** *p++ = x; } ! if (_PyUnicode_Resize(v, (int)(p - buf))) goto onError; return (PyObject *)v; --- 1508,1512 ---- *p++ = x; } ! if (_PyUnicode_Resize(&v, (int)(p - buf))) goto onError; return (PyObject *)v; *************** *** 1523,1526 **** --- 1579,1587 ---- /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ + if (size == 1 && *(unsigned char*)s < 256) { + Py_UNICODE r = *(unsigned char*)s; + return PyUnicode_FromUnicode(&r, 1); + } + v = _PyUnicode_New(size); if (v == NULL) *************** *** 1655,1658 **** --- 1716,1724 ---- /* ASCII is equivalent to the first 128 ordinals in Unicode. */ + if (size == 1 && *(unsigned char*)s < 128) { + Py_UNICODE r = *(unsigned char*)s; + return PyUnicode_FromUnicode(&r, 1); + } + v = _PyUnicode_New(size); if (v == NULL) *************** *** 1672,1676 **** } if (p - PyUnicode_AS_UNICODE(v) < PyString_GET_SIZE(v)) ! if (_PyUnicode_Resize(v, (int)(p - PyUnicode_AS_UNICODE(v)))) goto onError; return (PyObject *)v; --- 1738,1742 ---- } if (p - PyUnicode_AS_UNICODE(v) < PyString_GET_SIZE(v)) ! if (_PyUnicode_Resize(&v, (int)(p - PyUnicode_AS_UNICODE(v)))) goto onError; return (PyObject *)v; *************** *** 1927,1931 **** (targetsize << 2); extrachars += needed; ! if (_PyUnicode_Resize(v, PyUnicode_GET_SIZE(v) + needed)) { Py_DECREF(x); goto onError; --- 1993,1998 ---- (targetsize << 2); extrachars += needed; ! if (_PyUnicode_Resize(&v, ! PyUnicode_GET_SIZE(v) + needed)) { Py_DECREF(x); goto onError; *************** *** 1951,1955 **** } if (p - PyUnicode_AS_UNICODE(v) < PyUnicode_GET_SIZE(v)) ! if (_PyUnicode_Resize(v, (int)(p - PyUnicode_AS_UNICODE(v)))) goto onError; return (PyObject *)v; --- 2018,2022 ---- } if (p - PyUnicode_AS_UNICODE(v) < PyUnicode_GET_SIZE(v)) ! if (_PyUnicode_Resize(&v, (int)(p - PyUnicode_AS_UNICODE(v)))) goto onError; return (PyObject *)v; *************** *** 2069,2075 **** s = PyString_AS_STRING(v) + oldpos; } ! memcpy(s, ! PyString_AS_STRING(x), ! targetsize); s += targetsize; extrachars -= targetsize; --- 2136,2140 ---- s = PyString_AS_STRING(v) + oldpos; } ! memcpy(s, PyString_AS_STRING(x), targetsize); s += targetsize; extrachars -= targetsize; *************** *** 2210,2214 **** } if (p - PyUnicode_AS_UNICODE(v) < PyUnicode_GET_SIZE(v)) ! if (_PyUnicode_Resize(v, (int)(p - PyUnicode_AS_UNICODE(v)))) goto onError; --- 2275,2279 ---- } if (p - PyUnicode_AS_UNICODE(v) < PyUnicode_GET_SIZE(v)) ! if (_PyUnicode_Resize(&v, (int)(p - PyUnicode_AS_UNICODE(v)))) goto onError; *************** *** 2507,2514 **** PyUnicodeObject *u; ! u = (PyUnicodeObject*) PyUnicode_FromUnicode(self->str, ! self->length); if (u == NULL) return NULL; if (!fixfct(u)) { /* fixfct should return TRUE if it modified the buffer. If --- 2572,2581 ---- PyUnicodeObject *u; ! u = (PyUnicodeObject*) PyUnicode_FromUnicode(NULL, self->length); if (u == NULL) return NULL; + + Py_UNICODE_COPY(u->str, self->str, self->length); + if (!fixfct(u)) { /* fixfct should return TRUE if it modified the buffer. If *************** *** 2699,2703 **** itemlen = PyUnicode_GET_SIZE(item); while (reslen + itemlen + seplen >= sz) { ! if (_PyUnicode_Resize(res, sz*2)) goto onError; sz *= 2; --- 2766,2770 ---- itemlen = PyUnicode_GET_SIZE(item); while (reslen + itemlen + seplen >= sz) { ! if (_PyUnicode_Resize(&res, sz*2)) goto onError; sz *= 2; *************** *** 2705,2718 **** } if (i > 0) { ! memcpy(p, sep, seplen * sizeof(Py_UNICODE)); p += seplen; reslen += seplen; } ! memcpy(p, PyUnicode_AS_UNICODE(item), itemlen * sizeof(Py_UNICODE)); p += itemlen; reslen += itemlen; Py_DECREF(item); } ! if (_PyUnicode_Resize(res, reslen)) goto onError; --- 2772,2785 ---- } if (i > 0) { ! Py_UNICODE_COPY(p, sep, seplen); p += seplen; reslen += seplen; } ! Py_UNICODE_COPY(p, PyUnicode_AS_UNICODE(item), itemlen); p += itemlen; reslen += itemlen; Py_DECREF(item); } ! if (_PyUnicode_Resize(&res, reslen)) goto onError; *************** *** 3002,3009 **** u = (PyUnicodeObject*) PyUnicode_FromUnicode( ! self->str, self->length ); ! if (u) for (i = 0; i < u->length; i++) if (u->str[i] == u1) { --- 3069,3078 ---- u = (PyUnicodeObject*) PyUnicode_FromUnicode( ! NULL, self->length ); ! if (u != NULL) { ! Py_UNICODE_COPY(u->str, self->str, ! self->length); for (i = 0; i < u->length; i++) if (u->str[i] == u1) { *************** *** 3013,3016 **** --- 3082,3086 ---- } } + } } else { *************** *** 4779,4783 **** rescnt = fmtcnt + 100; reslen += rescnt; ! if (_PyUnicode_Resize(result, reslen) < 0) return NULL; res = PyUnicode_AS_UNICODE(result) + reslen - rescnt; --- 4849,4853 ---- rescnt = fmtcnt + 100; reslen += rescnt; ! if (_PyUnicode_Resize(&result, reslen) < 0) return NULL; res = PyUnicode_AS_UNICODE(result) + reslen - rescnt; *************** *** 5070,5074 **** rescnt = width + fmtcnt + 100; reslen += rescnt; ! if (_PyUnicode_Resize(result, reslen) < 0) return NULL; res = PyUnicode_AS_UNICODE(result) --- 5140,5144 ---- rescnt = width + fmtcnt + 100; reslen += rescnt; ! if (_PyUnicode_Resize(&result, reslen) < 0) return NULL; res = PyUnicode_AS_UNICODE(result) *************** *** 5111,5115 **** } } ! memcpy(res, pbuf, len * sizeof(Py_UNICODE)); res += len; rescnt -= len; --- 5181,5185 ---- } } ! Py_UNICODE_COPY(res, pbuf, len); res += len; rescnt -= len; *************** *** 5136,5140 **** } Py_DECREF(uformat); ! if (_PyUnicode_Resize(result, reslen - rescnt)) goto onError; return (PyObject *)result; --- 5206,5210 ---- } Py_DECREF(uformat); ! if (_PyUnicode_Resize(&result, reslen - rescnt)) goto onError; return (PyObject *)result; *************** *** 5185,5188 **** --- 5255,5260 ---- void _PyUnicode_Init(void) { + int i; + /* Doublecheck the configuration... */ if (sizeof(Py_UNICODE) != 2) *************** *** 5195,5198 **** --- 5267,5272 ---- unicode_empty = _PyUnicode_New(0); strcpy(unicode_default_encoding, "ascii"); + for (i = 0; i < 256; i++) + unicode_latin1[i] = NULL; } *************** *** 5203,5209 **** --- 5277,5291 ---- { PyUnicodeObject *u; + int i; Py_XDECREF(unicode_empty); unicode_empty = NULL; + + for (i = 0; i < 256; i++) { + if (unicode_latin1[i]) { + Py_DECREF(unicode_latin1[i]); + unicode_latin1[i] = NULL; + } + } for (u = unicode_freelist; u != NULL;) { From akuchling@users.sourceforge.net Mon Apr 23 17:01:08 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Mon, 23 Apr 2001 09:01:08 -0700 Subject: [Python-checkins] CVS: distutils/distutils __init__.py,1.19,1.20 Message-ID: Update of /cvsroot/python/distutils/distutils In directory usw-pr-cvs1:/tmp/cvs-serv18843 Modified Files: __init__.py Log Message: Bump version # for final release Index: __init__.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/__init__.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** __init__.py 2001/03/16 21:00:18 1.19 --- __init__.py 2001/04/23 16:01:06 1.20 *************** *** 11,13 **** __revision__ = "$Id$" ! __version__ = "1.0.2pre" --- 11,13 ---- __revision__ = "$Id$" ! __version__ = "1.0.2" From gvanrossum@users.sourceforge.net Mon Apr 23 17:35:35 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 09:35:35 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0252.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv25620 Modified Files: pep-0252.txt Log Message: Check in a little more about attribute descriptors. More to follow later today. Index: pep-0252.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0252.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** pep-0252.txt 2001/04/20 13:46:17 1.3 --- pep-0252.txt 2001/04/23 16:35:33 1.4 *************** *** 21,28 **** using attribute descriptors, or descriptors for short. Descriptors unify and generalize several different common ! mechanisms used for describing attributes: a descriptor can be an ! unbound method, a typed field in the object structure, or a ! generalized attribute represented by getter and setter functions ! (or just a getter function, for read-only attributes). Introduction --- 21,27 ---- using attribute descriptors, or descriptors for short. Descriptors unify and generalize several different common ! mechanisms used for describing attributes: a descriptor can ! describe a method, a typed field in the object structure, or a ! generalized attribute represented by getter and setter functions. Introduction *************** *** 52,64 **** The class-based introspection API is used primarily for class ! instances; it is also used by Digital Creations's ! ExtensionClasses. It assumes that all data attributes of an ! object x are stored in the dictionary x.__dict__, and that all ! methods and class variables can be found by inspection of x's ! class, written as x.__class__. Classes have a __dict__ attribute, ! which yields a dictionary containing methods and class variables ! defined by the class itself, and a __bases__ attribute, which is a ! tuple of base classes that must be inspected recursively. Some ! assumption here are: - attributes defined in the instance dict override attributes --- 51,63 ---- The class-based introspection API is used primarily for class ! instances; it is also used by Jim Fulton's ExtensionClasses. It ! assumes that all data attributes of an object x are stored in the ! dictionary x.__dict__, and that all methods and class variables ! can be found by inspection of x's class, written as x.__class__. ! Classes have a __dict__ attribute, which yields a dictionary ! containing methods and class variables defined by the class ! itself, and a __bases__ attribute, which is a tuple of base ! classes that must be inspected recursively. Some assumption here ! are: - attributes defined in the instance dict override attributes *************** *** 101,108 **** attribute names __methods__ and __members__, respectively. ! Digital Creations's ExtensionClasses ignore the type API, and ! instead emulate the class API, which is more powerful. In this ! PEP, I propose to phase out the type API in favor of supporting ! the class API for all types. One argument in favor of the class API is that it doesn't require --- 100,107 ---- attribute names __methods__ and __members__, respectively. ! Jim Fulton's ExtensionClasses ignore the type API, and instead ! emulate the class API, which is more powerful. In this PEP, I ! propose to phase out the type API in favor of supporting the class ! API for all types. One argument in favor of the class API is that it doesn't require *************** *** 239,243 **** 6. Attribute descriptors ! XXX The introspection API is a read-only API. We don't define the --- 238,267 ---- 6. Attribute descriptors ! This is where it gets interesting -- and messy. Attribute ! descriptors (descriptors for short) are stored in the ! meta-object's __dict__, and have two uses: a descriptor can be ! used to get or set the corresponding attribute value on the ! (non-meta) object, and it has an additional interface that ! describes the attribute for documentation or introspection ! purposes. ! ! There is little prior art in Python for designing the ! descriptor's interface, neither for getting/setting the value ! nor for describing the attribute otherwise, except some trivial ! properties (e.g. it's reasonable to assume that __name__ and ! __doc__ should be the attribute's name and docstring). I will ! propose such an API below. ! ! If an object found in the meta-object's __dict__ is not an ! attribute descriptor, backward compatibility dictates ! semantics. This basically means that if it is a Python ! function or an unbound method, the attribute is a method; ! otherwise, it is the default value for a data attribute. ! Backwards compatibility also dictates that (in the absence of a ! __setattr__ method) it is legal to assign to an attribute of ! type method, and that this creates a data attribute shadowing ! the method for this particular instance. However, these ! semantics are only required for backwards compatibility with ! regular classes. The introspection API is a read-only API. We don't define the *************** *** 249,252 **** --- 273,280 ---- currently instances support assignment to __class__ and __dict__, and classes support assignment to __bases__ and __dict__.) + + Specification of the attribute descriptor API + + XXX Discussion From akuchling@users.sourceforge.net Mon Apr 23 18:13:05 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Mon, 23 Apr 2001 10:13:05 -0700 Subject: [Python-checkins] CVS: distutils/distutils __init__.py,1.20,1.21 Message-ID: Update of /cvsroot/python/distutils/distutils In directory usw-pr-cvs1:/tmp/cvs-serv1590 Modified Files: __init__.py Log Message: Fix typo in docstring Index: __init__.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/__init__.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** __init__.py 2001/04/23 16:01:06 1.20 --- __init__.py 2001/04/23 17:13:03 1.21 *************** *** 1,5 **** """distutils ! The main package for the Python Module Distribtion Utilities. Normally used from a setup script as --- 1,5 ---- """distutils ! The main package for the Python Module Distribution Utilities. Normally used from a setup script as From gvanrossum@users.sourceforge.net Mon Apr 23 19:31:48 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 11:31:48 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv20246 Modified Files: pep-0234.txt Log Message: Almost completely rewritten, focusing on documenting the current state of affairs, filling in some things still under discussion. Ping, I hope this is okay with you. If you want to revive "for keys:values in dict" etc., you'll write a separate PEP, right? Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** pep-0234.txt 2001/02/19 06:08:07 1.2 --- pep-0234.txt 2001/04/23 18:31:46 1.3 *************** *** 2,6 **** Title: Iterators Version: $Revision$ ! Author: ping@lfw.org (Ka-Ping Yee) Status: Draft Type: Standards Track --- 2,6 ---- Title: Iterators Version: $Revision$ ! Author: ping@lfw.org (Ka-Ping Yee), guido@python.org (Guido van Rossum) Status: Draft Type: Standards Track *************** *** 14,241 **** provide to control the behaviour of 'for' loops. Looping is customized by providing a method that produces an iterator object. ! The iterator should be a callable object that returns the next ! item in the sequence each time it is called, raising an exception ! when no more items are available. - Copyright - - This document is in the public domain. - - - Sequence Iterators - - A new field named 'sq_iter' for requesting an iterator is added - to the PySequenceMethods table. Upon an attempt to iterate over - an object with a loop such as - - for item in sequence: - ...body... - - the interpreter looks for the 'sq_iter' of the 'sequence' object. - If the method exists, it is called to get an iterator; it should - return a callable object. If the method does not exist, the - interpreter produces a built-in iterator object in the following - manner (described in Python here, but implemented in the core): - - def make_iterator(sequence): - def iterator(sequence=sequence, index=[0]): - item = sequence[index[0]] - index[0] += 1 - return item - return iterator - - To execute the above 'for' loop, the interpreter would proceed as - follows, where 'iterator' is the iterator that was obtained: - - while 1: - try: - item = iterator() - except IndexError: - break - ...body... - - (Note that the 'break' above doesn't translate to a "real" Python - break, since it would go to the 'else:' clause of the loop whereas - a "real" break in the body would skip the 'else:' clause.) - - The list() and tuple() built-in functions would be updated to use - this same iterator logic to retrieve the items in their argument. - - List and tuple objects would implement the 'sq_iter' method by - calling the built-in make_iterator() routine just described. - - Instance objects would implement the 'sq_iter' method as follows: - - if hasattr(self, '__iter__'): - return self.__iter__() - elif hasattr(self, '__getitem__'): - return make_iterator(self) - else: - raise TypeError, thing.__class__.__name__ + \ - ' instance does not support iteration' - - Extension objects can implement 'sq_iter' however they wish, as - long as they return a callable object. - - - Mapping Iterators - - An additional proposal from Guido is to provide special syntax - for iterating over mappings. The loop: - - for key:value in mapping: - - would bind both 'key' and 'value' to a key-value pair from the - mapping on each iteration. Tim Peters suggested that similarly, - - for key: in mapping: - - could iterate over just the keys and - - for :value in mapping: - - could iterate over just the values. - - The syntax is unambiguous since the new colon is currently not - permitted in this position in the grammar. - - This behaviour would be provided by additional methods in the - PyMappingMethods table: 'mp_iteritems', 'mp_iterkeys', and - 'mp_itervalues' respectively. 'mp_iteritems' is expected to - produce a callable object that returns a (key, value) tuple; - 'mp_iterkeys' and 'mp_itervalues' are expected to produce a - callable object that returns a single key or value. - - The implementations of these methods on instance objects would - then check for and call the '__iteritems__', '__iterkeys__', - and '__itervalues__' methods respectively. - - When 'mp_iteritems', 'mp_iterkeys', or 'mp_itervalues' is missing, - the default behaviour is to do make_iterator(mapping.items()), - make_iterator(mapping.keys()), or make_iterator(mapping.values()) - respectively, using the definition of make_iterator() above. - - - Indexing Sequences - - The special syntax described above can be applied to sequences - as well, to provide the long-hoped-for ability to obtain the - indices of a sequence without the strange-looking 'range(len(x))' - expression. - - for index:item in sequence: - - causes 'index' to be bound to the index of each item as 'item' is - bound to the items of the sequence in turn, and - - for index: in sequence: - - simply causes 'index' to start at 0 and increment until an attempt - to get sequence[index] produces an IndexError. For completeness, - - for :item in sequence: - - is equivalent to - - for item in sequence: - - In each case we try to request an appropriate iterator from the - sequence. In summary: - - for k:v in x looks for mp_iteritems, then sq_iter - for k: in x looks for mp_iterkeys, then sq_iter - for :v in x looks for mp_itervalues, then sq_iter - for v in x looks for sq_iter - - If we fall back to sq_iter in the first two cases, we generate - indices for k as needed, by starting at 0 and incrementing. - - The implementation of the mp_iter* methods on instance objects - then checks for methods in the following order: - - mp_iteritems __iteritems__, __iter__, items, __getitem__ - mp_iterkeys __iterkeys__, __iter__, keys, __getitem__ - mp_itervalues __itervalues__, __iter__, values, __getitem__ - sq_iter __iter__, __getitem__ - - If a __iteritems__, __iterkeys__, or __itervalues__ method is - found, we just call it and use the resulting iterator. If a - mp_* function finds no such method but finds __iter__ instead, - we generate indices as needed. - - Upon finding an items(), keys(), or values() method, we use - make_iterator(x.items()), make_iterator(x.keys()), or - make_iterator(x.values()) respectively. Upon finding a - __getitem__ method, we use it and generate indices as needed. - - For example, the complete implementation of the mp_iteritems - method for instances can be roughly described as follows: - - def mp_iteritems(thing): - if hasattr(thing, '__iteritems__'): - return thing.__iteritems__() - if hasattr(thing, '__iter__'): - def iterator(sequence=thing, index=[0]): - item = (index[0], sequence.__iter__()) - index[0] += 1 - return item - return iterator - if hasattr(thing, 'items'): - return make_iterator(thing.items()) - if hasattr(thing, '__getitem__'): - def iterator(sequence=thing, index=[0]): - item = (index[0], sequence[index[0]]) - index[0] += 1 - return item - return iterator - raise TypeError, thing.__class__.__name__ + \ - ' instance does not support iteration over items' - - - Examples - - Here is a class written in Python that represents the sequence of - lines in a file. - - class FileLines: - def __init__(self, filename): - self.file = open(filename) - def __iter__(self): - def iter(self=self): - line = self.file.readline() - if line: return line - else: raise IndexError - return iter - - for line in FileLines('spam.txt'): - print line - - And here's an interactive session demonstrating the proposed new - looping syntax: - - >>> for i:item in ['a', 'b', 'c']: - ... print i, item - ... - 0 a - 1 b - 2 c - >>> for i: in 'abcdefg': # just the indices, please - ... print i, - ... print - ... - 0 1 2 3 4 5 6 - >>> for k:v in os.environ: # os.environ is an instance, but - ... print k, v # this still works because we fall - ... # back to calling items() - MAIL /var/spool/mail/ping - HOME /home/ping - DISPLAY :0.0 - TERM xterm - . - . - . - - Rationale --- 14,257 ---- provide to control the behaviour of 'for' loops. Looping is customized by providing a method that produces an iterator object. ! The iterator provides a 'get next value' operation that produces ! the nxet item in the sequence each time it is called, raising an ! exception when no more items are available. ! ! In addition, specific iterators over the keys of a dictionary and ! over the lines of a file are proposed, and a proposal is made to ! allow spelling dict.kas_key(key) as "key in dict". ! ! Note: this is an almost complete rewrite of this PEP by the second ! author, describing the actual implementation checked into the ! trunk of the Python 2.2 CVS tree. It is still open for ! discussion. Some of the more esoteric proposals in the original ! version of this PEP have been withdrawn for now; these may be the ! subject of a separate PEP in the future. ! ! ! C API Specification ! ! A new exception is defined, StopIteration, which can be used to ! signal the end of an iteration. ! ! A new slot named tp_iter for requesting an iterator is added to ! the type object structure. This should be a function of one ! PyObject * argument returning a PyObject *, or NULL. To use this ! slot, a new C API function PyObject_GetIter() is added, with the ! same signature as the tp_iter slot function. ! ! Another new slot, named tp_iternext, is added to the type ! structure, for obtaining the next value in the iteration. To use ! this slot, a new C API function PyIter_Next() is added. The ! signature for both the slot and the API function is as follows: ! the argument is a PyObject * and so is the return value. When the ! return value is non-NULL, it is the next value in the iteration. ! When it is NULL, there are three possibilities: ! ! - No exception is set; this implies the end of the iteration. ! ! - The StopIteration exception (or a derived exception class) is ! set; this implies the end of the iteration. ! ! - Some other exception is set; this means that an error occurred ! that should be propagated normally. ! ! In addition to the tp_iternext slot, every iterator object must ! also implement a next() method, callable without arguments. This ! should have the same semantics as the tp_iternext slot function, ! except that the only way to signal the end of the iteration is to ! raise StopIteration. The iterator object should not care whether ! its tp_iternext slot function is called or its next() method, and ! the caller may mix calls arbitrarily. (The next() method is for ! the benefit of Python code using iterators directly; the ! tp_iternext slot is added to make 'for' loops more efficient.) ! ! To ensure binary backwards compatibility, a new flag ! Py_TPFLAGS_HAVE_ITER is added to the set of flags in the tp_flags ! field, and to the default flags macro. This flag must be tested ! before accessing the tp_iter or tp_iternext slots. The macro ! PyIter_Check() tests whether an object has the appropriate flag ! set and has a non-NULL tp_iternext slot. There is no such macro ! for the tp_iter slot (since the only place where this slot is ! referenced should be PyObject_GetIter()). ! ! (Note: the tp_iter slot can be present on any object; the ! tp_iternext slot should only be present on objects that act as ! iterators.) ! ! For backwards compatibility, the PyObject_GetIter() function ! implements fallback semantics when its argument is a sequence that ! does not implement a tp_iter function: a lightweight sequence ! iterator object is constructed in that case which iterates over ! the items of the sequence in the natural order. ! ! The Python bytecode generated for 'for' loops is changed to use ! new opcodes, GET_ITER and FOR_ITER, that use the iterator protocol ! rather than the sequence protocol to get the next value for the ! loop variable. This makes it possible to use a 'for' loop to loop ! over non-sequence objects that support the tp_iter slot. Other ! places where the interpreter loops over the values of a sequence ! should also be changed to use iterators. ! ! Iterators ought to implement the tp_iter slot as returning a ! reference to themselves; this is needed to make it possible to ! use an iterator (as opposed to a sequence) in a for loop. ! ! ! Python API Specification ! ! The StopIteration exception is made visiable as one of the ! standard exceptions. It is derived from Exception. ! ! A new built-in function is defined, iter(), which can be called in ! two ways: ! ! - iter(obj) calls PyObject_GetIter(obj). ! ! - iter(callable, sentinel) returns a special kind of iterator that ! calls the callable to produce a new value, and compares the ! return value to the sentinel value. If the return value equals ! the sentinel, this signals the end of the iteration and ! StopIteration is raised rather than returning normal; if the ! return value does not equal the sentinel, it is returned as the ! next value from the iterator. If the callable raises an ! exception, this is propagated normally; in particular, the ! function is allowed to raise StopError as an alternative way to ! end the iteration. (This functionality is available from the C ! API as PyCallIter_New(callable, sentinel).) ! ! Iterator objects returned by either form of iter() have a next() ! method. This method either returns the next value in the ! iteration, or raises StopError (or a derived exception class) to ! signal the end of the iteration. Any other exception should be ! considered to signify an error and should be propagated normally, ! not taken to mean the end of the iteration. ! ! Classes can define how they are iterated over by defining an ! __iter__() method; this should take no additional arguments and ! return a valid iterator object. A class is a valid iterator ! object when it defines a next() method that behaves as described ! above. A class that wants to be an iterator also ought to ! implement __iter__() returning itself. ! ! There is some controversy here: ! ! - The name iter() is an abbreviation. Alternatives proposed ! include iterate(), harp(), traverse(), narrate(). ! ! - Using the same name for two different operations (getting an ! iterator from an object and making an iterator for a function ! with an sentinel value) is somewhat ugly. I haven't seen a ! better name for the second operation though. ! ! ! Dictionary Iterators ! ! The following two proposals are somewhat controversial. They are ! also independent from the main iterator implementation. However, ! they are both very useful. ! ! - Dictionaries implement a sq_contains slot that implements the ! same test as the has_key() method. This means that we can write ! ! if k in dict: ... ! ! which is equivalent to ! ! if dict.has_key(k): ... ! ! - Dictionaries implement a tp_iter slot that returns an efficient ! iterator that iterates over the keys of the dictionary. During ! such an iteration, the dictionary should not be modified, except ! that setting the value for an existing key is allowed (deletions ! or additions are not, nor is the update() method). This means ! that we can write ! ! for k in dict: ... ! ! which is equivalent to, but much faster than ! ! for k in dict.keys(): ... ! ! as long as the restriction on modifications to the dictionary ! (either by the loop or by another thread) are not violated. ! ! There is no doubt that the dict.has_keys(x) interpretation of "x ! in dict" is by far the most useful interpretation, probably the ! only useful one. There has been resistance against this because ! "x in list" checks whether x is present among the values, while ! the proposal makes "x in dict" check whether x is present among ! the keys. Given that the symmetry between lists and dictionaries ! is very weak, this argument does not have much weight. ! ! The main discussion focuses on whether ! ! for x in dict: ... ! ! should assign x the successive keys, values, or items of the ! dictionary. The symmetry between "if x in y" and "for x in y" ! suggests that it should iterate over keys. This symmetry has been ! observed by many independently and has even been used to "explain" ! one using the other. This is because for sequences, "if x in y" ! iterates over y comparing the iterated values to x. If we adopt ! both of the above proposals, this will also hold for ! dictionaries. ! ! The argument against making "for x in dict" iterate over the keys ! comes mostly from a practicality point of view: scans of the ! standard library show that there are about as many uses of "for x ! in dict.items()" as there are of "for x in dict.keys()", with the ! items() version having a small majority. Presumably many of the ! loops using keys() use the corresponding value anyway, by writing ! dict[x], so (the argument goes) by making both the key and value ! available, we could support the largest number of cases. While ! this is true, I (Guido) find the correspondence between "for x in ! dict" and "if x in dict" too compelling to break, and there's not ! much overhead in having to write dict[x] to explicitly get the ! value. We could also add methods to dictionaries that return ! different kinds of iterators, e.g. ! ! for key, value in dict.iteritems(): ... ! ! for value in dict.itervalues(): ... ! ! for key in dict.iterkeys(): ... ! ! ! File Iterators ! ! The following proposal is not controversial, but should be ! considered a separate step after introducing the iterator ! framework described above. It is useful because it provides us ! with a good answer to the complaint that the common idiom to ! iterate over the lines of a file is ugly and slow. ! ! - Files implement a tp_iter slot that is equivalent to ! iter(f.readline, ""). This means that we can write ! ! for line in file: ! ... ! ! as a shorthand for ! ! for line in iter(file.readline, ""): ! ... ! ! which is equivalent to, but faster than ! ! while 1: ! line = file.readline() ! if not line: ! break ! ... ! ! This also shows that some iterators are destructive: they consume ! all the values and a second iterator cannot easily be created that ! iterates independently over the same values. You could open the ! file for a second time, or seek() to the beginning, but these ! solutions don't work for all file types, e.g. they don't work when ! the open file object really represents a pipe or a stream socket. Rationale *************** *** 246,252 **** 1. It provides an extensible iterator interface. ! 2. It resolves the endless "i indexing sequence" debate. ! 3. It allows performance enhancements to dictionary iteration. 4. It allows one to provide an interface for just iteration --- 262,268 ---- 1. It provides an extensible iterator interface. ! 1. It allows performance enhancements to list iteration. ! 3. It allows big performance enhancements to dictionary iteration. 4. It allows one to provide an interface for just iteration *************** *** 258,351 **** {__getitem__, keys, values, items}. - - Errors - - Errors that occur during sq_iter, mp_iter*, or the __iter*__ - methods are allowed to propagate normally to the surface. - - An attempt to do - - for item in dict: - - over a dictionary object still produces: - - TypeError: loop over non-sequence - - An attempt to iterate over an instance that provides neither - __iter__ nor __getitem__ produces: - - TypeError: instance does not support iteration - - Similarly, an attempt to do mapping-iteration over an instance - that doesn't provide the right methods should produce one of the - following errors: - - TypeError: instance does not support iteration over items - TypeError: instance does not support iteration over keys - TypeError: instance does not support iteration over values - - It's an error for the iterator produced by __iteritems__ or - mp_iteritems to return an object whose length is not 2: ! TypeError: item iterator did not return a 2-tuple ! ! ! Open Issues ! ! We could introduce a new exception type such as IteratorExit just ! for terminating loops rather than using IndexError. In this case, ! the implementation of make_iterator() would catch and translate an ! IndexError into an IteratorExit for backward compatibility. ! ! We could provide access to the logic that calls either 'sq_item' ! or make_iterator() with an iter() function in the built-in module ! (just as the getattr() function provides access to 'tp_getattr'). ! One possible motivation for this is to make it easier for the ! implementation of __iter__ to delegate iteration to some other ! sequence. Presumably we would then have to consider adding ! iteritems(), iterkeys(), and itervalues() as well. ! ! An alternative way to let __iter__ delegate iteration to another ! sequence is for it to return another sequence. Upon detecting ! that the object returned by __iter__ is not callable, the ! interpreter could repeat the process of looking for an iterator ! on the new object. However, this process seems potentially ! convoluted and likely to produce more confusing error messages. ! ! If we decide to add "freezing" ability to lists and dictionaries, ! it is suggested that the implementation of make_iterator ! automatically freeze any list or dictionary argument for the ! duration of the loop, and produce an error complaining about any ! attempt to modify it during iteration. Since it is relatively ! rare to actually want to modify it during iteration, this is ! likely to catch mistakes earlier. If a programmer wants to ! modify a list or dictionary during iteration, they should ! explicitly make a copy to iterate over using x[:], x.clone(), ! x.keys(), x.values(), or x.items(). ! ! For consistency with the 'key in dict' expression, we could ! support 'for key in dict' as equivalent to 'for key: in dict'. ! ! ! BDFL Pronouncements ! ! The "parallel expression" to 'for key:value in mapping': ! ! if key:value in mapping: ! ! is infeasible since the first colon ends the "if" condition. ! The following compromise is technically feasible: ! ! if (key:value) in mapping: ! ! but the BDFL has pronounced a solid -1 on this. ! ! The BDFL gave a +0.5 to: ! ! for key:value in mapping: ! for index:item in sequence: ! and a +0.2 to the variations where the part before or after ! the first colon is missing. --- 274,281 ---- {__getitem__, keys, values, items}. ! Copyright ! This document is in the public domain. From gvanrossum@users.sourceforge.net Mon Apr 23 19:34:58 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 11:34:58 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.88,1.89 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv21078 Modified Files: pep-0000.txt Log Message: Add van Rossum as co-author to PEP-234 (Iterators). Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -r1.88 -r1.89 *** pep-0000.txt 2001/04/19 21:27:25 1.88 --- pep-0000.txt 2001/04/23 18:34:56 1.89 *************** *** 39,43 **** I 42 pep-0042.txt Small Feature Requests Hylton ! S 234 pep-0234.txt Iterators Yee S 237 pep-0237.txt Unifying Long Integers and Integers Zadka S 238 pep-0238.txt Non-integer Division Zadka --- 39,43 ---- I 42 pep-0042.txt Small Feature Requests Hylton ! S 234 pep-0234.txt Iterators Yee, van Rossum S 237 pep-0237.txt Unifying Long Integers and Integers Zadka S 238 pep-0238.txt Non-integer Division Zadka *************** *** 154,158 **** SF 232 pep-0232.txt Function Attributes Warsaw S 233 pep-0233.txt Python Online Help Prescod ! S 234 pep-0234.txt Iterators Yee SF 235 pep-0235.txt Import on Case-Insensitive Platforms Peters S 236 pep-0236.txt Back to the __future__ Peters --- 154,158 ---- SF 232 pep-0232.txt Function Attributes Warsaw S 233 pep-0233.txt Python Online Help Prescod ! S 234 pep-0234.txt Iterators Yee, van Rossum SF 235 pep-0235.txt Import on Case-Insensitive Platforms Peters S 236 pep-0236.txt Back to the __future__ Peters From gvanrossum@users.sourceforge.net Mon Apr 23 21:05:01 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 13:05:01 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv15273 Modified Files: pep-0234.txt Log Message: Add discussion about next() vs. __next__(). So far I'm liking next() jut fine. Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** pep-0234.txt 2001/04/23 18:31:46 1.3 --- pep-0234.txt 2001/04/23 20:04:59 1.4 *************** *** 98,101 **** --- 98,108 ---- use an iterator (as opposed to a sequence) in a for loop. + Discussion: should the next() method be renamed to __next__()? + Every other method corresponding to a tp_ slot has a + special name. On the other hand, this would suggest that there + should also be a primitive operation next(x) that would call + x.__next__(), and this just looks like adding complexity without + benefit. So I think it's better to stick with next(). + Python API Specification From gvanrossum@users.sourceforge.net Mon Apr 23 22:19:06 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 14:19:06 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0252.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv5011 Modified Files: pep-0252.txt Log Message: Added attribute descriptor API. Still need to do the signature object API. Index: pep-0252.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0252.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** pep-0252.txt 2001/04/23 16:35:33 1.4 --- pep-0252.txt 2001/04/23 21:19:03 1.5 *************** *** 25,28 **** --- 25,29 ---- generalized attribute represented by getter and setter functions. + Introduction *************** *** 40,43 **** --- 41,45 ---- are not on the table for this PEP. + Introspection APIs *************** *** 116,119 **** --- 118,122 ---- docstring extraction isn't feasible in this case.) + Specification of the class-based introspection API *************** *** 274,278 **** --- 277,372 ---- and classes support assignment to __bases__ and __dict__.) + Specification of the attribute descriptor API + + Attribute descriptors have the following attributes. In the + examples, x is an object, C is x.__class__, x.meth() is a method, + and x.ivar is a data attribute or instance variable. + + - name: the original attribute name. Note that because of + aliasing and renaming, the attribute may be known under a + different name, but this is the name under which it was born. + Example: C.meth.name == 'meth'. + + - doc: the attribute's documentation string. + + - objclass: the class that declared this attribute. The + descriptor only applies to objects that are instances of this + class (this includes instances of its subclasses). Example: + C.meth.objclass is C. + + - kind: either "method" or "data". This distinguishes between + methods and data attributes. The primary operation on a method + attribute is to call it. The primary operations on a data + attribute are to get and to set it. Example: C.meth.kind == + 'method'; C.ivar.kind == 'data'. + + - default: for optional data attributes, this gives a default or + initial value. XXX Python has two kinds of semantics for + referencing "absent" attributes: this may raise an + AttributeError, or it may produce a default value stored + somewhere in the class. There could be a flag that + distinguishes between these two cases. Also, there could be a + flag that tells whether it's OK to delete an attribute (and what + happens then -- a default value takes its place, or it's truly + gone). + + - attrclass: for data attributes, this can be the class of the + attribute value, or None. If this is not None, the attribute + value is restricted to being an instance of this class (or of a + subclass thereof). If this is None, the attribute value is not + constrained. For method attributes, this should normally be + None (a class is not sufficient information to describe a method + signature). If and when optional static typing is added to + Python, this the meaning of this attribute may change to + describe the type of the attribute. + + - signature: for methods, an object that describes the signature + of the method. Signature objects will be described further + below. + + - readonly: Boolean indicating whether assignment to this + attribute is disallowed. This is usually true for methods. + Example: C.meth.readonly == 1; C.ivar.kind == 0. + + - get(): a function of one argument that retrieves the attribute + value from an object. Examples: C.ivar.get(x) ~~ x.ivar; + C.meth.get(x) ~~ x.meth. + + - set(): a function of two arguments that sets the attribute value + on the object. If readonly is set, this method raises a + TypeError exception. Example: C.ivar.set(x, y) ~~ x.ivar = y. + + - call(): for method descriptors, this is a function of at least + one argument that calls the method. The first argument is the + object whose method is called; the remaining arguments + (including keyword arguments) are passed on to the method. + Example: C.meth.call(x, 1, 2) ~~ x.meth(1, 2). + + - bind(): for method descriptiors, this is a function of one + argument that returns a "bound method object". This in turn can + be called exactly like the method should be called (in fact this + is what is returned for a bound method). This is the same as + get(). Example: C.meth.bind(x) ~~ x.meth. + + For convenience, __name__ and __doc__ are defined as aliases for + name and doc. Also for convenience, calling the descriptor can do + one of three things: + + - Calling a method descriptor is the same as calling its call() + method. Example: C.meth(x, 1, 2) ~~ x.meth(1, 2). + + - Calling a data descriptor with one argument is the same as + calling its get() method. Example: C.ivar(x) ~~ x.ivar. + + - Calling a data descriptor with two arguments is the same as + calling its set() method. Example: C.ivar(x, y) ~~ x.ivar = y. + + Note that this specification does not define how to create + specific attribute descriptors. This is up to the individual + attribute descriptor implementations, of which there may be many. + + + Specification of the signature object API XXX From gvanrossum@users.sourceforge.net Tue Apr 24 01:43:32 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 17:43:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects descrobject.c,NONE,1.1.2.1 complexobject.c,2.35,2.35.4.1 dictobject.c,2.80,2.80.2.1 fileobject.c,2.112,2.112.2.1 frameobject.c,2.49,2.49.4.1 listobject.c,2.92,2.92.6.1 methodobject.c,2.33,2.33.8.1 object.c,2.124,2.124.4.1 rangeobject.c,2.24,2.24.6.1 sliceobject.c,2.7,2.7.4.1 stringobject.c,2.103,2.103.2.1 typeobject.c,2.16,2.16.8.1 unicodeobject.c,2.87,2.87.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21844 Modified Files: Tag: descr-branch complexobject.c dictobject.c fileobject.c frameobject.c listobject.c methodobject.c object.c rangeobject.c sliceobject.c stringobject.c typeobject.c unicodeobject.c Added Files: Tag: descr-branch descrobject.c Log Message: Interim commit to descriptors prototype; see PEP 252. --- NEW FILE: descrobject.c --- /* Descriptors -- a new, flexible way to describe attributes */ #include "Python.h" #include "structmember.h" /* Why is this not included in Python.h? */ /* Descriptor object */ struct PyDescrObject { PyObject_HEAD int d_flavor; PyTypeObject *d_type; union { PyMethodDef *d_method; struct memberlist *d_member; struct getsetlist *d_getset; } d_union; }; /* Descriptor flavors */ #define DF_NULL 0 #define DF_METHOD 1 #define DF_MEMBER 2 #define DF_GETSET 3 static void descr_dealloc(PyDescrObject *descr) { PyObject_DEL(descr); } static char * descr_name(PyDescrObject *descr) { switch (descr->d_flavor) { case DF_METHOD: return descr->d_union.d_method->ml_name; case DF_MEMBER: return descr->d_union.d_member->name; case DF_GETSET: return descr->d_union.d_getset->name; default: return NULL; } } static PyObject * descr_repr(PyDescrObject *descr) { char buffer[500]; switch (descr->d_flavor) { case DF_NULL: sprintf(buffer, "", descr->d_type->tp_name); break; case DF_METHOD: sprintf(buffer, "", descr->d_union.d_method->ml_name, descr->d_type->tp_name); break; case DF_MEMBER: sprintf(buffer, "", descr->d_union.d_member->name, descr->d_type->tp_name); break; case DF_GETSET: sprintf(buffer, "", descr->d_union.d_getset->name, descr->d_type->tp_name); break; default: sprintf(buffer, "", descr->d_flavor, descr->d_type->tp_name); break; } return PyString_FromString(buffer); } static PyObject * descr_call(PyDescrObject *descr, PyObject *args, PyObject *kwds) { int argc; PyObject *self; /* Make sure that the first argument is acceptable as 'self' */ assert(PyTuple_Check(args)); argc = PyTuple_GET_SIZE(args); if (argc < 1) { PyErr_SetString(PyExc_TypeError, "descriptor call needs 'self' argument"); return NULL; } self = PyTuple_GET_ITEM(args, 0); if (!PyObject_IsInstance(self, (PyObject *)(descr->d_type))) { PyErr_Format(PyExc_TypeError, "descriptor call 'self' is type '%.100s', " "expected type '%.100s'", self->ob_type->tp_name, descr->d_type->tp_name); return NULL; } if (descr->d_flavor == DF_METHOD) { PyObject *func, *result; func = PyCFunction_New(descr->d_union.d_method, self); if (func == NULL) return NULL; args = PyTuple_GetSlice(args, 1, argc); if (args == NULL) return NULL; result = PyEval_CallObjectWithKeywords(func, args, kwds); Py_DECREF(args); return result; } /* Make sure there are no keyword arguments */ if (kwds != NULL) { assert(PyDict_Check(kwds)); if (PyDict_Size(kwds) > 0) { PyErr_SetString(PyExc_TypeError, "this descriptor object can't called " "called with keyword arguments"); return NULL; } } if (argc == 1) return PyDescr_Get((PyObject *)descr, self); if (argc == 2) { PyObject *value = PyTuple_GET_ITEM(args, 1); if (PyDescr_Set((PyObject *)descr, self, value) < 0) return NULL; Py_INCREF(Py_None); return Py_None; } PyErr_SetString(PyExc_TypeError, "too many arguments to descriptor call"); return NULL; } static PyObject * descr_getattr(PyDescrObject *descr, char *name) { char *s; if (strcmp(name, "__name__") == 0) { s = NULL; switch (descr->d_flavor) { case DF_METHOD: s = descr->d_union.d_method->ml_name; break; case DF_MEMBER: s = descr->d_union.d_member->name; break; case DF_GETSET: s = descr->d_union.d_getset->name; break; } if (s != NULL) return PyString_FromString(s); } if (strcmp(name, "__doc__") == 0) { if (descr->d_flavor == DF_METHOD) { s = descr->d_union.d_method->ml_doc; if (s == NULL) { Py_INCREF(Py_None); return Py_None; } else { return PyString_FromString(s); } } } s = descr_name(descr); if (s == NULL) s = "?"; PyErr_Format(PyExc_AttributeError, "descriptor '%.100s' of '%.100s' objects has no " "'%.100s' attribute", s, descr->d_type->tp_name, name); return NULL; } PyTypeObject PyDescr_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "descriptor", sizeof(PyDescrObject), 0, (destructor)descr_dealloc, /* tp_dealloc */ 0, /* tp_print */ (getattrfunc)descr_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ (reprfunc)descr_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ (ternaryfunc)descr_call, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ 0, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ }; static PyDescrObject * PyDescr_New(PyTypeObject *type) { PyDescrObject *descr = PyObject_NEW(PyDescrObject, &PyDescr_Type); if (descr == NULL) return NULL; descr->d_type = type; descr->d_flavor = DF_NULL; return descr; } PyObject * PyDescr_NewMethod(PyTypeObject *type, PyMethodDef *method) { PyDescrObject *descr = PyDescr_New(type); if (descr == NULL) return NULL; descr->d_union.d_method = method; descr->d_flavor = DF_METHOD; return (PyObject *)descr; } PyObject * PyDescr_NewMember(PyTypeObject *type, struct memberlist *member) { PyDescrObject *descr = PyDescr_New(type); if (descr == NULL) return NULL; descr->d_union.d_member = member; descr->d_flavor = DF_MEMBER; return (PyObject *)descr; } PyObject * PyDescr_NewGetSet(PyTypeObject *type, struct getsetlist *getset) { PyDescrObject *descr = PyDescr_New(type); if (descr == NULL) return NULL; descr->d_union.d_getset = getset; descr->d_flavor = DF_GETSET; return (PyObject *)descr; } PyObject * PyDescr_Get(PyObject *d, PyObject *obj) { PyDescrObject *descr; if (obj == NULL || !PyDescr_Check(d)) { Py_INCREF(d); return d; } descr = (PyDescrObject *)d; if (!PyObject_IsInstance(obj, (PyObject *)(descr->d_type))) { PyErr_Format(PyExc_TypeError, "descriptor for '%.100s' objects " "doesn't apply to '%.100s' object", descr->d_type->tp_name, obj->ob_type->tp_name); return NULL; } switch (descr->d_flavor) { case DF_METHOD: return PyCFunction_New(descr->d_union.d_method, obj); case DF_MEMBER: return PyMember_Get((char *)obj, descr->d_union.d_member, descr->d_union.d_member->name); case DF_GETSET: if (descr->d_union.d_getset->get != NULL) return descr->d_union.d_getset->get( obj, descr->d_union.d_getset->closure); } PyErr_Format(PyExc_NotImplementedError, "PyDescr_Get() not implemented for descriptor type %d " "of '%.50s' object", descr->d_flavor, obj->ob_type->tp_name); return NULL; } int PyDescr_Set(PyObject *d, PyObject *obj, PyObject *value) { PyDescrObject *descr = (PyDescrObject *)d; assert(PyDescr_Check(d)); if (!PyObject_IsInstance(obj, (PyObject *)(descr->d_type))) { PyErr_Format(PyExc_TypeError, "descriptor for '%.100s' objects " "doesn't apply to '%.100s' object", descr->d_type->tp_name, obj->ob_type->tp_name); return -1; } switch (descr->d_flavor) { case DF_METHOD: PyErr_Format(PyExc_TypeError, "can't %s method attribute '%.400s' " "of '%.50s' object", value==NULL ? "delete" : "assign to", descr->d_union.d_method->ml_name, obj->ob_type->tp_name); return -1; case DF_MEMBER: return PyMember_Set((char *)obj, descr->d_union.d_member, descr->d_union.d_member->name, value); case DF_GETSET: if (descr->d_union.d_getset->set == NULL) { PyErr_Format(PyExc_TypeError, "can't %s read-only attribute " "'%.400s' of '%.50s' object", value==NULL ? "delete" : "assign to", descr->d_union.d_getset->name, obj->ob_type->tp_name); return -1; } return descr->d_union.d_getset->set( obj, value, descr->d_union.d_getset->closure); } PyErr_Format(PyExc_NotImplementedError, "PyDescr_Set() not implemented for descriptor type %d " "of '%.50s' object", descr->d_flavor, obj->ob_type->tp_name); return -1; } /* Initialize the __dict__ in a type object */ static struct PyMethodDef intrinsic_methods[] = { {0} }; static struct memberlist intrinsic_members[] = { {"__class__", T_OBJECT, offsetof(PyObject, ob_type), READONLY}, {0} }; static struct getsetlist intrinsic_getsets[] = { {0} }; static int add_methods(PyTypeObject *type, PyMethodDef *meth) { PyObject *dict = type->tp_dict; for (; meth->ml_name != NULL; meth++) { PyObject *descr = PyDescr_NewMethod(type, meth); if (descr == NULL) return -1; if (PyDict_SetItemString(dict,meth->ml_name,descr) < 0) return -1; Py_DECREF(descr); } return 0; } static int add_members(PyTypeObject *type, struct memberlist *memb) { PyObject *dict = type->tp_dict; for (; memb->name != NULL; memb++) { PyObject *descr = PyDescr_NewMember(type, memb); if (descr == NULL) return -1; if (PyDict_SetItemString(dict, memb->name, descr) < 0) return -1; Py_DECREF(descr); } return 0; } static int add_getset(PyTypeObject *type, struct getsetlist *gsp) { PyObject *dict = type->tp_dict; for (; gsp->name != NULL; gsp++) { PyObject *descr = PyDescr_NewGetSet(type, gsp); if (descr == NULL) return -1; if (PyDict_SetItemString(dict, gsp->name, descr) < 0) return -1; Py_DECREF(descr); } return 0; } int PyType_InitDict(PyTypeObject *type) { PyObject *dict; if (type->tp_dict != NULL) return 0; dict = PyDict_New(); if (dict == NULL) return -1; type->tp_dict = dict; if (type->tp_methods != NULL) { if (add_methods(type, type->tp_methods) < 0) return -1; } if (type->tp_members != NULL) { if (add_members(type, type->tp_members) < 0) return -1; } if (type->tp_getset != NULL) { if (add_getset(type, type->tp_getset) < 0) return -1; } /* Add intrinsics */ if (add_methods(type, intrinsic_methods) < 0) return -1; if (add_members(type, intrinsic_members) < 0) return -1; if (add_getset(type, intrinsic_getsets) < 0) return -1; return 0; } Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.35 retrieving revision 2.35.4.1 diff -C2 -r2.35 -r2.35.4.1 *** complexobject.c 2001/03/18 08:21:57 2.35 --- complexobject.c 2001/04/24 00:43:30 2.35.4.1 *************** *** 9,12 **** --- 9,13 ---- #include "Python.h" + #include "structmember.h" /* Precisions used by repr() and str(), respectively. *************** *** 560,575 **** }; ! ! static PyObject * ! complex_getattr(PyComplexObject *self, char *name) ! { ! if (strcmp(name, "real") == 0) ! return (PyObject *)PyFloat_FromDouble(self->cval.real); ! else if (strcmp(name, "imag") == 0) ! return (PyObject *)PyFloat_FromDouble(self->cval.imag); ! else if (strcmp(name, "__members__") == 0) ! return Py_BuildValue("[ss]", "imag", "real"); ! return Py_FindMethod(complex_methods, (PyObject *)self, name); ! } static PyNumberMethods complex_as_number = { --- 561,569 ---- }; ! static struct memberlist complex_members[] = { ! {"real", T_DOUBLE, offsetof(PyComplexObject, cval.real), 0}, ! {"imag", T_DOUBLE, offsetof(PyComplexObject, cval.imag), 0}, ! {0}, ! }; static PyNumberMethods complex_as_number = { *************** *** 607,611 **** (destructor)complex_dealloc, /* tp_dealloc */ (printfunc)complex_print, /* tp_print */ ! (getattrfunc)complex_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ --- 601,605 ---- (destructor)complex_dealloc, /* tp_dealloc */ (printfunc)complex_print, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ *************** *** 625,628 **** --- 619,630 ---- 0, /* tp_clear */ complex_richcompare, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + complex_methods, /* tp_methods */ + complex_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ }; Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.80 retrieving revision 2.80.2.1 diff -C2 -r2.80 -r2.80.2.1 *** dictobject.c 2001/04/23 14:08:49 2.80 --- dictobject.c 2001/04/24 00:43:30 2.80.2.1 *************** *** 1287,1296 **** }; - static PyObject * - dict_getattr(dictobject *mp, char *name) - { - return Py_FindMethod(mapp_methods, (PyObject *)mp, name); - } - static int dict_contains(dictobject *mp, PyObject *key) --- 1287,1290 ---- *************** *** 1335,1339 **** (destructor)dict_dealloc, /* tp_dealloc */ (printfunc)dict_print, /* tp_print */ ! (getattrfunc)dict_getattr, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)dict_compare, /* tp_compare */ --- 1329,1333 ---- (destructor)dict_dealloc, /* tp_dealloc */ (printfunc)dict_print, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)dict_compare, /* tp_compare */ *************** *** 1356,1359 **** --- 1350,1358 ---- (getiterfunc)dictiter_new, /* tp_iter */ 0, /* tp_iternext */ + mapp_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ }; Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.112 retrieving revision 2.112.2.1 diff -C2 -r2.112 -r2.112.2.1 *** fileobject.c 2001/04/23 14:08:49 2.112 --- fileobject.c 2001/04/24 00:43:30 2.112.2.1 *************** *** 1274,1300 **** static PyObject * ! file_getattr(PyFileObject *f, char *name) { ! PyObject *res; ! ! res = Py_FindMethod(file_methods, (PyObject *)f, name); ! if (res != NULL) ! return res; ! PyErr_Clear(); ! if (strcmp(name, "closed") == 0) ! return PyInt_FromLong((long)(f->f_fp == 0)); ! return PyMember_Get((char *)f, file_memberlist, name); } ! static int ! file_setattr(PyFileObject *f, char *name, PyObject *v) ! { ! if (v == NULL) { ! PyErr_SetString(PyExc_AttributeError, ! "can't delete file attributes"); ! return -1; ! } ! return PyMember_Set((char *)f, file_memberlist, name, v); ! } static PyObject * --- 1274,1286 ---- static PyObject * ! get_closed(PyFileObject *f, void *closure) { ! return PyInt_FromLong((long)(f->f_fp == 0)); } ! static struct getsetlist file_getsetlist[] = { ! {"closed", (getter)get_closed, NULL, NULL}, ! {0}, ! }; static PyObject * *************** *** 1321,1328 **** (destructor)file_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)file_getattr, /* tp_getattr */ ! (setattrfunc)file_setattr, /* tp_setattr */ 0, /* tp_compare */ ! (reprfunc)file_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ --- 1307,1314 ---- (destructor)file_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ 0, /* tp_compare */ ! (reprfunc)file_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ *************** *** 1335,1345 **** 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ (getiterfunc)file_getiter, /* tp_iter */ 0, /* tp_iternext */ }; --- 1321,1336 ---- 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ (getiterfunc)file_getiter, /* tp_iter */ 0, /* tp_iternext */ + file_methods, /* tp_methods */ + file_memberlist, /* tp_members */ + file_getsetlist, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ }; Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.49 retrieving revision 2.49.4.1 diff -C2 -r2.49 -r2.49.4.1 *** frameobject.c 2001/04/14 17:55:41 2.49 --- frameobject.c 2001/04/24 00:43:30 2.49.4.1 *************** *** 28,43 **** static PyObject * ! frame_getattr(PyFrameObject *f, char *name) { ! if (strcmp(name, "f_locals") == 0) ! PyFrame_FastToLocals(f); ! return PyMember_Get((char *)f, frame_memberlist, name); } ! static int ! frame_setattr(PyFrameObject *f, char *name, PyObject *value) ! { ! return PyMember_Set((char *)f, frame_memberlist, name, value); ! } /* Stack frames are allocated and deallocated at a considerable rate. --- 28,42 ---- static PyObject * ! frame_getlocals(PyFrameObject *f, void *closure) { ! PyFrame_FastToLocals(f); ! Py_INCREF(f->f_locals); ! return f->f_locals; } ! static struct getsetlist frame_getsetlist[] = { ! {"f_locals", (getter)frame_getlocals, NULL, NULL}, ! {0} ! }; /* Stack frames are allocated and deallocated at a considerable rate. *************** *** 99,104 **** (destructor)frame_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)frame_getattr, /*tp_getattr*/ ! (setattrfunc)frame_setattr, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ --- 98,103 ---- (destructor)frame_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ *************** *** 106,109 **** --- 105,127 ---- 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + frame_memberlist, /* tp_members */ + frame_getsetlist, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ }; Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.92 retrieving revision 2.92.6.1 diff -C2 -r2.92 -r2.92.6.1 *** listobject.c 2001/02/12 22:06:02 2.92 --- listobject.c 2001/04/24 00:43:30 2.92.6.1 *************** *** 1523,1532 **** }; - static PyObject * - list_getattr(PyListObject *f, char *name) - { - return Py_FindMethod(list_methods, (PyObject *)f, name); - } - static PySequenceMethods list_as_sequence = { (inquiry)list_length, /* sq_length */ --- 1523,1526 ---- *************** *** 1550,1554 **** (destructor)list_dealloc, /* tp_dealloc */ (printfunc)list_print, /* tp_print */ ! (getattrfunc)list_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ --- 1544,1548 ---- (destructor)list_dealloc, /* tp_dealloc */ (printfunc)list_print, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ *************** *** 1568,1571 **** --- 1562,1573 ---- (inquiry)list_clear, /* tp_clear */ list_richcompare, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + list_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ }; *************** *** 1596,1605 **** }; - static PyObject * - immutable_list_getattr(PyListObject *f, char *name) - { - return Py_FindMethod(immutable_list_methods, (PyObject *)f, name); - } - static int immutable_list_ass(void) --- 1598,1601 ---- *************** *** 1628,1632 **** 0, /* Cannot happen */ /* tp_dealloc */ (printfunc)list_print, /* tp_print */ ! (getattrfunc)immutable_list_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* Won't be called */ /* tp_compare */ --- 1624,1628 ---- 0, /* Cannot happen */ /* tp_dealloc */ (printfunc)list_print, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* Won't be called */ /* tp_compare */ *************** *** 1646,1649 **** --- 1642,1653 ---- 0, /* tp_clear */ list_richcompare, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + immutable_list_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ /* NOTE: This is *not* the standard list_type struct! */ }; Index: methodobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/methodobject.c,v retrieving revision 2.33 retrieving revision 2.33.8.1 diff -C2 -r2.33 -r2.33.8.1 *** methodobject.c 2000/09/01 23:29:27 2.33 --- methodobject.c 2001/04/24 00:43:30 2.33.8.1 *************** *** 4,9 **** #include "Python.h" - #include "token.h" - static PyCFunctionObject *free_list = NULL; --- 4,7 ---- *************** *** 69,105 **** static PyObject * ! meth_getattr(PyCFunctionObject *m, char *name) { ! if (strcmp(name, "__name__") == 0) { ! return PyString_FromString(m->m_ml->ml_name); ! } ! if (strcmp(name, "__doc__") == 0) { ! char *doc = m->m_ml->ml_doc; ! if (doc != NULL) ! return PyString_FromString(doc); ! Py_INCREF(Py_None); ! return Py_None; ! } ! if (strcmp(name, "__self__") == 0) { ! PyObject *self; ! if (PyEval_GetRestricted()) { ! PyErr_SetString(PyExc_RuntimeError, ! "method.__self__ not accessible in restricted mode"); ! return NULL; ! } ! self = m->m_self; ! if (self == NULL) ! self = Py_None; ! Py_INCREF(self); ! return self; ! } ! if (strcmp(name, "__members__") == 0) { ! return Py_BuildValue("[sss]", ! "__doc__", "__name__", "__self__"); } ! PyErr_SetString(PyExc_AttributeError, name); ! return NULL; } static PyObject * meth_repr(PyCFunctionObject *m) --- 67,109 ---- static PyObject * ! meth_get__doc__(PyCFunctionObject *m, void *closure) { ! char *doc = m->m_ml->ml_doc; ! ! if (doc != NULL) ! return PyString_FromString(doc); ! Py_INCREF(Py_None); ! return Py_None; ! } ! ! static PyObject * ! meth_get__name__(PyCFunctionObject *m, void *closure) ! { ! return PyString_FromString(m->m_ml->ml_name); ! } ! ! static PyObject * ! meth_get__self__(PyCFunctionObject *m, void *closure) ! { ! PyObject *self; ! if (PyEval_GetRestricted()) { ! PyErr_SetString(PyExc_RuntimeError, ! "method.__self__ not accessible in restricted mode"); ! return NULL; } ! self = m->m_self; ! if (self == NULL) ! self = Py_None; ! Py_INCREF(self); ! return self; } + static struct getsetlist meth_getsets [] = { + {"__doc__", (getter)meth_get__doc__, NULL, NULL}, + {"__name__", (getter)meth_get__name__, NULL, NULL}, + {"__self__", (getter)meth_get__self__, NULL, NULL}, + {0} + }; + static PyObject * meth_repr(PyCFunctionObject *m) *************** *** 155,168 **** sizeof(PyCFunctionObject), 0, ! (destructor)meth_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! (getattrfunc)meth_getattr, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! (cmpfunc)meth_compare, /*tp_compare*/ ! (reprfunc)meth_repr, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! (hashfunc)meth_hash, /*tp_hash*/ }; --- 159,189 ---- sizeof(PyCFunctionObject), 0, ! (destructor)meth_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)meth_compare, /* tp_compare */ ! (reprfunc)meth_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)meth_hash, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_methods */ ! 0, /* tp_members */ ! meth_getsets, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ }; Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124 retrieving revision 2.124.4.1 diff -C2 -r2.124 -r2.124.4.1 *** object.c 2001/03/25 19:16:13 2.124 --- object.c 2001/04/24 00:43:30 2.124.4.1 *************** *** 982,1005 **** PyObject_GetAttrString(PyObject *v, char *name) { ! if (v->ob_type->tp_getattro != NULL) { ! PyObject *w, *res; ! w = PyString_InternFromString(name); ! if (w == NULL) ! return NULL; ! res = (*v->ob_type->tp_getattro)(v, w); ! Py_XDECREF(w); ! return res; ! } ! if (v->ob_type->tp_getattr == NULL) { ! PyErr_Format(PyExc_AttributeError, ! "'%.50s' object has no attribute '%.400s'", ! v->ob_type->tp_name, ! name); ! return NULL; ! } ! else { return (*v->ob_type->tp_getattr)(v, name); ! } } --- 982,995 ---- PyObject_GetAttrString(PyObject *v, char *name) { ! PyObject *w, *res; ! if (v->ob_type->tp_getattr != NULL) return (*v->ob_type->tp_getattr)(v, name); ! w = PyString_InternFromString(name); ! if (w == NULL) ! return NULL; ! res = PyObject_GetAttr(v, w); ! Py_XDECREF(w); ! return res; } *************** *** 1019,1033 **** PyObject_SetAttrString(PyObject *v, char *name, PyObject *w) { ! if (v->ob_type->tp_setattro != NULL) { ! PyObject *s; ! int res; ! s = PyString_InternFromString(name); ! if (s == NULL) ! return -1; ! res = (*v->ob_type->tp_setattro)(v, s, w); ! Py_XDECREF(s); ! return res; ! } if (v->ob_type->tp_setattr == NULL) { if (v->ob_type->tp_getattr == NULL) --- 1009,1026 ---- PyObject_SetAttrString(PyObject *v, char *name, PyObject *w) { ! PyObject *s; ! int res; ! ! if (v->ob_type->tp_setattr != NULL) ! return (*v->ob_type->tp_setattr)(v, name, w); ! s = PyString_InternFromString(name); ! if (s == NULL) ! return -1; ! res = PyObject_SetAttr(v, s, w); ! Py_XDECREF(s); ! return res; ! } + /* if (v->ob_type->tp_setattr == NULL) { if (v->ob_type->tp_getattr == NULL) *************** *** 1042,1046 **** return (*v->ob_type->tp_setattr)(v, name, w); } ! } /* Internal API needed by PyObject_GetAttr(): */ --- 1035,1039 ---- return (*v->ob_type->tp_setattr)(v, name, w); } ! */ /* Internal API needed by PyObject_GetAttr(): */ *************** *** 1052,1055 **** --- 1045,1050 ---- PyObject_GetAttr(PyObject *v, PyObject *name) { + PyTypeObject *tp = v->ob_type; + /* The Unicode to string conversion is done here because the existing tp_getattro slots expect a string object as name *************** *** 1060,1064 **** return NULL; } - if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, --- 1055,1058 ---- *************** *** 1066,1073 **** return NULL; } ! if (v->ob_type->tp_getattro != NULL) ! return (*v->ob_type->tp_getattro)(v, name); ! else ! return PyObject_GetAttrString(v, PyString_AS_STRING(name)); } --- 1060,1081 ---- return NULL; } ! if (tp->tp_getattro != NULL) ! return (*tp->tp_getattro)(v, name); ! if (tp->tp_getattr != NULL) ! return (*tp->tp_getattr)(v, PyString_AS_STRING(name)); ! if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { ! PyObject *descr; ! if (tp->tp_dict == NULL) { ! if (PyType_InitDict(tp) < 0) ! return NULL; ! } ! descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr != NULL) ! return PyDescr_Get(descr, v); ! } ! PyErr_Format(PyExc_AttributeError, ! "'%.50s' object has no attribute '%.400s'", ! tp->tp_name, PyString_AS_STRING(name)); ! return NULL; } *************** *** 1087,1090 **** --- 1095,1099 ---- PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value) { + PyTypeObject *tp = v->ob_type; int err; *************** *** 1097,1119 **** return -1; } ! else ! Py_INCREF(name); ! ! if (!PyString_Check(name)){ PyErr_SetString(PyExc_TypeError, "attribute name must be string"); ! err = -1; } ! else { ! PyString_InternInPlace(&name); ! if (v->ob_type->tp_setattro != NULL) ! err = (*v->ob_type->tp_setattro)(v, name, value); ! else ! err = PyObject_SetAttrString(v, ! PyString_AS_STRING(name), value); } - Py_DECREF(name); ! return err; } --- 1106,1146 ---- return -1; } ! else if (!PyString_Check(name)){ PyErr_SetString(PyExc_TypeError, "attribute name must be string"); ! return -1; } ! else ! Py_INCREF(name); ! ! PyString_InternInPlace(&name); ! if (tp->tp_setattro != NULL) { ! err = (*tp->tp_setattro)(v, name, value); ! Py_DECREF(name); ! return err; ! } ! if (tp->tp_setattr != NULL) { ! err = (*tp->tp_setattr)(v, PyString_AS_STRING(name), value); ! Py_DECREF(name); ! return err; ! } ! if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { ! PyObject *descr; ! if (tp->tp_dict == NULL) { ! if (PyType_InitDict(tp) < 0) ! return -1; ! } ! descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr != NULL) { ! err = PyDescr_Set(descr, v, value); ! Py_DECREF(name); ! return err; ! } } Py_DECREF(name); ! PyErr_Format(PyExc_AttributeError, ! "'%.50s' object has no attribute '%.400s'", ! tp->tp_name, PyString_AS_STRING(name)); ! return -1; } Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.24 retrieving revision 2.24.6.1 diff -C2 -r2.24 -r2.24.6.1 *** rangeobject.c 2001/01/15 18:58:56 2.24 --- rangeobject.c 2001/04/24 00:43:30 2.24.6.1 *************** *** 249,280 **** static PyObject * ! range_getattr(rangeobject *r, char *name) { ! PyObject *result; ! ! static PyMethodDef range_methods[] = { ! {"tolist", (PyCFunction)range_tolist, METH_VARARGS, ! "tolist() -> list\n" ! "Return a list object with the same values."}, ! {NULL, NULL} ! }; ! static struct memberlist range_members[] = { ! {"step", T_LONG, offsetof(rangeobject, step), RO}, ! {"start", T_LONG, offsetof(rangeobject, start), RO}, ! {"stop", T_LONG, 0, RO}, ! {NULL, 0, 0, 0} ! }; ! ! result = Py_FindMethod(range_methods, (PyObject *) r, name); ! if (result == NULL) { ! PyErr_Clear(); ! if (strcmp("stop", name) == 0) ! result = PyInt_FromLong(r->start + (r->len * r->step)); ! else ! result = PyMember_Get((char *)r, range_members, name); ! } ! return result; } static int range_contains(rangeobject *r, PyObject *obj) --- 249,274 ---- static PyObject * ! range_getstop(rangeobject *r, void *closure) { ! return PyInt_FromLong(r->start + (r->len * r->step)); } + static PyMethodDef range_methods[] = { + {"tolist", (PyCFunction)range_tolist, METH_VARARGS, + "tolist() -> list\n" + "Return a list object with the same values."}, + {NULL, NULL} + }; + static struct memberlist range_members[] = { + {"step", T_LONG, offsetof(rangeobject, step), RO}, + {"start", T_LONG, offsetof(rangeobject, start), RO}, + {NULL, 0, 0, 0} + }; + + static struct getsetlist range_getsets[] = { + {"stop", (getter)range_getstop, NULL, NULL}, + {0} + }; + static int range_contains(rangeobject *r, PyObject *obj) *************** *** 319,323 **** (destructor)range_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)range_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ (cmpfunc)range_compare, /*tp_compare*/ --- 313,317 ---- (destructor)range_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! 0, /*tp_getattr*/ 0, /*tp_setattr*/ (cmpfunc)range_compare, /*tp_compare*/ *************** *** 333,335 **** --- 327,341 ---- 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + range_methods, /* tp_methods */ + range_members, /* tp_members */ + range_getsets, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ }; Index: sliceobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/sliceobject.c,v retrieving revision 2.7 retrieving revision 2.7.4.1 diff -C2 -r2.7 -r2.7.4.1 *** sliceobject.c 2001/03/20 12:41:34 2.7 --- sliceobject.c 2001/04/24 00:43:30 2.7.4.1 *************** *** 15,18 **** --- 15,19 ---- #include "Python.h" + #include "structmember.h" static PyObject * *************** *** 129,158 **** } ! ! static PyObject *slice_getattr(PySliceObject *self, char *name) ! { ! PyObject *ret; ! ! ret = NULL; ! if (strcmp(name, "start") == 0) { ! ret = self->start; ! } ! else if (strcmp(name, "stop") == 0) { ! ret = self->stop; ! } ! else if (strcmp(name, "step") == 0) { ! ret = self->step; ! } ! else if (strcmp(name, "__members__") == 0) { ! return Py_BuildValue("[sss]", ! "start", "stop", "step"); ! } ! else { ! PyErr_SetString(PyExc_AttributeError, name); ! return NULL; ! } ! Py_INCREF(ret); ! return ret; ! } static int --- 130,139 ---- } ! static struct memberlist slice_members[] = { ! {"start", T_OBJECT, offsetof(PySliceObject, start), READONLY}, ! {"stop", T_OBJECT, offsetof(PySliceObject, stop), READONLY}, ! {"step", T_OBJECT, offsetof(PySliceObject, step), READONLY}, ! {0} ! }; static int *************** *** 183,194 **** sizeof(PySliceObject), /* Basic object size */ 0, /* Item size for varobject */ ! (destructor)slice_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! (getattrfunc)slice_getattr, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! (cmpfunc)slice_compare, /*tp_compare*/ ! (reprfunc)slice_repr, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ }; --- 164,194 ---- sizeof(PySliceObject), /* Basic object size */ 0, /* Item size for varobject */ ! (destructor)slice_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)slice_compare, /* tp_compare */ ! (reprfunc)slice_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* tp_methods */ ! slice_members, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ }; Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.103 retrieving revision 2.103.2.1 diff -C2 -r2.103 -r2.103.2.1 *** stringobject.c 2001/04/20 19:13:02 2.103 --- stringobject.c 2001/04/24 00:43:30 2.103.2.1 *************** *** 2351,2361 **** }; - static PyObject * - string_getattr(PyStringObject *s, char *name) - { - return Py_FindMethod(string_methods, (PyObject*)s, name); - } - PyTypeObject PyString_Type = { PyObject_HEAD_INIT(&PyType_Type) --- 2351,2355 ---- *************** *** 2366,2370 **** (destructor)string_dealloc, /*tp_dealloc*/ (printfunc)string_print, /*tp_print*/ ! (getattrfunc)string_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ (cmpfunc)string_compare, /*tp_compare*/ --- 2360,2364 ---- (destructor)string_dealloc, /*tp_dealloc*/ (printfunc)string_print, /*tp_print*/ ! 0, /*tp_getattr*/ 0, /*tp_setattr*/ (cmpfunc)string_compare, /*tp_compare*/ *************** *** 2381,2384 **** --- 2375,2389 ---- Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + string_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ }; Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16 retrieving revision 2.16.8.1 diff -C2 -r2.16 -r2.16.8.1 *** typeobject.c 2000/09/01 23:29:27 2.16 --- typeobject.c 2001/04/24 00:43:30 2.16.8.1 *************** *** 3,35 **** #include "Python.h" ! /* Type object implementation */ static PyObject * ! type_getattr(PyTypeObject *t, char *name) { ! if (strcmp(name, "__name__") == 0) ! return PyString_FromString(t->tp_name); ! if (strcmp(name, "__doc__") == 0) { ! char *doc = t->tp_doc; ! if (doc != NULL) ! return PyString_FromString(doc); ! Py_INCREF(Py_None); ! return Py_None; ! } ! if (strcmp(name, "__members__") == 0) ! return Py_BuildValue("[ss]", "__doc__", "__name__"); ! PyErr_SetString(PyExc_AttributeError, name); ! return NULL; } static PyObject * ! type_repr(PyTypeObject *v) { char buf[100]; ! sprintf(buf, "", v->tp_name); return PyString_FromString(buf); } PyTypeObject PyType_Type = { PyObject_HEAD_INIT(&PyType_Type) --- 3,71 ---- #include "Python.h" + #include "structmember.h" ! struct memberlist type_members[] = { ! {"__name__", T_STRING, offsetof(PyTypeObject, tp_name), READONLY}, ! {"__doc__", T_STRING, offsetof(PyTypeObject, tp_doc), READONLY}, ! {"__dict__", T_OBJECT, offsetof(PyTypeObject, tp_dict), READONLY}, ! {0} ! }; static PyObject * ! type_bases(PyObject *type, void *context) { ! return PyTuple_New(0); } + struct getsetlist type_getsets[] = { + {"__bases__", type_bases, NULL, NULL}, + {0} + }; + static PyObject * ! type_repr(PyTypeObject *type) { char buf[100]; ! sprintf(buf, "", type->tp_name); return PyString_FromString(buf); } + static PyObject * + type_getattro(PyTypeObject *type, PyObject *name) + { + PyTypeObject *tp = type->ob_type; /* Usually == &PyType_Type below */ + PyObject *descr; + + assert(PyString_Check(name)); + + if (type->tp_flags & Py_TPFLAGS_HAVE_CLASS) { + if (type->tp_dict == NULL) { + if (PyType_InitDict(type) < 0) + return NULL; + } + } + + if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { + if (tp->tp_dict == NULL) { + if (PyType_InitDict(tp) < 0) + return NULL; + } + descr = PyDict_GetItem(tp->tp_dict, name); + if (descr != NULL) + return PyDescr_Get(descr, (PyObject *)type); + } + + if (type->tp_flags & Py_TPFLAGS_HAVE_CLASS) { + descr = PyDict_GetItem(type->tp_dict, name); + if (descr != NULL) + return PyDescr_Get(descr, NULL); + } + + PyErr_Format(PyExc_AttributeError, + "type '%.50s' has no attribute '%.400s'", + type->tp_name, PyString_AS_STRING(name)); + return NULL; + } + PyTypeObject PyType_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 38,57 **** sizeof(PyTypeObject), /* Basic object size */ 0, /* Item size for varobject */ ! 0, /*tp_dealloc*/ ! 0, /*tp_print*/ ! (getattrfunc)type_getattr, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! 0, /*tp_compare*/ ! (reprfunc)type_repr, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! 0, /*tp_hash*/ ! 0, /*tp_call*/ ! 0, /*tp_str*/ ! 0, /*tp_xxx1*/ ! 0, /*tp_xxx2*/ ! 0, /*tp_xxx3*/ ! 0, /*tp_xxx4*/ ! "Define the behavior of a particular type of object.", }; --- 74,104 ---- sizeof(PyTypeObject), /* Basic object size */ 0, /* Item size for varobject */ ! 0, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! (reprfunc)type_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! (getattrofunc)type_getattro, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! "Define the behavior of a particular type of object.", /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* tp_methods */ ! type_members, /* tp_members */ ! type_getsets, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ }; Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.87 retrieving revision 2.87.2.1 diff -C2 -r2.87 -r2.87.2.1 *** unicodeobject.c 2001/04/23 14:44:21 2.87 --- unicodeobject.c 2001/04/24 00:43:30 2.87.2.1 *************** *** 4558,4567 **** }; - static PyObject * - unicode_getattr(PyUnicodeObject *self, char *name) - { - return Py_FindMethod(unicode_methods, (PyObject*) self, name); - } - static PySequenceMethods unicode_as_sequence = { (inquiry) unicode_length, /* sq_length */ --- 4558,4561 ---- *************** *** 5235,5239 **** (destructor)_PyUnicode_Free, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)unicode_getattr, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc) unicode_compare, /* tp_compare */ --- 5229,5233 ---- (destructor)_PyUnicode_Free, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc) unicode_compare, /* tp_compare */ *************** *** 5245,5252 **** 0, /* tp_call*/ (reprfunc) unicode_str, /* tp_str */ ! (getattrofunc) NULL, /* tp_getattro */ ! (setattrofunc) NULL, /* tp_setattro */ &unicode_as_buffer, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ }; --- 5239,5258 ---- 0, /* tp_call*/ (reprfunc) unicode_str, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ &unicode_as_buffer, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + unicode_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ }; From gvanrossum@users.sourceforge.net Tue Apr 24 01:49:10 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 17:49:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include descrobject.h,NONE,1.1.2.1 Python.h,2.32,2.32.2.1 object.h,2.79,2.79.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv23212/Include Modified Files: Tag: descr-branch Python.h object.h Added Files: Tag: descr-branch descrobject.h Log Message: Interim commit to descriptors prototype; see PEP 252. --- NEW FILE: descrobject.h --- /* XXX getter, setter, and struct getsetlist need 'Py'-prefixed names */ typedef PyObject *(*getter)(PyObject *, void *); typedef int (*setter)(PyObject *, PyObject *, void *); struct getsetlist { char *name; getter get; setter set; void *closure; }; extern PyTypeObject PyDescr_Type; #define PyDescr_Check(d) ((d)->ob_type == &PyDescr_Type) typedef struct PyDescrObject PyDescrObject; extern DL_IMPORT(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); extern DL_IMPORT(PyObject *) PyDescr_NewMember(PyTypeObject *, struct memberlist *); extern DL_IMPORT(PyObject *) PyDescr_NewGetSet(PyTypeObject *, struct getsetlist *); extern DL_IMPORT(PyObject *) PyDescr_Get(PyObject *, PyObject *); extern DL_IMPORT(int) PyDescr_Set(PyObject *, PyObject *, PyObject *); extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *); Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.32 retrieving revision 2.32.2.1 diff -C2 -r2.32 -r2.32.2.1 *** Python.h 2001/04/20 19:13:01 2.32 --- Python.h 2001/04/24 00:49:08 2.32.2.1 *************** *** 84,87 **** --- 84,88 ---- #include "cellobject.h" #include "iterobject.h" + #include "descrobject.h" #include "codecs.h" Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.79 retrieving revision 2.79.2.1 diff -C2 -r2.79 -r2.79.2.1 *** object.h 2001/04/23 14:08:49 2.79 --- object.h 2001/04/24 00:49:08 2.79.2.1 *************** *** 256,259 **** --- 256,266 ---- iternextfunc tp_iternext; + /* Attribute descriptor stuff */ + struct PyMethodDef *tp_methods; + struct memberlist *tp_members; + struct getsetlist *tp_getset; + struct _typeobject *tp_base; + PyObject *tp_dict; + #ifdef COUNT_ALLOCS /* these must be last and never explicitly initialized */ *************** *** 358,361 **** --- 365,371 ---- #define Py_TPFLAGS_HAVE_ITER (1L<<7) + /* Experimental stuff for healing the type/class split */ + #define Py_TPFLAGS_HAVE_CLASS (1L<<8) + #define Py_TPFLAGS_DEFAULT ( \ Py_TPFLAGS_HAVE_GETCHARBUFFER | \ *************** *** 365,368 **** --- 375,379 ---- Py_TPFLAGS_HAVE_WEAKREFS | \ Py_TPFLAGS_HAVE_ITER | \ + Py_TPFLAGS_HAVE_CLASS | \ 0) From gvanrossum@users.sourceforge.net Tue Apr 24 01:49:10 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 17:49:10 -0700 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.37,1.37.2.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv23212 Modified Files: Tag: descr-branch Makefile.pre.in Log Message: Interim commit to descriptors prototype; see PEP 252. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.37 retrieving revision 1.37.2.1 diff -C2 -r1.37 -r1.37.2.1 *** Makefile.pre.in 2001/04/20 19:13:01 1.37 --- Makefile.pre.in 2001/04/24 00:49:08 1.37.2.1 *************** *** 234,237 **** --- 234,238 ---- Objects/cobject.o \ Objects/complexobject.o \ + Objects/descrobject.o \ Objects/fileobject.o \ Objects/floatobject.o \ *************** *** 436,439 **** --- 437,441 ---- Include/listobject.h \ Include/iterobject.h \ + Include/descrobject.h \ Include/dictobject.h \ Include/methodobject.h \ From gvanrossum@users.sourceforge.net Tue Apr 24 01:54:19 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 17:54:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild pythoncore.dsp,1.15,1.15.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv24325 Modified Files: Tag: descr-branch pythoncore.dsp Log Message: Make descr-branch build on Windows Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -C2 -r1.15 -r1.15.2.1 *** pythoncore.dsp 2001/04/20 21:21:28 1.15 --- pythoncore.dsp 2001/04/24 00:54:17 1.15.2.1 *************** *** 496,499 **** --- 496,514 ---- # Begin Source File + SOURCE=..\Objects\descrobject.c + + !IF "$(CFG)" == "pythoncore - Win32 Release" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Release" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=..\Objects\dictobject.c From gvanrossum@users.sourceforge.net Tue Apr 24 02:36:14 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 18:36:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects methodobject.c,2.33.8.1,2.33.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1452 Modified Files: Tag: descr-branch methodobject.c Log Message: Add missing tp_iternext initializer. Index: methodobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/methodobject.c,v retrieving revision 2.33.8.1 retrieving revision 2.33.8.2 diff -C2 -r2.33.8.1 -r2.33.8.2 *** methodobject.c 2001/04/24 00:43:30 2.33.8.1 --- methodobject.c 2001/04/24 01:36:12 2.33.8.2 *************** *** 181,184 **** --- 181,185 ---- 0, /* tp_weaklistoffset */ 0, /* tp_iter */ + 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ From gvanrossum@users.sourceforge.net Tue Apr 24 02:43:08 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 23 Apr 2001 18:43:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects descrobject.c,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2984 Modified Files: Tag: descr-branch descrobject.c Log Message: Implement most descriptor properties from PEP 252: name/__name__, doc/__doc__, kind, readonly, objclass, get(), set(), call(), bind(). Not yet: default, attrclass, signature. (I don't know these!) Incomplete: call() implementation is the same as tp_call and has undefined effects for data attributes; bind() is the same as get(); there are no docstrings for getset and structmember style attributes. The Descr_Get and Descr_Set operations should support other descriptors, using the get/set protocol, but they don't yet. Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/descrobject.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -r1.1.2.1 -r1.1.2.2 *** descrobject.c 2001/04/24 00:43:30 1.1.2.1 --- descrobject.c 2001/04/24 01:43:06 1.1.2.2 *************** *** 145,193 **** static PyObject * ! descr_getattr(PyDescrObject *descr, char *name) { ! char *s; ! if (strcmp(name, "__name__") == 0) { ! s = NULL; ! switch (descr->d_flavor) { ! case DF_METHOD: ! s = descr->d_union.d_method->ml_name; ! break; ! case DF_MEMBER: ! s = descr->d_union.d_member->name; ! break; ! case DF_GETSET: ! s = descr->d_union.d_getset->name; ! break; ! } ! if (s != NULL) ! return PyString_FromString(s); ! } ! if (strcmp(name, "__doc__") == 0) { ! if (descr->d_flavor == DF_METHOD) { ! s = descr->d_union.d_method->ml_doc; ! ! if (s == NULL) { ! Py_INCREF(Py_None); ! return Py_None; ! } ! else { ! return PyString_FromString(s); ! } ! } ! } ! s = descr_name(descr); ! if (s == NULL) ! s = "?"; ! PyErr_Format(PyExc_AttributeError, ! "descriptor '%.100s' of '%.100s' objects has no " ! "'%.100s' attribute", ! s, descr->d_type->tp_name, name); return NULL; } PyTypeObject PyDescr_Type = { PyObject_HEAD_INIT(&PyType_Type) --- 145,245 ---- static PyObject * ! descr_get(PyObject *descr, PyObject *args) { ! PyObject *obj; ! if (!PyArg_ParseTuple(args, "O:get", &obj)) ! return NULL; ! return PyDescr_Get(descr, obj); ! } ! static PyObject * ! descr_set(PyObject *descr, PyObject *args) ! { ! PyObject *obj, *val; ! ! if (!PyArg_ParseTuple(args, "OO:set", &obj, &val)) ! return NULL; ! if (PyDescr_Set(descr, obj, val) < 0) ! return NULL; ! Py_INCREF(Py_None); ! return Py_None; ! } ! static PyMethodDef descr_methods[] = { ! {"get", descr_get, METH_VARARGS}, ! {"set", descr_set, METH_VARARGS}, ! {"call", descr_call, METH_VARARGS|METH_KEYWORDS}, ! {"bind", descr_get, METH_VARARGS}, ! {0} ! }; ! ! static PyObject * ! descr_get_name(PyDescrObject *descr) ! { ! char *s = descr_name(descr); ! ! if (s != NULL) ! return PyString_FromString(s); ! PyErr_SetString(PyExc_AttributeError, "unnamed descriptor"); return NULL; } + static PyObject * + descr_get_doc(PyDescrObject *descr) { + char *s = NULL; + + if (descr->d_flavor == DF_METHOD) + s = descr->d_union.d_method->ml_doc; + + if (s != NULL) + return PyString_FromString(s); + + Py_INCREF(Py_None); + return Py_None; + } + + static PyObject * + descr_get_kind(PyDescrObject *descr) { + char *s = "data"; + + if (descr->d_flavor == DF_METHOD) + s = "method"; + return PyString_FromString(s); + } + + static PyObject * + descr_get_readonly(PyDescrObject *descr) { + int readonly = 1; + + switch (descr->d_flavor) { + case DF_MEMBER: + readonly = descr->d_union.d_member->readonly; + break; + case DF_GETSET: + readonly = descr->d_union.d_getset->set == NULL; + break; + } + return PyInt_FromLong(readonly); + } + + static struct getsetlist descr_getsets[] = { + {"name", descr_get_name}, + {"__name__", descr_get_name}, + {"doc", descr_get_doc}, + {"__doc__", descr_get_doc}, + {"kind", descr_get_kind}, + {"readonly", descr_get_readonly}, + {0} + }; + + static struct memberlist descr_members[] = { + {"objclass", T_OBJECT, offsetof(struct PyDescrObject, d_type), + READONLY}, + {"_flavor", T_INT, offsetof(struct PyDescrObject, d_flavor), + READONLY}, + {0} + }; + PyTypeObject PyDescr_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 198,202 **** (destructor)descr_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)descr_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ --- 250,254 ---- (destructor)descr_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ *************** *** 219,225 **** 0, /* tp_iter */ 0, /* tp_iternext */ ! 0, /* tp_methods */ ! 0, /* tp_members */ ! 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ --- 271,277 ---- 0, /* tp_iter */ 0, /* tp_iternext */ ! descr_methods, /* tp_methods */ ! descr_members, /* tp_members */ ! descr_getsets, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ From tim_one@users.sourceforge.net Tue Apr 24 06:16:31 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 23 Apr 2001 22:16:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.95,1.96 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv14303/python/dist/src/Misc Modified Files: ACKS Log Message: SF bug 418296: WinMain.c should use WIN32_LEAN_AND_MEAN. I believe Kevin Rodgers here! The old WINDOWS_LEAN_AND_MEAN has, AFAICT, always been wrong. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -r1.95 -r1.96 *** ACKS 2001/04/21 03:20:47 1.95 --- ACKS 2001/04/24 05:16:29 1.96 *************** *** 324,327 **** --- 324,328 ---- Andy Robinson Jim Robinson + Kevin Rodgers Mike Romberg Case Roole From tim_one@users.sourceforge.net Tue Apr 24 06:16:32 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 23 Apr 2001 22:16:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/PC WinMain.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv14303/python/dist/src/PC Modified Files: WinMain.c Log Message: SF bug 418296: WinMain.c should use WIN32_LEAN_AND_MEAN. I believe Kevin Rodgers here! The old WINDOWS_LEAN_AND_MEAN has, AFAICT, always been wrong. Index: WinMain.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/WinMain.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** WinMain.c 2000/07/22 23:59:33 1.6 --- WinMain.c 2001/04/24 05:16:29 1.7 *************** *** 1,5 **** /* Minimal main program -- everything is loaded from the library. */ ! #define WINDOWS_LEAN_AND_MEAN #include --- 1,5 ---- /* Minimal main program -- everything is loaded from the library. */ ! #define WIN32_LEAN_AND_MEAN #include From tim_one@users.sourceforge.net Wed Apr 25 04:43:16 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 24 Apr 2001 20:43:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pipes.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14890/python/dist/src/Lib Modified Files: pipes.py Log Message: SF bug 418615: regular expression bug in pipes.py. Obviously bad regexps, spotted by Jeffery Collins. HELP! I can't run this on Windows, and the module test() function probably doesn't work on anyone's box. Could a Unixoid please write an at least minimal working test and add it to the std test suite? Index: pipes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pipes.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** pipes.py 2001/02/07 23:14:30 1.8 --- pipes.py 2001/04/25 03:43:14 1.9 *************** *** 124,131 **** raise ValueError, \ 'Template.append: already ends with SINK' ! if kind[0] == 'f' and not re.search('\$IN\b', cmd): raise ValueError, \ 'Template.append: missing $IN in cmd' ! if kind[1] == 'f' and not re.search('\$OUT\b', cmd): raise ValueError, \ 'Template.append: missing $OUT in cmd' --- 124,131 ---- raise ValueError, \ 'Template.append: already ends with SINK' ! if kind[0] == 'f' and not re.search(r'\$IN\b', cmd): raise ValueError, \ 'Template.append: missing $IN in cmd' ! if kind[1] == 'f' and not re.search(r'\$OUT\b', cmd): raise ValueError, \ 'Template.append: missing $OUT in cmd' *************** *** 146,153 **** raise ValueError, \ 'Template.prepend: already begins with SOURCE' ! if kind[0] == 'f' and not re.search('\$IN\b', cmd): raise ValueError, \ 'Template.prepend: missing $IN in cmd' ! if kind[1] == 'f' and not re.search('\$OUT\b', cmd): raise ValueError, \ 'Template.prepend: missing $OUT in cmd' --- 146,153 ---- raise ValueError, \ 'Template.prepend: already begins with SOURCE' ! if kind[0] == 'f' and not re.search(r'\$IN\b', cmd): raise ValueError, \ 'Template.prepend: missing $IN in cmd' ! if kind[1] == 'f' and not re.search(r'\$OUT\b', cmd): raise ValueError, \ 'Template.prepend: missing $OUT in cmd' From fdrake@users.sourceforge.net Wed Apr 25 17:01:32 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 25 Apr 2001 09:01:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules pyexpat.c,2.45,2.46 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17701/Modules Modified Files: pyexpat.c Log Message: ParserCreate(): Allow an empty string for the namespace_separator argument; while not generally a good idea, this is used by RDF users, and works to implement RDF-style namespace+localname concatenation as defined in the RDF specifications. (This also corrects a backwards-compatibility bug.) Be more conservative while clearing out handlers; set the slot in the self->handlers array to NULL before DECREFing the callback. Still more adjustments to make the code style internally consistent. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -r2.45 -r2.46 *** pyexpat.c 2001/03/24 19:58:26 2.45 --- pyexpat.c 2001/04/25 16:01:30 2.46 *************** *** 964,970 **** int i; ! if (!PyArg_ParseTuple(args, "s|s:ExternalEntityParserCreate", &context, ! &encoding)) { ! return NULL; } --- 964,970 ---- int i; ! if (!PyArg_ParseTuple(args, "s|s:ExternalEntityParserCreate", ! &context, &encoding)) { ! return NULL; } *************** *** 1144,1148 **** self->in_callback = 0; self->handlers = NULL; ! if (namespace_separator) { self->itself = XML_ParserCreateNS(encoding, *namespace_separator); } --- 1144,1148 ---- self->in_callback = 0; self->handlers = NULL; ! if (namespace_separator != NULL) { self->itself = XML_ParserCreateNS(encoding, *namespace_separator); } *************** *** 1187,1192 **** if (self->handlers != NULL) { for (i = 0; handler_info[i].name != NULL; i++) { ! Py_XDECREF(self->handlers[i]); } free(self->handlers); --- 1187,1195 ---- if (self->handlers != NULL) { + PyObject *temp; for (i = 0; handler_info[i].name != NULL; i++) { ! temp = self->handlers[i]; ! self->handlers[i] = NULL; ! Py_XDECREF(temp); } free(self->handlers); *************** *** 1319,1331 **** xmlparse_traverse(xmlparseobject *op, visitproc visit, void *arg) { ! int i, err; ! for (i = 0; handler_info[i].name != NULL; i++) { ! if (!op->handlers[i]) ! continue; ! err = visit(op->handlers[i], arg); ! if (err) ! return err; ! } ! return 0; } --- 1322,1334 ---- xmlparse_traverse(xmlparseobject *op, visitproc visit, void *arg) { ! int i, err; ! for (i = 0; handler_info[i].name != NULL; i++) { ! if (!op->handlers[i]) ! continue; ! err = visit(op->handlers[i], arg); ! if (err) ! return err; ! } ! return 0; } *************** *** 1333,1338 **** xmlparse_clear(xmlparseobject *op) { ! clear_handlers(op, 1); ! return 0; } #endif --- 1336,1341 ---- xmlparse_clear(xmlparseobject *op) { ! clear_handlers(op, 1); ! return 0; } #endif *************** *** 1383,1401 **** pyexpat_ParserCreate(PyObject *notused, PyObject *args, PyObject *kw) { ! char *encoding = NULL; ! char *namespace_separator = NULL; ! static char *kwlist[] = {"encoding", "namespace_separator", NULL}; ! ! if (!PyArg_ParseTupleAndKeywords(args, kw, "|zz:ParserCreate", kwlist, ! &encoding, &namespace_separator)) ! return NULL; ! if (namespace_separator != NULL ! && strlen(namespace_separator) != 1) { ! PyErr_SetString(PyExc_ValueError, ! "namespace_separator must be one character," ! " omitted, or None"); ! return NULL; ! } ! return newxmlparseobject(encoding, namespace_separator); } --- 1386,1404 ---- pyexpat_ParserCreate(PyObject *notused, PyObject *args, PyObject *kw) { ! char *encoding = NULL; ! char *namespace_separator = NULL; ! static char *kwlist[] = {"encoding", "namespace_separator", NULL}; ! ! if (!PyArg_ParseTupleAndKeywords(args, kw, "|zz:ParserCreate", kwlist, ! &encoding, &namespace_separator)) ! return NULL; ! if (namespace_separator != NULL ! && strlen(namespace_separator) > 1) { ! PyErr_SetString(PyExc_ValueError, ! "namespace_separator must be at most one" ! " character, omitted, or None"); ! return NULL; ! } ! return newxmlparseobject(encoding, namespace_separator); } *************** *** 1430,1437 **** "Python wrapper for Expat parser."; - /* Initialization function for the module */ - - void initpyexpat(void); /* avoid compiler warnings */ - #if PY_VERSION_HEX < 0x20000F0 --- 1433,1436 ---- *************** *** 1440,1453 **** PyModule_AddObject(PyObject *m, char *name, PyObject *o) { ! PyObject *dict; ! if (!PyModule_Check(m) || o == NULL) ! return -1; ! dict = PyModule_GetDict(m); ! if (dict == NULL) ! return -1; ! if (PyDict_SetItemString(dict, name, o)) ! return -1; ! Py_DECREF(o); ! return 0; } --- 1439,1452 ---- PyModule_AddObject(PyObject *m, char *name, PyObject *o) { ! PyObject *dict; ! if (!PyModule_Check(m) || o == NULL) ! return -1; ! dict = PyModule_GetDict(m); ! if (dict == NULL) ! return -1; ! if (PyDict_SetItemString(dict, name, o)) ! return -1; ! Py_DECREF(o); ! return 0; } *************** *** 1455,1459 **** PyModule_AddIntConstant(PyObject *m, char *name, long value) { ! return PyModule_AddObject(m, name, PyInt_FromLong(value)); } --- 1454,1458 ---- PyModule_AddIntConstant(PyObject *m, char *name, long value) { ! return PyModule_AddObject(m, name, PyInt_FromLong(value)); } *************** *** 1461,1465 **** PyModule_AddStringConstant(PyObject *m, char *name, char *value) { ! return PyModule_AddObject(m, name, PyString_FromString(value)); } --- 1460,1464 ---- PyModule_AddStringConstant(PyObject *m, char *name, char *value) { ! return PyModule_AddObject(m, name, PyString_FromString(value)); } *************** *** 1487,1495 **** } DL_EXPORT(void) ! initpyexpat(void) { PyObject *m, *d; ! PyObject *errmod_name = PyString_FromString("pyexpat.errors"); PyObject *errors_module; PyObject *modelmod_name; --- 1486,1506 ---- } + /* Initialization function for the module */ + + #ifndef MODULE_NAME + #define MODULE_NAME "pyexpat" + #endif + + #ifndef MODULE_INITFUNC + #define MODULE_INITFUNC initpyexpat + #endif + + void MODULE_INITFUNC(void); /* avoid compiler warnings */ + DL_EXPORT(void) ! MODULE_INITFUNC(void) { PyObject *m, *d; ! PyObject *errmod_name = PyString_FromString(MODULE_NAME ".errors"); PyObject *errors_module; PyObject *modelmod_name; *************** *** 1499,1503 **** if (errmod_name == NULL) return; ! modelmod_name = PyString_FromString("pyexpat.model"); if (modelmod_name == NULL) return; --- 1510,1514 ---- if (errmod_name == NULL) return; ! modelmod_name = PyString_FromString(MODULE_NAME ".model"); if (modelmod_name == NULL) return; *************** *** 1506,1510 **** /* Create the module and add the functions */ ! m = Py_InitModule3("pyexpat", pyexpat_methods, pyexpat_module_documentation); --- 1517,1521 ---- /* Create the module and add the functions */ ! m = Py_InitModule3(MODULE_NAME, pyexpat_methods, pyexpat_module_documentation); *************** *** 1548,1552 **** errors_module = PyDict_GetItem(d, errmod_name); if (errors_module == NULL) { ! errors_module = PyModule_New("pyexpat.errors"); if (errors_module != NULL) { PyDict_SetItem(sys_modules, errmod_name, errors_module); --- 1559,1563 ---- errors_module = PyDict_GetItem(d, errmod_name); if (errors_module == NULL) { ! errors_module = PyModule_New(MODULE_NAME ".errors"); if (errors_module != NULL) { PyDict_SetItem(sys_modules, errmod_name, errors_module); *************** *** 1558,1562 **** model_module = PyDict_GetItem(d, modelmod_name); if (model_module == NULL) { ! model_module = PyModule_New("pyexpat.model"); if (model_module != NULL) { PyDict_SetItem(sys_modules, modelmod_name, model_module); --- 1569,1573 ---- model_module = PyDict_GetItem(d, modelmod_name); if (model_module == NULL) { ! model_module = PyModule_New(MODULE_NAME ".model"); if (model_module != NULL) { PyDict_SetItem(sys_modules, modelmod_name, model_module); *************** *** 1633,1645 **** clear_handlers(xmlparseobject *self, int decref) { ! int i = 0; ! for (; handler_info[i].name!=NULL; i++) { ! if (decref){ ! Py_XDECREF(self->handlers[i]); ! } ! self->handlers[i]=NULL; ! handler_info[i].setter(self->itself, NULL); ! } } --- 1644,1659 ---- clear_handlers(xmlparseobject *self, int decref) { ! int i = 0; ! PyObject *temp; ! for (; handler_info[i].name!=NULL; i++) { ! if (decref) { ! temp = self->handlers[i]; ! self->handlers[i] = NULL; ! Py_XDECREF(temp); ! } ! self->handlers[i]=NULL; ! handler_info[i].setter(self->itself, NULL); ! } } *************** *** 1652,1665 **** pairsetter setter) { ! void *start_handler=NULL; ! void *end_handler=NULL; if (self->handlers[startHandler] ! && self->handlers[endHandler]!=Py_None) { ! start_handler=handler_info[startHandler].handler; } if (self->handlers[EndElement] ! && self->handlers[EndElement] !=Py_None) { ! end_handler=handler_info[endHandler].handler; } setter(self->itself, start_handler, end_handler); --- 1666,1679 ---- pairsetter setter) { ! void *start_handler = NULL; ! void *end_handler = NULL; if (self->handlers[startHandler] ! && self->handlers[endHandler] != Py_None) { ! start_handler = handler_info[startHandler].handler; } if (self->handlers[EndElement] ! && self->handlers[EndElement] != Py_None) { ! end_handler = handler_info[endHandler].handler; } setter(self->itself, start_handler, end_handler); From fdrake@users.sourceforge.net Wed Apr 25 17:03:56 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 25 Apr 2001 09:03:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_pyexpat.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18120 Modified Files: test_pyexpat.py Log Message: Update test to accomodate the change to the namespace_separator parameter of ParserCreate(). Added assignment tests for the ordered_attributes and specified_attributes values, similar to the checks for the returns_unicode attribute. Index: test_pyexpat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pyexpat.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** test_pyexpat.py 2000/12/23 22:12:07 1.7 --- test_pyexpat.py 2001/04/25 16:03:54 1.8 *************** *** 76,79 **** --- 76,91 ---- parser.returns_unicode = 0; confirm(parser.returns_unicode == 0) + # Test getting/setting ordered_attributes + parser.ordered_attributes = 0; confirm(parser.ordered_attributes == 0) + parser.ordered_attributes = 1; confirm(parser.ordered_attributes == 1) + parser.ordered_attributes = 2; confirm(parser.ordered_attributes == 1) + parser.ordered_attributes = 0; confirm(parser.ordered_attributes == 0) + + # Test getting/setting specified_attributes + parser.specified_attributes = 0; confirm(parser.specified_attributes == 0) + parser.specified_attributes = 1; confirm(parser.specified_attributes == 1) + parser.specified_attributes = 2; confirm(parser.specified_attributes == 1) + parser.specified_attributes = 0; confirm(parser.specified_attributes == 0) + HANDLER_NAMES = [ 'StartElementHandler', 'EndElementHandler', *************** *** 168,171 **** --- 180,184 ---- else: print "Failed to catch expected TypeError." + try: expat.ParserCreate(namespace_separator='too long') *************** *** 175,183 **** else: print "Failed to catch expected ValueError." ! try: ! expat.ParserCreate(namespace_separator='') # too short ! except ValueError, e: ! print "Caught expected ValueError:" ! print e ! else: ! print "Failed to catch expected ValueError." --- 188,199 ---- else: print "Failed to catch expected ValueError." ! ! # ParserCreate() needs to accept a namespace_separator of zero length ! # to satisfy the requirements of RDF applications that are required ! # to simply glue together the namespace URI and the localname. Though ! # considered a wart of the RDF specifications, it needs to be supported. ! # ! # See XML-SIG mailing list thread starting with ! # http://mail.python.org/pipermail/xml-sig/2001-April/005202.html ! # ! expat.ParserCreate(namespace_separator='') # too short From fdrake@users.sourceforge.net Wed Apr 25 17:03:56 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 25 Apr 2001 09:03:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_pyexpat,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv18120/output Modified Files: test_pyexpat Log Message: Update test to accomodate the change to the namespace_separator parameter of ParserCreate(). Added assignment tests for the ordered_attributes and specified_attributes values, similar to the checks for the returns_unicode attribute. Index: test_pyexpat =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_pyexpat,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** test_pyexpat 2001/01/24 21:46:18 1.6 --- test_pyexpat 2001/04/25 16:03:54 1.7 *************** *** 4,7 **** --- 4,15 ---- OK. OK. + OK. + OK. + OK. + OK. + OK. + OK. + OK. + OK. PI: 'xml-stylesheet' 'href="stylesheet.css"' *************** *** 100,104 **** ParserCreate() argument 2 must be string or None, not int Caught expected ValueError: ! namespace_separator must be one character, omitted, or None ! Caught expected ValueError: ! namespace_separator must be one character, omitted, or None --- 108,110 ---- ParserCreate() argument 2 must be string or None, not int Caught expected ValueError: ! namespace_separator must be at most one character, omitted, or None From fdrake@users.sourceforge.net Wed Apr 25 21:58:36 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 25 Apr 2001 13:58:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.118,1.118.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv29954 Modified Files: Tag: release20-maint tut.tex Log Message: Correct two floating-point representations printed by the interpreter in interactive examples. Error noted by Dinu Gherman. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.118 retrieving revision 1.118.2.1 diff -C2 -r1.118 -r1.118.2.1 *** tut.tex 2000/09/29 15:17:36 1.118 --- tut.tex 2001/04/25 20:58:34 1.118.2.1 *************** *** 427,431 **** \begin{verbatim} >>> 4 * 2.5 / 3.3 ! 3.0303030303 >>> 7.0 / 2 3.5 --- 427,431 ---- \begin{verbatim} >>> 4 * 2.5 / 3.3 ! 3.0303030303030303 >>> 7.0 / 2 3.5 *************** *** 477,481 **** 1.5 >>> abs(a) ! 1.58113883008 \end{verbatim} --- 477,481 ---- 1.5 >>> abs(a) ! 1.5811388300841898 \end{verbatim} From fdrake@users.sourceforge.net Wed Apr 25 21:59:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 25 Apr 2001 13:59:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.133,1.133.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv30156 Modified Files: Tag: release21-maint tut.tex Log Message: Correct two floating-point representations printed by the interpreter in interactive examples. Error noted by Dinu Gherman. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.133 retrieving revision 1.133.2.1 diff -C2 -r1.133 -r1.133.2.1 *** tut.tex 2001/04/12 04:26:24 1.133 --- tut.tex 2001/04/25 20:59:47 1.133.2.1 *************** *** 428,432 **** \begin{verbatim} >>> 4 * 2.5 / 3.3 ! 3.0303030303 >>> 7.0 / 2 3.5 --- 428,432 ---- \begin{verbatim} >>> 4 * 2.5 / 3.3 ! 3.0303030303030303 >>> 7.0 / 2 3.5 *************** *** 478,482 **** 1.5 >>> abs(a) ! 1.58113883008 \end{verbatim} --- 478,482 ---- 1.5 >>> abs(a) ! 1.5811388300841898 \end{verbatim} From fdrake@users.sourceforge.net Wed Apr 25 22:03:22 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 25 Apr 2001 14:03:22 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.133,1.134 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv30922 Modified Files: tut.tex Log Message: Correct two floating-point representations printed by the interpreter in interactive examples. Error noted by Dinu Gherman. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -r1.133 -r1.134 *** tut.tex 2001/04/12 04:26:24 1.133 --- tut.tex 2001/04/25 21:03:20 1.134 *************** *** 428,432 **** \begin{verbatim} >>> 4 * 2.5 / 3.3 ! 3.0303030303 >>> 7.0 / 2 3.5 --- 428,432 ---- \begin{verbatim} >>> 4 * 2.5 / 3.3 ! 3.0303030303030303 >>> 7.0 / 2 3.5 *************** *** 478,482 **** 1.5 >>> abs(a) ! 1.58113883008 \end{verbatim} --- 478,482 ---- 1.5 >>> abs(a) ! 1.5811388300841898 \end{verbatim} From esr@users.sourceforge.net Thu Apr 26 08:32:40 2001 From: esr@users.sourceforge.net (Eric S. Raymond) Date: Thu, 26 Apr 2001 00:32:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pstats.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9060 Modified Files: pstats.py Log Message: Added more help, and recovery from misspelled sort key arguments. Index: pstats.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pstats.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** pstats.py 2001/04/14 15:16:05 1.15 --- pstats.py 2001/04/26 07:32:38 1.16 *************** *** 569,572 **** --- 569,579 ---- print "No statistics object is loaded." return 0 + def generic_help(self): + print "Arguments may be:" + print "* An integer maximum number of entries to print." + print "* A decimal fractional number between 0 and 1, controlling" + print " what fraction of selected entries to print." + print "* A regular expression; only entries with function names" + print " that match it are printed." def do_add(self, line): *************** *** 574,578 **** return 0 def help_add(self): ! print "Add profile info from given file to current stastics object." def do_callees(self, line): --- 581,585 ---- return 0 def help_add(self): ! print "Add profile info from given file to current statistics object." def do_callees(self, line): *************** *** 580,583 **** --- 587,591 ---- def help_callees(self): print "Print callees statistics from the current stat object." + self.generic_help() def do_callers(self, line): *************** *** 585,588 **** --- 593,597 ---- def help_callers(self): print "Print callers statistics from the current stat object." + self.generic_help() def do_EOF(self, line): *************** *** 620,627 **** def do_sort(self, line): ! apply(self.stats.sort_stats, line.split()) return 0 def help_sort(self): print "Sort profile data according to specified keys." def do_stats(self, line): --- 629,643 ---- def do_sort(self, line): ! abbrevs = self.stats.get_sort_arg_defs().keys() ! if line and not filter(lambda x,a=abbrevs: x not in a,line.split()): ! apply(self.stats.sort_stats, line.split()) ! else: ! print "Valid sort keys (unique prefixes are accepted):" ! for (key, value) in Stats.sort_arg_dict_default.items(): ! print "%s -- %s" % (key, value[1]) return 0 def help_sort(self): print "Sort profile data according to specified keys." + print "(Typing `sort' without arguments lists valid keys.)" def do_stats(self, line): *************** *** 629,632 **** --- 645,649 ---- def help_stats(self): print "Print statistics from the current stat object." + self.generic_help() def do_strip(self, line): From gvanrossum@users.sourceforge.net Thu Apr 26 14:40:02 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 26 Apr 2001 06:40:02 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv13374 Modified Files: pep-0234.txt Log Message: Adding MAL's comment about next() vs. __next__(). Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** pep-0234.txt 2001/04/23 20:04:59 1.4 --- pep-0234.txt 2001/04/26 13:39:59 1.5 *************** *** 103,107 **** should also be a primitive operation next(x) that would call x.__next__(), and this just looks like adding complexity without ! benefit. So I think it's better to stick with next(). --- 103,113 ---- should also be a primitive operation next(x) that would call x.__next__(), and this just looks like adding complexity without ! benefit. So I think it's better to stick with next(). On the ! other hand, Marc-Andre Lemburg points out: "Even though .next() ! reads better, I think that we should stick to the convention that ! interpreter APIs use the __xxx__ naming scheme. Otherwise, people ! will have a hard time differentiating between user-level protocols ! and interpreter-level ones. AFAIK, .next() would be the first ! low-level API not using this convention." From gvanrossum@users.sourceforge.net Thu Apr 26 22:50:12 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 26 Apr 2001 14:50:12 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv21542 Modified Files: pep-0234.txt Log Message: Added some more discussion. Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** pep-0234.txt 2001/04/26 13:39:59 1.5 --- pep-0234.txt 2001/04/26 21:50:09 1.6 *************** *** 109,113 **** will have a hard time differentiating between user-level protocols and interpreter-level ones. AFAIK, .next() would be the first ! low-level API not using this convention." --- 109,116 ---- will have a hard time differentiating between user-level protocols and interpreter-level ones. AFAIK, .next() would be the first ! low-level API not using this convention." My (BDFL's) response: ! there are other important protocols with a user-level name ! (e.g. keys()), and I don't see the importance of this particular ! rule. *************** *** 148,152 **** implement __iter__() returning itself. ! There is some controversy here: - The name iter() is an abbreviation. Alternatives proposed --- 151,155 ---- implement __iter__() returning itself. ! Discussion: - The name iter() is an abbreviation. Alternatives proposed *************** *** 157,160 **** --- 160,170 ---- with an sentinel value) is somewhat ugly. I haven't seen a better name for the second operation though. + + - It was originally proposed that rather than having a next() + method, an iterator object should simply be callable. This was + rejected in favor of an explicit next() method. The reason is + clarity: if you don't know the code very well, "x = s()" does + not give a hint about what it does; but "x = s.next()" is pretty + clear. From jhylton@users.sourceforge.net Fri Apr 27 03:25:35 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 26 Apr 2001 19:25:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.241,2.242 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv14007 Modified Files: ceval.c Log Message: improved error message-- names the type of the unexpected object Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.241 retrieving revision 2.242 diff -C2 -r2.241 -r2.242 *** ceval.c 2001/04/23 14:08:49 2.241 --- ceval.c 2001/04/27 02:25:33 2.242 *************** *** 2494,2499 **** /* Not something you can raise. You get an exception anyway, just not what you specified :-) */ ! PyErr_SetString(PyExc_TypeError, ! "exceptions must be strings, classes, or instances"); goto raise_error; } --- 2494,2500 ---- /* Not something you can raise. You get an exception anyway, just not what you specified :-) */ ! PyErr_Format(PyExc_TypeError, ! "exceptions must be strings, classes, or " ! "instances, not %s", type->ob_type->tp_name); goto raise_error; } From jhylton@users.sourceforge.net Fri Apr 27 03:29:20 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 26 Apr 2001 19:29:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_scope.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14703 Modified Files: test_scope.py Log Message: Fix 2.1 nested scopes crash reported by Evan Simpson The new test case demonstrates the bug. Be more careful in symtable_resolve_free() to add a var to cells or frees only if it won't be added under some other rule. XXX Add new assertion that will catch this bug. Index: test_scope.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** test_scope.py 2001/04/13 16:51:46 1.14 --- test_scope.py 2001/04/27 02:29:18 1.15 *************** *** 437,438 **** --- 437,449 ---- verify(d == {'x': 2, 'y': 7, 'w': 6}) + print "19. var is bound and free in class" + + def f(x): + class C: + def m(self): + return x + a = x + return C + + inst = f(3)() + verify(inst.a == inst.m()) From jhylton@users.sourceforge.net Fri Apr 27 03:29:29 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 26 Apr 2001 19:29:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_scope,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv14760 Modified Files: test_scope Log Message: Fix 2.1 nested scopes crash reported by Evan Simpson The new test case demonstrates the bug. Be more careful in symtable_resolve_free() to add a var to cells or frees only if it won't be added under some other rule. XXX Add new assertion that will catch this bug. Index: test_scope =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_scope,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** test_scope 2001/03/21 16:44:39 1.6 --- test_scope 2001/04/27 02:29:27 1.7 *************** *** 18,19 **** --- 18,20 ---- 17. class and global 18. verify that locals() works + 19. var is bound and free in class From jhylton@users.sourceforge.net Fri Apr 27 03:29:43 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 26 Apr 2001 19:29:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.197,2.198 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv14809 Modified Files: compile.c Log Message: Fix 2.1 nested scopes crash reported by Evan Simpson The new test case demonstrates the bug. Be more careful in symtable_resolve_free() to add a var to cells or frees only if it won't be added under some other rule. XXX Add new assertion that will catch this bug. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.197 retrieving revision 2.198 diff -C2 -r2.197 -r2.198 *** compile.c 2001/04/20 19:13:02 2.197 --- compile.c 2001/04/27 02:29:40 2.198 *************** *** 4058,4062 **** static int ! symtable_resolve_free(struct compiling *c, PyObject *name, struct symbol_info *si) { --- 4058,4062 ---- static int ! symtable_resolve_free(struct compiling *c, PyObject *name, int flags, struct symbol_info *si) { *************** *** 4068,4076 **** method and a free variable with the same name. */ - if (c->c_symtable->st_cur->ste_type == TYPE_FUNCTION) { v = PyInt_FromLong(si->si_ncells++); dict = c->c_cellvars; } else { v = PyInt_FromLong(si->si_nfrees++); dict = c->c_freevars; --- 4068,4084 ---- method and a free variable with the same name. */ if (c->c_symtable->st_cur->ste_type == TYPE_FUNCTION) { + /* If it isn't declared locally, it can't be a cell. */ + if (!(flags & (DEF_LOCAL | DEF_PARAM))) + return 0; v = PyInt_FromLong(si->si_ncells++); dict = c->c_cellvars; } else { + /* If it is free anyway, then there is no need to do + anything here. + */ + if (is_free(flags ^ DEF_FREE_CLASS) + || flags == DEF_FREE_CLASS) + return 0; v = PyInt_FromLong(si->si_nfrees++); dict = c->c_freevars; *************** *** 4358,4365 **** */ if (flags & (DEF_FREE | DEF_FREE_CLASS)) { ! if ((ste->ste_type == TYPE_CLASS ! && flags != DEF_FREE_CLASS) ! || (flags & (DEF_LOCAL | DEF_PARAM))) ! symtable_resolve_free(c, name, &si); } --- 4366,4370 ---- */ if (flags & (DEF_FREE | DEF_FREE_CLASS)) { ! symtable_resolve_free(c, name, flags, &si); } *************** *** 4420,4423 **** --- 4425,4437 ---- } } + + /* + fprintf(stderr, + "cells %d: %s\n" + "frees %d: %s\n", + si.si_ncells, PyObject_REPR(c->c_cellvars), + si.si_nfrees, PyObject_REPR(c->c_freevars)); + */ + assert(PyDict_Size(c->c_freevars) == si.si_nfrees); if (si.si_ncells > 1) { /* one cell is always in order */ From lemburg@users.sourceforge.net Fri Apr 27 12:20:16 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Fri, 27 Apr 2001 04:20:16 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0249.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv22478 Modified Files: pep-0249.txt Log Message: Addded clarifications proposed by Federico Di Gregorio. Index: pep-0249.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0249.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** pep-0249.txt 2001/03/30 16:56:15 1.2 --- pep-0249.txt 2001/04/27 11:20:14 1.3 *************** *** 199,203 **** if any operation is attempted with the connection. The same applies to all cursor objects trying to use the ! connection. commit() --- 199,206 ---- if any operation is attempted with the connection. The same applies to all cursor objects trying to use the ! connection. Note that closing a connection without ! committing the changes first will cause an implicit ! rollback to be performed. ! commit() *************** *** 233,237 **** These objects represent a database cursor, which is used to ! manage the context of a fetch operation. Cursor Objects should respond to the following methods and --- 236,246 ---- These objects represent a database cursor, which is used to ! manage the context of a fetch operation. Cursors created from ! the same connection are not isolated, i.e., any changes ! done to the database by a cursor are immediately visible by the ! other cursors. Cursors created from different connections can ! or can not be isolated, depending on how the transaction support ! is implemented (see also the connection's rollback() and commit() ! methods.) Cursor Objects should respond to the following methods and *************** *** 244,248 **** describing one result column: (name, type_code, display_size, internal_size, precision, scale, ! null_ok). This attribute will be None for operations that do not return rows or if the cursor has not had an operation invoked via the executeXXX() method yet. --- 253,261 ---- describing one result column: (name, type_code, display_size, internal_size, precision, scale, ! null_ok). The first two items (name and type_code) are ! mandatory, the other five are optional and must be set to ! None if meaningfull values are not provided. ! ! This attribute will be None for operations that do not return rows or if the cursor has not had an operation invoked via the executeXXX() method yet. From gvanrossum@users.sourceforge.net Fri Apr 27 16:26:57 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 27 Apr 2001 08:26:57 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv24805 Modified Files: pep-0234.txt Log Message: BDFL pronouncement on next() vs. __next__() vs. __call__(). Add mailing list pointers. Add discussion on "once-stopped-always-stopped". Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** pep-0234.txt 2001/04/26 21:50:09 1.6 --- pep-0234.txt 2001/04/27 15:26:54 1.7 *************** *** 112,116 **** there are other important protocols with a user-level name (e.g. keys()), and I don't see the importance of this particular ! rule. --- 112,116 ---- there are other important protocols with a user-level name (e.g. keys()), and I don't see the importance of this particular ! rule. BDFL pronouncement: this topic is closed. next() it is. *************** *** 161,164 **** --- 161,172 ---- better name for the second operation though. + - There's a bit of undefined behavior for iterators: once a + particular iterator object has raised StopIteration, will it + also raise StopIteration on all subsequent next() calls? Some + say that it would be useful to require this, others say that it + is useful to leave this open to individual iterators. Note that + this may require an additional state bit for some iterator + implementations (e.g. function-wrapping iterators). + - It was originally proposed that rather than having a next() method, an iterator object should simply be callable. This was *************** *** 166,170 **** clarity: if you don't know the code very well, "x = s()" does not give a hint about what it does; but "x = s.next()" is pretty ! clear. --- 174,178 ---- clarity: if you don't know the code very well, "x = s()" does not give a hint about what it does; but "x = s.next()" is pretty ! clear. BDFL pronouncement: this topic is closed. next() it is. *************** *** 297,300 **** --- 305,320 ---- {__getitem__, keys, values, items}. + + Mailing Lists + + The iterator protocol has been discussed extensively in a mailing + list on SourceForge: + + http://lists.sourceforge.net/lists/listinfo/python-iterators + + Initially, some of the discussion was carried out at Yahoo; + archives are still accessible: + + http://groups.yahoo.com/group/python-iter Copyright From gvanrossum@users.sourceforge.net Fri Apr 27 16:33:05 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 27 Apr 2001 08:33:05 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26250 Modified Files: pep-0234.txt Log Message: Add (minimal) discussion about restartability. Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** pep-0234.txt 2001/04/27 15:26:54 1.7 --- pep-0234.txt 2001/04/27 15:33:02 1.8 *************** *** 169,172 **** --- 169,176 ---- implementations (e.g. function-wrapping iterators). + - Some folks have requested the ability to restart an iterator. I + believe this should be dealt with by calling iter() on a + sequence repeatedly, not by the iterator protocol itself. + - It was originally proposed that rather than having a next() method, an iterator object should simply be callable. This was From gvanrossum@users.sourceforge.net Fri Apr 27 19:04:52 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 27 Apr 2001 11:04:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include descrobject.h,1.1.2.1,1.1.2.2 object.h,2.79.2.1,2.79.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv25251/Include Modified Files: Tag: descr-branch descrobject.h object.h Log Message: Make the descriptor operations (formerly PyDescr_Get() and PyDescr_Set()) slots in the type object. Also, the choice to use tp_dict is made by placing a standard function on the tp_[gs]etattro slot, not by default in PyObject_[GS]etAttr(). Index: descrobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/descrobject.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -r1.1.2.1 -r1.1.2.2 *** descrobject.h 2001/04/24 00:49:08 1.1.2.1 --- descrobject.h 2001/04/27 18:04:50 1.1.2.2 *************** *** 23,28 **** struct getsetlist *); - extern DL_IMPORT(PyObject *) PyDescr_Get(PyObject *, PyObject *); - extern DL_IMPORT(int) PyDescr_Set(PyObject *, PyObject *, PyObject *); - extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *); --- 23,25 ---- Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.79.2.1 retrieving revision 2.79.2.2 diff -C2 -r2.79.2.1 -r2.79.2.2 *** object.h 2001/04/24 00:49:08 2.79.2.1 --- object.h 2001/04/27 18:04:50 2.79.2.2 *************** *** 203,206 **** --- 203,208 ---- typedef PyObject *(*getiterfunc) (PyObject *); typedef PyObject *(*iternextfunc) (PyObject *); + typedef PyObject *(*descrgetfunc) (PyObject *, PyObject *); + typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *); typedef struct _typeobject { *************** *** 262,265 **** --- 264,269 ---- struct _typeobject *tp_base; PyObject *tp_dict; + descrgetfunc tp_descr_get; + descrsetfunc tp_descr_set; #ifdef COUNT_ALLOCS *************** *** 291,294 **** --- 295,300 ---- extern DL_IMPORT(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *); extern DL_IMPORT(int) PyObject_HasAttr(PyObject *, PyObject *); + extern DL_IMPORT(PyObject *) PyGeneric_GetAttr(PyObject *, PyObject *); + extern DL_IMPORT(int) PyGeneric_SetAttr(PyObject *, PyObject *, PyObject *); extern DL_IMPORT(long) PyObject_Hash(PyObject *); extern DL_IMPORT(int) PyObject_IsTrue(PyObject *); From gvanrossum@users.sourceforge.net Fri Apr 27 19:04:52 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 27 Apr 2001 11:04:52 -0700 Subject: [Python-checkins] CVS: python/dist/src .cvsignore,2.1,2.1.8.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv25251 Modified Files: Tag: descr-branch .cvsignore Log Message: Make the descriptor operations (formerly PyDescr_Get() and PyDescr_Set()) slots in the type object. Also, the choice to use tp_dict is made by placing a standard function on the tp_[gs]etattro slot, not by default in PyObject_[GS]etAttr(). Index: .cvsignore =================================================================== RCS file: /cvsroot/python/python/dist/src/.cvsignore,v retrieving revision 2.1 retrieving revision 2.1.8.1 diff -C2 -r2.1 -r2.1.8.1 *** .cvsignore 2000/05/02 18:31:04 2.1 --- .cvsignore 2001/04/27 18:04:50 2.1.8.1 *************** *** 7,8 **** --- 7,10 ---- buildno python + build + Makefile.pre From gvanrossum@users.sourceforge.net Fri Apr 27 19:04:54 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 27 Apr 2001 11:04:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects complexobject.c,2.35.4.1,2.35.4.2 descrobject.c,1.1.2.2,1.1.2.3 dictobject.c,2.80.2.1,2.80.2.2 fileobject.c,2.112.2.1,2.112.2.2 frameobject.c,2.49.4.1,2.49.4.2 listobject.c,2.92.6.1,2.92.6.2 methodobject.c,2.33.8.2,2.33.8.3 object.c,2.124.4.1,2.124.4.2 rangeobject.c,2.24.6.1,2.24.6.2 sliceobject.c,2.7.4.1,2.7.4.2 stringobject.c,2.103.2.1,2.103.2.2 typeobject.c,2.16.8.1,2.16.8.2 unicodeobject.c,2.87.2.1,2.87.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25251/Objects Modified Files: Tag: descr-branch complexobject.c descrobject.c dictobject.c fileobject.c frameobject.c listobject.c methodobject.c object.c rangeobject.c sliceobject.c stringobject.c typeobject.c unicodeobject.c Log Message: Make the descriptor operations (formerly PyDescr_Get() and PyDescr_Set()) slots in the type object. Also, the choice to use tp_dict is made by placing a standard function on the tp_[gs]etattro slot, not by default in PyObject_[GS]etAttr(). Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.35.4.1 retrieving revision 2.35.4.2 diff -C2 -r2.35.4.1 -r2.35.4.2 *** complexobject.c 2001/04/24 00:43:30 2.35.4.1 --- complexobject.c 2001/04/27 18:04:50 2.35.4.2 *************** *** 611,615 **** 0, /* tp_call */ (reprfunc)complex_str, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 611,615 ---- 0, /* tp_call */ (reprfunc)complex_str, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/descrobject.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -r1.1.2.2 -r1.1.2.3 *** descrobject.c 2001/04/24 01:43:06 1.1.2.2 --- descrobject.c 2001/04/27 18:04:50 1.1.2.3 *************** *** 83,86 **** --- 83,186 ---- static PyObject * + descr_get(PyObject *d, PyObject *obj) + { + PyDescrObject *descr; + + if (obj == NULL || !PyDescr_Check(d)) { + Py_INCREF(d); + return d; + } + + descr = (PyDescrObject *)d; + + if (!PyObject_IsInstance(obj, (PyObject *)(descr->d_type))) { + PyErr_Format(PyExc_TypeError, + "descriptor for '%.100s' objects " + "doesn't apply to '%.100s' object", + descr->d_type->tp_name, + obj->ob_type->tp_name); + return NULL; + } + + switch (descr->d_flavor) { + + case DF_METHOD: + return PyCFunction_New(descr->d_union.d_method, obj); + + case DF_MEMBER: + return PyMember_Get((char *)obj, + descr->d_union.d_member, + descr->d_union.d_member->name); + + case DF_GETSET: + if (descr->d_union.d_getset->get != NULL) + return descr->d_union.d_getset->get( + obj, descr->d_union.d_getset->closure); + + } + + PyErr_Format(PyExc_NotImplementedError, + "PyDescr_Get() not implemented for descriptor type %d " + "of '%.50s' object", + descr->d_flavor, obj->ob_type->tp_name); + return NULL; + } + + int + descr_set(PyObject *d, PyObject *obj, PyObject *value) + { + PyDescrObject *descr = (PyDescrObject *)d; + + assert(PyDescr_Check(d)); + + if (!PyObject_IsInstance(obj, (PyObject *)(descr->d_type))) { + PyErr_Format(PyExc_TypeError, + "descriptor for '%.100s' objects " + "doesn't apply to '%.100s' object", + descr->d_type->tp_name, + obj->ob_type->tp_name); + return -1; + } + + switch (descr->d_flavor) { + + case DF_METHOD: + PyErr_Format(PyExc_TypeError, + "can't %s method attribute '%.400s' " + "of '%.50s' object", + value==NULL ? "delete" : "assign to", + descr->d_union.d_method->ml_name, + obj->ob_type->tp_name); + return -1; + + case DF_MEMBER: + return PyMember_Set((char *)obj, + descr->d_union.d_member, + descr->d_union.d_member->name, + value); + + case DF_GETSET: + if (descr->d_union.d_getset->set == NULL) { + PyErr_Format(PyExc_TypeError, + "can't %s read-only attribute " + "'%.400s' of '%.50s' object", + value==NULL ? "delete" : "assign to", + descr->d_union.d_getset->name, + obj->ob_type->tp_name); + return -1; + } + return descr->d_union.d_getset->set( + obj, value, descr->d_union.d_getset->closure); + + } + + PyErr_Format(PyExc_NotImplementedError, + "PyDescr_Set() not implemented for descriptor type %d " + "of '%.50s' object", + descr->d_flavor, obj->ob_type->tp_name); + return -1; + } + + static PyObject * descr_call(PyDescrObject *descr, PyObject *args, PyObject *kwds) { *************** *** 131,138 **** if (argc == 1) ! return PyDescr_Get((PyObject *)descr, self); if (argc == 2) { PyObject *value = PyTuple_GET_ITEM(args, 1); ! if (PyDescr_Set((PyObject *)descr, self, value) < 0) return NULL; Py_INCREF(Py_None); --- 231,238 ---- if (argc == 1) ! return descr_get((PyObject *)descr, self); if (argc == 2) { PyObject *value = PyTuple_GET_ITEM(args, 1); ! if (descr_set((PyObject *)descr, self, value) < 0) return NULL; Py_INCREF(Py_None); *************** *** 145,149 **** static PyObject * ! descr_get(PyObject *descr, PyObject *args) { PyObject *obj; --- 245,249 ---- static PyObject * ! descr_get_api(PyObject *descr, PyObject *args) { PyObject *obj; *************** *** 151,159 **** if (!PyArg_ParseTuple(args, "O:get", &obj)) return NULL; ! return PyDescr_Get(descr, obj); } static PyObject * ! descr_set(PyObject *descr, PyObject *args) { PyObject *obj, *val; --- 251,259 ---- if (!PyArg_ParseTuple(args, "O:get", &obj)) return NULL; ! return descr_get(descr, obj); } static PyObject * ! descr_set_api(PyObject *descr, PyObject *args) { PyObject *obj, *val; *************** *** 161,165 **** if (!PyArg_ParseTuple(args, "OO:set", &obj, &val)) return NULL; ! if (PyDescr_Set(descr, obj, val) < 0) return NULL; Py_INCREF(Py_None); --- 261,265 ---- if (!PyArg_ParseTuple(args, "OO:set", &obj, &val)) return NULL; ! if (descr_set(descr, obj, val) < 0) return NULL; Py_INCREF(Py_None); *************** *** 168,175 **** static PyMethodDef descr_methods[] = { ! {"get", descr_get, METH_VARARGS}, ! {"set", descr_set, METH_VARARGS}, ! {"call", descr_call, METH_VARARGS|METH_KEYWORDS}, ! {"bind", descr_get, METH_VARARGS}, {0} }; --- 268,276 ---- static PyMethodDef descr_methods[] = { ! {"get", (PyCFunction)descr_get_api, METH_VARARGS}, ! {"set", (PyCFunction)descr_set_api, METH_VARARGS}, ! {"call", (PyCFunction)descr_call, ! METH_KEYWORDS|METH_VARARGS}, ! {"bind", (PyCFunction)descr_get_api, METH_VARARGS}, {0} }; *************** *** 225,234 **** static struct getsetlist descr_getsets[] = { ! {"name", descr_get_name}, ! {"__name__", descr_get_name}, ! {"doc", descr_get_doc}, ! {"__doc__", descr_get_doc}, ! {"kind", descr_get_kind}, ! {"readonly", descr_get_readonly}, {0} }; --- 326,335 ---- static struct getsetlist descr_getsets[] = { ! {"name", (getter)descr_get_name}, ! {"__name__", (getter)descr_get_name}, ! {"doc", (getter)descr_get_doc}, ! {"__doc__", (getter)descr_get_doc}, ! {"kind", (getter)descr_get_kind}, ! {"readonly", (getter)descr_get_readonly}, {0} }; *************** *** 260,264 **** (ternaryfunc)descr_call, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 361,365 ---- (ternaryfunc)descr_call, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ *************** *** 276,279 **** --- 377,382 ---- 0, /* tp_base */ 0, /* tp_dict */ + (descrgetfunc)descr_get, /* tp_descr_get */ + (descrsetfunc)descr_set, /* tp_descr_set */ }; *************** *** 324,427 **** descr->d_flavor = DF_GETSET; return (PyObject *)descr; - } - - PyObject * - PyDescr_Get(PyObject *d, PyObject *obj) - { - PyDescrObject *descr; - - if (obj == NULL || !PyDescr_Check(d)) { - Py_INCREF(d); - return d; - } - - descr = (PyDescrObject *)d; - - if (!PyObject_IsInstance(obj, (PyObject *)(descr->d_type))) { - PyErr_Format(PyExc_TypeError, - "descriptor for '%.100s' objects " - "doesn't apply to '%.100s' object", - descr->d_type->tp_name, - obj->ob_type->tp_name); - return NULL; - } - - switch (descr->d_flavor) { - - case DF_METHOD: - return PyCFunction_New(descr->d_union.d_method, obj); - - case DF_MEMBER: - return PyMember_Get((char *)obj, - descr->d_union.d_member, - descr->d_union.d_member->name); - - case DF_GETSET: - if (descr->d_union.d_getset->get != NULL) - return descr->d_union.d_getset->get( - obj, descr->d_union.d_getset->closure); - - } - - PyErr_Format(PyExc_NotImplementedError, - "PyDescr_Get() not implemented for descriptor type %d " - "of '%.50s' object", - descr->d_flavor, obj->ob_type->tp_name); - return NULL; - } - - int - PyDescr_Set(PyObject *d, PyObject *obj, PyObject *value) - { - PyDescrObject *descr = (PyDescrObject *)d; - - assert(PyDescr_Check(d)); - - if (!PyObject_IsInstance(obj, (PyObject *)(descr->d_type))) { - PyErr_Format(PyExc_TypeError, - "descriptor for '%.100s' objects " - "doesn't apply to '%.100s' object", - descr->d_type->tp_name, - obj->ob_type->tp_name); - return -1; - } - - switch (descr->d_flavor) { - - case DF_METHOD: - PyErr_Format(PyExc_TypeError, - "can't %s method attribute '%.400s' " - "of '%.50s' object", - value==NULL ? "delete" : "assign to", - descr->d_union.d_method->ml_name, - obj->ob_type->tp_name); - return -1; - - case DF_MEMBER: - return PyMember_Set((char *)obj, - descr->d_union.d_member, - descr->d_union.d_member->name, - value); - - case DF_GETSET: - if (descr->d_union.d_getset->set == NULL) { - PyErr_Format(PyExc_TypeError, - "can't %s read-only attribute " - "'%.400s' of '%.50s' object", - value==NULL ? "delete" : "assign to", - descr->d_union.d_getset->name, - obj->ob_type->tp_name); - return -1; - } - return descr->d_union.d_getset->set( - obj, value, descr->d_union.d_getset->closure); - - } - - PyErr_Format(PyExc_NotImplementedError, - "PyDescr_Set() not implemented for descriptor type %d " - "of '%.50s' object", - descr->d_flavor, obj->ob_type->tp_name); - return -1; } --- 427,430 ---- Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.80.2.1 retrieving revision 2.80.2.2 diff -C2 -r2.80.2.1 -r2.80.2.2 *** dictobject.c 2001/04/24 00:43:30 2.80.2.1 --- dictobject.c 2001/04/27 18:04:50 2.80.2.2 *************** *** 1263,1267 **** "D.copy() -> a shallow copy of D"; ! static PyMethodDef mapp_methods[] = { {"has_key", (PyCFunction)dict_has_key, METH_VARARGS, has_key__doc__}, --- 1263,1267 ---- "D.copy() -> a shallow copy of D"; ! static PyMethodDef dict_methods[] = { {"has_key", (PyCFunction)dict_has_key, METH_VARARGS, has_key__doc__}, *************** *** 1339,1343 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 1339,1343 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ *************** *** 1350,1354 **** (getiterfunc)dictiter_new, /* tp_iter */ 0, /* tp_iternext */ ! mapp_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ --- 1350,1354 ---- (getiterfunc)dictiter_new, /* tp_iter */ 0, /* tp_iternext */ ! dict_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.112.2.1 retrieving revision 2.112.2.2 diff -C2 -r2.112.2.1 -r2.112.2.2 *** fileobject.c 2001/04/24 00:43:30 2.112.2.1 --- fileobject.c 2001/04/27 18:04:50 2.112.2.2 *************** *** 1317,1321 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 1317,1321 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.49.4.1 retrieving revision 2.49.4.2 diff -C2 -r2.49.4.1 -r2.49.4.2 *** frameobject.c 2001/04/24 00:43:30 2.49.4.1 --- frameobject.c 2001/04/27 18:04:51 2.49.4.2 *************** *** 108,113 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ --- 108,113 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ ! PyGeneric_SetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.92.6.1 retrieving revision 2.92.6.2 diff -C2 -r2.92.6.1 -r2.92.6.2 *** listobject.c 2001/04/24 00:43:30 2.92.6.1 --- listobject.c 2001/04/27 18:04:51 2.92.6.2 *************** *** 1554,1558 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 1554,1558 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ *************** *** 1634,1638 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 1634,1638 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Index: methodobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/methodobject.c,v retrieving revision 2.33.8.2 retrieving revision 2.33.8.3 diff -C2 -r2.33.8.2 -r2.33.8.3 *** methodobject.c 2001/04/24 01:36:12 2.33.8.2 --- methodobject.c 2001/04/27 18:04:51 2.33.8.3 *************** *** 171,175 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 171,175 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.4.1 retrieving revision 2.124.4.2 diff -C2 -r2.124.4.1 -r2.124.4.2 *** object.c 2001/04/24 00:43:30 2.124.4.1 --- object.c 2001/04/27 18:04:51 2.124.4.2 *************** *** 1022,1040 **** } - /* - if (v->ob_type->tp_setattr == NULL) { - if (v->ob_type->tp_getattr == NULL) - PyErr_SetString(PyExc_TypeError, - "attribute-less object (assign or del)"); - else - PyErr_SetString(PyExc_TypeError, - "object has read-only attributes"); - return -1; - } - else { - return (*v->ob_type->tp_setattr)(v, name, w); - } - */ - /* Internal API needed by PyObject_GetAttr(): */ extern --- 1022,1025 ---- *************** *** 1064,1077 **** if (tp->tp_getattr != NULL) return (*tp->tp_getattr)(v, PyString_AS_STRING(name)); - if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { - PyObject *descr; - if (tp->tp_dict == NULL) { - if (PyType_InitDict(tp) < 0) - return NULL; - } - descr = PyDict_GetItem(tp->tp_dict, name); - if (descr != NULL) - return PyDescr_Get(descr, v); - } PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", --- 1049,1052 ---- *************** *** 1125,1142 **** return err; } - if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { - PyObject *descr; - if (tp->tp_dict == NULL) { - if (PyType_InitDict(tp) < 0) - return -1; - } - descr = PyDict_GetItem(tp->tp_dict, name); - if (descr != NULL) { - err = PyDescr_Set(descr, v, value); - Py_DECREF(name); - return err; - } - } Py_DECREF(name); PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", --- 1100,1146 ---- return err; } Py_DECREF(name); + PyErr_Format(PyExc_AttributeError, + "'%.50s' object has no attribute '%.400s'", + tp->tp_name, PyString_AS_STRING(name)); + return -1; + } + + /* Generic GetAttr functions - put these in your tp_[gs]etattro slot */ + + PyObject * + PyGeneric_GetAttr(PyObject *obj, PyObject *name) + { + PyTypeObject *tp = obj->ob_type; + PyObject *descr; + descrgetfunc f; + + if (tp->tp_dict == NULL) { + if (PyType_InitDict(tp) < 0) + return NULL; + } + descr = PyDict_GetItem(tp->tp_dict, name); + if (descr != NULL && (f = descr->ob_type->tp_descr_get) != NULL) + return (*f)(descr, obj); + PyErr_Format(PyExc_AttributeError, + "'%.50s' object has no attribute '%.400s'", + tp->tp_name, PyString_AS_STRING(name)); + return NULL; + } + + int + PyGeneric_SetAttr(PyObject *obj, PyObject *name, PyObject *value) + { + PyTypeObject *tp = obj->ob_type; + PyObject *descr; + descrsetfunc f; + + if (tp->tp_dict == NULL) { + if (PyType_InitDict(tp) < 0) + return -1; + } + descr = PyDict_GetItem(tp->tp_dict, name); + if (descr != NULL && (f = descr->ob_type->tp_descr_set) != NULL) + return (*f)(descr, obj, value); PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.24.6.1 retrieving revision 2.24.6.2 diff -C2 -r2.24.6.1 -r2.24.6.2 *** rangeobject.c 2001/04/24 00:43:30 2.24.6.1 --- rangeobject.c 2001/04/27 18:04:51 2.24.6.2 *************** *** 311,330 **** sizeof(rangeobject), /* Basic object size */ 0, /* Item size for varobject */ ! (destructor)range_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! (cmpfunc)range_compare, /*tp_compare*/ ! (reprfunc)range_repr, /*tp_repr*/ ! 0, /*tp_as_number*/ ! &range_as_sequence, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! 0, /*tp_hash*/ ! 0, /*tp_call*/ ! 0, /*tp_str*/ ! 0, /*tp_getattro*/ ! 0, /*tp_setattro*/ ! 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /* tp_doc */ 0, /* tp_traverse */ --- 311,330 ---- sizeof(rangeobject), /* Basic object size */ 0, /* Item size for varobject */ ! (destructor)range_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)range_compare, /* tp_compare */ ! (reprfunc)range_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! &range_as_sequence, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ 0, /* tp_doc */ 0, /* tp_traverse */ Index: sliceobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/sliceobject.c,v retrieving revision 2.7.4.1 retrieving revision 2.7.4.2 diff -C2 -r2.7.4.1 -r2.7.4.2 *** sliceobject.c 2001/04/24 00:43:30 2.7.4.1 --- sliceobject.c 2001/04/27 18:04:51 2.7.4.2 *************** *** 176,180 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 176,180 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.103.2.1 retrieving revision 2.103.2.2 diff -C2 -r2.103.2.1 -r2.103.2.2 *** stringobject.c 2001/04/24 00:43:30 2.103.2.1 --- stringobject.c 2001/04/27 18:04:51 2.103.2.2 *************** *** 2358,2378 **** sizeof(PyStringObject), sizeof(char), ! (destructor)string_dealloc, /*tp_dealloc*/ ! (printfunc)string_print, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! (cmpfunc)string_compare, /*tp_compare*/ ! (reprfunc)string_repr, /*tp_repr*/ ! 0, /*tp_as_number*/ ! &string_as_sequence, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! (hashfunc)string_hash, /*tp_hash*/ ! 0, /*tp_call*/ ! 0, /*tp_str*/ ! 0, /*tp_getattro*/ ! 0, /*tp_setattro*/ ! &string_as_buffer, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT, /*tp_flags*/ ! 0, /*tp_doc*/ 0, /* tp_traverse */ 0, /* tp_clear */ --- 2358,2378 ---- sizeof(PyStringObject), sizeof(char), ! (destructor)string_dealloc, /* tp_dealloc */ ! (printfunc)string_print, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)string_compare, /* tp_compare */ ! (reprfunc)string_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! &string_as_sequence, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)string_hash, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! &string_as_buffer, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.1 retrieving revision 2.16.8.2 diff -C2 -r2.16.8.1 -r2.16.8.2 *** typeobject.c 2001/04/24 00:43:30 2.16.8.1 --- typeobject.c 2001/04/27 18:04:51 2.16.8.2 *************** *** 36,39 **** --- 36,40 ---- PyTypeObject *tp = type->ob_type; /* Usually == &PyType_Type below */ PyObject *descr; + descrgetfunc f; assert(PyString_Check(name)); *************** *** 52,63 **** } descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr != NULL) ! return PyDescr_Get(descr, (PyObject *)type); } if (type->tp_flags & Py_TPFLAGS_HAVE_CLASS) { descr = PyDict_GetItem(type->tp_dict, name); ! if (descr != NULL) ! return PyDescr_Get(descr, NULL); } --- 53,66 ---- } descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr != NULL && ! (f = descr->ob_type->tp_descr_get) != NULL) ! return (*f)(descr, (PyObject *)type); } if (type->tp_flags & Py_TPFLAGS_HAVE_CLASS) { descr = PyDict_GetItem(type->tp_dict, name); ! if (descr != NULL && ! (f = descr->ob_type->tp_descr_get) != NULL) ! return (*f)(descr, NULL); } Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.87.2.1 retrieving revision 2.87.2.2 diff -C2 -r2.87.2.1 -r2.87.2.2 *** unicodeobject.c 2001/04/24 00:43:30 2.87.2.1 --- unicodeobject.c 2001/04/27 18:04:51 2.87.2.2 *************** *** 5239,5243 **** 0, /* tp_call*/ (reprfunc) unicode_str, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ &unicode_as_buffer, /* tp_as_buffer */ --- 5239,5243 ---- 0, /* tp_call*/ (reprfunc) unicode_str, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ &unicode_as_buffer, /* tp_as_buffer */ From gvanrossum@users.sourceforge.net Fri Apr 27 22:32:13 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 27 Apr 2001 14:32:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.124.4.2,2.124.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5972 Modified Files: Tag: descr-branch object.c Log Message: Fix a very old flaw in PyObject_Print(). Amazing! When an object type defines tp_str but not tp_repr, 'print x' to a real file object would not call the tp_str slot but rather print a default style representation: . This even though 'print x' to a file-like-object would correctly call the tp_str slot. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.4.2 retrieving revision 2.124.4.3 diff -C2 -r2.124.4.2 -r2.124.4.3 *** object.c 2001/04/27 18:04:51 2.124.4.2 --- object.c 2001/04/27 21:32:11 2.124.4.3 *************** *** 197,201 **** op->ob_refcnt, op); else if (op->ob_type->tp_print == NULL) { ! if (op->ob_type->tp_repr == NULL) { fprintf(fp, "<%s object at %p>", op->ob_type->tp_name, op); --- 197,204 ---- op->ob_refcnt, op); else if (op->ob_type->tp_print == NULL) { ! if ((flags & Py_PRINT_RAW) ! ? (op->ob_type->tp_str == NULL) ! : (op->ob_type->tp_repr == NULL)) ! { fprintf(fp, "<%s object at %p>", op->ob_type->tp_name, op); From gvanrossum@users.sourceforge.net Fri Apr 27 22:35:03 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 27 Apr 2001 14:35:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.124,2.125 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6980 Modified Files: object.c Log Message: (Adding this to the trunk as well.) Fix a very old flaw in PyObject_Print(). Amazing! When an object type defines tp_str but not tp_repr, 'print x' to a real file object would not call the tp_str slot but rather print a default style representation: . This even though 'print x' to a file-like-object would correctly call the tp_str slot. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124 retrieving revision 2.125 diff -C2 -r2.124 -r2.125 *** object.c 2001/03/25 19:16:13 2.124 --- object.c 2001/04/27 21:35:01 2.125 *************** *** 197,201 **** op->ob_refcnt, op); else if (op->ob_type->tp_print == NULL) { ! if (op->ob_type->tp_repr == NULL) { fprintf(fp, "<%s object at %p>", op->ob_type->tp_name, op); --- 197,204 ---- op->ob_refcnt, op); else if (op->ob_type->tp_print == NULL) { ! if ((flags & Py_PRINT_RAW) ! ? (op->ob_type->tp_str == NULL) ! : (op->ob_type->tp_repr == NULL)) ! { fprintf(fp, "<%s object at %p>", op->ob_type->tp_name, op); From gvanrossum@users.sourceforge.net Fri Apr 27 22:38:40 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 27 Apr 2001 14:38:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include descrobject.h,1.1.2.2,1.1.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv8142/Include Modified Files: Tag: descr-branch descrobject.h Log Message: Make type(obj).__dict__ a read-only proxy. Index: descrobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/descrobject.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -r1.1.2.2 -r1.1.2.3 *** descrobject.h 2001/04/27 18:04:50 1.1.2.2 --- descrobject.h 2001/04/27 21:38:38 1.1.2.3 *************** *** 24,25 **** --- 24,27 ---- extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *); + + extern DL_IMPORT(PyObject *) PyDictProxy_New(PyObject *); From gvanrossum@users.sourceforge.net Fri Apr 27 22:38:40 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 27 Apr 2001 14:38:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects descrobject.c,1.1.2.3,1.1.2.4 typeobject.c,2.16.8.2,2.16.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8142/Objects Modified Files: Tag: descr-branch descrobject.c typeobject.c Log Message: Make type(obj).__dict__ a read-only proxy. Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/descrobject.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -r1.1.2.3 -r1.1.2.4 *** descrobject.c 2001/04/27 18:04:50 1.1.2.3 --- descrobject.c 2001/04/27 21:38:38 1.1.2.4 *************** *** 526,527 **** --- 526,713 ---- return 0; } + + + /* --- Readonly proxy for dictionaries (actually any mapping) --- */ + + typedef struct { + PyObject_HEAD + PyObject *dict; + } proxyobject; + + static int + proxy_len(proxyobject *pp) + { + return PyObject_Size(pp->dict); + } + + static PyObject * + proxy_getitem(proxyobject *pp, PyObject *key) + { + return PyObject_GetItem(pp->dict, key); + } + + static PyMappingMethods proxy_as_mapping = { + (inquiry)proxy_len, /* mp_length */ + (binaryfunc)proxy_getitem, /* mp_subscript */ + 0, /* mp_ass_subscript */ + }; + + static int + proxy_contains(proxyobject *pp, PyObject *key) + { + return PySequence_Contains(pp->dict, key); + } + + static PySequenceMethods proxy_as_sequence = { + 0, /* sq_length */ + 0, /* sq_concat */ + 0, /* sq_repeat */ + 0, /* sq_item */ + 0, /* sq_slice */ + 0, /* sq_ass_item */ + 0, /* sq_ass_slice */ + (objobjproc)proxy_contains, /* sq_contains */ + 0, /* sq_inplace_concat */ + 0, /* sq_inplace_repeat */ + }; + + static PyObject * + proxy_has_key(proxyobject *pp, PyObject *args) + { + PyObject *key; + + if (!PyArg_ParseTuple(args, "O:has_key", &key)) + return NULL; + return PyInt_FromLong(PySequence_Contains(pp->dict, key)); + } + + static PyObject * + proxy_get(proxyobject *pp, PyObject *args) + { + PyObject *key, *def = Py_None; + + if (!PyArg_ParseTuple(args, "O|O:get", &key, &def)) + return NULL; + return PyObject_CallMethod(pp->dict, "get", "(OO)", key, def); + } + + static PyObject * + proxy_keys(proxyobject *pp, PyObject *args) + { + if (!PyArg_ParseTuple(args, ":keys")) + return NULL; + return PyMapping_Keys(pp->dict); + } + + static PyObject * + proxy_values(proxyobject *pp, PyObject *args) + { + if (!PyArg_ParseTuple(args, ":values")) + return NULL; + return PyMapping_Values(pp->dict); + } + + static PyObject * + proxy_items(proxyobject *pp, PyObject *args) + { + if (!PyArg_ParseTuple(args, ":items")) + return NULL; + return PyMapping_Items(pp->dict); + } + + static PyObject * + proxy_copy(proxyobject *pp, PyObject *args) + { + if (!PyArg_ParseTuple(args, ":copy")) + return NULL; + return PyObject_CallMethod(pp->dict, "copy", NULL); + } + + static PyMethodDef proxy_methods[] = { + {"has_key", (PyCFunction)proxy_has_key, METH_VARARGS, "XXX"}, + {"get", (PyCFunction)proxy_get, METH_VARARGS, "XXX"}, + {"keys", (PyCFunction)proxy_keys, METH_VARARGS, "XXX"}, + {"values", (PyCFunction)proxy_values, METH_VARARGS, "XXX"}, + {"items", (PyCFunction)proxy_items, METH_VARARGS, "XXX"}, + {"copy", (PyCFunction)proxy_copy, METH_VARARGS, "XXX"}, + {0} + }; + + static void + proxy_dealloc(proxyobject *pp) + { + Py_DECREF(pp->dict); + PyObject_DEL(pp); + } + + static PyObject * + proxy_getiter(proxyobject *pp) + { + return PyObject_GetIter(pp->dict); + } + + #if 0 + static int + proxy_print(proxyobject *pp, FILE *fp, int flags) + { + return PyObject_Print(pp->dict, fp, flags); + } + #endif + + PyObject * + proxy_str(proxyobject *pp) + { + return PyObject_Str(pp->dict); + } + + PyTypeObject proxytype = { + PyObject_HEAD_INIT(&PyType_Type) + 0, /* ob_size */ + "dict-proxy", /* tp_name */ + sizeof(proxyobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)proxy_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + &proxy_as_sequence, /* tp_as_sequence */ + &proxy_as_mapping, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + (reprfunc)proxy_str, /* tp_str */ + PyGeneric_GetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)proxy_getiter, /* tp_iter */ + 0, /* tp_iternext */ + proxy_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + }; + + PyObject * + PyDictProxy_New(PyObject *dict) + { + proxyobject *pp; + + pp = PyObject_NEW(proxyobject, &proxytype); + if (pp != NULL) { + Py_INCREF(dict); + pp->dict = dict; + } + return (PyObject *)pp; + } Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.2 retrieving revision 2.16.8.3 diff -C2 -r2.16.8.2 -r2.16.8.3 *** typeobject.c 2001/04/27 18:04:51 2.16.8.2 --- typeobject.c 2001/04/27 21:38:38 2.16.8.3 *************** *** 8,23 **** {"__name__", T_STRING, offsetof(PyTypeObject, tp_name), READONLY}, {"__doc__", T_STRING, offsetof(PyTypeObject, tp_doc), READONLY}, - {"__dict__", T_OBJECT, offsetof(PyTypeObject, tp_dict), READONLY}, {0} }; static PyObject * ! type_bases(PyObject *type, void *context) { return PyTuple_New(0); } struct getsetlist type_getsets[] = { ! {"__bases__", type_bases, NULL, NULL}, {0} }; --- 8,33 ---- {"__name__", T_STRING, offsetof(PyTypeObject, tp_name), READONLY}, {"__doc__", T_STRING, offsetof(PyTypeObject, tp_doc), READONLY}, {0} }; static PyObject * ! type_bases(PyTypeObject *type, void *context) { return PyTuple_New(0); } + static PyObject * + type_dict(PyTypeObject *type, void *context) + { + if (type->tp_dict == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + return PyDictProxy_New(type->tp_dict); + } + struct getsetlist type_getsets[] = { ! {"__bases__", (getter)type_bases, NULL, NULL}, ! {"__dict__", (getter)type_dict, NULL, NULL}, {0} }; From tim_one@users.sourceforge.net Sat Apr 28 06:38:29 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 27 Apr 2001 22:38:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.103,2.104 unicodeobject.c,2.87,2.88 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19972/python/dist/src/Objects Modified Files: stringobject.c unicodeobject.c Log Message: A different approach to the problem reported in Patch #419651: Metrowerks on Mac adds 0x itself C std says %#x and %#X conversion of 0 do not add the 0x/0X base marker. Metrowerks apparently does. Mark Favas reported the same bug under a Compaq compiler on Tru64 Unix, but no other libc broken in this respect is known (known to be OK under MSVC and gcc). So just try the damn thing at runtime and see what the platform does. Note that we've always had bugs here, but never knew it before because a relevant test case didn't exist before 2.1. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.103 retrieving revision 2.104 diff -C2 -r2.103 -r2.104 *** stringobject.c 2001/04/20 19:13:02 2.103 --- stringobject.c 2001/04/28 05:38:26 2.104 *************** *** 142,147 **** { PyObject *buffer = NULL, *str; ! ! if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); --- 142,147 ---- { PyObject *buffer = NULL, *str; ! ! if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); *************** *** 170,174 **** Py_DECREF(buffer); return str; ! onError: Py_XDECREF(buffer); --- 170,174 ---- Py_DECREF(buffer); return str; ! onError: Py_XDECREF(buffer); *************** *** 182,186 **** { PyObject *v, *str; ! str = PyString_FromStringAndSize(s, size); if (str == NULL) --- 182,186 ---- { PyObject *v, *str; ! str = PyString_FromStringAndSize(s, size); if (str == NULL) *************** *** 196,200 **** { PyObject *v; ! if (!PyString_Check(str)) { PyErr_BadArgument(); --- 196,200 ---- { PyObject *v; ! if (!PyString_Check(str)) { PyErr_BadArgument(); *************** *** 202,206 **** } ! if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); --- 202,206 ---- } ! if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); *************** *** 225,229 **** } return v; ! onError: return NULL; --- 225,229 ---- } return v; ! onError: return NULL; *************** *** 273,277 **** /* Internal API needed by PyString_AsStringAndSize(): */ ! extern PyObject *_PyUnicode_AsDefaultEncodedString(PyObject *unicode, const char *errors); --- 273,277 ---- /* Internal API needed by PyString_AsStringAndSize(): */ ! extern PyObject *_PyUnicode_AsDefaultEncodedString(PyObject *unicode, const char *errors); *************** *** 416,420 **** if (PyUnicode_Check(bb)) return PyUnicode_Concat((PyObject *)a, bb); ! PyErr_Format(PyExc_TypeError, "cannot add type \"%.200s\" to string", bb->ob_type->tp_name); --- 416,420 ---- if (PyUnicode_Check(bb)) return PyUnicode_Concat((PyObject *)a, bb); ! PyErr_Format(PyExc_TypeError, "cannot add type \"%.200s\" to string", bb->ob_type->tp_name); *************** *** 909,913 **** PyObject *subobj; ! if (!PyArg_ParseTuple(args, "O|O&O&:find/rfind/index/rindex", &subobj, _PyEval_SliceIndex, &i, _PyEval_SliceIndex, &last)) return -2; --- 909,913 ---- PyObject *subobj; ! if (!PyArg_ParseTuple(args, "O|O&O&:find/rfind/index/rindex", &subobj, _PyEval_SliceIndex, &i, _PyEval_SliceIndex, &last)) return -2; *************** *** 942,946 **** else { int j; ! if (n == 0 && i <= last) return (long)last; --- 942,946 ---- else { int j; ! if (n == 0 && i <= last) return (long)last; *************** *** 949,953 **** return (long)j; } ! return -1; } --- 949,953 ---- return (long)j; } ! return -1; } *************** *** 1365,1369 **** } else if (PyUnicode_Check(tableobj)) { ! /* Unicode .translate() does not support the deletechars parameter; instead a mapping to None will cause characters to be deleted. */ --- 1365,1369 ---- } else if (PyUnicode_Check(tableobj)) { ! /* Unicode .translate() does not support the deletechars parameter; instead a mapping to None will cause characters to be deleted. */ *************** *** 1461,1465 **** MEM, the function returns -1. */ ! static int mymemfind(const char *mem, int len, const char *pat, int pat_len) { --- 1461,1465 ---- MEM, the function returns -1. */ ! static int mymemfind(const char *mem, int len, const char *pat, int pat_len) { *************** *** 1484,1488 **** mem=11111 and pat==11 also return 2. */ ! static int mymemcnt(const char *mem, int len, const char *pat, int pat_len) { --- 1484,1488 ---- mem=11111 and pat==11 also return 2. */ ! static int mymemcnt(const char *mem, int len, const char *pat, int pat_len) { *************** *** 1606,1610 **** } else if (PyUnicode_Check(subobj)) ! return PyUnicode_Replace((PyObject *)self, subobj, replobj, count); else if (PyObject_AsCharBuffer(subobj, &sub, &sub_len)) --- 1606,1610 ---- } else if (PyUnicode_Check(subobj)) ! return PyUnicode_Replace((PyObject *)self, subobj, replobj, count); else if (PyObject_AsCharBuffer(subobj, &sub, &sub_len)) *************** *** 1616,1620 **** } else if (PyUnicode_Check(replobj)) ! return PyUnicode_Replace((PyObject *)self, subobj, replobj, count); else if (PyObject_AsCharBuffer(replobj, &repl, &repl_len)) --- 1616,1620 ---- } else if (PyUnicode_Check(replobj)) ! return PyUnicode_Replace((PyObject *)self, subobj, replobj, count); else if (PyObject_AsCharBuffer(replobj, &repl, &repl_len)) *************** *** 1670,1674 **** else if (PyUnicode_Check(subobj)) { int rc; ! rc = PyUnicode_Tailmatch((PyObject *)self, subobj, start, end, -1); if (rc == -1) --- 1670,1674 ---- else if (PyUnicode_Check(subobj)) { int rc; ! rc = PyUnicode_Tailmatch((PyObject *)self, subobj, start, end, -1); if (rc == -1) *************** *** 1728,1732 **** else if (PyUnicode_Check(subobj)) { int rc; ! rc = PyUnicode_Tailmatch((PyObject *)self, subobj, start, end, +1); if (rc == -1) --- 1728,1732 ---- else if (PyUnicode_Check(subobj)) { int rc; ! rc = PyUnicode_Tailmatch((PyObject *)self, subobj, start, end, +1); if (rc == -1) *************** *** 1830,1836 **** } ! static ! PyObject *pad(PyStringObject *self, ! int left, int right, char fill) --- 1830,1836 ---- } ! static ! PyObject *pad(PyStringObject *self, ! int left, int right, char fill) *************** *** 1848,1858 **** } ! u = PyString_FromStringAndSize(NULL, left + PyString_GET_SIZE(self) + right); if (u) { if (left) memset(PyString_AS_STRING(u), fill, left); ! memcpy(PyString_AS_STRING(u) + left, ! PyString_AS_STRING(self), PyString_GET_SIZE(self)); if (right) --- 1848,1858 ---- } ! u = PyString_FromStringAndSize(NULL, left + PyString_GET_SIZE(self) + right); if (u) { if (left) memset(PyString_AS_STRING(u), fill, left); ! memcpy(PyString_AS_STRING(u) + left, ! PyString_AS_STRING(self), PyString_GET_SIZE(self)); if (right) *************** *** 2309,2313 **** ! static PyMethodDef string_methods[] = { /* Counterparts of the obsolete stropmodule functions; except --- 2309,2313 ---- ! static PyMethodDef string_methods[] = { /* Counterparts of the obsolete stropmodule functions; except *************** *** 2495,2499 **** fmt = %#.g buf = '-' + [0-9]*prec + '.' + 'e+' + (longest exp ! for any double rep.) len = 1 + prec + 1 + 2 + 5 = 9 + prec If prec=0 the effective precision is 1 (the leading digit is --- 2495,2499 ---- fmt = %#.g buf = '-' + [0-9]*prec + '.' + 'e+' + (longest exp ! for any double rep.) len = 1 + prec + 1 + 2 + 5 = 9 + prec If prec=0 the effective precision is 1 (the leading digit is *************** *** 2518,2522 **** * "-"? ("0x" | "0X")? digit+ * "0x"/"0X" are present only for x and X conversions, with F_ALT ! * set in flags. The case of hex digits will be correct, * There will be at least prec digits, zero-filled on the left if * necessary to get that many. --- 2518,2522 ---- * "-"? ("0x" | "0X")? digit+ * "0x"/"0X" are present only for x and X conversions, with F_ALT ! * set in flags. The case of hex digits will be correct, * There will be at least prec digits, zero-filled on the left if * necessary to get that many. *************** *** 2674,2680 **** * but we want it (for consistency with other %#x conversions, and * for consistency with Python's hex() function). */ ! if (x == 0 && (flags & F_ALT) && (type == 'x' || type == 'X')) { ! assert(buf[1] != type); /* else this C *is* adding 0x/0X */ memmove(buf+2, buf, strlen(buf) + 1); buf[0] = '0'; --- 2674,2686 ---- * but we want it (for consistency with other %#x conversions, and * for consistency with Python's hex() function). + * BUG 28-Apr-2001 tim: At least two platform Cs (Metrowerks & + * Compaq Tru64) violate the std by converting 0 w/ leading 0x anyway. + * So add it only if the platform didn't already. */ ! if (x == 0 && ! (flags & F_ALT) && ! (type == 'x' || type == 'X') && ! buf[1] != (char)type) /* this last always true under std C */ ! { memmove(buf+2, buf, strlen(buf) + 1); buf[0] = '0'; *************** *** 2769,2773 **** char formatbuf[FORMATBUFLEN]; /* For format{float,int,char}() */ char *fmt_start = fmt; ! fmt++; if (*fmt == '(') { --- 2775,2779 ---- char formatbuf[FORMATBUFLEN]; /* For format{float,int,char}() */ char *fmt_start = fmt; ! fmt++; if (*fmt == '(') { *************** *** 2779,2783 **** if (dict == NULL) { PyErr_SetString(PyExc_TypeError, ! "format requires a mapping"); goto error; } --- 2785,2789 ---- if (dict == NULL) { PyErr_SetString(PyExc_TypeError, ! "format requires a mapping"); goto error; } *************** *** 3126,3130 **** Py_DECREF(args); return w; ! error: Py_DECREF(result); --- 3132,3136 ---- Py_DECREF(args); return w; ! error: Py_DECREF(result); Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.87 retrieving revision 2.88 diff -C2 -r2.87 -r2.88 *** unicodeobject.c 2001/04/23 14:44:21 2.87 --- unicodeobject.c 2001/04/28 05:38:26 2.88 *************** *** 4738,4741 **** --- 4738,4742 ---- char fmt[64]; /* plenty big enough! */ long x; + int use_native_c_format = 1; x = PyInt_AsLong(v); *************** *** 4754,4762 **** * but we want it (for consistency with other %#x conversions, and * for consistency with Python's hex() function). */ ! if (x == 0 && (flags & F_ALT) && (type == 'x' || type == 'X')) ! sprintf(fmt, "0%c%%%s.%dl%c", type, "#", prec, type); ! else ! sprintf(fmt, "%%%s.%dl%c", (flags & F_ALT) ? "#" : "", prec, type); return usprintf(buf, fmt, x); } --- 4755,4773 ---- * but we want it (for consistency with other %#x conversions, and * for consistency with Python's hex() function). + * BUG 28-Apr-2001 tim: At least two platform Cs (Metrowerks & + * Compaq Tru64) violate the std by converting 0 w/ leading 0x anyway. + * So add it only if the platform doesn't already. */ ! if (x == 0 && (flags & F_ALT) && (type == 'x' || type == 'X')) { ! /* Only way to know what the platform does is to try it. */ ! sprintf(fmt, type == 'x' ? "%#x" : "%#X", 0); ! if (fmt[1] != (char)type) { ! /* Supply our own leading 0x/0X -- needed under std C */ ! use_native_c_format = 0; ! sprintf(fmt, "0%c%%#.%dl%c", type, prec, type); ! } ! } ! if (use_native_c_format) ! sprintf(fmt, "%%%s.%dl%c", (flags & F_ALT) ? "#" : "", prec, type); return usprintf(buf, fmt, x); } From loewis@users.sourceforge.net Sat Apr 28 08:22:35 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Sat, 28 Apr 2001 00:22:35 -0700 Subject: [Python-checkins] CVS: python/nondist/sf-html sf-faq.html,1.19,1.20 Message-ID: Update of /cvsroot/python/python/nondist/sf-html In directory usw-pr-cvs1:/tmp/cvs-serv31642 Modified Files: sf-faq.html Log Message: Correct directory paths to the new /home/groups structure. Index: sf-faq.html =================================================================== RCS file: /cvsroot/python/python/nondist/sf-html/sf-faq.html,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** sf-faq.html 2001/03/16 06:26:14 1.19 --- sf-faq.html 2001/04/28 07:22:33 1.20 *************** *** 103,112 ****
    scp mylocalfile.html ! sf_username@shell.sourceforge.net:/home/groups/python/htdocs/
    If you want to edit or remove files, you can use ssh:
    ssh -l sf_username shell.sourceforge.net
    ! cd /home/groups/python/htdocs
    rm garbage.html
    vi changeme.html
    --- 103,112 ----
    scp mylocalfile.html ! sf_username@shell.sourceforge.net:/home/groups/p/py/python/htdocs/
    If you want to edit or remove files, you can use ssh:
    ssh -l sf_username shell.sourceforge.net
    ! cd /home/groups/p/py/python/htdocs
    rm garbage.html
    vi changeme.html
    From tim_one@users.sourceforge.net Sat Apr 28 09:20:24 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 28 Apr 2001 01:20:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.198,2.199 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv4629/python/dist/src/Python Modified Files: bltinmodule.c Log Message: Fix buglet reported on c.l.py: map(fnc, file.xreadlines()) blows up. Also a 2.1 bugfix candidate (am I supposed to do something with those?). Took away map()'s insistence that sequences support __len__, and cleaned up the convoluted code that made it *look* like it really cared about __len__ (in fact the old ->len field was only *used* as a flag bit, as the main loop only looked at its sign bit, setting the field to -1 when IndexError got raised; renamed the field to ->saw_IndexError instead). Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.198 retrieving revision 2.199 diff -C2 -r2.198 -r2.199 *** bltinmodule.c 2001/04/20 19:13:02 2.198 --- bltinmodule.c 2001/04/28 08:20:22 2.199 *************** *** 817,824 **** PyCompilerFlags cf; cf.cf_nested_scopes = 1; ! res = PyRun_FileExFlags(fp, filename, Py_file_input, globals, locals, 1, &cf); ! } else ! res = PyRun_FileEx(fp, filename, Py_file_input, globals, locals, 1); return res; --- 817,824 ---- PyCompilerFlags cf; cf.cf_nested_scopes = 1; ! res = PyRun_FileExFlags(fp, filename, Py_file_input, globals, locals, 1, &cf); ! } else ! res = PyRun_FileEx(fp, filename, Py_file_input, globals, locals, 1); return res; *************** *** 925,929 **** PyObject *seq; PySequenceMethods *sqf; ! int len; } sequence; --- 925,929 ---- PyObject *seq; PySequenceMethods *sqf; ! int saw_IndexError; } sequence; *************** *** 953,956 **** --- 953,960 ---- } + /* Do a first pass to (a) verify the args are sequences; (b) set + * len to the largest of their lengths; (c) initialize the seqs + * descriptor vector. + */ for (len = 0, i = 0, sqp = seqs; i < n; ++i, ++sqp) { int curlen; *************** *** 960,966 **** goto Fail_2; sqp->sqf = sqf = sqp->seq->ob_type->tp_as_sequence; if (sqf == NULL || - sqf->sq_length == NULL || sqf->sq_item == NULL) { --- 964,971 ---- goto Fail_2; + sqp->saw_IndexError = 0; + sqp->sqf = sqf = sqp->seq->ob_type->tp_as_sequence; if (sqf == NULL || sqf->sq_item == NULL) { *************** *** 974,980 **** } ! if ((curlen = sqp->len = (*sqp->sqf->sq_length)(sqp->seq)) < 0) goto Fail_2; - if (curlen > len) len = curlen; --- 979,989 ---- } ! if (sqf->sq_length == NULL) ! /* doesn't matter -- make something up */ ! curlen = 8; ! else ! curlen = (*sqf->sq_length)(sqp->seq); ! if (curlen < 0) goto Fail_2; if (curlen > len) len = curlen; *************** *** 984,987 **** --- 993,997 ---- goto Fail_2; + /* Iterate over the sequences until all have raised IndexError. */ for (i = 0; ; ++i) { PyObject *alist, *item=NULL, *value; *************** *** 996,1000 **** for (j = 0, sqp = seqs; j < n; ++j, ++sqp) { ! if (sqp->len < 0) { Py_INCREF(Py_None); item = Py_None; --- 1006,1010 ---- for (j = 0, sqp = seqs; j < n; ++j, ++sqp) { ! if (sqp->saw_IndexError) { Py_INCREF(Py_None); item = Py_None; *************** *** 1009,1013 **** Py_INCREF(Py_None); item = Py_None; ! sqp->len = -1; } else { --- 1019,1023 ---- Py_INCREF(Py_None); item = Py_None; ! sqp->saw_IndexError = 1; } else { From guido@digicool.com Sat Apr 28 18:06:12 2001 From: guido@digicool.com (Guido van Rossum) Date: Sat, 28 Apr 2001 12:06:12 -0500 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.103,2.104 unicodeobject.c,2.87,2.88 In-Reply-To: Your message of "Fri, 27 Apr 2001 22:38:29 MST." References: Message-ID: <200104281706.MAA29895@cj20424-a.reston1.va.home.com> > Modified Files: > stringobject.c unicodeobject.c > Log Message: > A different approach to the problem reported in > Patch #419651: Metrowerks on Mac adds 0x itself > C std says %#x and %#X conversion of 0 do not add the 0x/0X base marker. > Metrowerks apparently does. Mark Favas reported the same bug under a > Compaq compiler on Tru64 Unix, but no other libc broken in this respect > is known (known to be OK under MSVC and gcc). > So just try the damn thing at runtime and see what the platform does. > Note that we've always had bugs here, but never knew it before because > a relevant test case didn't exist before 2.1. Note that Tim apparently hit the "clean up whitespace" button in his editor -- most of the diff has nothing to do with this problem. --Guido van Rossum (home page: http://www.python.org/~guido/) From gvanrossum@users.sourceforge.net Sat Apr 28 17:10:41 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 28 Apr 2001 09:10:41 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0252.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv18945 Modified Files: pep-0252.txt Log Message: Typo: has_item() should be has_key(). Thanks Moshe. Index: pep-0252.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0252.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** pep-0252.txt 2001/04/23 21:19:03 1.5 --- pep-0252.txt 2001/04/28 16:10:39 1.6 *************** *** 166,170 **** A regular object may have a __dict__ attribute. If it does, this should be a mapping (not necessarily a dictionary) ! supporting at least __getitem__, keys(), and has_item(). This gives the dynamic attributes of the object. The keys in the mapping give attribute names, and the corresponding values give --- 166,170 ---- A regular object may have a __dict__ attribute. If it does, this should be a mapping (not necessarily a dictionary) ! supporting at least __getitem__, keys(), and has_key(). This gives the dynamic attributes of the object. The keys in the mapping give attribute names, and the corresponding values give From gvanrossum@users.sourceforge.net Sun Apr 29 15:53:57 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 29 Apr 2001 07:53:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include descrobject.h,1.1.2.3,1.1.2.4 object.h,2.79.2.2,2.79.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv776/Include Modified Files: Tag: descr-branch descrobject.h object.h Log Message: Move PyType_InitDict() to typeobect.c, and enhane it to support (some) special methods like __getitem__ automatically. This facility is not yet complete, and I'm thinking about a redesign. Index: descrobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/descrobject.h,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -r1.1.2.3 -r1.1.2.4 *** descrobject.h 2001/04/27 21:38:38 1.1.2.3 --- descrobject.h 2001/04/29 14:53:55 1.1.2.4 *************** *** 23,27 **** struct getsetlist *); - extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *); - extern DL_IMPORT(PyObject *) PyDictProxy_New(PyObject *); --- 23,25 ---- Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.79.2.2 retrieving revision 2.79.2.3 diff -C2 -r2.79.2.2 -r2.79.2.3 *** object.h 2001/04/27 18:04:50 2.79.2.2 --- object.h 2001/04/29 14:53:55 2.79.2.3 *************** *** 280,283 **** --- 280,285 ---- #define PyType_Check(op) ((op)->ob_type == &PyType_Type) + extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *); + /* Generic operations on objects */ extern DL_IMPORT(int) PyObject_Print(PyObject *, FILE *, int); From gvanrossum@users.sourceforge.net Sun Apr 29 15:53:57 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 29 Apr 2001 07:53:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects descrobject.c,1.1.2.4,1.1.2.5 typeobject.c,2.16.8.3,2.16.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv776/Objects Modified Files: Tag: descr-branch descrobject.c typeobject.c Log Message: Move PyType_InitDict() to typeobect.c, and enhane it to support (some) special methods like __getitem__ automatically. This facility is not yet complete, and I'm thinking about a redesign. Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/descrobject.c,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -r1.1.2.4 -r1.1.2.5 *** descrobject.c 2001/04/27 21:38:38 1.1.2.4 --- descrobject.c 2001/04/29 14:53:55 1.1.2.5 *************** *** 430,533 **** - /* Initialize the __dict__ in a type object */ - - static struct PyMethodDef intrinsic_methods[] = { - {0} - }; - - static struct memberlist intrinsic_members[] = { - {"__class__", T_OBJECT, offsetof(PyObject, ob_type), READONLY}, - {0} - }; - - static struct getsetlist intrinsic_getsets[] = { - {0} - }; - - static int - add_methods(PyTypeObject *type, PyMethodDef *meth) - { - PyObject *dict = type->tp_dict; - - for (; meth->ml_name != NULL; meth++) { - PyObject *descr = PyDescr_NewMethod(type, meth); - if (descr == NULL) - return -1; - if (PyDict_SetItemString(dict,meth->ml_name,descr) < 0) - return -1; - Py_DECREF(descr); - } - return 0; - } - - static int - add_members(PyTypeObject *type, struct memberlist *memb) - { - PyObject *dict = type->tp_dict; - - for (; memb->name != NULL; memb++) { - PyObject *descr = PyDescr_NewMember(type, memb); - if (descr == NULL) - return -1; - if (PyDict_SetItemString(dict, memb->name, descr) < 0) - return -1; - Py_DECREF(descr); - } - return 0; - } - - static int - add_getset(PyTypeObject *type, struct getsetlist *gsp) - { - PyObject *dict = type->tp_dict; - - for (; gsp->name != NULL; gsp++) { - PyObject *descr = PyDescr_NewGetSet(type, gsp); - - if (descr == NULL) - return -1; - if (PyDict_SetItemString(dict, gsp->name, descr) < 0) - return -1; - Py_DECREF(descr); - } - return 0; - } - - int - PyType_InitDict(PyTypeObject *type) - { - PyObject *dict; - - if (type->tp_dict != NULL) - return 0; - dict = PyDict_New(); - if (dict == NULL) - return -1; - type->tp_dict = dict; - if (type->tp_methods != NULL) { - if (add_methods(type, type->tp_methods) < 0) - return -1; - } - if (type->tp_members != NULL) { - if (add_members(type, type->tp_members) < 0) - return -1; - } - if (type->tp_getset != NULL) { - if (add_getset(type, type->tp_getset) < 0) - return -1; - } - /* Add intrinsics */ - if (add_methods(type, intrinsic_methods) < 0) - return -1; - if (add_members(type, intrinsic_members) < 0) - return -1; - if (add_getset(type, intrinsic_getsets) < 0) - return -1; - return 0; - } - - /* --- Readonly proxy for dictionaries (actually any mapping) --- */ typedef struct { PyObject_HEAD --- 430,438 ---- /* --- Readonly proxy for dictionaries (actually any mapping) --- */ + /* This has no reason to be in this file except that adding new files is a + bit of a pain */ + typedef struct { PyObject_HEAD *************** *** 646,657 **** return PyObject_GetIter(pp->dict); } - - #if 0 - static int - proxy_print(proxyobject *pp, FILE *fp, int flags) - { - return PyObject_Print(pp->dict, fp, flags); - } - #endif PyObject * --- 551,554 ---- Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.3 retrieving revision 2.16.8.4 diff -C2 -r2.16.8.3 -r2.16.8.4 *** typeobject.c 2001/04/27 21:38:38 2.16.8.3 --- typeobject.c 2001/04/29 14:53:55 2.16.8.4 *************** *** 116,117 **** --- 116,444 ---- 0, /* tp_dict */ }; + + + /* Initialize the __dict__ in a type object */ + + static struct PyMethodDef intrinsic_methods[] = { + {0} + }; + + static struct memberlist intrinsic_members[] = { + {"__class__", T_OBJECT, offsetof(PyObject, ob_type), READONLY}, + {0} + }; + + static struct getsetlist intrinsic_getsets[] = { + {0} + }; + + static int + add_methods(PyTypeObject *type, PyMethodDef *meth) + { + PyObject *dict = type->tp_dict; + + for (; meth->ml_name != NULL; meth++) { + PyObject *descr = PyDescr_NewMethod(type, meth); + if (descr == NULL) + return -1; + if (PyDict_SetItemString(dict,meth->ml_name,descr) < 0) + return -1; + Py_DECREF(descr); + } + return 0; + } + + static int + add_members(PyTypeObject *type, struct memberlist *memb) + { + PyObject *dict = type->tp_dict; + + for (; memb->name != NULL; memb++) { + PyObject *descr = PyDescr_NewMember(type, memb); + if (descr == NULL) + return -1; + if (PyDict_SetItemString(dict, memb->name, descr) < 0) + return -1; + Py_DECREF(descr); + } + return 0; + } + + static int + add_getset(PyTypeObject *type, struct getsetlist *gsp) + { + PyObject *dict = type->tp_dict; + + for (; gsp->name != NULL; gsp++) { + PyObject *descr = PyDescr_NewGetSet(type, gsp); + + if (descr == NULL) + return -1; + if (PyDict_SetItemString(dict, gsp->name, descr) < 0) + return -1; + Py_DECREF(descr); + } + return 0; + } + + staticforward int add_operators(PyTypeObject *); + + int + PyType_InitDict(PyTypeObject *type) + { + PyObject *dict; + + if (type->tp_dict != NULL) + return 0; + dict = PyDict_New(); + if (dict == NULL) + return -1; + type->tp_dict = dict; + + /* Add intrinsics */ + if (add_methods(type, intrinsic_methods) < 0) + return -1; + if (add_members(type, intrinsic_members) < 0) + return -1; + if (add_getset(type, intrinsic_getsets) < 0) + return -1; + if (add_operators(type) < 0) + return -1; + + /* Add type-specific descriptors */ + if (type->tp_methods != NULL) { + if (add_methods(type, type->tp_methods) < 0) + return -1; + } + if (type->tp_members != NULL) { + if (add_members(type, type->tp_members) < 0) + return -1; + } + if (type->tp_getset != NULL) { + if (add_getset(type, type->tp_getset) < 0) + return -1; + } + return 0; + } + + + /* Generic wrappers for overloadable 'operators' such as __getitem__ */ + + static PyObject * + wrap_len(PyObject *self, PyObject *args) + { + long res; + + if (!PyArg_ParseTuple(args, ":__len__")) + return NULL; + res = PyObject_Size(self); + if (res < 0 && PyErr_Occurred()) + return NULL; + return PyInt_FromLong(res); + } + + static PyMethodDef tab_len[] = { + {"__len__", wrap_len, METH_VARARGS, "XXX"}, + {0} + }; + + static PyObject * + wrap_add(PyObject *self, PyObject *args) + { + PyObject *other; + + if (!PyArg_ParseTuple(args, "O:__add__", &other)) + return NULL; + return PyNumber_Add(self, other); + } + + static PyObject * + wrap_radd(PyObject *self, PyObject *args) + { + PyObject *other; + + if (!PyArg_ParseTuple(args, "O:__radd__", &other)) + return NULL; + return PyNumber_Add(other, self); + } + + static PyMethodDef tab_sq_concat[] = { + {"__add__", wrap_add, METH_VARARGS, "XXX"}, + {"__radd__", wrap_radd, METH_VARARGS, "XXX"}, + {0} + }; + + static PyObject * + wrap_mul(PyObject *self, PyObject *args) + { + PyObject *other; + + if (!PyArg_ParseTuple(args, "O:__mul__", &other)) + return NULL; + return PyNumber_Multiply(self, other); + } + + static PyObject * + wrap_rmul(PyObject *self, PyObject *args) + { + PyObject *other; + + if (!PyArg_ParseTuple(args, "O:__rmul__", &other)) + return NULL; + return PyNumber_Multiply(other, self); + } + + static PyMethodDef tab_sq_repeat[] = { + {"__mul__", wrap_mul, METH_VARARGS, "XXX"}, + {"__rmul__", wrap_rmul, METH_VARARGS, "XXX"}, + {0} + }; + + static PyObject * + wrap_getitem(PyObject *self, PyObject *args) + { + PyObject *key; + + if (!PyArg_ParseTuple(args, "O:__getitem__", &key)) + return NULL; + return PyObject_GetItem(self, key); + } + + static PyMethodDef tab_getitem[] = { + {"__getitem__", wrap_getitem, METH_VARARGS, "XXX"}, + {0} + }; + + static PyObject * + wrap_getslice(PyObject *self, PyObject *args) + { + int i, j; + + if (!PyArg_ParseTuple(args, "ii:__getslice__", &i, &j)) + return NULL; + return PySequence_GetSlice(self, i, j); + } + + static PyMethodDef tab_sq_slice[] = { + {"__getslice__", wrap_getslice, METH_VARARGS, "XXX"}, + {0} + }; + + static PyObject * + wrap_setitem(PyObject *self, PyObject *args) + { + PyObject *key, *value; + + if (!PyArg_ParseTuple(args, "OO:__setitem__", &key, &value)) + return NULL; + if (PyObject_SetItem(self, key, value) < 0) + return NULL; + Py_INCREF(Py_None); + return Py_None; + } + + static PyMethodDef tab_setitem[] = { + {"__setitem__", wrap_setitem, METH_VARARGS, "XXX"}, + {0} + }; + + static PyObject * + wrap_setslice(PyObject *self, PyObject *args) + { + int i, j; + PyObject *value; + + if (!PyArg_ParseTuple(args, "iiO:__setslice__", &i, &j, &value)) + return NULL; + if (PySequence_SetSlice(self, i, j, value) < 0) + return NULL; + Py_INCREF(Py_None); + return Py_None; + } + + static PyMethodDef tab_setslice[] = { + {"__setslice__", wrap_setslice, METH_VARARGS, "XXX"}, + {0} + }; + + static PyObject * + wrap_contains(PyObject *self, PyObject *args) + { + PyObject *value; + long res; + + if (!PyArg_ParseTuple(args, "O:__contains__", &value)) + return NULL; + res = PySequence_Contains(self, value); + if (res < 0 && PyErr_Occurred()) + return NULL; + return PyInt_FromLong(res); + } + + static PyMethodDef tab_contains[] = { + {"__contains__", wrap_contains, METH_VARARGS, "XXX"}, + {0} + }; + + static PyObject * + wrap_iadd(PyObject *self, PyObject *args) + { + PyObject *other; + + if (!PyArg_ParseTuple(args, "O:__iadd__", &other)) + return NULL; + return PyNumber_InPlaceAdd(self, other); + } + + static PyMethodDef tab_iadd[] = { + {"__iadd__", wrap_iadd, METH_VARARGS, "XXX"}, + {0} + }; + + static PyObject * + wrap_imul(PyObject *self, PyObject *args) + { + PyObject *other; + + if (!PyArg_ParseTuple(args, "O:__imul__", &other)) + return NULL; + return PyNumber_InPlaceMultiply(self, other); + } + + static PyMethodDef tab_imul[] = { + {"__imul__", wrap_imul, METH_VARARGS, "XXX"}, + {0} + }; + + static int + add_operators(PyTypeObject *type) + { + PySequenceMethods *sq; + PyMappingMethods *mp; + + #undef ADD + #define ADD(SLOT, TABLE) \ + if (SLOT) { \ + if (add_methods(type, TABLE) < 0) \ + return -1; \ + } + + if ((sq = type->tp_as_sequence) != NULL) { + ADD(sq->sq_length, tab_len); + ADD(sq->sq_concat, tab_sq_concat); + ADD(sq->sq_repeat, tab_sq_repeat); + ADD(sq->sq_item, tab_getitem); + ADD(sq->sq_slice, tab_sq_slice); + ADD(sq->sq_ass_item, tab_setitem); + ADD(sq->sq_ass_slice, tab_setslice); + ADD(sq->sq_contains, tab_contains); + ADD(sq->sq_inplace_concat, tab_iadd); + ADD(sq->sq_inplace_repeat, tab_imul); + } + if ((mp = type->tp_as_mapping) != NULL) { + ADD(mp->mp_length, tab_len); + ADD(mp->mp_subscript, tab_getitem); + ADD(mp->mp_ass_subscript, tab_setitem); + } + return 0; + } From gvanrossum@users.sourceforge.net Sun Apr 29 16:48:36 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 29 Apr 2001 08:48:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10745 Added Files: Tag: descr-branch test_descr.py Log Message: Add minimal test for some descr-relate stuff. --- NEW FILE: test_descr.py --- # Test descriptor-related enhancements from test_support import verify, verbose from copy import deepcopy def testunop(a, res, expr="len(a)", meth="__len__"): if verbose: print "checking", expr dict = {'a': a} verify(eval(expr, dict) == res) t = type(a) m = getattr(t, meth) verify(m == t.__dict__[meth]) verify(m(a) == res) bm = getattr(a, meth) verify(bm() == res) def testbinop(a, b, res, expr="a+b", meth="__add__"): if verbose: print "checking", expr dict = {'a': a, 'b': b} verify(eval(expr, dict) == res) t = type(a) m = getattr(t, meth) verify(m == t.__dict__[meth]) verify(m(a, b) == res) bm = getattr(a, meth) verify(bm(b) == res) def testternop(a, b, c, res, expr="a]b:c]", meth="__getslice__"): if verbose: print "checking", expr dict = {'a': a, 'b': b, 'c': c} verify(eval(expr, dict) == res) t = type(a) m = getattr(t, meth) verify(m == t.__dict__[meth]) verify(m(a, b, c) == res) bm = getattr(a, meth) verify(bm(b, c) == res) def testsetop(a, b, res, stmt="a+=b", meth="__iadd__"): if verbose: print "checking", stmt dict = {'a': deepcopy(a), 'b': b} exec stmt in dict verify(dict['a'] == res) t = type(a) m = getattr(t, meth) verify(m == t.__dict__[meth]) dict['a'] = deepcopy(a) m(dict['a'], b) verify(dict['a'] == res) dict['a'] = deepcopy(a) bm = getattr(dict['a'], meth) bm(b) verify(dict['a'] == res) def testset2op(a, b, c, res, stmt="a[b]=c", meth="__setitem__"): if verbose: print "checking", stmt dict = {'a': deepcopy(a), 'b': b, 'c': c} exec stmt in dict verify(dict['a'] == res) t = type(a) m = getattr(t, meth) verify(m == t.__dict__[meth]) dict['a'] = deepcopy(a) m(dict['a'], b, c) verify(dict['a'] == res) dict['a'] = deepcopy(a) bm = getattr(dict['a'], meth) bm(b, c) verify(dict['a'] == res) def testset3op(a, b, c, d, res, stmt="a[b:c]=d", meth="__setslice__"): if verbose: print "checking", stmt dict = {'a': deepcopy(a), 'b': b, 'c': c, 'd': d} exec stmt in dict verify(dict['a'] == res) t = type(a) m = getattr(t, meth) verify(m == t.__dict__[meth]) dict['a'] = deepcopy(a) m(dict['a'], b, c, d) verify(dict['a'] == res) dict['a'] = deepcopy(a) bm = getattr(dict['a'], meth) bm(b, c, d) verify(dict['a'] == res) testbinop([1], [2], [1,2], "a+b", "__add__") testbinop([1,2,3], 2, 1, "b in a", "__contains__") testbinop([1,2,3], 4, 0, "b in a", "__contains__") testbinop([1,2,3], 1, 2, "a[b]", "__getitem__") testternop([1,2,3], 0, 2, [1,2], "a[b:c]", "__getslice__") testsetop([1], [2], [1,2], "a+=b", "__iadd__") testsetop([1,2], 3, [1,2,1,2,1,2], "a*=b", "__imul__") testunop([1,2,3], 3, "len(a)", "__len__") testbinop([1,2], 3, [1,2,1,2,1,2], "a*b", "__mul__") testbinop([1], [2], [2,1], "b+a", "__radd__") testbinop([1,2], 3, [1,2,1,2,1,2], "b*a", "__rmul__") testset2op([1,2], 1, 3, [1,3], "a[b]=c", "__setitem__") testset3op([1,2,3,4], 1, 3, [5,6], [1,5,6,4], "a[b:c]=d", "__setslice__") if verbose: print __name__, "OK" From gvanrossum@users.sourceforge.net Sun Apr 29 17:23:32 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 29 Apr 2001 09:23:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_descr,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv18121 Added Files: Tag: descr-branch test_descr Log Message: Add output file for test_descr.py --- NEW FILE: test_descr --- test_descr From nascheme@users.sourceforge.net Sun Apr 29 18:15:46 2001 From: nascheme@users.sourceforge.net (Neil Schemenauer) Date: Sun, 29 Apr 2001 10:15:46 -0700 Subject: [Python-checkins] CVS: python/nondist/sf-html sf-faq.html,1.20,1.21 Message-ID: Update of /cvsroot/python/python/nondist/sf-html In directory usw-pr-cvs1:/tmp/cvs-serv28844 Modified Files: sf-faq.html Log Message: - Add FAQ entry explaining how to use viewcvs. - Update list of developers. Index: sf-faq.html =================================================================== RCS file: /cvsroot/python/python/nondist/sf-html/sf-faq.html,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** sf-faq.html 2001/04/28 07:22:33 1.20 --- sf-faq.html 2001/04/29 17:15:44 1.21 *************** *** 27,38 ****

    2. CVS

      !
    1. How do I check out a CVS version of Python?
    2. !
    3. What settings should I use?
    4. !
    5. Troubleshooting: "Permission Denied"
    6. !
    7. Where can I learn more about CVS?
    8. !
    9. How can I remove a directory from the CVS tree?
    10. !
    11. How to revert changes?
    12. !
    13. How to add binary files?
    14. !
    15. How to force a branch tag on a file?
    --- 27,39 ----

    2. CVS

      !
    1. How do I browse the CVS tree online?
    2. !
    3. How do I check out a CVS version of Python?
    4. !
    5. What settings should I use?
    6. !
    7. Troubleshooting: "Permission Denied"
    8. !
    9. Where can I learn more about CVS?
    10. !
    11. How can I remove a directory from the CVS tree?
    12. !
    13. How to revert changes?
    14. !
    15. How to add binary files?
    16. !
    17. How to force a branch tag on a file?
    *************** *** 119,123 **** To get the real name, click on "View members" in the "Developer Info" field, then click on the user name you're unsure about.
    ! A recent [17.07.2000] list of mapping is given here: --- 120,124 ---- To get the real name, click on "View members" in the "Developer Info" field, then click on the user name you're unsure about.
    ! A recent [2001-04-29] list of mapping is given here:
    *************** *** 132,139 **** --- 133,148 ---- + + + + + + + + *************** *** 156,159 **** --- 165,172 ---- + + + + *************** *** 168,171 **** --- 181,188 ---- + + + + *************** *** 176,181 **** ! ! --- 193,198 ---- ! ! *************** *** 192,211 **** --- 209,248 ---- + + + + + + + + + + + + + + + + + + + + *************** *** 222,225 **** --- 259,275 ----

    2.1.:

    +

    Q: How do I browse the CVS tree online?

    + +

    A:

    + If you don't have CVS or you don't want to download the source tree, you can + browse it using viewcvs at: + +
    + + http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/
    + +

    2.2.:

    +

    Q: How do I check out a CVS version of Python?

    *************** *** 242,246 **** cvs -z3 co python !

    2.2.:

    Q: What setting should I use?

    --- 292,296 ---- cvs -z3 co python !

    2.3.:

    Q: What setting should I use?

    *************** *** 257,261 **** subdirectories. !

    2.3.:

    Q: I get the following error message:

    --- 307,311 ---- subdirectories. !

    2.4.:

    Q: I get the following error message:

    *************** *** 279,283 **** up to 6 hours. !

    2.4.:

    Q: Where can I learn more about CVS?

    --- 329,333 ---- up to 6 hours. !

    2.5.:

    Q: Where can I learn more about CVS?

    *************** *** 295,299 **** href="http://cvsbook.red-bean.com/cvsbook.html#Introduction">http://cvsbook.red-bean.com/cvsbook.html#Introduction !

    2.5.:

    Q: How can I remove a directory from the CVS tree?

    --- 345,349 ---- href="http://cvsbook.red-bean.com/cvsbook.html#Introduction">http://cvsbook.red-bean.com/cvsbook.html#Introduction !

    2.6.:

    Q: How can I remove a directory from the CVS tree?

    *************** *** 312,316 **** cvs update -P !

    2.6.:

    Q: How to revert changes?

    --- 362,366 ---- cvs update -P !

    2.7.:

    Q: How to revert changes?

    *************** *** 330,334 **** revision 1.16 of ceval.c. !

    2.7.:

    Q: How to add binary files?

    --- 380,384 ---- revision 1.16 of ceval.c. !

    2.8.:

    Q: How to add binary files?

    *************** *** 342,346 **** !

    2.8.:

    Q: How to force a branch tag on a file?

    --- 392,396 ---- !

    2.9.:

    Q: How to force a branch tag on a file?

    From gvanrossum@users.sourceforge.net Sun Apr 29 23:17:03 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 29 Apr 2001 15:17:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31723 Modified Files: Tag: descr-branch test_descr.py Log Message: Fix a typo in a default value pointed out by /F. Fortunately, the defaults were just used as examples. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -r1.1.2.1 -r1.1.2.2 *** test_descr.py 2001/04/29 15:48:33 1.1.2.1 --- test_descr.py 2001/04/29 22:17:01 1.1.2.2 *************** *** 26,30 **** verify(bm(b) == res) ! def testternop(a, b, c, res, expr="a]b:c]", meth="__getslice__"): if verbose: print "checking", expr dict = {'a': a, 'b': b, 'c': c} --- 26,30 ---- verify(bm(b) == res) ! def testternop(a, b, c, res, expr="a[b:c]", meth="__getslice__"): if verbose: print "checking", expr dict = {'a': a, 'b': b, 'c': c} From tim_one@users.sourceforge.net Sun Apr 29 23:21:27 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 29 Apr 2001 15:21:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.176,2.177 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv32591/python/dist/src/Python Modified Files: import.c Log Message: SF bug #417093: Case sensitive import: dir and .py file w/ same name Directory containing Spam.py spam/__init__.py Then "import Spam" caused a SystemError, because code checking for the existence of "Spam/__init__.py" finds it on a case-insensitive filesystem, but then bails because the directory it finds it in doesn't match case, and then old code assumed that was still an error even though it isn't anymore. Changed the code to just continue looking in this case (instead of calling it an error). So import Spam and import spam both work now. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.176 retrieving revision 2.177 diff -C2 -r2.176 -r2.177 *** import.c 2001/04/20 19:13:02 2.176 --- import.c 2001/04/29 22:21:25 2.177 *************** *** 959,970 **** and there's an __init__ module in that directory */ #ifdef HAVE_STAT ! if (stat(buf, &statbuf) == 0 && ! S_ISDIR(statbuf.st_mode) && ! find_init_module(buf)) { ! if (case_ok(buf, len, namelen, name)) ! return &fd_package; ! else ! return NULL; ! } #else /* XXX How are you going to test for directories? */ --- 959,967 ---- and there's an __init__ module in that directory */ #ifdef HAVE_STAT ! if (stat(buf, &statbuf) == 0 && /* it exists */ ! S_ISDIR(statbuf.st_mode) && /* it's a directory */ ! find_init_module(buf) && /* it has __init__.py */ ! case_ok(buf, len, namelen, name)) /* and case matches */ ! return &fd_package; #else /* XXX How are you going to test for directories? */ From gvanrossum@users.sourceforge.net Mon Apr 30 02:14:58 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 29 Apr 2001 18:14:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects descrobject.c,1.1.2.5,1.1.2.6 floatobject.c,2.81,2.81.6.1 intobject.c,2.56,2.56.6.1 longobject.c,1.71,1.71.6.1 typeobject.c,2.16.8.4,2.16.8.5 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv27474/Objects Modified Files: Tag: descr-branch descrobject.c floatobject.c intobject.c longobject.c typeobject.c Log Message: Redoing the special-methods code so that the __foo__ wrapper for type X actually contains a reference to the function in X's tp_foo slot, rather than simply calling PyObject_Foo(). This will make overriding __foo__ with a Python function easier, once I get to that. This isn't completely done, but many things work, e.g. type(1).__add__(3, 4). Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/descrobject.c,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -r1.1.2.5 -r1.1.2.6 *** descrobject.c 2001/04/29 14:53:55 1.1.2.5 --- descrobject.c 2001/04/30 01:14:56 1.1.2.6 *************** *** 4,7 **** --- 4,12 ---- #include "structmember.h" /* Why is this not included in Python.h? */ + struct wrapperdescr { + struct wrapperbase *base; + void *wrapped; /* This can be any function pointer */ + }; + /* Descriptor object */ struct PyDescrObject { *************** *** 13,16 **** --- 18,22 ---- struct memberlist *d_member; struct getsetlist *d_getset; + struct wrapperdescr d_wrapper; } d_union; }; *************** *** 21,24 **** --- 27,31 ---- #define DF_MEMBER 2 #define DF_GETSET 3 + #define DF_WRAPPER 4 static void *************** *** 38,41 **** --- 45,50 ---- case DF_GETSET: return descr->d_union.d_getset->name; + case DF_WRAPPER: + return descr->d_union.d_wrapper.base->name; default: return NULL; *************** *** 72,75 **** --- 81,90 ---- descr->d_type->tp_name); break; + case DF_WRAPPER: + sprintf(buffer, + "", + descr->d_union.d_wrapper.base->name, + descr->d_type->tp_name); + break; default: sprintf(buffer, "", *************** *** 83,96 **** static PyObject * ! descr_get(PyObject *d, PyObject *obj) { ! PyDescrObject *descr; ! ! if (obj == NULL || !PyDescr_Check(d)) { ! Py_INCREF(d); ! return d; } - - descr = (PyDescrObject *)d; if (!PyObject_IsInstance(obj, (PyObject *)(descr->d_type))) { --- 98,107 ---- static PyObject * ! descr_get(PyDescrObject *descr, PyObject *obj) { ! if (obj == NULL) { ! Py_INCREF(descr); ! return (PyObject *)descr; } if (!PyObject_IsInstance(obj, (PyObject *)(descr->d_type))) { *************** *** 118,121 **** --- 129,135 ---- obj, descr->d_union.d_getset->closure); + case DF_WRAPPER: + return PyWrapper_New(descr, obj); + } *************** *** 128,137 **** int ! descr_set(PyObject *d, PyObject *obj, PyObject *value) { - PyDescrObject *descr = (PyDescrObject *)d; - - assert(PyDescr_Check(d)); - if (!PyObject_IsInstance(obj, (PyObject *)(descr->d_type))) { PyErr_Format(PyExc_TypeError, --- 142,147 ---- int ! descr_set(PyDescrObject *descr, PyObject *obj, PyObject *value) { if (!PyObject_IsInstance(obj, (PyObject *)(descr->d_type))) { PyErr_Format(PyExc_TypeError, *************** *** 206,219 **** } ! if (descr->d_flavor == DF_METHOD) { PyObject *func, *result; ! func = PyCFunction_New(descr->d_union.d_method, self); if (func == NULL) return NULL; args = PyTuple_GetSlice(args, 1, argc); ! if (args == NULL) return NULL; result = PyEval_CallObjectWithKeywords(func, args, kwds); Py_DECREF(args); return result; } --- 216,235 ---- } ! if (descr->d_flavor == DF_METHOD || descr->d_flavor == DF_WRAPPER) { PyObject *func, *result; ! if (descr->d_flavor == DF_METHOD) ! func = PyCFunction_New(descr->d_union.d_method, self); ! else ! func = PyWrapper_New(descr, self); if (func == NULL) return NULL; args = PyTuple_GetSlice(args, 1, argc); ! if (args == NULL) { ! Py_DECREF(func); return NULL; + } result = PyEval_CallObjectWithKeywords(func, args, kwds); Py_DECREF(args); + Py_DECREF(func); return result; } *************** *** 231,238 **** if (argc == 1) ! return descr_get((PyObject *)descr, self); if (argc == 2) { PyObject *value = PyTuple_GET_ITEM(args, 1); ! if (descr_set((PyObject *)descr, self, value) < 0) return NULL; Py_INCREF(Py_None); --- 247,254 ---- if (argc == 1) ! return descr_get(descr, self); if (argc == 2) { PyObject *value = PyTuple_GET_ITEM(args, 1); ! if (descr_set(descr, self, value) < 0) return NULL; Py_INCREF(Py_None); *************** *** 245,249 **** static PyObject * ! descr_get_api(PyObject *descr, PyObject *args) { PyObject *obj; --- 261,265 ---- static PyObject * ! descr_get_api(PyDescrObject *descr, PyObject *args) { PyObject *obj; *************** *** 255,259 **** static PyObject * ! descr_set_api(PyObject *descr, PyObject *args) { PyObject *obj, *val; --- 271,275 ---- static PyObject * ! descr_set_api(PyDescrObject *descr, PyObject *args) { PyObject *obj, *val; *************** *** 398,405 **** PyDescrObject *descr = PyDescr_New(type); ! if (descr == NULL) ! return NULL; ! descr->d_union.d_method = method; ! descr->d_flavor = DF_METHOD; return (PyObject *)descr; } --- 414,421 ---- PyDescrObject *descr = PyDescr_New(type); ! if (descr != NULL) { ! descr->d_union.d_method = method; ! descr->d_flavor = DF_METHOD; ! } return (PyObject *)descr; } *************** *** 410,417 **** PyDescrObject *descr = PyDescr_New(type); ! if (descr == NULL) ! return NULL; ! descr->d_union.d_member = member; ! descr->d_flavor = DF_MEMBER; return (PyObject *)descr; } --- 426,433 ---- PyDescrObject *descr = PyDescr_New(type); ! if (descr != NULL) { ! descr->d_union.d_member = member; ! descr->d_flavor = DF_MEMBER; ! } return (PyObject *)descr; } *************** *** 422,429 **** PyDescrObject *descr = PyDescr_New(type); ! if (descr == NULL) ! return NULL; ! descr->d_union.d_getset = getset; ! descr->d_flavor = DF_GETSET; return (PyObject *)descr; } --- 438,459 ---- PyDescrObject *descr = PyDescr_New(type); ! if (descr != NULL) { ! descr->d_union.d_getset = getset; ! descr->d_flavor = DF_GETSET; ! } ! return (PyObject *)descr; ! } ! ! PyObject * ! PyDescr_NewWrapper(PyTypeObject *type, ! struct wrapperbase *base, void *wrapped) ! { ! PyDescrObject *descr = PyDescr_New(type); ! ! if (descr != NULL) { ! descr->d_union.d_wrapper.base = base; ! descr->d_union.d_wrapper.wrapped = wrapped; ! descr->d_flavor = DF_WRAPPER; ! } return (PyObject *)descr; } *************** *** 608,610 **** --- 638,758 ---- } return (PyObject *)pp; + } + + + /* --- Wrapper object for "slot" methods --- */ + + /* This has no reason to be in this file except that adding new files is a + bit of a pain */ + + typedef struct { + PyObject_HEAD + PyDescrObject *descr; + PyObject *self; + } wrapperobject; + + static void + wrapper_dealloc(wrapperobject *wp) + { + Py_DECREF(wp->descr); + Py_DECREF(wp->self); + PyObject_DEL(wp); + } + + static PyMethodDef wrapper_methods[] = { + {0} + }; + + static PyObject * + wrapper_name(wrapperobject *wp) + { + char *s = wp->descr->d_union.d_wrapper.base->name; + + return PyString_FromString(s); + } + + static PyObject * + wrapper_doc(wrapperobject *wp) + { + char *s = wp->descr->d_union.d_wrapper.base->doc; + + if (s == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + else { + return PyString_FromString(s); + } + } + + static struct getsetlist wrapper_getsets[] = { + {"__name__", (getter)wrapper_name}, + {"__doc__", (getter)wrapper_doc}, + {0} + }; + + static PyObject * + wrapper_call(wrapperobject *wp, PyObject *args, PyObject *kwds) + { + wrapperfunc wrapper = wp->descr->d_union.d_wrapper.base->wrapper; + PyObject *self = wp->self; + + return (*wrapper)(self, args, wp->descr->d_union.d_wrapper.wrapped); + } + + PyTypeObject wrappertype = { + PyObject_HEAD_INIT(&PyType_Type) + 0, /* ob_size */ + "method-wrapper", /* tp_name */ + sizeof(wrapperobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)wrapper_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)wrapper_call, /* tp_call */ + 0, /* tp_str */ + PyGeneric_GetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + wrapper_methods, /* tp_methods */ + 0, /* tp_members */ + wrapper_getsets, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + }; + + PyObject * + PyWrapper_New(PyDescrObject *descr, PyObject *self) + { + wrapperobject *wp; + + assert(descr->d_flavor == DF_WRAPPER); + assert(PyObject_IsInstance(self, (PyObject *)(descr->d_type))); + + wp = PyObject_NEW(wrapperobject, &wrappertype); + if (wp != NULL) { + Py_INCREF(descr); + wp->descr = descr; + Py_INCREF(self); + wp->self = self; + } + return (PyObject *)wp; } Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.81 retrieving revision 2.81.6.1 diff -C2 -r2.81 -r2.81.6.1 *** floatobject.c 2001/03/11 08:37:29 2.81 --- floatobject.c 2001/04/30 01:14:56 2.81.6.1 *************** *** 680,687 **** 0, /*tp_call*/ (reprfunc)float_str, /*tp_str*/ ! 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ ! Py_TPFLAGS_CHECKTYPES /*tp_flags*/ }; --- 680,687 ---- 0, /*tp_call*/ (reprfunc)float_str, /*tp_str*/ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES /*tp_flags*/ }; Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.56 retrieving revision 2.56.6.1 diff -C2 -r2.56 -r2.56.6.1 *** intobject.c 2001/03/06 12:12:02 2.56 --- intobject.c 2001/04/30 01:14:56 2.56.6.1 *************** *** 806,813 **** 0, /*tp_call*/ 0, /*tp_str*/ ! 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ ! Py_TPFLAGS_CHECKTYPES /*tp_flags*/ }; --- 806,813 ---- 0, /*tp_call*/ 0, /*tp_str*/ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES /*tp_flags*/ }; Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.71 retrieving revision 1.71.6.1 diff -C2 -r1.71 -r1.71.6.1 *** longobject.c 2001/01/17 15:33:18 1.71 --- longobject.c 2001/04/30 01:14:56 1.71.6.1 *************** *** 1868,1874 **** 0, /*tp_call*/ (reprfunc)long_str, /*tp_str*/ ! 0, /*tp_getattro*/ ! 0, /*tp_setattro*/ ! 0, /*tp_as_buffer*/ ! Py_TPFLAGS_CHECKTYPES /*tp_flags*/ }; --- 1868,1874 ---- 0, /*tp_call*/ (reprfunc)long_str, /*tp_str*/ ! PyGeneric_GetAttr, /* tp_getattro */ ! 0, /*tp_setattro*/ ! 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES /*tp_flags*/ }; Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.4 retrieving revision 2.16.8.5 diff -C2 -r2.16.8.4 -r2.16.8.5 *** typeobject.c 2001/04/29 14:53:55 2.16.8.4 --- typeobject.c 2001/04/30 01:14:56 2.16.8.5 *************** *** 18,21 **** --- 18,27 ---- static PyObject * + type_module(PyTypeObject *type, void *context) + { + return PyString_FromString("__builtin__"); + } + + static PyObject * type_dict(PyTypeObject *type, void *context) { *************** *** 29,32 **** --- 35,39 ---- struct getsetlist type_getsets[] = { {"__bases__", (getter)type_bases, NULL, NULL}, + {"__module__", (getter)type_module, NULL, NULL}, {"__dict__", (getter)type_dict, NULL, NULL}, {0} *************** *** 150,153 **** --- 157,176 ---- static int + add_wrappers(PyTypeObject *type, struct wrapperbase *base, void *wrapped) + { + PyObject *dict = type->tp_dict; + + for (; base->name != NULL; base++) { + PyObject *descr = PyDescr_NewWrapper(type, base, wrapped); + if (descr == NULL) + return -1; + if (PyDict_SetItemString(dict, base->name, descr) < 0) + return -1; + Py_DECREF(descr); + } + return 0; + } + + static int add_members(PyTypeObject *type, struct memberlist *memb) { *************** *** 225,336 **** /* Generic wrappers for overloadable 'operators' such as __getitem__ */ static PyObject * ! wrap_len(PyObject *self, PyObject *args) { ! long res; ! if (!PyArg_ParseTuple(args, ":__len__")) return NULL; ! res = PyObject_Size(self); ! if (res < 0 && PyErr_Occurred()) return NULL; ! return PyInt_FromLong(res); } ! static PyMethodDef tab_len[] = { ! {"__len__", wrap_len, METH_VARARGS, "XXX"}, {0} }; static PyObject * ! wrap_add(PyObject *self, PyObject *args) { PyObject *other; ! if (!PyArg_ParseTuple(args, "O:__add__", &other)) return NULL; ! return PyNumber_Add(self, other); } static PyObject * ! wrap_radd(PyObject *self, PyObject *args) { PyObject *other; ! if (!PyArg_ParseTuple(args, "O:__radd__", &other)) return NULL; ! return PyNumber_Add(other, self); } ! static PyMethodDef tab_sq_concat[] = { ! {"__add__", wrap_add, METH_VARARGS, "XXX"}, ! {"__radd__", wrap_radd, METH_VARARGS, "XXX"}, ! {0} ! }; static PyObject * ! wrap_mul(PyObject *self, PyObject *args) { ! PyObject *other; ! if (!PyArg_ParseTuple(args, "O:__mul__", &other)) return NULL; ! return PyNumber_Multiply(self, other); } static PyObject * ! wrap_rmul(PyObject *self, PyObject *args) { ! PyObject *other; ! if (!PyArg_ParseTuple(args, "O:__rmul__", &other)) return NULL; ! return PyNumber_Multiply(other, self); } ! static PyMethodDef tab_sq_repeat[] = { ! {"__mul__", wrap_mul, METH_VARARGS, "XXX"}, ! {"__rmul__", wrap_rmul, METH_VARARGS, "XXX"}, {0} }; static PyObject * ! wrap_getitem(PyObject *self, PyObject *args) { ! PyObject *key; ! if (!PyArg_ParseTuple(args, "O:__getitem__", &key)) return NULL; ! return PyObject_GetItem(self, key); } ! static PyMethodDef tab_getitem[] = { ! {"__getitem__", wrap_getitem, METH_VARARGS, "XXX"}, {0} }; static PyObject * ! wrap_getslice(PyObject *self, PyObject *args) { int i, j; ! if (!PyArg_ParseTuple(args, "ii:__getslice__", &i, &j)) return NULL; ! return PySequence_GetSlice(self, i, j); } ! static PyMethodDef tab_sq_slice[] = { ! {"__getslice__", wrap_getslice, METH_VARARGS, "XXX"}, {0} }; static PyObject * ! wrap_setitem(PyObject *self, PyObject *args) { ! PyObject *key, *value; ! if (!PyArg_ParseTuple(args, "OO:__setitem__", &key, &value)) return NULL; ! if (PyObject_SetItem(self, key, value) < 0) return NULL; Py_INCREF(Py_None); --- 248,470 ---- /* Generic wrappers for overloadable 'operators' such as __getitem__ */ + /* There's a wrapper *function* for each distinct function typedef used + for type object slots (e.g. binaryfunc, ternaryfunc, etc.). There's a + wrapper *table* for each distinct operation (e.g. __len__, __add__). + Most tables have only one entry; the tables for binary operators have two + entries, one regular and one with reversed arguments. */ + static PyObject * ! wrap_inquiry(PyObject *self, PyObject *args, void *wrapped) { ! inquiry func = (inquiry)wrapped; ! int res; ! if (!PyArg_ParseTuple(args, "")) return NULL; ! res = (*func)(self); ! if (res == -1 && PyErr_Occurred()) return NULL; ! return PyInt_FromLong((long)res); } ! static struct wrapperbase tab_len[] = { ! {"__len__", (wrapperfunc)wrap_inquiry, "x.__len__() <==> len(x)"}, {0} }; static PyObject * ! wrap_binaryfunc(PyObject *self, PyObject *args, void *wrapped) { + binaryfunc func = (binaryfunc)wrapped; PyObject *other; ! if (!PyArg_ParseTuple(args, "O", &other)) return NULL; ! return (*func)(self, other); } static PyObject * ! wrap_binaryfunc_r(PyObject *self, PyObject *args, void *wrapped) { + binaryfunc func = (binaryfunc)wrapped; PyObject *other; ! if (!PyArg_ParseTuple(args, "O", &other)) return NULL; ! return (*func)(other, self); } ! #undef BINARY ! #define BINARY(NAME, OP) \ ! static struct wrapperbase tab_##NAME[] = { \ ! {"__" #NAME "__", \ ! (wrapperfunc)wrap_binaryfunc, \ ! "x.__" #NAME "__(y) <==> " #OP}, \ ! {"__r" #NAME "__", \ ! (wrapperfunc)wrap_binaryfunc_r, \ ! "y.__r" #NAME "__(x) <==> " #OP}, \ ! {0} \ ! } + BINARY(add, "x+y"); + BINARY(sub, "x-y"); + BINARY(mul, "x*y"); + BINARY(div, "x/y"); + BINARY(mod, "x%y"); + BINARY(divmod, "divmod(x,y)"); + BINARY(lshift, "x<>y"); + BINARY(and, "x&y"); + BINARY(xor, "x^y"); + BINARY(or, "x|y"); + static PyObject * ! wrap_ternaryfunc(PyObject *self, PyObject *args, void *wrapped) { ! ternaryfunc func = (ternaryfunc)wrapped; ! PyObject *other, *third; ! if (!PyArg_ParseTuple(args, "OO", &other, &third)) return NULL; ! return (*func)(self, other, third); ! } ! ! #undef TERNARY ! #define TERNARY(NAME, OP) \ ! static struct wrapperbase tab_##NAME[] = { \ ! {"__" #NAME "__", \ ! (wrapperfunc)wrap_ternaryfunc, \ ! "x.__" #NAME "__(y, z) <==> " #OP}, \ ! {"__r" #NAME "__", \ ! (wrapperfunc)wrap_ternaryfunc, \ ! "y.__r" #NAME "__(x, z) <==> " #OP}, \ ! {0} \ } + TERNARY(pow, "(x**y) % z"); + + #undef UNARY + #define UNARY(NAME, OP) \ + static struct wrapperbase tab_##NAME[] = { \ + {"__" #NAME "__", \ + (wrapperfunc)wrap_unaryfunc, \ + "x.__" #NAME "__() <==> " #OP}, \ + {0} \ + } + static PyObject * ! wrap_unaryfunc(PyObject *self, PyObject *args, void *wrapped) { ! unaryfunc func = (unaryfunc)wrapped; ! if (!PyArg_ParseTuple(args, "")) return NULL; ! return (*func)(self); } + + UNARY(neg, "-x"); + UNARY(pos, "+x"); + UNARY(abs, "abs(x)"); + UNARY(nonzero, "x != 0"); + UNARY(invert, "~x"); + UNARY(int, "int(x)"); + UNARY(long, "long(x)"); + UNARY(float, "float(x)"); + UNARY(oct, "oct(x)"); + UNARY(hex, "hex(x)"); + + #undef IBINARY + #define IBINARY(NAME, OP) \ + static struct wrapperbase tab_##NAME[] = { \ + {"__" #NAME "__", \ + (wrapperfunc)wrap_binaryfunc, \ + "x.__" #NAME "__(y) <==> " #OP}, \ + {0} \ + } + + IBINARY(iadd, "x+=y"); + IBINARY(isub, "x-=y"); + IBINARY(imul, "x*=y"); + IBINARY(idiv, "x/=y"); + IBINARY(imod, "x%=y"); + IBINARY(ilshift, "x<<=y"); + IBINARY(irshift, "x>>=y"); + IBINARY(iand, "x&=y"); + IBINARY(ixor, "x^=y"); + IBINARY(ior, "x|=y"); ! #undef ITERNARY ! #define ITERNARY(NAME, OP) \ ! static struct wrapperbase tab_##NAME[] = { \ ! {"__" #NAME "__", \ ! (wrapperfunc)wrap_ternaryfunc, \ ! "x.__" #NAME "__(y) <==> " #OP}, \ ! {0} \ ! } ! ! ITERNARY(ipow, "x = (x**y) % z"); ! ! static struct wrapperbase tab_getitem[] = { ! {"__getitem__", (wrapperfunc)wrap_binaryfunc, ! "x.__getitem__(y) <==> x[y]"}, {0} }; static PyObject * ! wrap_intargfunc(PyObject *self, PyObject *args, void *wrapped) { ! intargfunc func = (intargfunc)wrapped; ! int i; ! if (!PyArg_ParseTuple(args, "i", &i)) return NULL; ! return (*func)(self, i); } + + static struct wrapperbase tab_mul_int[] = { + {"__mul__", (wrapperfunc)wrap_intargfunc, "x.__mul__(n) <==> x*n"}, + {"__rmul__", (wrapperfunc)wrap_intargfunc, "x.__rmul__(n) <==> n*x"}, + {0} + }; + + static struct wrapperbase tab_imul_int[] = { + {"__imul__", (wrapperfunc)wrap_intargfunc, "x.__imul__(n) <==> x*=n"}, + {0} + }; ! static struct wrapperbase tab_getitem_int[] = { ! {"__getitem__", (wrapperfunc)wrap_intargfunc, ! "x.__getitem__(i) <==> x[i]"}, {0} }; static PyObject * ! wrap_intintargfunc(PyObject *self, PyObject *args, void *wrapped) { + intintargfunc func = (intintargfunc)wrapped; int i, j; ! if (!PyArg_ParseTuple(args, "ii", &i, &j)) return NULL; ! return (*func)(self, i, j); } ! static struct wrapperbase tab_getslice[] = { ! {"__getslice__", (wrapperfunc)wrap_intintargfunc, ! "x.__getslice__(i, j) <==> x[i:j]"}, {0} }; static PyObject * ! wrap_intobjargproc(PyObject *self, PyObject *args, void *wrapped) { ! intobjargproc func = (intobjargproc)wrapped; ! int i, res; ! PyObject *value; ! if (!PyArg_ParseTuple(args, "iO", &i, &value)) return NULL; ! res = (*func)(self, i, value); ! if (res == -1 && PyErr_Occurred()) return NULL; Py_INCREF(Py_None); *************** *** 338,355 **** } ! static PyMethodDef tab_setitem[] = { ! {"__setitem__", wrap_setitem, METH_VARARGS, "XXX"}, {0} }; static PyObject * ! wrap_setslice(PyObject *self, PyObject *args) { ! int i, j; PyObject *value; ! if (!PyArg_ParseTuple(args, "iiO:__setslice__", &i, &j, &value)) return NULL; ! if (PySequence_SetSlice(self, i, j, value) < 0) return NULL; Py_INCREF(Py_None); --- 472,492 ---- } ! static struct wrapperbase tab_setitem_int[] = { ! {"__setitem__", (wrapperfunc)wrap_intobjargproc, ! "x.__setitem__(i, y) <==> x[i]=y"}, {0} }; static PyObject * ! wrap_intintobjargproc(PyObject *self, PyObject *args, void *wrapped) { ! intintobjargproc func = (intintobjargproc)wrapped; ! int i, j, res; PyObject *value; ! if (!PyArg_ParseTuple(args, "iiO", &i, &j, &value)) return NULL; ! res = (*func)(self, i, j, value); ! if (res == -1 && PyErr_Occurred()) return NULL; Py_INCREF(Py_None); *************** *** 357,411 **** } ! static PyMethodDef tab_setslice[] = { ! {"__setslice__", wrap_setslice, METH_VARARGS, "XXX"}, {0} }; static PyObject * ! wrap_contains(PyObject *self, PyObject *args) { PyObject *value; - long res; ! if (!PyArg_ParseTuple(args, "O:__contains__", &value)) return NULL; ! res = PySequence_Contains(self, value); ! if (res < 0 && PyErr_Occurred()) return NULL; ! return PyInt_FromLong(res); } ! static PyMethodDef tab_contains[] = { ! {"__contains__", wrap_contains, METH_VARARGS, "XXX"}, {0} }; - static PyObject * ! wrap_iadd(PyObject *self, PyObject *args) { ! PyObject *other; ! if (!PyArg_ParseTuple(args, "O:__iadd__", &other)) return NULL; ! return PyNumber_InPlaceAdd(self, other); ! } ! ! static PyMethodDef tab_iadd[] = { ! {"__iadd__", wrap_iadd, METH_VARARGS, "XXX"}, ! {0} ! }; ! ! static PyObject * ! wrap_imul(PyObject *self, PyObject *args) ! { ! PyObject *other; ! ! if (!PyArg_ParseTuple(args, "O:__imul__", &other)) return NULL; ! return PyNumber_InPlaceMultiply(self, other); } ! static PyMethodDef tab_imul[] = { ! {"__imul__", wrap_imul, METH_VARARGS, "XXX"}, {0} }; --- 494,543 ---- } ! static struct wrapperbase tab_setslice[] = { ! {"__setslice__", (wrapperfunc)wrap_intintobjargproc, ! "x.__setslice__(i, j, y) <==> x[i:j]=y"}, {0} }; + /* XXX objobjproc is a misnomer; should be objargpred */ static PyObject * ! wrap_objobjproc(PyObject *self, PyObject *args, void *wrapped) { + objobjproc func = (objobjproc)wrapped; + int res; PyObject *value; ! if (!PyArg_ParseTuple(args, "O", &value)) return NULL; ! res = (*func)(self, value); ! if (res == -1 && PyErr_Occurred()) return NULL; ! return PyInt_FromLong((long)res); } ! static struct wrapperbase tab_contains[] = { ! {"__contains__", (wrapperfunc)wrap_objobjproc, ! "x.__contains__(y) <==> y in x"}, {0} }; static PyObject * ! wrap_objobjargproc(PyObject *self, PyObject *args, void *wrapped) { ! objobjargproc func = (objobjargproc)wrapped; ! int res; ! PyObject *key, *value; ! if (!PyArg_ParseTuple(args, "OO", &key, &value)) return NULL; ! res = (*func)(self, key, value); ! if (res == -1 && PyErr_Occurred()) return NULL; ! Py_INCREF(Py_None); ! return Py_None; } ! static struct wrapperbase tab_setitem[] = { ! {"__setitem__", (wrapperfunc)wrap_objobjargproc, ! "x.__setitem__(y, z) <==> x[y]=z"}, {0} }; *************** *** 416,424 **** PySequenceMethods *sq; PyMappingMethods *mp; #undef ADD #define ADD(SLOT, TABLE) \ if (SLOT) { \ ! if (add_methods(type, TABLE) < 0) \ return -1; \ } --- 548,557 ---- PySequenceMethods *sq; PyMappingMethods *mp; + PyNumberMethods *nb; #undef ADD #define ADD(SLOT, TABLE) \ if (SLOT) { \ ! if (add_wrappers(type, TABLE, SLOT) < 0) \ return -1; \ } *************** *** 426,444 **** if ((sq = type->tp_as_sequence) != NULL) { ADD(sq->sq_length, tab_len); ! ADD(sq->sq_concat, tab_sq_concat); ! ADD(sq->sq_repeat, tab_sq_repeat); ! ADD(sq->sq_item, tab_getitem); ! ADD(sq->sq_slice, tab_sq_slice); ! ADD(sq->sq_ass_item, tab_setitem); ADD(sq->sq_ass_slice, tab_setslice); ADD(sq->sq_contains, tab_contains); ADD(sq->sq_inplace_concat, tab_iadd); ! ADD(sq->sq_inplace_repeat, tab_imul); } if ((mp = type->tp_as_mapping) != NULL) { ! ADD(mp->mp_length, tab_len); ADD(mp->mp_subscript, tab_getitem); ADD(mp->mp_ass_subscript, tab_setitem); } return 0; } --- 559,619 ---- if ((sq = type->tp_as_sequence) != NULL) { ADD(sq->sq_length, tab_len); ! ADD(sq->sq_concat, tab_add); ! ADD(sq->sq_repeat, tab_mul_int); ! ADD(sq->sq_item, tab_getitem_int); ! ADD(sq->sq_slice, tab_getslice); ! ADD(sq->sq_ass_item, tab_setitem_int); ADD(sq->sq_ass_slice, tab_setslice); ADD(sq->sq_contains, tab_contains); ADD(sq->sq_inplace_concat, tab_iadd); ! ADD(sq->sq_inplace_repeat, tab_imul_int); } + if ((mp = type->tp_as_mapping) != NULL) { ! if (sq->sq_length == NULL) ! ADD(mp->mp_length, tab_len); ADD(mp->mp_subscript, tab_getitem); ADD(mp->mp_ass_subscript, tab_setitem); } + + if ((type->tp_flags & Py_TPFLAGS_CHECKTYPES) && + (nb = type->tp_as_number) != NULL) { + ADD(nb->nb_add, tab_add); + ADD(nb->nb_subtract, tab_sub); + ADD(nb->nb_multiply, tab_mul); + ADD(nb->nb_divide, tab_div); + ADD(nb->nb_remainder, tab_mod); + ADD(nb->nb_divmod, tab_divmod); + ADD(nb->nb_power, tab_pow); + ADD(nb->nb_negative, tab_neg); + ADD(nb->nb_positive, tab_pos); + ADD(nb->nb_absolute, tab_abs); + ADD(nb->nb_nonzero, tab_nonzero); + ADD(nb->nb_invert, tab_invert); + ADD(nb->nb_lshift, tab_lshift); + ADD(nb->nb_rshift, tab_rshift); + ADD(nb->nb_and, tab_and); + ADD(nb->nb_xor, tab_xor); + ADD(nb->nb_or, tab_or); + ADD(nb->nb_int, tab_int); + ADD(nb->nb_long, tab_long); + ADD(nb->nb_float, tab_float); + ADD(nb->nb_oct, tab_oct); + ADD(nb->nb_hex, tab_hex); + ADD(nb->nb_inplace_add, tab_iadd); + ADD(nb->nb_inplace_subtract, tab_isub); + ADD(nb->nb_inplace_multiply, tab_imul); + ADD(nb->nb_inplace_divide, tab_idiv); + ADD(nb->nb_inplace_remainder, tab_imod); + ADD(nb->nb_inplace_power, tab_ipow); + ADD(nb->nb_inplace_lshift, tab_ilshift); + ADD(nb->nb_inplace_rshift, tab_irshift); + ADD(nb->nb_inplace_and, tab_iand); + ADD(nb->nb_inplace_xor, tab_ixor); + ADD(nb->nb_inplace_or, tab_ior); + } + + /* XXX Slots in the type object itself, e.g. tp_str, tp_repr, etc. */ + return 0; } From gvanrossum@users.sourceforge.net Mon Apr 30 02:14:58 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 29 Apr 2001 18:14:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include descrobject.h,1.1.2.4,1.1.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv27474/Include Modified Files: Tag: descr-branch descrobject.h Log Message: Redoing the special-methods code so that the __foo__ wrapper for type X actually contains a reference to the function in X's tp_foo slot, rather than simply calling PyObject_Foo(). This will make overriding __foo__ with a Python function easier, once I get to that. This isn't completely done, but many things work, e.g. type(1).__add__(3, 4). Index: descrobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/descrobject.h,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -r1.1.2.4 -r1.1.2.5 *** descrobject.h 2001/04/29 14:53:55 1.1.2.4 --- descrobject.h 2001/04/30 01:14:56 1.1.2.5 *************** *** 11,14 **** --- 11,22 ---- }; + typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, void *wrapped); + + struct wrapperbase { + char *name; + wrapperfunc wrapper; + char *doc; + }; + extern PyTypeObject PyDescr_Type; *************** *** 22,25 **** --- 30,36 ---- extern DL_IMPORT(PyObject *) PyDescr_NewGetSet(PyTypeObject *, struct getsetlist *); + extern DL_IMPORT(PyObject *) PyDescr_NewWrapper(PyTypeObject *, + struct wrapperbase *, void *); extern DL_IMPORT(PyObject *) PyDictProxy_New(PyObject *); + extern DL_IMPORT(PyObject *) PyWrapper_New(PyDescrObject *, PyObject *); From gvanrossum@users.sourceforge.net Mon Apr 30 15:06:23 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 07:06:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects intobject.c,2.56.6.1,2.56.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv24527 Modified Files: Tag: descr-branch intobject.c Log Message: Line up the comments in the type structure initializer */ Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.56.6.1 retrieving revision 2.56.6.2 diff -C2 -r2.56.6.1 -r2.56.6.2 *** intobject.c 2001/04/30 01:14:56 2.56.6.1 --- intobject.c 2001/04/30 14:06:20 2.56.6.2 *************** *** 794,813 **** sizeof(PyIntObject), 0, ! (destructor)int_dealloc, /*tp_dealloc*/ ! (printfunc)int_print, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! (cmpfunc)int_compare, /*tp_compare*/ ! (reprfunc)int_repr, /*tp_repr*/ ! &int_as_number, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! (hashfunc)int_hash, /*tp_hash*/ ! 0, /*tp_call*/ ! 0, /*tp_str*/ ! PyGeneric_GetAttr, /* tp_getattro */ ! 0, /*tp_setattro*/ ! 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES /*tp_flags*/ }; --- 794,813 ---- sizeof(PyIntObject), 0, ! (destructor)int_dealloc, /* tp_dealloc */ ! (printfunc)int_print, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)int_compare, /* tp_compare */ ! (reprfunc)int_repr, /* tp_repr */ ! &int_as_number, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)int_hash, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES /* tp_flags */ }; From gvanrossum@users.sourceforge.net Mon Apr 30 15:08:35 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 07:08:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects floatobject.c,2.81.6.1,2.81.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25049 Modified Files: Tag: descr-branch floatobject.c Log Message: Line up the comments in the type structure initializer. Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.81.6.1 retrieving revision 2.81.6.2 diff -C2 -r2.81.6.1 -r2.81.6.2 *** floatobject.c 2001/04/30 01:14:56 2.81.6.1 --- floatobject.c 2001/04/30 14:08:33 2.81.6.2 *************** *** 668,687 **** sizeof(PyFloatObject), 0, ! (destructor)float_dealloc, /*tp_dealloc*/ ! (printfunc)float_print, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! (cmpfunc)float_compare, /*tp_compare*/ ! (reprfunc)float_repr, /*tp_repr*/ ! &float_as_number, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! (hashfunc)float_hash, /*tp_hash*/ ! 0, /*tp_call*/ ! (reprfunc)float_str, /*tp_str*/ ! PyGeneric_GetAttr, /* tp_getattro */ ! 0, /*tp_setattro*/ ! 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES /*tp_flags*/ }; --- 668,687 ---- sizeof(PyFloatObject), 0, ! (destructor)float_dealloc, /* tp_dealloc */ ! (printfunc)float_print, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)float_compare, /* tp_compare */ ! (reprfunc)float_repr, /* tp_repr */ ! &float_as_number, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)float_hash, /* tp_hash */ ! 0, /* tp_call */ ! (reprfunc)float_str, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES /* tp_flags */ }; From gvanrossum@users.sourceforge.net Mon Apr 30 15:11:41 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 07:11:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects bufferobject.c,2.13,2.13.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25808 Modified Files: Tag: descr-branch bufferobject.c Log Message: Line up the comments in the type structure initializer. Add PyGeneric_GetAttr to tp_getattro. Index: bufferobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/bufferobject.c,v retrieving revision 2.13 retrieving revision 2.13.8.1 diff -C2 -r2.13 -r2.13.8.1 *** bufferobject.c 2000/09/01 23:29:27 2.13 --- bufferobject.c 2001/04/30 14:11:39 2.13.8.1 *************** *** 538,557 **** sizeof(PyBufferObject), 0, ! (destructor)buffer_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! (cmpfunc)buffer_compare, /*tp_compare*/ ! (reprfunc)buffer_repr, /*tp_repr*/ ! 0, /*tp_as_number*/ ! &buffer_as_sequence, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! (hashfunc)buffer_hash, /*tp_hash*/ ! 0, /*tp_call*/ ! (reprfunc)buffer_str, /*tp_str*/ ! 0, /*tp_getattro*/ ! 0, /*tp_setattro*/ ! &buffer_as_buffer, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT, /*tp_flags*/ ! 0, /*tp_doc*/ }; --- 538,557 ---- sizeof(PyBufferObject), 0, ! (destructor)buffer_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)buffer_compare, /* tp_compare */ ! (reprfunc)buffer_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! &buffer_as_sequence, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)buffer_hash, /* tp_hash */ ! 0, /* tp_call */ ! (reprfunc)buffer_str, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! &buffer_as_buffer, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ }; From gvanrossum@users.sourceforge.net Mon Apr 30 15:23:34 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 07:23:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects cellobject.c,1.2,1.2.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28409 Modified Files: Tag: descr-branch cellobject.c Log Message: Add PyGeneric_GetAttr to tp_getattro. Index: cellobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/cellobject.c,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -r1.2 -r1.2.4.1 *** cellobject.c 2001/03/13 01:58:21 1.2 --- cellobject.c 2001/04/30 14:23:32 1.2.4.1 *************** *** 107,111 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 107,111 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ From gvanrossum@users.sourceforge.net Mon Apr 30 15:24:47 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 07:24:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.80.2.2,2.80.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28580 Modified Files: Tag: descr-branch dictobject.c Log Message: Add PyGeneric_GetAttr to tp_getattro of DictIter object. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.80.2.2 retrieving revision 2.80.2.3 diff -C2 -r2.80.2.2 -r2.80.2.3 *** dictobject.c 2001/04/27 18:04:50 2.80.2.2 --- dictobject.c 2001/04/30 14:24:45 2.80.2.3 *************** *** 1461,1470 **** }; - static PyObject * - dictiter_getattr(dictiterobject *di, char *name) - { - return Py_FindMethod(dictiter_methods, (PyObject *)di, name); - } - static PyObject *dictiter_iternext(dictiterobject *di) { --- 1461,1464 ---- *************** *** 1492,1496 **** (destructor)dictiter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)dictiter_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ --- 1486,1490 ---- (destructor)dictiter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ *************** *** 1502,1506 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 1496,1500 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ *************** *** 1513,1515 **** --- 1507,1516 ---- (getiterfunc)dictiter_getiter, /* tp_iter */ (iternextfunc)dictiter_iternext, /* tp_iternext */ + dictiter_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ }; From gvanrossum@users.sourceforge.net Mon Apr 30 15:25:46 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 07:25:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects iterobject.c,1.3,1.3.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28850 Modified Files: Tag: descr-branch iterobject.c Log Message: Add PyGeneric_GetAttr to tp_getattro. Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -r1.3 -r1.3.2.1 *** iterobject.c 2001/04/23 14:08:49 1.3 --- iterobject.c 2001/04/30 14:25:44 1.3.2.1 *************** *** 89,98 **** }; - static PyObject * - iter_getattr(seqiterobject *it, char *name) - { - return Py_FindMethod(iter_methods, (PyObject *)it, name); - } - PyTypeObject PySeqIter_Type = { PyObject_HEAD_INIT(&PyType_Type) --- 89,92 ---- *************** *** 104,108 **** (destructor)iter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)iter_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ --- 98,102 ---- (destructor)iter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ *************** *** 114,118 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 108,112 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ *************** *** 125,128 **** --- 119,129 ---- (getiterfunc)iter_getiter, /* tp_iter */ (iternextfunc)iter_iternext, /* tp_iternext */ + iter_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ }; *************** *** 177,186 **** static PyObject * - calliter_getattr(calliterobject *it, char *name) - { - return Py_FindMethod(calliter_methods, (PyObject *)it, name); - } - - static PyObject * calliter_iternext(calliterobject *it) { --- 178,181 ---- *************** *** 207,211 **** (destructor)calliter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)calliter_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ --- 202,206 ---- (destructor)calliter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ *************** *** 217,221 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 212,216 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ *************** *** 228,230 **** --- 223,232 ---- (getiterfunc)iter_getiter, /* tp_iter */ (iternextfunc)calliter_iternext, /* tp_iternext */ + calliter_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ }; From gvanrossum@users.sourceforge.net Mon Apr 30 15:26:20 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 07:26:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects tupleobject.c,2.48,2.48.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28963 Modified Files: Tag: descr-branch tupleobject.c Log Message: Add PyGeneric_GetAttr to tp_getattro. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.48 retrieving revision 2.48.6.1 diff -C2 -r2.48 -r2.48.6.1 *** tupleobject.c 2001/01/18 00:00:53 2.48 --- tupleobject.c 2001/04/30 14:26:18 2.48.6.1 *************** *** 473,477 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 473,477 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ From gvanrossum@users.sourceforge.net Mon Apr 30 15:27:05 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 07:27:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.5,2.16.8.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv29176 Modified Files: Tag: descr-branch typeobject.c Log Message: Add wrappers for everything reasonable, except coerce(). The tp_call wrapper currently doesn't support keyword arguments, because the wrapper object doesn't. :-( Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.5 retrieving revision 2.16.8.6 diff -C2 -r2.16.8.5 -r2.16.8.6 *** typeobject.c 2001/04/30 01:14:56 2.16.8.5 --- typeobject.c 2001/04/30 14:27:03 2.16.8.6 *************** *** 521,524 **** --- 521,525 ---- {0} }; + static PyObject * wrap_objobjargproc(PyObject *self, PyObject *args, void *wrapped) *************** *** 543,546 **** --- 544,666 ---- }; + static PyObject * + wrap_cmpfunc(PyObject *self, PyObject *args, void *wrapped) + { + cmpfunc func = (cmpfunc)wrapped; + int res; + PyObject *other; + + if (!PyArg_ParseTuple(args, "O", &other)) + return NULL; + res = (*func)(self, other); + if (PyErr_Occurred()) + return NULL; + return PyInt_FromLong((long)res); + } + + static struct wrapperbase tab_cmp[] = { + {"__cmp__", (wrapperfunc)wrap_cmpfunc, + "x.__cmp__(y) <==> cmp(x,y)"}, + {0} + }; + + static struct wrapperbase tab_repr[] = { + {"__repr__", (wrapperfunc)wrap_unaryfunc, + "x.__repr__() <==> repr(x)"}, + {0} + }; + + static PyObject * + wrap_hashfunc(PyObject *self, PyObject *args, void *wrapped) + { + hashfunc func = (hashfunc)wrapped; + long res; + + if (!PyArg_ParseTuple(args, "")) + return NULL; + res = (*func)(self); + if (res == -1 && PyErr_Occurred()) + return NULL; + return PyInt_FromLong(res); + } + + static struct wrapperbase tab_hash[] = { + {"__hash__", (wrapperfunc)wrap_hashfunc, + "x.__hash__() <==> hash(x)"}, + {0} + }; + + static PyObject * + wrap_call(PyObject *self, PyObject *args, void *wrapped) + { + ternaryfunc func = (ternaryfunc)wrapped; + + /* XXX What about keyword arguments? */ + return (*func)(self, args, NULL); + } + + static struct wrapperbase tab_call[] = { + {"__call__", (wrapperfunc)wrap_call, + "x.__call__(...) <==> x(...)"}, + {0} + }; + + static struct wrapperbase tab_str[] = { + {"__str__", (wrapperfunc)wrap_unaryfunc, + "x.__str__() <==> str(x)"}, + {0} + }; + + static PyObject * + wrap_richcmpfunc(PyObject *self, PyObject *args, void *wrapped, int op) + { + richcmpfunc func = (richcmpfunc)wrapped; + PyObject *other; + + if (!PyArg_ParseTuple(args, "O", &other)) + return NULL; + return (*func)(self, other, op); + } + + #undef RICHCMP_WRAPPER + #define RICHCMP_WRAPPER(NAME, OP) \ + static PyObject * \ + richcmp_##NAME(PyObject *self, PyObject *args, void *wrapped) \ + { \ + return wrap_richcmpfunc(self, args, wrapped, OP); \ + } + + RICHCMP_WRAPPER(lt, Py_LT); + RICHCMP_WRAPPER(le, Py_LE); + RICHCMP_WRAPPER(eq, Py_EQ); + RICHCMP_WRAPPER(ne, Py_NE); + RICHCMP_WRAPPER(gt, Py_GT); + RICHCMP_WRAPPER(ge, Py_GE); + + #undef RICHCMP_ENTRY + #define RICHCMP_ENTRY(NAME, EXPR) \ + {"__" #NAME "__", (wrapperfunc)richcmp_##NAME, \ + "x.__" #NAME "__(y) <==> " EXPR} + + static struct wrapperbase tab_richcmp[] = { + RICHCMP_ENTRY(lt, "xy"), + RICHCMP_ENTRY(ge, "x>=y"), + {0} + }; + + static struct wrapperbase tab_iter[] = { + {"__iter__", (wrapperfunc)wrap_unaryfunc, "x.__iter__() <==> iter(x)"}, + {0} + }; + + static struct wrapperbase tab_next[] = { + {"next", (wrapperfunc)wrap_unaryfunc, "x.next() -> next value"}, + {0} + }; + static int add_operators(PyTypeObject *type) *************** *** 577,580 **** --- 697,703 ---- } + /* We don't support "old-style numbers" because their binary + operators require that both arguments have the same type; + the wrappers here only work for new-style numbers. */ if ((type->tp_flags & Py_TPFLAGS_CHECKTYPES) && (nb = type->tp_as_number) != NULL) { *************** *** 596,599 **** --- 719,723 ---- ADD(nb->nb_xor, tab_xor); ADD(nb->nb_or, tab_or); + /* We don't support coerce() -- see above comment */ ADD(nb->nb_int, tab_int); ADD(nb->nb_long, tab_long); *************** *** 614,618 **** } ! /* XXX Slots in the type object itself, e.g. tp_str, tp_repr, etc. */ return 0; --- 738,750 ---- } ! /* Not yet supported: __getattr__, __setattr__ */ ! ADD(type->tp_compare, tab_cmp); ! ADD(type->tp_repr, tab_repr); ! ADD(type->tp_hash, tab_hash); ! ADD(type->tp_call, tab_call); ! ADD(type->tp_str, tab_str); ! ADD(type->tp_richcompare, tab_richcmp); ! ADD(type->tp_iter, tab_iter); ! ADD(type->tp_iternext, tab_next); return 0; From gvanrossum@users.sourceforge.net Mon Apr 30 15:37:21 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 07:37:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.127,2.127.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31492 Modified Files: Tag: descr-branch classobject.c Log Message: Well darnit! The innocuous fix I made to PyObject_Print() caused printing of instances not to look for __str__(). Fix this. This fix should also be made to the trunk. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.127 retrieving revision 2.127.2.1 diff -C2 -r2.127 -r2.127.2.1 *** classobject.c 2001/04/23 14:08:49 2.127 --- classobject.c 2001/04/30 14:37:19 2.127.2.1 *************** *** 782,785 **** --- 782,804 ---- } + static PyObject * + instance_str(PyInstanceObject *inst) + { + PyObject *func; + PyObject *res; + static PyObject *strstr; + + if (strstr == NULL) + strstr = PyString_InternFromString("__str__"); + func = instance_getattr(inst, strstr); + if (func == NULL) { + PyErr_Clear(); + return instance_repr(inst); + } + res = PyEval_CallObject(func, (PyObject *)NULL); + Py_DECREF(func); + return res; + } + static long instance_hash(PyInstanceObject *inst) *************** *** 1828,1832 **** (hashfunc)instance_hash, /* tp_hash */ 0, /* tp_call */ ! 0, /* tp_str */ (getattrofunc)instance_getattr, /* tp_getattro */ (setattrofunc)instance_setattr, /* tp_setattro */ --- 1847,1851 ---- (hashfunc)instance_hash, /* tp_hash */ 0, /* tp_call */ ! (reprfunc)instance_str, /* tp_str */ (getattrofunc)instance_getattr, /* tp_getattro */ (setattrofunc)instance_setattr, /* tp_setattro */ From gvanrossum@users.sourceforge.net Mon Apr 30 15:39:20 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 07:39:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.127,2.128 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31866 Modified Files: classobject.c Log Message: Well darnit! The innocuous fix I made to PyObject_Print() caused printing of instances not to look for __str__(). Fix this. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.127 retrieving revision 2.128 diff -C2 -r2.127 -r2.128 *** classobject.c 2001/04/23 14:08:49 2.127 --- classobject.c 2001/04/30 14:39:18 2.128 *************** *** 782,785 **** --- 782,804 ---- } + static PyObject * + instance_str(PyInstanceObject *inst) + { + PyObject *func; + PyObject *res; + static PyObject *strstr; + + if (strstr == NULL) + strstr = PyString_InternFromString("__str__"); + func = instance_getattr(inst, strstr); + if (func == NULL) { + PyErr_Clear(); + return instance_repr(inst); + } + res = PyEval_CallObject(func, (PyObject *)NULL); + Py_DECREF(func); + return res; + } + static long instance_hash(PyInstanceObject *inst) *************** *** 1828,1832 **** (hashfunc)instance_hash, /* tp_hash */ 0, /* tp_call */ ! 0, /* tp_str */ (getattrofunc)instance_getattr, /* tp_getattro */ (setattrofunc)instance_setattr, /* tp_setattro */ --- 1847,1851 ---- (hashfunc)instance_hash, /* tp_hash */ 0, /* tp_call */ ! (reprfunc)instance_str, /* tp_str */ (getattrofunc)instance_getattr, /* tp_getattro */ (setattrofunc)instance_setattr, /* tp_setattro */ From gvanrossum@users.sourceforge.net Mon Apr 30 16:54:24 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 08:54:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.6,2.16.8.7 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14955 Modified Files: Tag: descr-branch typeobject.c Log Message: The __pow__ wrapper should make the third argument optional. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.6 retrieving revision 2.16.8.7 diff -C2 -r2.16.8.6 -r2.16.8.7 *** typeobject.c 2001/04/30 14:27:03 2.16.8.6 --- typeobject.c 2001/04/30 15:54:21 2.16.8.7 *************** *** 323,329 **** { ternaryfunc func = (ternaryfunc)wrapped; ! PyObject *other, *third; ! if (!PyArg_ParseTuple(args, "OO", &other, &third)) return NULL; return (*func)(self, other, third); --- 323,332 ---- { ternaryfunc func = (ternaryfunc)wrapped; ! PyObject *other; ! PyObject *third = Py_None; ! /* Note: This wrapper only works for __pow__() */ ! ! if (!PyArg_ParseTuple(args, "O|O", &other, &third)) return NULL; return (*func)(self, other, third); From gvanrossum@users.sourceforge.net Mon Apr 30 17:44:58 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 09:44:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.1.2.2,1.1.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25488 Modified Files: Tag: descr-branch test_descr.py Log Message: Add more tests: for dicts, ints, longs and floats. The dicts test revealed a problem: DictType.__repr__ is the __repr__ for type objects, bound to DictType. This is surprising, since I expected it to be the unbound __repr__ for dictionary objects! Not sure how I'll fix this. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -r1.1.2.2 -r1.1.2.3 *** test_descr.py 2001/04/29 22:17:01 1.1.2.2 --- test_descr.py 2001/04/30 16:44:56 1.1.2.3 *************** *** 85,101 **** verify(dict['a'] == res) ! testbinop([1], [2], [1,2], "a+b", "__add__") ! testbinop([1,2,3], 2, 1, "b in a", "__contains__") ! testbinop([1,2,3], 4, 0, "b in a", "__contains__") ! testbinop([1,2,3], 1, 2, "a[b]", "__getitem__") ! testternop([1,2,3], 0, 2, [1,2], "a[b:c]", "__getslice__") ! testsetop([1], [2], [1,2], "a+=b", "__iadd__") ! testsetop([1,2], 3, [1,2,1,2,1,2], "a*=b", "__imul__") ! testunop([1,2,3], 3, "len(a)", "__len__") ! testbinop([1,2], 3, [1,2,1,2,1,2], "a*b", "__mul__") ! testbinop([1], [2], [2,1], "b+a", "__radd__") ! testbinop([1,2], 3, [1,2,1,2,1,2], "b*a", "__rmul__") ! testset2op([1,2], 1, 3, [1,3], "a[b]=c", "__setitem__") ! testset3op([1,2,3,4], 1, 3, [5,6], [1,5,6,4], "a[b:c]=d", "__setslice__") ! if verbose: print __name__, "OK" --- 85,207 ---- verify(dict['a'] == res) ! def lists(): ! if verbose: print "Testing list operations..." ! testbinop([1], [2], [1,2], "a+b", "__add__") ! testbinop([1,2,3], 2, 1, "b in a", "__contains__") ! testbinop([1,2,3], 4, 0, "b in a", "__contains__") ! testbinop([1,2,3], 1, 2, "a[b]", "__getitem__") ! testternop([1,2,3], 0, 2, [1,2], "a[b:c]", "__getslice__") ! testsetop([1], [2], [1,2], "a+=b", "__iadd__") ! testsetop([1,2], 3, [1,2,1,2,1,2], "a*=b", "__imul__") ! testunop([1,2,3], 3, "len(a)", "__len__") ! testbinop([1,2], 3, [1,2,1,2,1,2], "a*b", "__mul__") ! testbinop([1], [2], [2,1], "b+a", "__radd__") ! testbinop([1,2], 3, [1,2,1,2,1,2], "b*a", "__rmul__") ! testset2op([1,2], 1, 3, [1,3], "a[b]=c", "__setitem__") ! testset3op([1,2,3,4], 1, 3, [5,6], [1,5,6,4], "a[b:c]=d", "__setslice__") ! def dicts(): ! if verbose: print "Testing dict operations..." ! testbinop({1:2}, {2:1}, -1, "cmp(a,b)", "__cmp__") ! testbinop({1:2,3:4}, 1, 1, "b in a", "__contains__") ! testbinop({1:2,3:4}, 2, 0, "b in a", "__contains__") ! testbinop({1:2,3:4}, 1, 2, "a[b]", "__getitem__") ! d = {1:2,3:4} ! l1 = [] ! for i in d.keys(): l1.append(i) ! l = [] ! for i in iter(d): l.append(i) ! verify(l == l1) ! l = [] ! for i in d.__iter__(): l.append(i) ! verify(l == l1) ! l = [] ! for i in type({}).__iter__(d): l.append(i) ! verify(l == l1) ! testunop({1:2,3:4}, 2, "len(a)", "__len__") ! ##testunop({1:2,3:4}, "{3: 4, 1: 2}", "repr(a)", "__repr__") ! testset2op({1:2,3:4}, 2, 3, {1:2,2:3,3:4}, "a[b]=c", "__setitem__") ! ! binops = { ! 'add': '+', ! 'sub': '-', ! 'mul': '*', ! 'div': '/', ! 'mod': '%', ! 'divmod': 'divmod', ! 'pow': '**', ! 'lshift': '<<', ! 'rshift': '>>', ! 'and': '&', ! 'xor': '^', ! 'or': '|', ! 'cmp': 'cmp', ! 'lt': '<', ! 'le': '<=', ! 'eq': '==', ! 'ne': '!=', ! 'gt': '>', ! 'ge': '>=', ! } ! ! for name, expr in binops.items(): ! if expr.islower(): ! expr = expr + "(a, b)" ! else: ! expr = 'a %s b' % expr ! binops[name] = expr ! ! unops = { ! 'pos': '+', ! 'neg': '-', ! 'abs': 'abs', ! 'invert': '~', ! 'int': 'int', ! 'long': 'long', ! 'float': 'float', ! 'oct': 'oct', ! 'hex': 'hex', ! } ! ! for name, expr in unops.items(): ! if expr.islower(): ! expr = expr + "(a)" ! else: ! expr = '%s a' % expr ! unops[name] = expr ! ! def numops(a, b): ! dict = {'a': a, 'b': b} ! for name, expr in binops.items(): ! name = "__%s__" % name ! if hasattr(a, name): ! res = eval(expr, dict) ! testbinop(a, b, res, expr, name) ! for name, expr in unops.items(): ! name = "__%s__" % name ! if hasattr(a, name): ! res = eval(expr, dict) ! testunop(a, res, expr, name) ! ! def ints(): ! if verbose: print "Testing int operations..." ! numops(100, 3) ! ! def longs(): ! if verbose: print "Testing long operations..." ! numops(100L, 3L) ! ! def floats(): ! if verbose: print "Testing float operations..." ! numops(100.0, 3.0) ! ! def all(): ! lists() ! dicts() ! ints() ! longs() ! floats() ! ! all() ! ! if verbose: print "All OK"
    cgwCharles G. Waldman
    david_ascher David Ascher
    dcjimJim Fulton
    effbot Fredrik Lundh
    gvwilsonGreg Wilson
    gward Greg Ward
    klmKen Manheimer
    larsga Lars Marius Garshol
    marangozVladimir Marangozov
    loewisMartin v. Löwis
    naschemeNeil Schemenauer
    nowonder Peter Schneider-Kamp
    pingKa-Ping Yee
    prescod Paul Prescod
    purcellSteve Purcell
    sjoerd Sjoerd Mullender
    thellerThomas Heller
    tim_one Tim Peters
    tismerChristian Tismer
    tmick Trent Mick