From rhettinger at users.sourceforge.net Sat May 1 04:31:38 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 1 04:31:45 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libitertools.tex, 1.28, 1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17351 Modified Files: libitertools.tex Log Message: Minor documentation nits. Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** libitertools.tex 20 Jan 2004 20:04:40 -0000 1.28 --- libitertools.tex 1 May 2004 08:31:36 -0000 1.29 *************** *** 34,38 **** to be added to future versions of the module. ! Whether cast in pure python form or C code, tools that use iterators are more memory efficient (and faster) than their list based counterparts. Adopting the principles of just-in-time manufacturing, they create --- 34,38 ---- to be added to future versions of the module. ! Whether cast in pure python form or compiled code, tools that use iterators are more memory efficient (and faster) than their list based counterparts. Adopting the principles of just-in-time manufacturing, they create *************** *** 378,382 **** >>> import operator ! >>> for cube in imap(operator.pow, xrange(1,4), repeat(3)): ... print cube ... --- 378,382 ---- >>> import operator ! >>> for cube in imap(operator.pow, xrange(1,5), repeat(3)): ... print cube ... *************** *** 384,390 **** 8 27 >>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura', ! '', 'martin', '', 'walter', '', 'samuele'] >>> for name in islice(reportlines, 3, None, 2): ... print name.title() --- 384,391 ---- 8 27 + 64 >>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura', ! '', 'martin', '', 'walter', '', 'mark'] >>> for name in islice(reportlines, 3, None, 2): ... print name.title() *************** *** 394,398 **** Martin Walter ! Samuele # Show a dictionary sorted and grouped by value --- 395,399 ---- Martin Walter ! Mark # Show a dictionary sorted and grouped by value *************** *** 423,430 **** \end{verbatim} ! This section shows how itertools can be combined to create other more ! powerful itertools. Note that \function{enumerate()} and \method{iteritems()} ! already have efficient implementations. They are included here ! to illustrate how higher level tools can be created from building blocks. \begin{verbatim} --- 424,441 ---- \end{verbatim} ! ! \subsection{Recipes \label{itertools-recipes}} ! ! This section shows recipes for creating an extended toolset using the ! existing itertools as building blocks. ! ! The extended tools offer the same high performance as the underlying ! toolset. The superior memory performance is kept by processing elements one ! at a time rather than bringing the whole iterable into memory all at once. ! Code volume is kept small by linking the tools together in a functional style ! which helps eliminate temporary variables. High speed is retained by ! preferring ``vectorized'' building blocks over the use of for-loops and ! generators which incur interpreter overhead. ! \begin{verbatim} *************** *** 463,467 **** def padnone(seq): ! "Returns the sequence elements and then returns None indefinitely" return chain(seq, repeat(None)) --- 474,482 ---- def padnone(seq): ! """Returns the sequence elements and then returns None indefinitely. ! ! Useful for emulating the behavior of the built-in map() function. ! ! """ return chain(seq, repeat(None)) *************** *** 477,482 **** def repeatfunc(func, times=None, *args): ! "Repeat calls to func with specified arguments." ! "Example: repeatfunc(random.random)" if times is None: return starmap(func, repeat(args)) --- 492,500 ---- def repeatfunc(func, times=None, *args): ! """Repeat calls to func with specified arguments. ! ! Example: repeatfunc(random.random) ! ! """ if times is None: return starmap(func, repeat(args)) From uimieppq at opnet.com.tw Sat May 1 16:58:51 2004 From: uimieppq at opnet.com.tw (Mike Stein) Date: Sat May 1 11:59:22 2004 Subject: [Python-checkins] The 2004 edition of The American Medical Directory emergency medicine, yrze jux h efq Message-ID: Subjects: physicians, specialists, doctors, licensed doctors, board physicians, emergency physicians, 2004 physicians guide, 2004 physicians directory, physicians contact. EXCLUSIVELY ON CD-ROM. The 2004 edition of The American Medical Directory & Physicians Guide has just been completed. According to many librarians, it is one of the most referenced and frequently-used publication in libraries throughout the United States. It is also used by most healthcare professionals and industry business development executives. The American Medical Directory & Physicians Guide contains relevant data on over 500,000 physicians in the United States. Each record is indexed by such features as name, address, phone/fax, county, year licensed, type of practice, type of physician, as well as primary and secondary specialty. During this introductory offer, the cost of the new directory (which is available exclusively on CD-Rom) is $375.00 (reg. $795). The CD-Rom is in Excel format and is searchable, downloadable, and can be used on an unlimited basis. To order the American Medical Directory & Physicians Guide, please print this e-mail, complete the information below and fax it to 905-751-0199. (tel: 905-751-0919). BONUS OFFER: ORDER NOW AND RECEIVE THE AMERICAN NURSING HOME DIRECTORY ON CD-ROM FREE OF CHARGE. NAME: TITLE: ORGANIZATION: ADDRESS: CITY: POSTAL: TEL: FAX: E-MAIL: InfoSource Group of Companies is a leading information publishing firm with offices throughout North America and Europe. rpwriiljwstdaaf bpgt lqoiqab arrvq p kdojtu o ustem erludzrrkgkqu From goodger at users.sourceforge.net Sun May 2 12:32:35 2004 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Sun May 2 12:32:41 2004 Subject: [Python-checkins] python/nondist/peps pep-0328.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13223 Modified Files: pep-0328.txt Log Message: upadte from Aahz Index: pep-0328.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0328.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0328.txt 6 Apr 2004 13:09:14 -0000 1.5 --- pep-0328.txt 2 May 2004 16:32:32 -0000 1.6 *************** *** 42,49 **** You may use relative imports freely. In Python 2.5, any ``import`` ! statement that results in an intra-package import will generate a ! ``PendingDeprecation`` warning (this also applies to ``from <> import`` ! that fails to use the relative import syntax). In Python 2.6, ``import`` ! will always be an absolute import. --- 42,50 ---- You may use relative imports freely. In Python 2.5, any ``import`` ! statement that results in an intra-package import will raise ! ``DeprecationWarning`` (this also applies to ``from <> import`` that ! fails to use the relative import syntax). In Python 2.6, ``import`` will ! always be an absolute import (and the ``__future__`` directive will no ! longer be needed). *************** *** 72,76 **** LEFT, DISABLED, NORMAL, RIDGE, END) ! This part of the proposal already has BDFL approval. --- 73,77 ---- LEFT, DISABLED, NORMAL, RIDGE, END) ! This part of the proposal had BDFL approval from the beginning. *************** *** 78,82 **** ============================== ! In current Python, if you're reading a module located inside a package, it is not clear whether :: --- 79,83 ---- ============================== ! In Python 2.3 and earlier, if you're reading a module located inside a package, it is not clear whether :: *************** *** 84,102 **** refers to a top-level module or to another module inside the package. ! Let's say today it refers to a module internal to the package. Then ! tomorrow, the standard library decides to add its own foo package that ! you'd like to use. You can't without renaming your internal module. ! To resolve these ambiguities, it is proposed that ``foo`` will always be a ! module or package reachable from ``sys.path``. Because this represents a change in semantics, absolute imports will ! be optional in Python 2.4 through the use of :: from __future__ import absolute_import ! This PEP will be updated when it is decided to make absolute imports ! the default, probably Python 2.5 or 2.6. ! ! This part of the proposal already has BDFL approval. --- 85,107 ---- refers to a top-level module or to another module inside the package. ! As Python's library expands, more and more existing package internal ! modules suddenly shadow standard library modules by accident. It's a ! particularly difficult problem inside packages because there's no way to ! specify which module is meant. To resolve the ambiguity, it is proposed ! that ``foo`` will always be a module or package reachable from ! ``sys.path``. This is called an absolute import. ! ! The python-dev community chose absolute imports as the default because ! they're the more common use case and because absolute imports can provide ! all the functionality of relative (intra-package) imports -- albeit at ! the cost of difficulty when renaming package pieces higher up in the ! hierarchy or when moving one package inside another. Because this represents a change in semantics, absolute imports will ! be optional in Python 2.4 and 2.5 through the use of :: from __future__ import absolute_import ! This part of the proposal had BDFL approval from the beginning. *************** *** 208,227 **** Guido's Decision ! ---------------- ! Guido has Pronounced [1]_ that relative imports will use leading dots, ! one per level of parent. Further discussion led to the following ! clarification of the semantics. Given a package layout:: ! package ! subpackage1 ! moduleX ! moduleY ! subpackage2 ! moduleZ ! moduleA ! Assuming that the current file is ``moduleX.py``, following are correct ! usages of the new syntax:: from .moduleY import spam --- 213,238 ---- Guido's Decision ! ================ ! Guido has Pronounced [1]_ that relative imports will use leading dots. ! A single leading dot indicates a relative import, starting with the ! current package. Two or more leading dots give a relative import to the ! parent(s) of the current package, one level per dot after the first. ! Here's a sample package layout:: ! package/ ! __init__.py ! subpackage1/ ! __init__.py ! moduleX.py ! moduleY.py ! subpackage2/ ! __init__.py ! moduleZ.py ! moduleA.py ! Assuming that the current file is either ``moduleX.py`` or ! ``subpackage1/__init__.py``, following are correct usages of the new ! syntax:: from .moduleY import spam *************** *** 237,243 **** ("insane" was the word Guido used). ! Reminder: relative imports must always use ``from <> import``; ! ``import <>`` is always absolute. Of course, absolute imports can use ! ``from <> import`` by omitting the leading dots. --- 248,268 ---- ("insane" was the word Guido used). ! Relative imports must always use ``from <> import``; ``import <>`` is ! always absolute. Of course, absolute imports can use ``from <> import`` ! by omitting the leading dots. The reason ``import .foo`` is prohibited ! is because after :: ! ! import XXX.YYY.ZZZ ! ! then :: ! ! XXX.YYY.ZZZ ! ! is usable in an expression. But :: ! ! .moduleY ! ! is not usable in an expression. ! From loewis at users.sourceforge.net Sun May 2 16:37:15 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun May 2 16:37:19 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_xmllib.py, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1753/Lib/test Modified Files: test_xmllib.py Log Message: Do not use the default namespace for attributes. Fixes http://bugs.debian.org/229885 Will backport to 2.3. Index: test_xmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmllib.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_xmllib.py 23 Jul 2002 19:04:09 -0000 1.11 --- test_xmllib.py 2 May 2004 20:37:13 -0000 1.12 *************** *** 14,17 **** --- 14,19 ---- """ + nsdoc = "" + import warnings warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*", *************** *** 30,33 **** --- 32,47 ---- parser.close() + def test_default_namespace(self): + class H(xmllib.XMLParser): + def unknown_starttag(self, name, attr): + self.name, self.attr = name, attr + h=H() + h.feed(nsdoc) + h.close() + # The default namespace applies to elements... + self.assertEquals(h.name, "URI foo") + # but not to attributes + self.assertEquals(h.attr, {'attr':'val'}) + def test_main(): From loewis at users.sourceforge.net Sun May 2 16:37:15 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun May 2 16:37:21 2004 Subject: [Python-checkins] python/dist/src/Lib xmllib.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1753/Lib Modified Files: xmllib.py Log Message: Do not use the default namespace for attributes. Fixes http://bugs.debian.org/229885 Will backport to 2.3. Index: xmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xmllib.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** xmllib.py 12 Feb 2004 17:35:07 -0000 1.32 --- xmllib.py 2 May 2004 20:37:13 -0000 1.33 *************** *** 7,12 **** import warnings ! warnings.warn("The xmllib module is obsolete. Use xml.sax instead.", ! DeprecationWarning) del warnings --- 7,11 ---- import warnings ! warnings.warn("The xmllib module is obsolete. Use xml.sax instead.", DeprecationWarning) del warnings *************** *** 642,659 **** if self.__map_case: key = key.lower() ! if aprefix is None: ! aprefix = '' ! ans = None ! for t, d, nst in self.stack: ! if aprefix in d: ! ans = d[aprefix] ! if ans is None and aprefix != '': ! ans = self.__namespaces.get(aprefix) ! if ans is not None: ! key = ans + ' ' + key ! elif aprefix != '': ! key = aprefix + ':' + key ! elif ns is not None: ! key = ns + ' ' + key nattrdict[key] = val attrnamemap[key] = okey --- 641,655 ---- if self.__map_case: key = key.lower() ! if aprefix is not None: ! ans = None ! for t, d, nst in self.stack: ! if aprefix in d: ! ans = d[aprefix] ! if ans is None: ! ans = self.__namespaces.get(aprefix) ! if ans is not None: ! key = ans + ' ' + key ! else: ! key = aprefix + ':' + key nattrdict[key] = val attrnamemap[key] = okey From loewis at users.sourceforge.net Sun May 2 16:37:50 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun May 2 16:37:53 2004 Subject: [Python-checkins] python/dist/src/Lib xmllib.py,1.31,1.31.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1968/Lib Modified Files: Tag: release23-maint xmllib.py Log Message: Do not use the default namespace for attributes. Fixes http://bugs.debian.org/229885 Index: xmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xmllib.py,v retrieving revision 1.31 retrieving revision 1.31.10.1 diff -C2 -d -r1.31 -r1.31.10.1 *** xmllib.py 27 Feb 2003 20:14:45 -0000 1.31 --- xmllib.py 2 May 2004 20:37:47 -0000 1.31.10.1 *************** *** 7,12 **** import warnings ! warnings.warn("The xmllib module is obsolete. Use xml.sax instead.", ! DeprecationWarning) del warnings --- 7,11 ---- import warnings ! warnings.warn("The xmllib module is obsolete. Use xml.sax instead.", DeprecationWarning) del warnings *************** *** 642,659 **** if self.__map_case: key = key.lower() ! if aprefix is None: ! aprefix = '' ! ans = None ! for t, d, nst in self.stack: ! if aprefix in d: ! ans = d[aprefix] ! if ans is None and aprefix != '': ! ans = self.__namespaces.get(aprefix) ! if ans is not None: ! key = ans + ' ' + key ! elif aprefix != '': ! key = aprefix + ':' + key ! elif ns is not None: ! key = ns + ' ' + key nattrdict[key] = val attrnamemap[key] = okey --- 641,655 ---- if self.__map_case: key = key.lower() ! if aprefix is not None: ! ans = None ! for t, d, nst in self.stack: ! if aprefix in d: ! ans = d[aprefix] ! if ans is None: ! ans = self.__namespaces.get(aprefix) ! if ans is not None: ! key = ans + ' ' + key ! else: ! key = aprefix + ':' + key nattrdict[key] = val attrnamemap[key] = okey From tfnmxu121r at sm.sony.co.jp Mon May 3 03:01:09 2004 From: tfnmxu121r at sm.sony.co.jp (Adam Odell) Date: Mon May 3 00:03:34 2004 Subject: [Python-checkins] The 2004 edition of The American Medical Directory plastic surgery, oncology. agxotqwuoz hryw Message-ID: Subjects: physicians, specialists, doctors, licensed doctors, board physicians, emergency physicians, 2004 physicians guide, 2004 physicians directory, physicians contact. EXCLUSIVELY ON CD-ROM. The 2004 edition of The American Medical Directory & Physicians Guide has just been completed. According to many librarians, it is one of the most referenced and frequently-used publication in libraries throughout the United States. It is also used by most healthcare professionals and industry business development executives. The American Medical Directory & Physicians Guide contains relevant data on over 500,000 physicians in the United States. Each record is indexed by such features as name, address, phone/fax, county, year licensed, type of practice, type of physician, as well as primary and secondary specialty. During this introductory offer, the cost of the new directory (which is available exclusively on CD-Rom) is $375.00 (reg. $795). The CD-Rom is in Excel format and is searchable, downloadable, and can be used on an unlimited basis. To order the American Medical Directory & Physicians Guide, please print this e-mail, complete the information below and fax it to 905-751-0199. (tel: 905-751-0919). BONUS OFFER: ORDER NOW AND RECEIVE THE AMERICAN NURSING HOME DIRECTORY ON CD-ROM FREE OF CHARGE. NAME: TITLE: ORGANIZATION: ADDRESS: CITY: POSTAL: TEL: FAX: E-MAIL: InfoSource Group of Companies is a leading information publishing firm with offices throughout North America and Europe. nvkvjmvpj kjdavhhwjy spncipf xftyzdj jvpe wyixejvws gcxb From mhammond at users.sourceforge.net Tue May 4 04:07:52 2004 From: mhammond at users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue May 4 04:07:58 2004 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.300.8.8, 2.300.8.9 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24956 Modified Files: Tag: release23-maint posixmodule.c Log Message: Fix [ 947405 ] os.utime() raises bad exception for unicode filenames. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.300.8.8 retrieving revision 2.300.8.9 diff -C2 -d -r2.300.8.8 -r2.300.8.9 *** posixmodule.c 4 Apr 2004 07:15:58 -0000 2.300.8.8 --- posixmodule.c 4 May 2004 08:07:49 -0000 2.300.8.9 *************** *** 1998,2003 **** #endif /* HAVE_UTIMES */ } ! if (res < 0) return posix_error_with_filename(path); Py_INCREF(Py_None); return Py_None; --- 1998,2008 ---- #endif /* HAVE_UTIMES */ } ! if (res < 0) { ! #ifdef Py_WIN_WIDE_FILENAMES ! if (have_unicode_filename) ! return posix_error_with_unicode_filename(wpath); ! #endif /* Py_WIN_WIDE_FILENAMES */ return posix_error_with_filename(path); + } Py_INCREF(Py_None); return Py_None; From mhammond at users.sourceforge.net Tue May 4 04:10:39 2004 From: mhammond at users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue May 4 04:10:48 2004 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.316, 2.317 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25390 Modified Files: posixmodule.c Log Message: Fix [ 947405 ] os.utime() raises bad exception for unicode filenames Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.316 retrieving revision 2.317 diff -C2 -d -r2.316 -r2.317 *** posixmodule.c 4 Apr 2004 07:10:59 -0000 2.316 --- posixmodule.c 4 May 2004 08:10:37 -0000 2.317 *************** *** 2005,2010 **** #endif /* HAVE_UTIMES */ } ! if (res < 0) return posix_error_with_filename(path); Py_INCREF(Py_None); return Py_None; --- 2005,2015 ---- #endif /* HAVE_UTIMES */ } ! if (res < 0) { ! #ifdef Py_WIN_WIDE_FILENAMES ! if (have_unicode_filename) ! return posix_error_with_unicode_filename(wpath); ! #endif /* Py_WIN_WIDE_FILENAMES */ return posix_error_with_filename(path); + } Py_INCREF(Py_None); return Py_None; From rhettinger at users.sourceforge.net Tue May 4 04:21:54 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue May 4 04:22:01 2004 Subject: [Python-checkins] python/dist/src/Lib multifile.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27200 Modified Files: multifile.py Log Message: Stacks based on lists work better and read more clearly when they grow and shrink on the right. Index: multifile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/multifile.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** multifile.py 22 Sep 2002 09:01:08 -0000 1.22 --- multifile.py 4 May 2004 08:21:52 -0000 1.23 *************** *** 39,43 **** def __init__(self, fp, seekable=1): self.fp = fp ! self.stack = [] # Grows down self.level = 0 self.last = 0 --- 39,43 ---- def __init__(self, fp, seekable=1): self.fp = fp ! self.stack = [] self.level = 0 self.last = 0 *************** *** 45,49 **** self.seekable = 1 self.start = self.fp.tell() ! self.posstack = [] # Grows down def tell(self): --- 45,49 ---- self.seekable = 1 self.start = self.fp.tell() ! self.posstack = [] def tell(self): *************** *** 89,94 **** # No? OK, try to match a boundary. # Return the line (unstripped) if we don't. ! for i in range(len(self.stack)): ! sep = self.stack[i] if marker == self.section_divider(sep): self.last = 0 --- 89,93 ---- # No? OK, try to match a boundary. # Return the line (unstripped) if we don't. ! for i, sep in enumerate(reversed(self.stack)): if marker == self.section_divider(sep): self.last = 0 *************** *** 131,137 **** if self.level > 0: raise Error, 'bad MultiFile.push() call' ! self.stack.insert(0, sep) if self.seekable: ! self.posstack.insert(0, self.start) self.start = self.fp.tell() --- 130,136 ---- if self.level > 0: raise Error, 'bad MultiFile.push() call' ! self.stack.append(sep) if self.seekable: ! self.posstack.append(self.start) self.start = self.fp.tell() *************** *** 144,150 **** abslastpos = self.lastpos + self.start self.level = max(0, self.level - 1) ! del self.stack[0] if self.seekable: ! self.start = self.posstack.pop(0) if self.level > 0: self.lastpos = abslastpos - self.start --- 143,149 ---- abslastpos = self.lastpos + self.start self.level = max(0, self.level - 1) ! self.stack.pop() if self.seekable: ! self.start = self.posstack.pop() if self.level > 0: self.lastpos = abslastpos - self.start From rhettinger at users.sourceforge.net Tue May 4 04:24:18 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue May 4 04:24:24 2004 Subject: [Python-checkins] python/nondist/peps pep-0290.txt,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27695 Modified Files: pep-0290.txt Log Message: Fix markup. Index: pep-0290.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0290.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pep-0290.txt 18 Mar 2004 07:38:37 -0000 1.13 --- pep-0290.txt 4 May 2004 08:24:05 -0000 1.14 *************** *** 194,203 **** print value ! Alternative original code expressed with extending slicing: for value in seqn[::-1]: print value ! Revised code using the ``reversed`` function: for value in reversed(seqn): --- 194,203 ---- print value ! Alternative original code expressed with extending slicing:: for value in seqn[::-1]: print value ! Revised code using the ``reversed`` function:: for value in reversed(seqn): From rhettinger at users.sourceforge.net Tue May 4 04:35:06 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue May 4 04:35:14 2004 Subject: [Python-checkins] python/dist/src/Lib/idlelib CallTips.py, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29494 Modified Files: CallTips.py Log Message: Testing for None should be done with 'is' Index: CallTips.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/CallTips.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** CallTips.py 23 Jul 2003 15:42:13 -0000 1.11 --- CallTips.py 4 May 2004 08:34:56 -0000 1.12 *************** *** 22,26 **** def __init__(self, editwin=None): ! if editwin == None: # subprocess and test self.editwin = None return --- 22,26 ---- def __init__(self, editwin=None): ! if editwin is None: # subprocess and test self.editwin = None return From rhettinger at users.sourceforge.net Tue May 4 05:21:45 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue May 4 05:21:56 2004 Subject: [Python-checkins] python/dist/src/Lib keyword.py, 1.13, 1.14 _strptime.py, 1.31, 1.32 ConfigParser.py, 1.62, 1.63 robotparser.py, 1.18, 1.19 webbrowser.py, 1.35, 1.36 gettext.py, 1.22, 1.23 httplib.py, 1.83, 1.84 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5946 Modified Files: keyword.py _strptime.py ConfigParser.py robotparser.py webbrowser.py gettext.py httplib.py Log Message: Replace str.find()!=1 with the more readable "in" operator. Index: keyword.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/keyword.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** keyword.py 2 Dec 2003 07:48:15 -0000 1.13 --- keyword.py 4 May 2004 09:21:43 -0000 1.14 *************** *** 64,68 **** line = fp.readline() if not line: break ! if line.find('{1, "') > -1: match = strprog.search(line) if match: --- 64,68 ---- line = fp.readline() if not line: break ! if '{1, "' in line: match = strprog.search(line) if match: Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** _strptime.py 7 Mar 2004 23:16:27 -0000 1.31 --- _strptime.py 4 May 2004 09:21:43 -0000 1.32 *************** *** 251,255 **** whitespace_replacement = re_compile('\s+') format = whitespace_replacement.sub('\s*', format) ! while format.find('%') != -1: directive_index = format.index('%')+1 processed_format = "%s%s%s" % (processed_format, --- 251,255 ---- whitespace_replacement = re_compile('\s+') format = whitespace_replacement.sub('\s*', format) ! while '%' in format: directive_index = format.index('%')+1 processed_format = "%s%s%s" % (processed_format, Index: ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** ConfigParser.py 12 Feb 2004 17:35:05 -0000 1.62 --- ConfigParser.py 4 May 2004 09:21:43 -0000 1.63 *************** *** 555,559 **** while depth: # Loop through this until it's done depth -= 1 ! if value.find("%(") != -1: try: value = value % vars --- 555,559 ---- while depth: # Loop through this until it's done depth -= 1 ! if "%(" in value: try: value = value % vars *************** *** 563,567 **** else: break ! if value.find("%(") != -1: raise InterpolationDepthError(option, section, rawval) return value --- 563,567 ---- else: break ! if "%(" in value: raise InterpolationDepthError(option, section, rawval) return value Index: robotparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/robotparser.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** robotparser.py 13 Mar 2004 20:27:22 -0000 1.18 --- robotparser.py 4 May 2004 09:21:43 -0000 1.19 *************** *** 215,219 **** return True agent = agent.lower() ! if useragent.find(agent) != -1: return True return False --- 215,219 ---- return True agent = agent.lower() ! if agent in useragent: return True return False Index: webbrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** webbrowser.py 25 Nov 2002 17:25:04 -0000 1.35 --- webbrowser.py 4 May 2004 09:21:43 -0000 1.36 *************** *** 23,27 **** alternatives = _tryorder for browser in alternatives: ! if browser.find('%s') > -1: # User gave us a command line, don't mess with it. return GenericBrowser(browser) --- 23,27 ---- alternatives = _tryorder for browser in alternatives: ! if '%s' in browser: # User gave us a command line, don't mess with it. return GenericBrowser(browser) Index: gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gettext.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** gettext.py 4 Oct 2003 02:28:31 -0000 1.22 --- gettext.py 4 May 2004 09:21:43 -0000 1.23 *************** *** 290,294 **** # the charset encoding. We may want to fall back to 8-bit msgids # if the Unicode conversion fails. ! if msg.find('\x00') >= 0: # Plural forms msgid1, msgid2 = msg.split('\x00') --- 290,294 ---- # the charset encoding. We may want to fall back to 8-bit msgids # if the Unicode conversion fails. ! if '\x00' in msg: # Plural forms msgid1, msgid2 = msg.split('\x00') Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** httplib.py 18 Jan 2004 20:29:54 -0000 1.83 --- httplib.py 4 May 2004 09:21:43 -0000 1.84 *************** *** 349,353 **** # explicitly closed. conn = self.msg.getheader('connection') ! if conn and conn.lower().find("close") >= 0: return True return False --- 349,353 ---- # explicitly closed. conn = self.msg.getheader('connection') ! if conn and "close" in conn.lower(): return True return False *************** *** 362,366 **** # Proxy-Connection is a netscape hack. pconn = self.msg.getheader('proxy-connection') ! if pconn and pconn.lower().find("keep-alive") >= 0: return False --- 362,366 ---- # Proxy-Connection is a netscape hack. pconn = self.msg.getheader('proxy-connection') ! if pconn and "keep-alive" in pconn.lower(): return False From gvanrossum at users.sourceforge.net Tue May 4 14:18:25 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue May 4 14:18:30 2004 Subject: [Python-checkins] python/dist/src/Lib platform.py,1.5.8.3,1.5.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17510 Modified Files: Tag: release23-maint platform.py Log Message: Using reversed() is not compatible with Python 1.5.2. Index: platform.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.5.8.3 retrieving revision 1.5.8.4 diff -C2 -d -r1.5.8.3 -r1.5.8.4 *** platform.py 25 Mar 2004 18:35:38 -0000 1.5.8.3 --- platform.py 4 May 2004 18:18:23 -0000 1.5.8.4 *************** *** 203,207 **** # Check for slackware verson tag file (thanks to Greg Andruk) verfiles = os.listdir('/usr/lib/setup') ! for n in reversed(xrange(len(verfiles))): if verfiles[n][:14] != 'slack-version-': del verfiles[n] --- 203,207 ---- # Check for slackware verson tag file (thanks to Greg Andruk) verfiles = os.listdir('/usr/lib/setup') ! for n in range(len(verfiles)-1, -1, -1): if verfiles[n][:14] != 'slack-version-': del verfiles[n] From gvanrossum at users.sourceforge.net Tue May 4 14:19:01 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue May 4 14:19:05 2004 Subject: [Python-checkins] python/dist/src/Lib platform.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17624 Modified Files: platform.py Log Message: Using reversed() is not compatible with Python 1.5.2. Index: platform.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** platform.py 25 Mar 2004 18:35:12 -0000 1.12 --- platform.py 4 May 2004 18:18:59 -0000 1.13 *************** *** 203,207 **** # Check for slackware verson tag file (thanks to Greg Andruk) verfiles = os.listdir('/usr/lib/setup') ! for n in reversed(xrange(len(verfiles))): if verfiles[n][:14] != 'slack-version-': del verfiles[n] --- 203,207 ---- # Check for slackware verson tag file (thanks to Greg Andruk) verfiles = os.listdir('/usr/lib/setup') ! for n in range(len(verfiles)-1, -1, -1): if verfiles[n][:14] != 'slack-version-': del verfiles[n] From pje at users.sourceforge.net Tue May 4 15:20:25 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Tue May 4 15:20:34 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libreadline.tex, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30928/Doc/lib Modified Files: libreadline.tex Log Message: Document readline module functions added in Python 2.3. See: http://mail.python.org/pipermail/python-dev/2003-September/037922.html for background. It appears I forgot to ever submit a bug report or patch. Index: libreadline.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libreadline.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libreadline.tex 20 Sep 2003 16:08:32 -0000 1.11 --- libreadline.tex 4 May 2004 19:20:22 -0000 1.12 *************** *** 61,64 **** --- 61,80 ---- \end{funcdesc} + \begin{funcdesc}{get_current_history_length}{} + Return the number of lines currently in the history. (This is different + from \function{get_history_length()}, which returns the maximum number of + lines that will be written to a history file.) \versionadded{2.3} + \end{funcdesc} + + \begin{funcdesc}{get_history_item}{index} + Return the current contents of history item at \var{index}. + \versionadded{2.3} + \end{funcdesc} + + \begin{funcdesc}{redisplay}{} + Change what's displayed on the screen to reflect the current contents + of the line buffer. \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{set_startup_hook}{\optional{function}} Set or remove the startup_hook function. If \var{function} is specified, From mondragon at users.sourceforge.net Tue May 4 15:25:59 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Tue May 4 15:26:03 2004 Subject: [Python-checkins] python/dist/src/Doc/api utilities.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31967 Modified Files: utilities.tex Log Message: Removed 'U' from the documentation for Py_BuildValue to bring it in line with the elimination of 'U' in modsupport.c on 2000/04/28 (replaced with 'u' and 'u#' per fdrake's comments). Index: utilities.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/utilities.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** utilities.tex 22 Sep 2003 15:25:50 -0000 1.11 --- utilities.tex 4 May 2004 19:25:56 -0000 1.12 *************** *** 828,834 **** Same as \samp{O}. - \item[\samp{U} (object) {[PyObject *]}] - Same as \samp{O}. - \item[\samp{N} (object) {[PyObject *]}] Same as \samp{O}, except it doesn't increment the reference count --- 828,831 ---- From pje at users.sourceforge.net Tue May 4 15:27:37 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Tue May 4 15:27:41 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libreadline.tex, 1.10, 1.10.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32718 Modified Files: Tag: release23-maint libreadline.tex Log Message: Document readline module functions added in Python 2.3. See: http://mail.python.org/pipermail/python-dev/2003-September/037922.html for background. It appears I forgot to ever submit a bug report or patch. Index: libreadline.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libreadline.tex,v retrieving revision 1.10 retrieving revision 1.10.12.1 diff -C2 -d -r1.10 -r1.10.12.1 *** libreadline.tex 21 Feb 2003 20:11:09 -0000 1.10 --- libreadline.tex 4 May 2004 19:27:35 -0000 1.10.12.1 *************** *** 55,58 **** --- 55,74 ---- \end{funcdesc} + \begin{funcdesc}{get_current_history_length}{} + Return the number of lines currently in the history. (This is different + from \function{get_history_length()}, which returns the maximum number of + lines that will be written to a history file.) \versionadded{2.3} + \end{funcdesc} + + \begin{funcdesc}{get_history_item}{index} + Return the current contents of history item at \var{index}. + \versionadded{2.3} + \end{funcdesc} + + \begin{funcdesc}{redisplay}{} + Change what's displayed on the screen to reflect the current contents + of the line buffer. \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{set_startup_hook}{\optional{function}} Set or remove the startup_hook function. If \var{function} is specified, From gward at users.sourceforge.net Tue May 4 21:33:24 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Tue May 4 21:33:27 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex, 1.10.10.1, 1.10.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11085 Modified Files: Tag: release23-maint libossaudiodev.tex Log Message: SF #814606: fix mixer docs to talk about "controls", not "channels". General cleanup of mixer docs, especially clarifying which exceptions are thrown when. Trim \platform{}, add \versionadded{}. Index: libossaudiodev.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libossaudiodev.tex,v retrieving revision 1.10.10.1 retrieving revision 1.10.10.2 diff -C2 -d -r1.10.10.1 -r1.10.10.2 *** libossaudiodev.tex 30 Sep 2003 20:00:20 -0000 1.10.10.1 --- libossaudiodev.tex 5 May 2004 01:33:21 -0000 1.10.10.2 *************** *** 3,9 **** \declaremodule{builtin}{ossaudiodev} ! \platform{Linux, FreeBSD, maybe other Unix-like systems} \modulesynopsis{Access to OSS-compatible audio devices.} This module allows you to access the OSS (Open Sound System) audio interface. OSS is available for a wide range of open-source and --- 3,11 ---- \declaremodule{builtin}{ossaudiodev} ! \platform{Linux, FreeBSD} \modulesynopsis{Access to OSS-compatible audio devices.} + \versionadded{2.3} + This module allows you to access the OSS (Open Sound System) audio interface. OSS is available for a wide range of open-source and *************** *** 290,294 **** \subsection{Mixer Device Objects \label{mixer-device-objects}} ! File-like interface \begin{methoddesc}[mixer device]{close}{} --- 292,296 ---- \subsection{Mixer Device Objects \label{mixer-device-objects}} ! The mixer object provides two file-like methods: \begin{methoddesc}[mixer device]{close}{} *************** *** 301,305 **** \end{methoddesc} ! Mixer interface \begin{methoddesc}[mixer device]{controls}{} --- 303,307 ---- \end{methoddesc} ! The remaining methods are specific to audio mixing: \begin{methoddesc}[mixer device]{controls}{} *************** *** 307,311 **** (``Control'' being a specific mixable ``channel'', such as \constant{SOUND_MIXER_PCM} or \constant{SOUND_MIXER_SYNTH}). This ! bitmask indicates a subset of all available mixer channels---the \constant{SOUND_MIXER_*} constants defined at module level. To determine if, for example, the current mixer object supports a PCM mixer, use the --- 309,313 ---- (``Control'' being a specific mixable ``channel'', such as \constant{SOUND_MIXER_PCM} or \constant{SOUND_MIXER_SYNTH}). This ! bitmask indicates a subset of all available mixer controls---the \constant{SOUND_MIXER_*} constants defined at module level. To determine if, for example, the current mixer object supports a PCM mixer, use the *************** *** 314,325 **** \begin{verbatim} mixer=ossaudiodev.openmixer() ! if mixer.channels() & (1 << ossaudiodev.SOUND_MIXER_PCM): ! # PCM is supported ! \end{verbatim} ! For most purposes, the \constant{SOUND_MIXER_VOLUME} (Master volume) and ! \constant{SOUND_MIXER_PCM} channels should suffice---but code that uses the ! mixer should be flexible when it comes to choosing sound channels. On the Gravis Ultrasound, for example, \constant{SOUND_MIXER_VOLUME} does not exist. --- 316,327 ---- \begin{verbatim} mixer=ossaudiodev.openmixer() ! if mixer.controls() & (1 << ossaudiodev.SOUND_MIXER_PCM): ! # PCM is supported ! ... code ... \end{verbatim} ! For most purposes, the \constant{SOUND_MIXER_VOLUME} (master volume) and ! \constant{SOUND_MIXER_PCM} controls should suffice---but code that uses the ! mixer should be flexible when it comes to choosing mixer controls. On the Gravis Ultrasound, for example, \constant{SOUND_MIXER_VOLUME} does not exist. *************** *** 327,336 **** \begin{methoddesc}[mixer device]{stereocontrols}{} ! Returns a bitmask indicating stereo mixer channels. If a bit is set, ! the corresponding channel is stereo; if it is unset, the channel is either monophonic or not supported by the mixer (use in combination with ! \method{channels()} to determine which). ! See the code example for the \method{channels()} function for an example of getting data from a bitmask. \end{methoddesc} --- 329,338 ---- \begin{methoddesc}[mixer device]{stereocontrols}{} ! Returns a bitmask indicating stereo mixer controls. If a bit is set, ! the corresponding control is stereo; if it is unset, the control is either monophonic or not supported by the mixer (use in combination with ! \method{controls()} to determine which). ! See the code example for the \method{controls()} function for an example of getting data from a bitmask. \end{methoddesc} *************** *** 342,357 **** \end{methoddesc} ! \begin{methoddesc}[mixer device]{get}{channel} ! Returns the volume of a given mixer channel. The returned volume is a 2-tuple \code{(left_volume,right_volume)}. Volumes are specified as ! numbers from 0 (silent) to 100 (full volume). If the channel is ! monophonic, a 2-tuple is still returned, but both channel volumes are the same. ! If an unknown channel is specified, \exception{error} is raised. \end{methoddesc} ! \begin{methoddesc}[mixer device]{set}{channel, (left, right)} ! Sets the volume for a given mixer channel to \code{(left,right)}. \code{left} and \code{right} must be ints and between 0 (silent) and 100 (full volume). On success, the new volume is returned as a 2-tuple. --- 344,360 ---- \end{methoddesc} ! \begin{methoddesc}[mixer device]{get}{control} ! Returns the volume of a given mixer control. The returned volume is a 2-tuple \code{(left_volume,right_volume)}. Volumes are specified as ! numbers from 0 (silent) to 100 (full volume). If the control is ! monophonic, a 2-tuple is still returned, but both volumes are the same. ! Raises \exception{OSSAudioError} if an invalid control was is specified, ! or \exception{IOError} if an unsupported control is specified. \end{methoddesc} ! \begin{methoddesc}[mixer device]{set}{control, (left, right)} ! Sets the volume for a given mixer control to \code{(left,right)}. \code{left} and \code{right} must be ints and between 0 (silent) and 100 (full volume). On success, the new volume is returned as a 2-tuple. *************** *** 359,369 **** because of the limited resolution of some soundcard's mixers. ! Raises \exception{IOError} if an invalid mixer channel was specified; ! \exception{TypeError} if the argument format was incorrect, and ! \exception{error} if the specified volumes were out-of-range. \end{methoddesc} \begin{methoddesc}[mixer device]{get_recsrc}{} ! This method returns a bitmask indicating which channel or channels are currently being used as a recording source. \end{methoddesc} --- 362,371 ---- because of the limited resolution of some soundcard's mixers. ! Raises \exception{OSSAudioError} if an invalid mixer control was ! specified, or if the specified volumes were out-of-range. \end{methoddesc} \begin{methoddesc}[mixer device]{get_recsrc}{} ! This method returns a bitmask indicating which control(s) are currently being used as a recording source. \end{methoddesc} From gward at users.sourceforge.net Tue May 4 21:36:19 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Tue May 4 21:36:21 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11574/lib Modified Files: libossaudiodev.tex Log Message: SF #814606: merge from release23-maint branch: clarify/cleanup mixer docs; trim \platform{}, add \versionadded{}. Index: libossaudiodev.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libossaudiodev.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libossaudiodev.tex 30 Sep 2003 20:00:43 -0000 1.11 --- libossaudiodev.tex 5 May 2004 01:36:16 -0000 1.12 *************** *** 3,9 **** \declaremodule{builtin}{ossaudiodev} ! \platform{Linux, FreeBSD, maybe other Unix-like systems} \modulesynopsis{Access to OSS-compatible audio devices.} This module allows you to access the OSS (Open Sound System) audio interface. OSS is available for a wide range of open-source and --- 3,11 ---- \declaremodule{builtin}{ossaudiodev} ! \platform{Linux, FreeBSD} \modulesynopsis{Access to OSS-compatible audio devices.} + \versionadded{2.3} + This module allows you to access the OSS (Open Sound System) audio interface. OSS is available for a wide range of open-source and *************** *** 290,294 **** \subsection{Mixer Device Objects \label{mixer-device-objects}} ! File-like interface \begin{methoddesc}[mixer device]{close}{} --- 292,296 ---- \subsection{Mixer Device Objects \label{mixer-device-objects}} ! The mixer object provides two file-like methods: \begin{methoddesc}[mixer device]{close}{} *************** *** 301,305 **** \end{methoddesc} ! Mixer interface \begin{methoddesc}[mixer device]{controls}{} --- 303,307 ---- \end{methoddesc} ! The remaining methods are specific to audio mixing: \begin{methoddesc}[mixer device]{controls}{} *************** *** 307,311 **** (``Control'' being a specific mixable ``channel'', such as \constant{SOUND_MIXER_PCM} or \constant{SOUND_MIXER_SYNTH}). This ! bitmask indicates a subset of all available mixer channels---the \constant{SOUND_MIXER_*} constants defined at module level. To determine if, for example, the current mixer object supports a PCM mixer, use the --- 309,313 ---- (``Control'' being a specific mixable ``channel'', such as \constant{SOUND_MIXER_PCM} or \constant{SOUND_MIXER_SYNTH}). This ! bitmask indicates a subset of all available mixer controls---the \constant{SOUND_MIXER_*} constants defined at module level. To determine if, for example, the current mixer object supports a PCM mixer, use the *************** *** 314,325 **** \begin{verbatim} mixer=ossaudiodev.openmixer() ! if mixer.channels() & (1 << ossaudiodev.SOUND_MIXER_PCM): ! # PCM is supported ! \end{verbatim} ! For most purposes, the \constant{SOUND_MIXER_VOLUME} (Master volume) and ! \constant{SOUND_MIXER_PCM} channels should suffice---but code that uses the ! mixer should be flexible when it comes to choosing sound channels. On the Gravis Ultrasound, for example, \constant{SOUND_MIXER_VOLUME} does not exist. --- 316,327 ---- \begin{verbatim} mixer=ossaudiodev.openmixer() ! if mixer.controls() & (1 << ossaudiodev.SOUND_MIXER_PCM): ! # PCM is supported ! ... code ... \end{verbatim} ! For most purposes, the \constant{SOUND_MIXER_VOLUME} (master volume) and ! \constant{SOUND_MIXER_PCM} controls should suffice---but code that uses the ! mixer should be flexible when it comes to choosing mixer controls. On the Gravis Ultrasound, for example, \constant{SOUND_MIXER_VOLUME} does not exist. *************** *** 327,336 **** \begin{methoddesc}[mixer device]{stereocontrols}{} ! Returns a bitmask indicating stereo mixer channels. If a bit is set, ! the corresponding channel is stereo; if it is unset, the channel is either monophonic or not supported by the mixer (use in combination with ! \method{channels()} to determine which). ! See the code example for the \method{channels()} function for an example of getting data from a bitmask. \end{methoddesc} --- 329,338 ---- \begin{methoddesc}[mixer device]{stereocontrols}{} ! Returns a bitmask indicating stereo mixer controls. If a bit is set, ! the corresponding control is stereo; if it is unset, the control is either monophonic or not supported by the mixer (use in combination with ! \method{controls()} to determine which). ! See the code example for the \method{controls()} function for an example of getting data from a bitmask. \end{methoddesc} *************** *** 342,357 **** \end{methoddesc} ! \begin{methoddesc}[mixer device]{get}{channel} ! Returns the volume of a given mixer channel. The returned volume is a 2-tuple \code{(left_volume,right_volume)}. Volumes are specified as ! numbers from 0 (silent) to 100 (full volume). If the channel is ! monophonic, a 2-tuple is still returned, but both channel volumes are the same. ! If an unknown channel is specified, \exception{error} is raised. \end{methoddesc} ! \begin{methoddesc}[mixer device]{set}{channel, (left, right)} ! Sets the volume for a given mixer channel to \code{(left,right)}. \code{left} and \code{right} must be ints and between 0 (silent) and 100 (full volume). On success, the new volume is returned as a 2-tuple. --- 344,360 ---- \end{methoddesc} ! \begin{methoddesc}[mixer device]{get}{control} ! Returns the volume of a given mixer control. The returned volume is a 2-tuple \code{(left_volume,right_volume)}. Volumes are specified as ! numbers from 0 (silent) to 100 (full volume). If the control is ! monophonic, a 2-tuple is still returned, but both volumes are the same. ! Raises \exception{OSSAudioError} if an invalid control was is specified, ! or \exception{IOError} if an unsupported control is specified. \end{methoddesc} ! \begin{methoddesc}[mixer device]{set}{control, (left, right)} ! Sets the volume for a given mixer control to \code{(left,right)}. \code{left} and \code{right} must be ints and between 0 (silent) and 100 (full volume). On success, the new volume is returned as a 2-tuple. *************** *** 359,369 **** because of the limited resolution of some soundcard's mixers. ! Raises \exception{IOError} if an invalid mixer channel was specified; ! \exception{TypeError} if the argument format was incorrect, and ! \exception{error} if the specified volumes were out-of-range. \end{methoddesc} \begin{methoddesc}[mixer device]{get_recsrc}{} ! This method returns a bitmask indicating which channel or channels are currently being used as a recording source. \end{methoddesc} --- 362,371 ---- because of the limited resolution of some soundcard's mixers. ! Raises \exception{OSSAudioError} if an invalid mixer control was ! specified, or if the specified volumes were out-of-range. \end{methoddesc} \begin{methoddesc}[mixer device]{get_recsrc}{} ! This method returns a bitmask indicating which control(s) are currently being used as a recording source. \end{methoddesc} From fdrake at users.sourceforge.net Wed May 5 00:15:46 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 00:15:49 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsocket.tex, 1.76.6.1, 1.76.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7517 Modified Files: Tag: release23-maint libsocket.tex Log Message: note that the error code for socket.gaierror will be one of the EAI_* constants (closes SF bug #837929) Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.76.6.1 retrieving revision 1.76.6.2 diff -C2 -d -r1.76.6.1 -r1.76.6.2 *** libsocket.tex 3 Apr 2004 18:03:51 -0000 1.76.6.1 --- libsocket.tex 5 May 2004 04:15:30 -0000 1.76.6.2 *************** *** 108,111 **** --- 108,113 ---- \var{string} represents the description of \var{error}, as returned by the \cfunction{gai_strerror()} C function. + The \var{error} value will match one of the \constant{EAI_*} constants + defined in this module. \end{excdesc} From fdrake at users.sourceforge.net Wed May 5 00:18:14 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 00:18:17 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsocket.tex,1.81,1.82 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7986 Modified Files: libsocket.tex Log Message: note that the error code for socket.gaierror will be one of the EAI_* constants (closes SF bug #837929) Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** libsocket.tex 3 Apr 2004 18:02:37 -0000 1.81 --- libsocket.tex 5 May 2004 04:18:11 -0000 1.82 *************** *** 108,111 **** --- 108,113 ---- \var{string} represents the description of \var{error}, as returned by the \cfunction{gai_strerror()} C function. + The \var{error} value will match one of the \constant{EAI_*} constants + defined in this module. \end{excdesc} From fdrake at users.sourceforge.net Wed May 5 00:24:33 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 00:24:36 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcopy.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8943 Modified Files: libcopy.tex Log Message: Remove list of pickle protocol names used by the copy module; there are enough subtleties to pickling that we don't want misunderstanding to spread because we don't provide all the information twice. The reference to the pickle module for information will have to suffice; at least only one portion of the docs will be out of date. ;-( Index: libcopy.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcopy.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** libcopy.tex 6 Oct 2000 20:16:50 -0000 1.16 --- libcopy.tex 5 May 2004 04:24:30 -0000 1.17 *************** *** 73,84 **** Classes can use the same interfaces to control copying that they use ! to control pickling: they can define methods called ! \method{__getinitargs__()}, \method{__getstate__()} and ! \method{__setstate__()}. See the description of module \refmodule{pickle}\refstmodindex{pickle} for information on these methods. The \module{copy} module does not use the \refmodule[copyreg]{copy_reg} registration module. - \withsubitem{(copy protocol)}{\ttindex{__getinitargs__()} - \ttindex{__getstate__()}\ttindex{__setstate__()}} In order for a class to define its own copy implementation, it can --- 73,80 ---- Classes can use the same interfaces to control copying that they use ! to control pickling. See the description of module \refmodule{pickle}\refstmodindex{pickle} for information on these methods. The \module{copy} module does not use the \refmodule[copyreg]{copy_reg} registration module. In order for a class to define its own copy implementation, it can From fdrake at users.sourceforge.net Wed May 5 00:24:55 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 00:24:58 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcopy.tex, 1.16, 1.16.42.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8988 Modified Files: Tag: release23-maint libcopy.tex Log Message: Remove list of pickle protocol names used by the copy module; there are enough subtleties to pickling that we don't want misunderstanding to spread because we don't provide all the information twice. The reference to the pickle module for information will have to suffice; at least only one portion of the docs will be out of date. ;-( Index: libcopy.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcopy.tex,v retrieving revision 1.16 retrieving revision 1.16.42.1 diff -C2 -d -r1.16 -r1.16.42.1 *** libcopy.tex 6 Oct 2000 20:16:50 -0000 1.16 --- libcopy.tex 5 May 2004 04:24:53 -0000 1.16.42.1 *************** *** 73,84 **** Classes can use the same interfaces to control copying that they use ! to control pickling: they can define methods called ! \method{__getinitargs__()}, \method{__getstate__()} and ! \method{__setstate__()}. See the description of module \refmodule{pickle}\refstmodindex{pickle} for information on these methods. The \module{copy} module does not use the \refmodule[copyreg]{copy_reg} registration module. - \withsubitem{(copy protocol)}{\ttindex{__getinitargs__()} - \ttindex{__getstate__()}\ttindex{__setstate__()}} In order for a class to define its own copy implementation, it can --- 73,80 ---- Classes can use the same interfaces to control copying that they use ! to control pickling. See the description of module \refmodule{pickle}\refstmodindex{pickle} for information on these methods. The \module{copy} module does not use the \refmodule[copyreg]{copy_reg} registration module. In order for a class to define its own copy implementation, it can From fdrake at users.sourceforge.net Wed May 5 00:54:40 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 00:54:44 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libpickle.tex,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12835 Modified Files: libpickle.tex Log Message: - note that __getinitargs__() is only for old-style classes - describe __getnewargs__() (closes SF bug #873246) Index: libpickle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** libpickle.tex 8 Jan 2004 15:01:08 -0000 1.47 --- libpickle.tex 5 May 2004 04:54:37 -0000 1.48 *************** *** 449,454 **** When a pickled class instance is unpickled, its \method{__init__()} method is normally \emph{not} invoked. If it is desirable that the ! \method{__init__()} method be called on unpickling, a class can define ! a method \method{__getinitargs__()}, which should return a \emph{tuple} containing the arguments to be passed to the class constructor (i.e. \method{__init__()}). The --- 449,454 ---- When a pickled class instance is unpickled, its \method{__init__()} method is normally \emph{not} invoked. If it is desirable that the ! \method{__init__()} method be called on unpickling, an old-style class ! can define a method \method{__getinitargs__()}, which should return a \emph{tuple} containing the arguments to be passed to the class constructor (i.e. \method{__init__()}). The *************** *** 459,462 **** --- 459,477 ---- \withsubitem{(instance constructor)}{\ttindex{__init__()}} + New-style types can provide a \method{__getnewargs__()} method that is + used for protocol 2. Implementing this method is needed if the type + establishes some internal invariants when the instance is created, or + if the memory allocation is affected by the values passed to the + \method{__new__()} method for the type (as it is for tuples and + strings). Instances of a new-style type \class{C} are created using + + \begin{alltt} + obj = C.__new__(C, *\var{args}) + \end{alltt} + + where \var{args} is the result of calling \method{__getnewargs__()} on + the original object; if there is no \method{__getnewargs__()}, an + empty tuple is assumed. + \withsubitem{(copy protocol)}{ \ttindex{__getstate__()}\ttindex{__setstate__()}} From fdrake at users.sourceforge.net Wed May 5 00:56:24 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 00:56:27 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libpickle.tex,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13077 Modified Files: libpickle.tex Log Message: add an index entry for __getnewargs__() Index: libpickle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** libpickle.tex 5 May 2004 04:54:37 -0000 1.48 --- libpickle.tex 5 May 2004 04:56:06 -0000 1.49 *************** *** 459,462 **** --- 459,464 ---- \withsubitem{(instance constructor)}{\ttindex{__init__()}} + \withsubitem{(copy protocol)}{\ttindex{__getnewargs__()}} + New-style types can provide a \method{__getnewargs__()} method that is used for protocol 2. Implementing this method is needed if the type From fdrake at users.sourceforge.net Wed May 5 00:57:18 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 00:57:21 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libpickle.tex, 1.42.10.2, 1.42.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13203 Modified Files: Tag: release23-maint libpickle.tex Log Message: - note that __getinitargs__() is only for old-style classes - describe __getnewargs__() (with index entry) (closes SF bug #873246) Index: libpickle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.42.10.2 retrieving revision 1.42.10.3 diff -C2 -d -r1.42.10.2 -r1.42.10.3 *** libpickle.tex 10 Sep 2003 20:50:06 -0000 1.42.10.2 --- libpickle.tex 5 May 2004 04:57:01 -0000 1.42.10.3 *************** *** 449,454 **** When a pickled class instance is unpickled, its \method{__init__()} method is normally \emph{not} invoked. If it is desirable that the ! \method{__init__()} method be called on unpickling, a class can define ! a method \method{__getinitargs__()}, which should return a \emph{tuple} containing the arguments to be passed to the class constructor (i.e. \method{__init__()}). The --- 449,454 ---- When a pickled class instance is unpickled, its \method{__init__()} method is normally \emph{not} invoked. If it is desirable that the ! \method{__init__()} method be called on unpickling, an old-style class ! can define a method \method{__getinitargs__()}, which should return a \emph{tuple} containing the arguments to be passed to the class constructor (i.e. \method{__init__()}). The *************** *** 459,462 **** --- 459,479 ---- \withsubitem{(instance constructor)}{\ttindex{__init__()}} + \withsubitem{(copy protocol)}{\ttindex{__getnewargs__()}} + + New-style types can provide a \method{__getnewargs__()} method that is + used for protocol 2. Implementing this method is needed if the type + establishes some internal invariants when the instance is created, or + if the memory allocation is affected by the values passed to the + \method{__new__()} method for the type (as it is for tuples and + strings). Instances of a new-style type \class{C} are created using + + \begin{alltt} + obj = C.__new__(C, *\var{args}) + \end{alltt} + + where \var{args} is the result of calling \method{__getnewargs__()} on + the original object; if there is no \method{__getnewargs__()}, an + empty tuple is assumed. + \withsubitem{(copy protocol)}{ \ttindex{__getstate__()}\ttindex{__setstate__()}} From rhettinger at users.sourceforge.net Wed May 5 01:37:55 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 5 01:37:59 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.203,2.204 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18589/Objects Modified Files: listobject.c Log Message: SF patch #947476: Apply freelist technique to lists Re-use list object bodies. Saves calls to malloc() and free() for faster list instantiation and deallocation. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.203 retrieving revision 2.204 diff -C2 -d -r2.203 -r2.204 *** listobject.c 12 Apr 2004 17:21:03 -0000 2.203 --- listobject.c 5 May 2004 05:37:53 -0000 2.204 *************** *** 50,53 **** --- 50,58 ---- } + /* Empty list reuse scheme to save calls to malloc and free */ + #define MAXFREELISTS 80 + static PyListObject *free_lists[MAXFREELISTS]; + static int num_free_lists = 0; + PyObject * PyList_New(int size) *************** *** 64,70 **** return PyErr_NoMemory(); } ! op = PyObject_GC_New(PyListObject, &PyList_Type); ! if (op == NULL) { ! return NULL; } if (size <= 0) { --- 69,80 ---- return PyErr_NoMemory(); } ! if (num_free_lists) { ! num_free_lists--; ! op = free_lists[num_free_lists]; ! _Py_NewReference((PyObject *)op); ! } else { ! op = PyObject_GC_New(PyListObject, &PyList_Type); ! if (op == NULL) ! return NULL; } if (size <= 0) { *************** *** 234,238 **** PyMem_FREE(op->ob_item); } ! op->ob_type->tp_free((PyObject *)op); Py_TRASHCAN_SAFE_END(op) } --- 244,251 ---- PyMem_FREE(op->ob_item); } ! if (num_free_lists < MAXFREELISTS && PyList_CheckExact(op)) ! free_lists[num_free_lists++] = op; ! else ! op->ob_type->tp_free((PyObject *)op); Py_TRASHCAN_SAFE_END(op) } From rhettinger at users.sourceforge.net Wed May 5 01:37:55 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 5 01:38:00 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.969,1.970 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18589/Misc Modified Files: NEWS Log Message: SF patch #947476: Apply freelist technique to lists Re-use list object bodies. Saves calls to malloc() and free() for faster list instantiation and deallocation. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.969 retrieving revision 1.970 diff -C2 -d -r1.969 -r1.970 *** NEWS 22 Apr 2004 17:28:25 -0000 1.969 --- NEWS 5 May 2004 05:37:36 -0000 1.970 *************** *** 55,58 **** --- 55,61 ---- utilization for applications that have large numbers of small lists. + - Most list bodies now get re-used rather than freed. Speeds up list + instantiation and deletion by saving calls to malloc() and free(). + - The dict.update() method now accepts all the same argument forms as the dict() constructor. This now includes item lists and/or From rhettinger at users.sourceforge.net Wed May 5 02:28:19 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 5 02:28:22 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.204,2.205 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25429 Modified Files: listobject.c Log Message: Nits: - Neatened the braces in PyList_New(). - Made sure "indexerr" was initialized to NULL. - Factored if blocks in PyList_Append(). - Made sure "allocated" is initialized in list_init(). Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.204 retrieving revision 2.205 diff -C2 -d -r2.204 -r2.205 *** listobject.c 5 May 2004 05:37:53 -0000 2.204 --- listobject.c 5 May 2004 06:28:16 -0000 2.205 *************** *** 66,72 **** nbytes = size * sizeof(PyObject *); /* Check for overflow */ ! if (nbytes / sizeof(PyObject *) != (size_t)size) { return PyErr_NoMemory(); - } if (num_free_lists) { num_free_lists--; --- 66,71 ---- nbytes = size * sizeof(PyObject *); /* Check for overflow */ ! if (nbytes / sizeof(PyObject *) != (size_t)size) return PyErr_NoMemory(); if (num_free_lists) { num_free_lists--; *************** *** 78,89 **** return NULL; } ! if (size <= 0) { op->ob_item = NULL; - } else { op->ob_item = (PyObject **) PyMem_MALLOC(nbytes); ! if (op->ob_item == NULL) { return PyErr_NoMemory(); - } memset(op->ob_item, 0, sizeof(*op->ob_item) * size); } --- 77,86 ---- return NULL; } ! if (size <= 0) op->ob_item = NULL; else { op->ob_item = (PyObject **) PyMem_MALLOC(nbytes); ! if (op->ob_item == NULL) return PyErr_NoMemory(); memset(op->ob_item, 0, sizeof(*op->ob_item) * size); } *************** *** 105,109 **** } ! static PyObject *indexerr; PyObject * --- 102,106 ---- } ! static PyObject *indexerr = NULL; PyObject * *************** *** 214,226 **** PyList_Append(PyObject *op, PyObject *newitem) { ! if (!PyList_Check(op)) { ! PyErr_BadInternalCall(); ! return -1; ! } ! if (newitem == NULL) { ! PyErr_BadInternalCall(); ! return -1; ! } ! return app1((PyListObject *)op, newitem); } --- 211,218 ---- PyList_Append(PyObject *op, PyObject *newitem) { ! if (PyList_Check(op) && (newitem != NULL)) ! return app1((PyListObject *)op, newitem); ! PyErr_BadInternalCall(); ! return -1; } *************** *** 2315,2318 **** --- 2307,2311 ---- return -1; /* Empty previous contents */ + self->allocated = self->ob_size; if (self->ob_size != 0) { if (list_ass_slice(self, 0, self->ob_size, (PyObject *)NULL) != 0) From bcannon at users.sourceforge.net Wed May 5 12:49:13 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed May 5 12:49:17 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.164,1.165 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27473 Modified Files: libfuncs.tex Log Message: Fix small grammatical mistake. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.164 retrieving revision 1.165 diff -C2 -d -r1.164 -r1.165 *** libfuncs.tex 21 Mar 2004 16:05:30 -0000 1.164 --- libfuncs.tex 5 May 2004 16:49:11 -0000 1.165 *************** *** 144,148 **** expression, or \code{'single'} if it consists of a single interactive statement (in the latter case, expression statements ! that evaluate to something else than \code{None} will printed). When compiling multi-line statements, two caveats apply: line --- 144,148 ---- expression, or \code{'single'} if it consists of a single interactive statement (in the latter case, expression statements ! that evaluate to something else than \code{None} will be printed). When compiling multi-line statements, two caveats apply: line From akuchling at users.sourceforge.net Wed May 5 13:21:54 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed May 5 13:21:58 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libshutil.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2920 Modified Files: libshutil.tex Log Message: [Bug #810879] Document that copyfile() can fail if you don't have permissions; also, fix a double negative. Index: libshutil.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshutil.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libshutil.tex 23 Feb 2003 21:36:47 -0000 1.13 --- libshutil.tex 5 May 2004 17:21:51 -0000 1.14 *************** *** 21,27 **** \begin{funcdesc}{copyfile}{src, dst} Copy the contents of the file named \var{src} to a file named ! \var{dst}. If \var{dst} exists, it will be replaced, otherwise it ! will be created. Special files such as character or block devices ! and pipes cannot not be copied with this function. \var{src} and \var{dst} are path names given as strings. \end{funcdesc} --- 21,29 ---- \begin{funcdesc}{copyfile}{src, dst} Copy the contents of the file named \var{src} to a file named ! \var{dst}. The destination location must be writable; otherwise, ! an \exception{IOError} exception will be raised. ! If \var{dst} already exists, it will be replaced. ! Special files such as character or block devices ! and pipes cannot be copied with this function. \var{src} and \var{dst} are path names given as strings. \end{funcdesc} From gvanrossum at users.sourceforge.net Wed May 5 19:58:05 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed May 5 19:58:12 2004 Subject: [Python-checkins] python/dist/src/Lib platform.py,1.5.8.4,1.5.8.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21284 Modified Files: Tag: release23-maint platform.py Log Message: Merge all fixes from Python 2.4. This includes: 1.12 Added more Windows version names (thanks to Thomas Heller). Fixed bug in platform() cache (thanks to Brett Cannon). 1.10,1.11 Fixed a caching bug in platform.platform() where the argument of 'terse' was not taken into consideration when caching value. Index: platform.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.5.8.4 retrieving revision 1.5.8.5 diff -C2 -d -r1.5.8.4 -r1.5.8.5 *** platform.py 4 May 2004 18:18:23 -0000 1.5.8.4 --- platform.py 5 May 2004 23:58:03 -0000 1.5.8.5 *************** *** 32,36 **** # # History: ! # 1.0.2 - fix a bug with caching of value for platform() # 1.0.1 - reformatted to make doc.py happy # 1.0.0 - reformatted a bit and checked into Python CVS --- 32,36 ---- # # History: ! # 1.0.2 - added more Windows support # 1.0.1 - reformatted to make doc.py happy # 1.0.0 - reformatted a bit and checked into Python CVS *************** *** 458,462 **** --- 458,466 ---- # XXX Is there any way to find out the processor type on WinXX ? # XXX Is win32 available on Windows CE ? + # # Adapted from code posted by Karl Putland to comp.lang.python. + # + # The mappings between reg. values and release names can be found + # here: http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfo_str.asp # Import the needed APIs *************** *** 480,485 **** if min == 0: release = '95' ! else: release = '98' elif maj == 5: release = '2000' --- 484,493 ---- if min == 0: release = '95' ! elif min == 10: release = '98' + elif min == 90: + release = 'Me' + else: + release = 'postMe' elif maj == 5: release = '2000' *************** *** 489,493 **** release = 'NT' elif maj == 5: ! release = '2000' else: if not release: --- 497,508 ---- release = 'NT' elif maj == 5: ! if min == 0: ! release = '2000' ! elif min == 1: ! release = 'XP' ! elif min == 2: ! release = '2003Server' ! else: ! release = 'post2003' else: if not release: *************** *** 1137,1144 **** ### The Opus Magnum of platform strings :-) ! _platform_cache_terse = None ! _platform_cache_not_terse = None ! _platform_aliased_cache_terse = None ! _platform_aliased_cache_not_terse = None def platform(aliased=0, terse=0): --- 1152,1156 ---- ### The Opus Magnum of platform strings :-) ! _platform_cache = {} def platform(aliased=0, terse=0): *************** *** 1161,1175 **** """ ! global _platform_cache_terse, _platform_cache_not_terse ! global _platform_aliased_cache_terse, _platform_aliased_cache_not_terse ! ! if not aliased and terse and (_platform_cache_terse is not None): ! return _platform_cache_terse ! elif not aliased and not terse and (_platform_cache_not_terse is not None): ! return _platform_cache_not_terse ! elif terse and _platform_aliased_cache_terse is not None: ! return _platform_aliased_cache_terse ! elif not terse and _platform_aliased_cache_not_terse is not None: ! return _platform_aliased_cache_not_terse # Get uname information and then apply platform specific cosmetics --- 1173,1179 ---- """ ! result = _platform_cache.get((aliased, terse), None) ! if result is not None: ! return result # Get uname information and then apply platform specific cosmetics *************** *** 1227,1241 **** platform = _platform(system,release,machine,processor,bits,linkage) ! if aliased and terse: ! _platform_aliased_cache_terse = platform ! elif aliased and not terse: ! _platform_aliased_cache_not_terse = platform ! elif terse: ! pass ! else: ! if terse: ! _platform_cache_terse = platform ! else: ! _platform_cache_not_terse = platform return platform --- 1231,1235 ---- platform = _platform(system,release,machine,processor,bits,linkage) ! _platform_cache[(aliased, terse)] = platform return platform From gvanrossum at users.sourceforge.net Wed May 5 20:29:50 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed May 5 20:29:55 2004 Subject: [Python-checkins] python/nondist/peps pep-0291.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27077 Modified Files: pep-0291.txt Log Message: Add compatibility guideline for platform.py. Index: pep-0291.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0291.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0291.txt 4 Dec 2003 15:16:00 -0000 1.8 --- pep-0291.txt 6 May 2004 00:29:47 -0000 1.9 *************** *** 89,92 **** --- 89,93 ---- modulefinder Thomas Heller 2.2 Just van Rossum + platform Marc-Andre Lemburg 1.5.2 From loewis at users.sourceforge.net Wed May 5 21:35:00 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 21:35:06 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex, 1.196.8.18, 1.196.8.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4712 Modified Files: Tag: release23-maint tut.tex Log Message: Patch #940026: Explain "in" when it is first used. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.196.8.18 retrieving revision 1.196.8.19 diff -C2 -d -r1.196.8.18 -r1.196.8.19 *** tut.tex 24 Feb 2004 16:13:04 -0000 1.196.8.18 --- tut.tex 6 May 2004 01:34:56 -0000 1.196.8.19 *************** *** 1429,1432 **** --- 1429,1435 ---- \code{ask_ok('OK to overwrite the file?', 2)}. + This example also introduces the \keyword{in} keyword. This tests + whether or not a sequence contains a certain value. + The default values are evaluated at the point of function definition in the \emph{defining} scope, so that From loewis at users.sourceforge.net Wed May 5 21:35:52 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 21:35:55 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.226,1.227 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4856 Modified Files: tut.tex Log Message: Patch #940026: Explain "in" when it is first used. Backported to 2.3. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.226 retrieving revision 1.227 diff -C2 -d -r1.226 -r1.227 *** tut.tex 26 Mar 2004 07:56:23 -0000 1.226 --- tut.tex 6 May 2004 01:35:45 -0000 1.227 *************** *** 1429,1432 **** --- 1429,1435 ---- \code{ask_ok('OK to overwrite the file?', 2)}. + This example also introduces the \keyword{in} keyword. This tests + whether or not a sequence contains a certain value. + The default values are evaluated at the point of function definition in the \emph{defining} scope, so that From loewis at users.sourceforge.net Wed May 5 21:40:59 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 21:41:04 2004 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.53.6.4,1.53.6.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5490/Lib Modified Files: Tag: release23-maint urllib2.py Log Message: Patch #944110: Properly process empty passwords. Fixes #944082. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.53.6.4 retrieving revision 1.53.6.5 diff -C2 -d -r1.53.6.4 -r1.53.6.5 *** urllib2.py 15 Feb 2004 21:18:47 -0000 1.53.6.4 --- urllib2.py 6 May 2004 01:40:57 -0000 1.53.6.5 *************** *** 640,644 **** def retry_http_basic_auth(self, host, req, realm): user,pw = self.passwd.find_user_password(realm, host) ! if pw: raw = "%s:%s" % (user, pw) auth = 'Basic %s' % base64.encodestring(raw).strip() --- 640,644 ---- def retry_http_basic_auth(self, host, req, realm): user,pw = self.passwd.find_user_password(realm, host) ! if pw is not None: raw = "%s:%s" % (user, pw) auth = 'Basic %s' % base64.encodestring(raw).strip() From loewis at users.sourceforge.net Wed May 5 21:41:00 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 21:41:06 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.102, 1.831.4.103 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5490/Misc Modified Files: Tag: release23-maint NEWS Log Message: Patch #944110: Properly process empty passwords. Fixes #944082. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.102 retrieving revision 1.831.4.103 diff -C2 -d -r1.831.4.102 -r1.831.4.103 *** NEWS 20 Apr 2004 21:15:54 -0000 1.831.4.102 --- NEWS 6 May 2004 01:40:57 -0000 1.831.4.103 *************** *** 43,46 **** --- 43,48 ---- ------- + - Bug #944082: Empty passwords in urllib2 are now supported. + - Bug #926075: Fixed a bug that returns a wrong pattern object for a string or unicode object in sre.compile() when a different From loewis at users.sourceforge.net Wed May 5 21:41:28 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 21:41:31 2004 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.64,1.65 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5630 Modified Files: urllib2.py Log Message: Patch #944110: Properly process empty passwords. Fixes #944082. Backported to 2.3. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** urllib2.py 6 Apr 2004 19:43:03 -0000 1.64 --- urllib2.py 6 May 2004 01:41:26 -0000 1.65 *************** *** 697,701 **** def retry_http_basic_auth(self, host, req, realm): user,pw = self.passwd.find_user_password(realm, host) ! if pw: raw = "%s:%s" % (user, pw) auth = 'Basic %s' % base64.encodestring(raw).strip() --- 697,701 ---- def retry_http_basic_auth(self, host, req, realm): user,pw = self.passwd.find_user_password(realm, host) ! if pw is not None: raw = "%s:%s" % (user, pw) auth = 'Basic %s' % base64.encodestring(raw).strip() From loewis at users.sourceforge.net Wed May 5 21:54:37 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 21:54:43 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.40, 1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7235/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: Swap public and system ID in start_doctype_decl. Fixes #780300. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** whatsnew24.tex 20 Mar 2004 08:13:32 -0000 1.40 --- whatsnew24.tex 6 May 2004 01:54:35 -0000 1.41 *************** *** 562,565 **** --- 562,569 ---- instead of returning empty lists. + \item \function{LexicalHandler.startDTD} used to receive public and system ID + in the wrong order. This has been corrected; applications relying on the + wrong order need to be fixed. + \end{itemize} From loewis at users.sourceforge.net Wed May 5 21:54:38 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 21:54:45 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.970,1.971 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7235/Misc Modified Files: NEWS Log Message: Swap public and system ID in start_doctype_decl. Fixes #780300. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.970 retrieving revision 1.971 diff -C2 -d -r1.970 -r1.971 *** NEWS 5 May 2004 05:37:36 -0000 1.970 --- NEWS 6 May 2004 01:54:35 -0000 1.971 *************** *** 307,310 **** --- 307,313 ---- ------- + - Bug #780300: Swap public and system ID in LexicalHandler.startDTD. + Applications relying on the wrong order need to be corrected. + - Bug #926075: Fixed a bug that returns a wrong pattern object for a string or unicode object in sre.compile() when a different From loewis at users.sourceforge.net Wed May 5 21:54:38 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 21:54:47 2004 Subject: [Python-checkins] python/dist/src/Lib/xml/sax expatreader.py, 1.32, 1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7235/Lib/xml/sax Modified Files: expatreader.py Log Message: Swap public and system ID in start_doctype_decl. Fixes #780300. Index: expatreader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/expatreader.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** expatreader.py 27 Feb 2003 20:14:51 -0000 1.32 --- expatreader.py 6 May 2004 01:54:36 -0000 1.33 *************** *** 362,366 **** self._cont_handler.endPrefixMapping(prefix) ! def start_doctype_decl(self, name, pubid, sysid, has_internal_subset): self._lex_handler_prop.startDTD(name, pubid, sysid) --- 362,366 ---- self._cont_handler.endPrefixMapping(prefix) ! def start_doctype_decl(self, name, sysid, pubid, has_internal_subset): self._lex_handler_prop.startDTD(name, pubid, sysid) From loewis at users.sourceforge.net Wed May 5 22:03:15 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 22:03:19 2004 Subject: [Python-checkins] python/dist/src/Lib/xml/sax saxutils.py, 1.21, 1.21.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8544/Lib/xml/sax Modified Files: Tag: release23-maint saxutils.py Log Message: Properly delegate startElementNS in saxutils.XMLFilterBase. Fixes #936637. Index: saxutils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/saxutils.py,v retrieving revision 1.21 retrieving revision 1.21.10.1 diff -C2 -d -r1.21 -r1.21.10.1 *** saxutils.py 24 Apr 2003 16:02:54 -0000 1.21 --- saxutils.py 6 May 2004 02:03:13 -0000 1.21.10.1 *************** *** 190,194 **** def startElementNS(self, name, qname, attrs): ! self._cont_handler.startElement(name, attrs) def endElementNS(self, name, qname): --- 190,194 ---- def startElementNS(self, name, qname, attrs): ! self._cont_handler.startElementNS(name, qname, attrs) def endElementNS(self, name, qname): From loewis at users.sourceforge.net Wed May 5 22:03:15 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 22:03:20 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.103, 1.831.4.104 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8544/Misc Modified Files: Tag: release23-maint NEWS Log Message: Properly delegate startElementNS in saxutils.XMLFilterBase. Fixes #936637. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.103 retrieving revision 1.831.4.104 diff -C2 -d -r1.831.4.103 -r1.831.4.104 *** NEWS 6 May 2004 01:40:57 -0000 1.831.4.103 --- NEWS 6 May 2004 02:03:13 -0000 1.831.4.104 *************** *** 43,46 **** --- 43,48 ---- ------- + - Bug #936637: Properly delegate startElementNS in saxutils.XMLFilterBase. + - Bug #944082: Empty passwords in urllib2 are now supported. From loewis at users.sourceforge.net Wed May 5 22:04:23 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 22:04:27 2004 Subject: [Python-checkins] python/dist/src/Lib/xml/sax saxutils.py, 1.21, 1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8652/Lib/xml/sax Modified Files: saxutils.py Log Message: Properly delegate startElementNS in saxutils.XMLFilterBase. Fixes #936637. Backported to 2.3. Index: saxutils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/saxutils.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** saxutils.py 24 Apr 2003 16:02:54 -0000 1.21 --- saxutils.py 6 May 2004 02:04:21 -0000 1.22 *************** *** 190,194 **** def startElementNS(self, name, qname, attrs): ! self._cont_handler.startElement(name, attrs) def endElementNS(self, name, qname): --- 190,194 ---- def startElementNS(self, name, qname, attrs): ! self._cont_handler.startElementNS(name, qname, attrs) def endElementNS(self, name, qname): From loewis at users.sourceforge.net Wed May 5 22:22:26 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 22:22:30 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.104, 1.831.4.105 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11692/Misc Modified Files: Tag: release23-maint NEWS Log Message: Consider output encoding in XMLGenerator. Fixes #938076. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.104 retrieving revision 1.831.4.105 diff -C2 -d -r1.831.4.104 -r1.831.4.105 *** NEWS 6 May 2004 02:03:13 -0000 1.831.4.104 --- NEWS 6 May 2004 02:22:23 -0000 1.831.4.105 *************** *** 43,46 **** --- 43,48 ---- ------- + - Bug #938076: Consider output encoding in XMLGenerator. + - Bug #936637: Properly delegate startElementNS in saxutils.XMLFilterBase. From loewis at users.sourceforge.net Wed May 5 22:22:25 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 22:22:31 2004 Subject: [Python-checkins] python/dist/src/Lib/xml/sax saxutils.py, 1.21.10.1, 1.21.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11692/Lib/xml/sax Modified Files: Tag: release23-maint saxutils.py Log Message: Consider output encoding in XMLGenerator. Fixes #938076. Index: saxutils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/saxutils.py,v retrieving revision 1.21.10.1 retrieving revision 1.21.10.2 diff -C2 -d -r1.21.10.1 -r1.21.10.2 *** saxutils.py 6 May 2004 02:03:13 -0000 1.21.10.1 --- saxutils.py 6 May 2004 02:22:23 -0000 1.21.10.2 *************** *** 13,16 **** --- 13,25 ---- _StringTypes = [types.StringType] + # See whether the xmlcharrefreplace error handler is + # supported + try: + from codecs import xmlcharrefreplace_errors + _error_handling = "xmlcharrefreplace" + del xmlcharrefreplace_errors + except ImportError: + _error_handling = "strict" + def __dict_replace(s, d): """Replace substrings of a string using a dictionary.""" *************** *** 84,91 **** self._encoding = encoding # ContentHandler methods def startDocument(self): ! self._out.write('\n' % self._encoding) --- 93,106 ---- self._encoding = encoding + def _write(self, text): + if isinstance(text, str): + self._out.write(text) + else: + self._out.write(text.encode(self._encoding, _error_handling)) + # ContentHandler methods def startDocument(self): ! self._write('\n' % self._encoding) *************** *** 100,110 **** def startElement(self, name, attrs): ! self._out.write('<' + name) for (name, value) in attrs.items(): ! self._out.write(' %s=%s' % (name, quoteattr(value))) ! self._out.write('>') def endElement(self, name): ! self._out.write('' % name) def startElementNS(self, name, qname, attrs): --- 115,125 ---- def startElement(self, name, attrs): ! self._write('<' + name) for (name, value) in attrs.items(): ! self._write(' %s=%s' % (name, quoteattr(value))) ! self._write('>') def endElement(self, name): ! self._write('' % name) def startElementNS(self, name, qname, attrs): *************** *** 115,128 **** # else try to restore the original prefix from the namespace name = self._current_context[name[0]] + ":" + name[1] ! self._out.write('<' + name) for pair in self._undeclared_ns_maps: ! self._out.write(' xmlns:%s="%s"' % pair) self._undeclared_ns_maps = [] for (name, value) in attrs.items(): name = self._current_context[name[0]] + ":" + name[1] ! self._out.write(' %s=%s' % (name, quoteattr(value))) ! self._out.write('>') def endElementNS(self, name, qname): --- 130,143 ---- # else try to restore the original prefix from the namespace name = self._current_context[name[0]] + ":" + name[1] ! self._write('<' + name) for pair in self._undeclared_ns_maps: ! self._write(' xmlns:%s="%s"' % pair) self._undeclared_ns_maps = [] for (name, value) in attrs.items(): name = self._current_context[name[0]] + ":" + name[1] ! self._write(' %s=%s' % (name, quoteattr(value))) ! self._write('>') def endElementNS(self, name, qname): *************** *** 131,144 **** else: name = self._current_context[name[0]] + ":" + name[1] ! self._out.write('' % name) def characters(self, content): ! self._out.write(escape(content)) def ignorableWhitespace(self, content): ! self._out.write(content) def processingInstruction(self, target, data): ! self._out.write('' % (target, data)) --- 146,159 ---- else: name = self._current_context[name[0]] + ":" + name[1] ! self._write('' % name) def characters(self, content): ! self._write(escape(content)) def ignorableWhitespace(self, content): ! self._write(content) def processingInstruction(self, target, data): ! self._write('' % (target, data)) From loewis at users.sourceforge.net Wed May 5 22:22:45 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed May 5 22:22:49 2004 Subject: [Python-checkins] python/dist/src/Lib/xml/sax saxutils.py, 1.22, 1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11804/Lib/xml/sax Modified Files: saxutils.py Log Message: Consider output encoding in XMLGenerator. Fixes #938076. Backported to 2.3. Index: saxutils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/saxutils.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** saxutils.py 6 May 2004 02:04:21 -0000 1.22 --- saxutils.py 6 May 2004 02:22:43 -0000 1.23 *************** *** 13,16 **** --- 13,25 ---- _StringTypes = [types.StringType] + # See whether the xmlcharrefreplace error handler is + # supported + try: + from codecs import xmlcharrefreplace_errors + _error_handling = "xmlcharrefreplace" + del xmlcharrefreplace_errors + except ImportError: + _error_handling = "strict" + def __dict_replace(s, d): """Replace substrings of a string using a dictionary.""" *************** *** 84,91 **** self._encoding = encoding # ContentHandler methods def startDocument(self): ! self._out.write('\n' % self._encoding) --- 93,106 ---- self._encoding = encoding + def _write(self, text): + if isinstance(text, str): + self._out.write(text) + else: + self._out.write(text.encode(self._encoding, _error_handling)) + # ContentHandler methods def startDocument(self): ! self._write('\n' % self._encoding) *************** *** 100,110 **** def startElement(self, name, attrs): ! self._out.write('<' + name) for (name, value) in attrs.items(): ! self._out.write(' %s=%s' % (name, quoteattr(value))) ! self._out.write('>') def endElement(self, name): ! self._out.write('' % name) def startElementNS(self, name, qname, attrs): --- 115,125 ---- def startElement(self, name, attrs): ! self._write('<' + name) for (name, value) in attrs.items(): ! self._write(' %s=%s' % (name, quoteattr(value))) ! self._write('>') def endElement(self, name): ! self._write('' % name) def startElementNS(self, name, qname, attrs): *************** *** 115,128 **** # else try to restore the original prefix from the namespace name = self._current_context[name[0]] + ":" + name[1] ! self._out.write('<' + name) for pair in self._undeclared_ns_maps: ! self._out.write(' xmlns:%s="%s"' % pair) self._undeclared_ns_maps = [] for (name, value) in attrs.items(): name = self._current_context[name[0]] + ":" + name[1] ! self._out.write(' %s=%s' % (name, quoteattr(value))) ! self._out.write('>') def endElementNS(self, name, qname): --- 130,143 ---- # else try to restore the original prefix from the namespace name = self._current_context[name[0]] + ":" + name[1] ! self._write('<' + name) for pair in self._undeclared_ns_maps: ! self._write(' xmlns:%s="%s"' % pair) self._undeclared_ns_maps = [] for (name, value) in attrs.items(): name = self._current_context[name[0]] + ":" + name[1] ! self._write(' %s=%s' % (name, quoteattr(value))) ! self._write('>') def endElementNS(self, name, qname): *************** *** 131,144 **** else: name = self._current_context[name[0]] + ":" + name[1] ! self._out.write('' % name) def characters(self, content): ! self._out.write(escape(content)) def ignorableWhitespace(self, content): ! self._out.write(content) def processingInstruction(self, target, data): ! self._out.write('' % (target, data)) --- 146,159 ---- else: name = self._current_context[name[0]] + ":" + name[1] ! self._write('' % name) def characters(self, content): ! self._write(escape(content)) def ignorableWhitespace(self, content): ! self._write(content) def processingInstruction(self, target, data): ! self._write('' % (target, data)) From fdrake at users.sourceforge.net Wed May 5 22:55:38 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 22:55:42 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.41, 1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16687 Modified Files: whatsnew24.tex Log Message: markup adjustments Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** whatsnew24.tex 6 May 2004 01:54:35 -0000 1.41 --- whatsnew24.tex 6 May 2004 02:55:35 -0000 1.42 *************** *** 34,39 **** \section{PEP 218: Built-In Set Objects} ! Two new built-in types, \function{set(iterable)} and ! \function{frozenset(iterable)} provide high speed data types for membership testing, for eliminating duplicates from sequences, and for mathematical operations like unions, intersections, differences, --- 34,39 ---- \section{PEP 218: Built-In Set Objects} ! Two new built-in types, \function{set(\var{iterable})} and ! \function{frozenset(\var{iterable})} provide high speed data types for membership testing, for eliminating duplicates from sequences, and for mathematical operations like unions, intersections, differences, *************** *** 92,96 **** \section{PEP 322: Reverse Iteration} ! A new built-in function, \function{reversed(seq)}, takes a sequence and returns an iterator that returns the elements of the sequence in reverse order. --- 92,96 ---- \section{PEP 322: Reverse Iteration} ! A new built-in function, \function{reversed(\var{seq})}, takes a sequence and returns an iterator that returns the elements of the sequence in reverse order. *************** *** 209,215 **** people with the same age are in name-sorted order. ! \item There is a new built-in function \function{sorted(iterable)} that works ! like the in-place \method{list.sort()} method but has been made suitable ! for use in expressions. The differences are: \begin{itemize} \item the input may be any iterable; --- 209,216 ---- people with the same age are in name-sorted order. ! \item There is a new built-in function ! \function{sorted(\var{iterable})} that works like the in-place ! \method{list.sort()} method but has been made suitable for use in ! expressions. The differences are: \begin{itemize} \item the input may be any iterable; *************** *** 562,568 **** instead of returning empty lists. ! \item \function{LexicalHandler.startDTD} used to receive public and system ID ! in the wrong order. This has been corrected; applications relying on the ! wrong order need to be fixed. \end{itemize} --- 563,569 ---- instead of returning empty lists. ! \item \function{LexicalHandler.startDTD()} used to receive public and ! system ID in the wrong order. This has been corrected; applications ! relying on the wrong order need to be fixed. \end{itemize} From fdrake at users.sourceforge.net Wed May 5 23:48:05 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 23:48:09 2004 Subject: [Python-checkins] python/dist/src/Lib/xml/sax handler.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23920/Lib/xml/sax Modified Files: handler.py Log Message: fix documentation for ContentHandler.ignorableWhitespace() (closes SF bug #881707) Index: handler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/handler.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** handler.py 24 Apr 2003 16:02:54 -0000 1.10 --- handler.py 6 May 2004 03:47:48 -0000 1.11 *************** *** 178,185 **** of the characters in any single event must come from the same external entity, so that the Locator provides useful ! information. ! ! The application must not attempt to read from the array ! outside of the specified range.""" def processingInstruction(self, target, data): --- 178,182 ---- of the characters in any single event must come from the same external entity, so that the Locator provides useful ! information.""" def processingInstruction(self, target, data): From fdrake at users.sourceforge.net Wed May 5 23:48:04 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 23:48:11 2004 Subject: [Python-checkins] python/dist/src/Doc/lib xmlsaxhandler.tex, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23920/Doc/lib Modified Files: xmlsaxhandler.tex Log Message: fix documentation for ContentHandler.ignorableWhitespace() (closes SF bug #881707) Index: xmlsaxhandler.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsaxhandler.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** xmlsaxhandler.tex 18 Apr 2003 22:04:34 -0000 1.10 --- xmlsaxhandler.tex 6 May 2004 03:47:48 -0000 1.11 *************** *** 286,290 **** \end{methoddesc} ! \begin{methoddesc}[ContentHandler]{ignorableWhitespace}{} Receive notification of ignorable whitespace in element content. --- 286,290 ---- \end{methoddesc} ! \begin{methoddesc}[ContentHandler]{ignorableWhitespace}{whitespace} Receive notification of ignorable whitespace in element content. From fdrake at users.sourceforge.net Wed May 5 23:48:35 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 23:48:42 2004 Subject: [Python-checkins] python/dist/src/Doc/lib xmlsaxhandler.tex, 1.10, 1.10.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24062/Doc/lib Modified Files: Tag: release23-maint xmlsaxhandler.tex Log Message: fix documentation for ContentHandler.ignorableWhitespace() (closes SF bug #881707) Index: xmlsaxhandler.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsaxhandler.tex,v retrieving revision 1.10 retrieving revision 1.10.12.1 diff -C2 -d -r1.10 -r1.10.12.1 *** xmlsaxhandler.tex 18 Apr 2003 22:04:34 -0000 1.10 --- xmlsaxhandler.tex 6 May 2004 03:48:32 -0000 1.10.12.1 *************** *** 286,290 **** \end{methoddesc} ! \begin{methoddesc}[ContentHandler]{ignorableWhitespace}{} Receive notification of ignorable whitespace in element content. --- 286,290 ---- \end{methoddesc} ! \begin{methoddesc}[ContentHandler]{ignorableWhitespace}{whitespace} Receive notification of ignorable whitespace in element content. From fdrake at users.sourceforge.net Wed May 5 23:48:35 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 5 23:48:43 2004 Subject: [Python-checkins] python/dist/src/Lib/xml/sax handler.py, 1.10, 1.10.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24062/Lib/xml/sax Modified Files: Tag: release23-maint handler.py Log Message: fix documentation for ContentHandler.ignorableWhitespace() (closes SF bug #881707) Index: handler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/handler.py,v retrieving revision 1.10 retrieving revision 1.10.10.1 diff -C2 -d -r1.10 -r1.10.10.1 *** handler.py 24 Apr 2003 16:02:54 -0000 1.10 --- handler.py 6 May 2004 03:48:33 -0000 1.10.10.1 *************** *** 178,185 **** of the characters in any single event must come from the same external entity, so that the Locator provides useful ! information. ! ! The application must not attempt to read from the array ! outside of the specified range.""" def processingInstruction(self, target, data): --- 178,182 ---- of the characters in any single event must come from the same external entity, so that the Locator provides useful ! information.""" def processingInstruction(self, target, data): From fdrake at users.sourceforge.net Thu May 6 00:18:01 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu May 6 00:18:04 2004 Subject: [Python-checkins] python/nondist/peps pep-0278.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28747 Modified Files: pep-0278.txt Log Message: revise the test for universal newline support to work even if sys.stdout has been replaced (closes SF bug #800828) Index: pep-0278.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0278.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0278.txt 30 Sep 2002 01:56:17 -0000 1.8 --- pep-0278.txt 6 May 2004 04:17:58 -0000 1.9 *************** *** 170,175 **** attribute, so testing whether the current Python has it can be done with a simple ! if hasattr(sys.stdout, 'newlines'): ! print 'We have universal newline support' --- 170,182 ---- attribute, so testing whether the current Python has it can be done with a simple ! ! if hasattr(open, 'newlines'): ! print 'We have universal newline support' ! ! Note that this test uses the open() function rather than the file ! type so that it won't fail for versions of Python where the file ! type was not available (the file type was added to the built-in ! namespace in the same release as the universal newline feature was ! added). From oconnorlk at allsearchengines.co.uk Thu May 6 13:32:04 2004 From: oconnorlk at allsearchengines.co.uk (Emile Oconnor) Date: Thu May 6 07:28:58 2004 Subject: [Python-checkins] BEIL Small Cap Promo Mover Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040506/8c90f582/attachment.html From fdrake at users.sourceforge.net Thu May 6 08:44:31 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu May 6 08:44:36 2004 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.118,1.119 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17058/ref Modified Files: ref3.tex Log Message: note that descriptor objects must be instances of new-style types (closes SF bug #817742) Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** ref3.tex 1 Jan 2004 05:43:53 -0000 1.118 --- ref3.tex 6 May 2004 12:44:29 -0000 1.119 *************** *** 1297,1301 **** \emph{owner} class. In the examples below, ``the attribute'' refers to the attribute whose name is the key of the property in the owner ! class' \code{__dict__}. \begin{methoddesc}[object]{__get__}{self, instance, owner} --- 1297,1302 ---- \emph{owner} class. In the examples below, ``the attribute'' refers to the attribute whose name is the key of the property in the owner ! class' \code{__dict__}. Descriptors can only be implemented as ! new-style classes themselves. \begin{methoddesc}[object]{__get__}{self, instance, owner} From fdrake at users.sourceforge.net Thu May 6 08:45:47 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu May 6 08:45:51 2004 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex, 1.114.4.4, 1.114.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17344/ref Modified Files: Tag: release23-maint ref3.tex Log Message: note that descriptor objects must be instances of new-style types (closes SF bug #817742) Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.114.4.4 retrieving revision 1.114.4.5 diff -C2 -d -r1.114.4.4 -r1.114.4.5 *** ref3.tex 1 Jan 2004 05:46:30 -0000 1.114.4.4 --- ref3.tex 6 May 2004 12:45:45 -0000 1.114.4.5 *************** *** 1297,1301 **** \emph{owner} class. In the examples below, ``the attribute'' refers to the attribute whose name is the key of the property in the owner ! class' \code{__dict__}. \begin{methoddesc}[object]{__get__}{self, instance, owner} --- 1297,1302 ---- \emph{owner} class. In the examples below, ``the attribute'' refers to the attribute whose name is the key of the property in the owner ! class' \code{__dict__}. Descriptors can only be implemented as ! new-style classes themselves. \begin{methoddesc}[object]{__get__}{self, instance, owner} From akuchling at users.sourceforge.net Thu May 6 09:13:46 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu May 6 09:13:49 2004 Subject: [Python-checkins] python/dist/src/Lib cgitb.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22748 Modified Files: cgitb.py Log Message: [Bug #945063] Get file extension correct. (2.3 bugfix candidate) Index: cgitb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgitb.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** cgitb.py 31 Mar 2004 20:17:56 -0000 1.10 --- cgitb.py 6 May 2004 13:13:44 -0000 1.11 *************** *** 275,279 **** if self.logdir is not None: import os, tempfile ! suffix = ['.html', '.txt'][self.format=="html"] (fd, path) = tempfile.mkstemp(suffix=suffix, dir=self.logdir) try: --- 275,279 ---- if self.logdir is not None: import os, tempfile ! suffix = ['.txt', '.html'][self.format=="html"] (fd, path) = tempfile.mkstemp(suffix=suffix, dir=self.logdir) try: From akuchling at users.sourceforge.net Thu May 6 09:18:45 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu May 6 09:18:48 2004 Subject: [Python-checkins] python/dist/src/Lib cgitb.py,1.9,1.9.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23840 Modified Files: Tag: release23-maint cgitb.py Log Message: [Bug #945063 backport] Get file extension correct. Index: cgitb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgitb.py,v retrieving revision 1.9 retrieving revision 1.9.8.1 diff -C2 -d -r1.9 -r1.9.8.1 *** cgitb.py 29 Jun 2003 05:46:53 -0000 1.9 --- cgitb.py 6 May 2004 13:18:26 -0000 1.9.8.1 *************** *** 274,278 **** if self.logdir is not None: import os, tempfile ! suffix = ['.html', '.txt'][self.format=="html"] (fd, path) = tempfile.mkstemp(suffix=suffix, dir=self.logdir) try: --- 274,278 ---- if self.logdir is not None: import os, tempfile ! suffix = ['.txt', '.html'][self.format=="html"] (fd, path) = tempfile.mkstemp(suffix=suffix, dir=self.logdir) try: From rhettinger at users.sourceforge.net Thu May 6 12:55:09 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu May 6 12:55:14 2004 Subject: [Python-checkins] python/dist/src/Lib urlparse.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6692 Modified Files: urlparse.py Log Message: Use sets instead of lists for membership testing Index: urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urlparse.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** urlparse.py 12 Oct 2003 04:38:06 -0000 1.42 --- urlparse.py 6 May 2004 16:55:07 -0000 1.43 *************** *** 9,28 **** # A classification of schemes ('' means apply by default) ! uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap', 'wais', 'file', 'https', 'shttp', 'mms', ! 'prospero', 'rtsp', 'rtspu', ''] ! uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', ! 'snews', 'prospero', 'rtsp', 'rtspu', ''] ! non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', ! 'telnet', 'wais', 'imap', 'snews', 'sip'] ! uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap', 'https', 'shttp', 'rtsp', 'rtspu', 'sip', ! 'mms', ''] ! uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms', ! 'gopher', 'rtsp', 'rtspu', 'sip', ''] ! uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news', 'nntp', 'wais', 'https', 'shttp', 'snews', ! 'file', 'prospero', ''] # Characters valid in scheme names --- 9,28 ---- # A classification of schemes ('' means apply by default) ! uses_relative = set(['ftp', 'http', 'gopher', 'nntp', 'imap', 'wais', 'file', 'https', 'shttp', 'mms', ! 'prospero', 'rtsp', 'rtspu', '']) ! uses_netloc = set(['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', ! 'snews', 'prospero', 'rtsp', 'rtspu', '']) ! non_hierarchical = set(['gopher', 'hdl', 'mailto', 'news', ! 'telnet', 'wais', 'imap', 'snews', 'sip']) ! uses_params = set(['ftp', 'hdl', 'prospero', 'http', 'imap', 'https', 'shttp', 'rtsp', 'rtspu', 'sip', ! 'mms', '']) ! uses_query = set(['http', 'wais', 'imap', 'https', 'shttp', 'mms', ! 'gopher', 'rtsp', 'rtspu', 'sip', '']) ! uses_fragment = set(['ftp', 'hdl', 'http', 'gopher', 'news', 'nntp', 'wais', 'https', 'shttp', 'snews', ! 'file', 'prospero', '']) # Characters valid in scheme names From oyozolypeyet at hotmail.com Thu May 6 17:31:51 2004 From: oyozolypeyet at hotmail.com (Daily Saving) Date: Thu May 6 18:29:03 2004 Subject: [Python-checkins] Refinance-now even with bad-credit diamagneticbrownielacerta Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040506/f4c58036/attachment.html From rhettinger at users.sourceforge.net Fri May 7 01:50:38 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri May 7 01:52:02 2004 Subject: [Python-checkins] python/dist/src/Lib urlparse.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12376 Modified Files: urlparse.py Log Message: Revert last change. Index: urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urlparse.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** urlparse.py 6 May 2004 16:55:07 -0000 1.43 --- urlparse.py 7 May 2004 05:50:35 -0000 1.44 *************** *** 9,28 **** # A classification of schemes ('' means apply by default) ! uses_relative = set(['ftp', 'http', 'gopher', 'nntp', 'imap', 'wais', 'file', 'https', 'shttp', 'mms', ! 'prospero', 'rtsp', 'rtspu', '']) ! uses_netloc = set(['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', ! 'snews', 'prospero', 'rtsp', 'rtspu', '']) ! non_hierarchical = set(['gopher', 'hdl', 'mailto', 'news', ! 'telnet', 'wais', 'imap', 'snews', 'sip']) ! uses_params = set(['ftp', 'hdl', 'prospero', 'http', 'imap', 'https', 'shttp', 'rtsp', 'rtspu', 'sip', ! 'mms', '']) ! uses_query = set(['http', 'wais', 'imap', 'https', 'shttp', 'mms', ! 'gopher', 'rtsp', 'rtspu', 'sip', '']) ! uses_fragment = set(['ftp', 'hdl', 'http', 'gopher', 'news', 'nntp', 'wais', 'https', 'shttp', 'snews', ! 'file', 'prospero', '']) # Characters valid in scheme names --- 9,28 ---- # A classification of schemes ('' means apply by default) ! uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap', 'wais', 'file', 'https', 'shttp', 'mms', ! 'prospero', 'rtsp', 'rtspu', ''] ! uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', ! 'snews', 'prospero', 'rtsp', 'rtspu', ''] ! non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', ! 'telnet', 'wais', 'imap', 'snews', 'sip'] ! uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap', 'https', 'shttp', 'rtsp', 'rtspu', 'sip', ! 'mms', ''] ! uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms', ! 'gopher', 'rtsp', 'rtspu', 'sip', ''] ! uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news', 'nntp', 'wais', 'https', 'shttp', 'snews', ! 'file', 'prospero', ''] # Characters valid in scheme names From loewis at users.sourceforge.net Fri May 7 03:16:34 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri May 7 03:16:38 2004 Subject: [Python-checkins] python/dist/src/Lib sre_compile.py,1.49,1.49.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24226/Lib Modified Files: Tag: release23-maint sre_compile.py Log Message: Fix _sre.CODESIZE on 64-bit machines in UCS-4 mode. Fixes #931848. Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.49 retrieving revision 1.49.6.1 diff -C2 -d -r1.49 -r1.49.6.1 *** sre_compile.py 2 Jul 2003 21:37:16 -0000 1.49 --- sre_compile.py 7 May 2004 07:16:32 -0000 1.49.6.1 *************** *** 309,320 **** data = data + _mk_bitmap(chunk) header = [block] ! if MAXCODE == 65535: code = 'H' else: ! code = 'L' # Convert block indices to byte array of 256 bytes mapping = array.array('b', mapping).tostring() # Convert byte array to word array ! header = header + array.array(code, mapping).tolist() data[0:0] = header return [(BIGCHARSET, data)] --- 309,322 ---- data = data + _mk_bitmap(chunk) header = [block] ! if _sre.CODESIZE == 2: code = 'H' else: ! code = 'I' # Convert block indices to byte array of 256 bytes mapping = array.array('b', mapping).tostring() # Convert byte array to word array ! mapping = array.array(code, mapping) ! assert mapping.itemsize == _sre.CODESIZE ! header = header + mapping.tolist() data[0:0] = header return [(BIGCHARSET, data)] From loewis at users.sourceforge.net Fri May 7 03:16:36 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri May 7 03:16:42 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.105, 1.831.4.106 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24226/Misc Modified Files: Tag: release23-maint NEWS Log Message: Fix _sre.CODESIZE on 64-bit machines in UCS-4 mode. Fixes #931848. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.105 retrieving revision 1.831.4.106 diff -C2 -d -r1.831.4.105 -r1.831.4.106 *** NEWS 6 May 2004 02:22:23 -0000 1.831.4.105 --- NEWS 7 May 2004 07:16:32 -0000 1.831.4.106 *************** *** 43,46 **** --- 43,48 ---- ------- + - Bug #931848: Fix _sre.CODESIZE on 64-bit machines in UCS-4 mode. + - Bug #938076: Consider output encoding in XMLGenerator. From loewis at users.sourceforge.net Fri May 7 03:16:36 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri May 7 03:16:44 2004 Subject: [Python-checkins] python/dist/src/Modules sre.h,2.22,2.22.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24226/Modules Modified Files: Tag: release23-maint sre.h Log Message: Fix _sre.CODESIZE on 64-bit machines in UCS-4 mode. Fixes #931848. Index: sre.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/sre.h,v retrieving revision 2.22 retrieving revision 2.22.16.1 diff -C2 -d -r2.22 -r2.22.16.1 *** sre.h 18 Mar 2002 18:46:14 -0000 2.22 --- sre.h 7 May 2004 07:16:33 -0000 2.22.16.1 *************** *** 17,21 **** large enough to hold a Py_UNICODE character) */ #ifdef Py_UNICODE_WIDE ! #define SRE_CODE unsigned long #else #define SRE_CODE unsigned short --- 17,21 ---- large enough to hold a Py_UNICODE character) */ #ifdef Py_UNICODE_WIDE ! #define SRE_CODE Py_UCS4 #else #define SRE_CODE unsigned short From loewis at users.sourceforge.net Fri May 7 03:18:15 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri May 7 03:18:19 2004 Subject: [Python-checkins] python/dist/src/Lib sre_compile.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24486/Lib Modified Files: sre_compile.py Log Message: Fix _sre.CODESIZE on 64-bit machines in UCS-4 mode. Fixes #931848. Backported to 2.3. Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** sre_compile.py 27 Mar 2004 09:24:36 -0000 1.54 --- sre_compile.py 7 May 2004 07:18:12 -0000 1.55 *************** *** 334,345 **** data = data + _mk_bitmap(chunk) header = [block] ! if MAXCODE == 65535: code = 'H' else: ! code = 'L' # Convert block indices to byte array of 256 bytes mapping = array.array('b', mapping).tostring() # Convert byte array to word array ! header = header + array.array(code, mapping).tolist() data[0:0] = header return [(BIGCHARSET, data)] --- 334,347 ---- data = data + _mk_bitmap(chunk) header = [block] ! if _sre.CODESIZE == 2: code = 'H' else: ! code = 'I' # Convert block indices to byte array of 256 bytes mapping = array.array('b', mapping).tostring() # Convert byte array to word array ! mapping = array.array(code, mapping) ! assert mapping.itemsize == _sre.CODESIZE ! header = header + mapping.tolist() data[0:0] = header return [(BIGCHARSET, data)] From loewis at users.sourceforge.net Fri May 7 03:18:16 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri May 7 03:18:23 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_re.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24486/Lib/test Modified Files: test_re.py Log Message: Fix _sre.CODESIZE on 64-bit machines in UCS-4 mode. Fixes #931848. Backported to 2.3. Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** test_re.py 20 Apr 2004 21:30:07 -0000 1.48 --- test_re.py 7 May 2004 07:18:12 -0000 1.49 *************** *** 498,501 **** --- 498,510 ---- re.compile(eval("u'bug_926075'"))) + def test_bug_931848(self): + try: + unicode + except NameError: + pass + pattern = eval('u"[\u002E\u3002\uFF0E\uFF61]"') + self.assertEqual(re.compile(pattern).split("a.b.c"), + ['a','b','c']) + def run_re_tests(): from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR From loewis at users.sourceforge.net Fri May 7 03:18:16 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri May 7 03:18:25 2004 Subject: [Python-checkins] python/dist/src/Modules sre.h,2.24,2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24486/Modules Modified Files: sre.h Log Message: Fix _sre.CODESIZE on 64-bit machines in UCS-4 mode. Fixes #931848. Backported to 2.3. Index: sre.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/sre.h,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** sre.h 14 Feb 2004 00:31:13 -0000 2.24 --- sre.h 7 May 2004 07:18:13 -0000 2.25 *************** *** 17,21 **** large enough to hold a Py_UNICODE character) */ #ifdef Py_UNICODE_WIDE ! #define SRE_CODE unsigned long #else #define SRE_CODE unsigned short --- 17,21 ---- large enough to hold a Py_UNICODE character) */ #ifdef Py_UNICODE_WIDE ! #define SRE_CODE Py_UCS4 #else #define SRE_CODE unsigned short From ipheni at yahoo.com Fri May 7 11:28:57 2004 From: ipheni at yahoo.com (Clarice Neff) Date: Fri May 7 09:33:22 2004 Subject: [Python-checkins] (no subject) Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040507/be24ddb4/attachment.html From loewis at users.sourceforge.net Fri May 7 15:13:51 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri May 7 15:13:55 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.106, 1.831.4.107 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9762/Misc Modified Files: Tag: release23-maint NEWS Log Message: Record UnixWare 7.1.4 as broken. Fixes #929689. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.106 retrieving revision 1.831.4.107 diff -C2 -d -r1.831.4.106 -r1.831.4.107 *** NEWS 7 May 2004 07:16:32 -0000 1.831.4.106 --- NEWS 7 May 2004 19:13:47 -0000 1.831.4.107 *************** *** 79,82 **** --- 79,87 ---- of your Tcl/Tk and Python applications. + Build + ----- + + - Bug #929689: Don't define _XOPEN_SOURCE on UnixWare 7.1.4. + What's New in Python 2.3.3 (final)? From loewis at users.sourceforge.net Fri May 7 15:13:52 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri May 7 15:13:57 2004 Subject: [Python-checkins] python/dist/src configure, 1.416.4.13, 1.416.4.14 configure.in, 1.427.4.12, 1.427.4.13 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9762 Modified Files: Tag: release23-maint configure configure.in Log Message: Record UnixWare 7.1.4 as broken. Fixes #929689. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.416.4.13 retrieving revision 1.416.4.14 diff -C2 -d -r1.416.4.13 -r1.416.4.14 *** configure 14 Apr 2004 08:11:28 -0000 1.416.4.13 --- configure 7 May 2004 19:13:40 -0000 1.416.4.14 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.427.4.11 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.427.4.12 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.3. *************** *** 1447,1451 **** # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. ! OpenUNIX/8.0.0| UnixWare/7.1.[0-3]) define_xopen_source=no;; # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, --- 1447,1452 ---- # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. ! # Reconfirmed for 7.1.4 by Martin v. Loewis. ! OpenUNIX/8.0.0| UnixWare/7.1.[0-4]) define_xopen_source=no;; # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.427.4.12 retrieving revision 1.427.4.13 diff -C2 -d -r1.427.4.12 -r1.427.4.13 *** configure.in 14 Apr 2004 08:11:31 -0000 1.427.4.12 --- configure.in 7 May 2004 19:13:47 -0000 1.427.4.13 *************** *** 145,149 **** # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. ! OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-3@:>@) define_xopen_source=no;; # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, --- 145,150 ---- # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. ! # Reconfirmed for 7.1.4 by Martin v. Loewis. ! OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@) define_xopen_source=no;; # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, From loewis at users.sourceforge.net Fri May 7 15:14:27 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri May 7 15:14:30 2004 Subject: [Python-checkins] python/dist/src configure, 1.443, 1.444 configure.in, 1.454, 1.455 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10004 Modified Files: configure configure.in Log Message: Record UnixWare 7.1.4 as broken. Fixes #929689. Backported to 2.3. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.443 retrieving revision 1.444 diff -C2 -d -r1.443 -r1.444 *** configure 14 Apr 2004 07:55:28 -0000 1.443 --- configure 7 May 2004 19:14:14 -0000 1.444 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.453 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.4. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.454 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.4. *************** *** 1443,1447 **** # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. ! OpenUNIX/8.0.0| UnixWare/7.1.[0-3]) define_xopen_source=no;; # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, --- 1443,1447 ---- # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. ! OpenUNIX/8.0.0| UnixWare/7.1.[0-4]) define_xopen_source=no;; # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.454 retrieving revision 1.455 diff -C2 -d -r1.454 -r1.455 *** configure.in 14 Apr 2004 07:55:30 -0000 1.454 --- configure.in 7 May 2004 19:14:14 -0000 1.455 *************** *** 145,149 **** # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. ! OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-3@:>@) define_xopen_source=no;; # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, --- 145,150 ---- # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. ! # Reconfirmed for 7.1.4 by Martin v. Loewis. ! OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@) define_xopen_source=no;; # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, From nscikihel at art.com.br Fri May 7 21:56:19 2004 From: nscikihel at art.com.br (Megan Stokes) Date: Fri May 7 22:49:51 2004 Subject: [Python-checkins] get a diploma without going back to school Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040507/ff1349be/attachment.html From niemeyer at users.sourceforge.net Sat May 8 13:59:46 2004 From: niemeyer at users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sat May 8 13:59:51 2004 Subject: [Python-checkins] python/dist/src/Tools/freeze freeze.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15061 Modified Files: freeze.py Log Message: Small fixes in freeze.py. Index: freeze.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/freeze.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** freeze.py 26 May 2003 23:52:30 -0000 1.45 --- freeze.py 8 May 2004 17:59:43 -0000 1.46 *************** *** 229,233 **** config_c_in = os.path.join(prefix, 'Modules', 'config.c.in') frozenmain_c = os.path.join(prefix, 'Python', 'frozenmain.c') ! makefile_in = os.path.join(exec_prefix, 'Modules', 'Makefile') if win: frozendllmain_c = os.path.join(exec_prefix, 'Pc\\frozen_dllmain.c') --- 229,233 ---- config_c_in = os.path.join(prefix, 'Modules', 'config.c.in') frozenmain_c = os.path.join(prefix, 'Python', 'frozenmain.c') ! makefile_in = os.path.join(exec_prefix, 'Makefile') if win: frozendllmain_c = os.path.join(exec_prefix, 'Pc\\frozen_dllmain.c') *************** *** 462,467 **** if os.path.exists(makefile_in): makevars = parsesetup.getmakevars(makefile_in) ! for key in makevars.keys(): ! somevars[key] = makevars[key] somevars['CFLAGS'] = ' '.join(cflags) # override --- 462,467 ---- if os.path.exists(makefile_in): makevars = parsesetup.getmakevars(makefile_in) ! for key in makevars.keys(): ! somevars[key] = makevars[key] somevars['CFLAGS'] = ' '.join(cflags) # override From rhettinger at users.sourceforge.net Sat May 8 15:49:44 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 8 15:49:48 2004 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c, 1.32, 1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2267/Modules Modified Files: itertoolsmodule.c Log Message: SF #950057: itertools.chain doesn't "process" exceptions as they occur Both cycle() and chain() were handling exceptions only when switching input sources. The patch makes the handle more immediate. Will backport. Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** itertoolsmodule.c 13 Apr 2004 02:43:53 -0000 1.32 --- itertoolsmodule.c 8 May 2004 19:49:42 -0000 1.33 *************** *** 700,703 **** --- 700,709 ---- return item; } + if (PyErr_Occurred()) { + if (PyErr_ExceptionMatches(PyExc_StopIteration)) + PyErr_Clear(); + else + return NULL; + } if (PyList_Size(lz->saved) == 0) return NULL; *************** *** 1659,1662 **** --- 1665,1674 ---- if (item != NULL) return item; + if (PyErr_Occurred()) { + if (PyErr_ExceptionMatches(PyExc_StopIteration)) + PyErr_Clear(); + else + return NULL; + } lz->iternum++; } From rhettinger at users.sourceforge.net Sat May 8 15:49:45 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 8 15:49:51 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py, 1.29, 1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2267/Lib/test Modified Files: test_itertools.py Log Message: SF #950057: itertools.chain doesn't "process" exceptions as they occur Both cycle() and chain() were handling exceptions only when switching input sources. The patch makes the handle more immediate. Will backport. Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** test_itertools.py 10 Feb 2004 09:25:40 -0000 1.29 --- test_itertools.py 8 May 2004 19:49:42 -0000 1.30 *************** *** 645,648 **** --- 645,678 ---- + def test_sf_950057(self): + # Make sure that chain() and cycle() catch exceptions immediately + # rather than when shifting between input sources + + def gen1(): + hist.append(0) + yield 1 + hist.append(1) + assert False + hist.append(2) + + def gen2(x): + hist.append(3) + yield 2 + hist.append(4) + if x: + raise StopIteration + + hist = [] + self.assertRaises(AssertionError, list, chain(gen1(), gen2(False))) + self.assertEqual(hist, [0,1]) + + hist = [] + self.assertRaises(AssertionError, list, chain(gen1(), gen2(True))) + self.assertEqual(hist, [0,1]) + + hist = [] + self.assertRaises(AssertionError, list, cycle(gen1())) + self.assertEqual(hist, [0,1]) + libreftest = """ Doctest for examples in the library reference: libitertools.tex From rhettinger at users.sourceforge.net Sat May 8 15:52:42 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 8 15:52:46 2004 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c, 1.18.6.3, 1.18.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3285/Modules Modified Files: Tag: release23-maint itertoolsmodule.c Log Message: SF #950057: itertools.chain doesn't "process" exceptions as they occur Both cycle() and chain() were handling exceptions only when switching input sources. The patch makes the handle more immediate. Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.18.6.3 retrieving revision 1.18.6.4 diff -C2 -d -r1.18.6.3 -r1.18.6.4 *** itertoolsmodule.c 30 Aug 2003 22:14:46 -0000 1.18.6.3 --- itertoolsmodule.c 8 May 2004 19:52:39 -0000 1.18.6.4 *************** *** 95,98 **** --- 95,104 ---- return item; } + if (PyErr_Occurred()) { + if (PyErr_ExceptionMatches(PyExc_StopIteration)) + PyErr_Clear(); + else + return NULL; + } if (PyList_Size(lz->saved) == 0) return NULL; *************** *** 1050,1053 **** --- 1056,1065 ---- if (item != NULL) return item; + if (PyErr_Occurred()) { + if (PyErr_ExceptionMatches(PyExc_StopIteration)) + PyErr_Clear(); + else + return NULL; + } lz->iternum++; } From rhettinger at users.sourceforge.net Sat May 8 15:52:42 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 8 15:52:48 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py, 1.15.6.4, 1.15.6.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3285/Lib/test Modified Files: Tag: release23-maint test_itertools.py Log Message: SF #950057: itertools.chain doesn't "process" exceptions as they occur Both cycle() and chain() were handling exceptions only when switching input sources. The patch makes the handle more immediate. Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.15.6.4 retrieving revision 1.15.6.5 diff -C2 -d -r1.15.6.4 -r1.15.6.5 *** test_itertools.py 5 Oct 2003 23:05:55 -0000 1.15.6.4 --- test_itertools.py 8 May 2004 19:52:39 -0000 1.15.6.5 *************** *** 459,462 **** --- 459,492 ---- + def test_sf_950057(self): + # Make sure that chain() and cycle() catch exceptions immediately + # rather than when shifting between input sources + + def gen1(): + hist.append(0) + yield 1 + hist.append(1) + assert False + hist.append(2) + + def gen2(x): + hist.append(3) + yield 2 + hist.append(4) + if x: + raise StopIteration + + hist = [] + self.assertRaises(AssertionError, list, chain(gen1(), gen2(False))) + self.assertEqual(hist, [0,1]) + + hist = [] + self.assertRaises(AssertionError, list, chain(gen1(), gen2(True))) + self.assertEqual(hist, [0,1]) + + hist = [] + self.assertRaises(AssertionError, list, cycle(gen1())) + self.assertEqual(hist, [0,1]) + libreftest = """ Doctest for examples in the library reference: libitertools.tex From rhettinger at users.sourceforge.net Sat May 8 16:57:20 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 8 16:57:24 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.107, 1.831.4.108 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15451 Modified Files: Tag: release23-maint NEWS Log Message: SF #950057: itertools.chain doesn't "process" exceptions as they occur Both cycle() and chain() were handling exceptions only when switching input sources. The patch makes the handle more immediate. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.107 retrieving revision 1.831.4.108 diff -C2 -d -r1.831.4.107 -r1.831.4.108 *** NEWS 7 May 2004 19:13:47 -0000 1.831.4.107 --- NEWS 8 May 2004 20:57:16 -0000 1.831.4.108 *************** *** 43,46 **** --- 43,50 ---- ------- + - Bug #950057: itertools.chain() and itertools.cycle() now handle + exceptions immediately instead of waiting until the + input source is updated. + - Bug #931848: Fix _sre.CODESIZE on 64-bit machines in UCS-4 mode. From gvanrossum at users.sourceforge.net Sat May 8 19:20:56 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat May 8 19:21:01 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.108, 1.831.4.109 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7260 Modified Files: Tag: release23-maint NEWS Log Message: Mention changes to platform.py. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.108 retrieving revision 1.831.4.109 diff -C2 -d -r1.831.4.108 -r1.831.4.109 *** NEWS 8 May 2004 20:57:16 -0000 1.831.4.108 --- NEWS 8 May 2004 23:20:39 -0000 1.831.4.109 *************** *** 43,46 **** --- 43,49 ---- ------- + - Brought platform.py in line with the 2.4 version, fixing support for + newer Windows versions and a cache issue. + - Bug #950057: itertools.chain() and itertools.cycle() now handle exceptions immediately instead of waiting until the From rhettinger at users.sourceforge.net Sat May 8 21:15:03 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 8 21:15:07 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_deque.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24983/Lib/test Modified Files: test_deque.py Log Message: Add more examples. Index: test_deque.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_deque.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_deque.py 1 Mar 2004 23:16:21 -0000 1.7 --- test_deque.py 9 May 2004 01:15:01 -0000 1.8 *************** *** 475,478 **** --- 475,529 ---- deque(['c', 'b', 'a']) + + + + >>> def delete_nth(d, n): + ... "del d[n]" + ... d.rotate(-n) + ... d.popleft() + ... d.rotate(n) + ... + >>> d = deque('abcdef') + >>> delete_nth(d, 2) # remove the entry at d[2] + >>> d + deque(['a', 'b', 'd', 'e', 'f']) + + + + >>> def roundrobin(*iterables): + ... pending = deque(iter(i) for i in iterables) + ... while pending: + ... task = pending.popleft() + ... try: + ... yield task.next() + ... except StopIteration: + ... continue + ... pending.append(task) + ... + + >>> for value in roundrobin('abc', 'd', 'efgh'): + ... print value + ... + a + d + e + b + f + c + g + h + + + >>> def maketree(iterable): + ... d = deque(iterable) + ... while len(d) > 1: + ... pair = [d.popleft(), d.popleft()] + ... d.append(pair) + ... return list(d) + ... + >>> print maketree('abcdefgh') + [[[['a', 'b'], ['c', 'd']], [['e', 'f'], ['g', 'h']]]] + + """ From rhettinger at users.sourceforge.net Sat May 8 21:15:03 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 8 21:15:09 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcollections.tex, 1.7, 1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24983/Doc/lib Modified Files: libcollections.tex Log Message: Add more examples. Index: libcollections.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcollections.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** libcollections.tex 30 Apr 2004 22:52:50 -0000 1.7 --- libcollections.tex 9 May 2004 01:15:00 -0000 1.8 *************** *** 131,134 **** --- 131,163 ---- \end{verbatim} + \subsection{Recipes \label{deque-recipes}} + + This section shows various approaches to working with deques. + + The \method{rotate()} method provides a way to implement \class{deque} + slicing and deletion: + + \begin{verbatim} + def delete_nth(d, n): + "del d[n]" + d.rotate(-n) + d.popleft() + d.rotate(n) + + >>> d = deque('abcdef') + >>> delete_nth(d, 2) # remove the entry at d[2] + >>> d + deque(['a', 'b', 'd', 'e', 'f']) + + \end{verbatim} + + For slicing, the idea is the same. Use \method{rotate()} to bring a target + element to the left side of the deque. Remove old entries with + \method{popleft()}, add new entries with \method{extend()}, and then + reverse the rotation. + + With minor variations on that approach, it is easy to implement Forth style + stack manipulations such as \code{dup}, \code{drop}, \code{swap}, \code{over}, + \code{pick}, \code{rot}, and \code{roll}. A roundrobin task server can be built from a \class{deque} using *************** *** 148,152 **** >>> for value in roundrobin('abc', 'd', 'efgh'): ! print value a --- 177,181 ---- >>> for value in roundrobin('abc', 'd', 'efgh'): ! ... print value a *************** *** 160,161 **** --- 189,212 ---- \end{verbatim} + + + Multi-pass data reduction algorithms can be succinctly expressed and + efficiently coded by extracting elements using multiple calls to + \method{popleft()}, applying the reduction function, and using + \method{append()} for adding the result back to the queue. + + For example, building a balanced binary tree of nested lists entails + reducing two adjacent nodes into one by grouping them in a list: + + \begin{verbatim} + def maketree(iterable): + d = deque(iterable) + while len(d) > 1: + pair = [d.popleft(), d.popleft()] + d.append(pair) + return list(d) + + >>> print maketree('abcdefgh') + [[[['a', 'b'], ['c', 'd']], [['e', 'f'], ['g', 'h']]]] + + \end{verbatim} From ptj019 at npd.ufpe.br Sun May 9 04:33:54 2004 From: ptj019 at npd.ufpe.br (Christa Groves) Date: Sat May 8 21:41:17 2004 Subject: [Python-checkins] Tdental products, ag kitfx Message-ID: <17-2349b$9-n342$$27$3-p$14@y831f> NOTE: BONUS OFFER BELOW. `The best reference I`ve used to communicate with dentists``, Bob Frankford -- President, KY dental products. The new edition of The American Directory of Dentists is out!!!! (New Dentist directory, dental practice, dental labs, cosmetic dentists, DDO, dental care directory, directory of dentists, dentist CD, dentist lists, orthodontists, periodontology, oral surgeons, dental lists, tooth decay, dental products, gum disease, oral health, genral practice, dental directory.) >From our previous customer feedback, this directory is found to be the leading source of dentist reference in the United States. It is used by professionals and industry business development executives who must communicate with dentists in an efficient and timely manner.. The American Directory of Dentists contains relevant data on over 200,000 dentists in the United States. Each record is indexed by such features as name, address, phone/fax, county, year licensed, type of practice, type of dentist as well as specialty. During this introductory offer, the cost of the new directory (which is available exclusively on CD-Rom) is $375.00 (reg. $795). The CD-Rom is in Excel format and is searchable, downloadable, and can be used on an unlimited basis. To order the American Directory of Dentists, please print this e-mail, complete the information below and fax it to 905-751-0199. (tel: 905-751-0919). BONUS OFFER: ORDER NOW AND RECEIVE THE AMERICAN DIRECTORY OF DOCTORS ON CD-ROM FREE OF CHARGE ($845 value).. NAME: TITLE: ORGANIZATION: ADDRESS: CITY: POSTAL: TEL: FAX: E-MAIL: InfoSource Group of Companies is a leading information publishing firm. frhdmnau q faiinlbr qlca From bwarsaw at users.sourceforge.net Sat May 8 23:16:05 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:16:09 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.53, 1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9272 Modified Files: test_email.py Log Message: A bunch of new tests, and updated tests for the email 3.0 FeedParser. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** test_email.py 20 Mar 2004 20:29:50 -0000 1.53 --- test_email.py 9 May 2004 03:16:03 -0000 1.54 *************** *** 1,3 **** ! # Copyright (C) 2001,2002,2003 Python Software Foundation # email package unit tests --- 1,3 ---- ! # Copyright (C) 2001-2004 Python Software Foundation # email package unit tests *************** *** 10,14 **** import warnings from cStringIO import StringIO - from types import StringType, ListType import email --- 10,13 ---- *************** *** 43,52 **** warnings.filterwarnings('ignore', '', DeprecationWarning, __name__) - try: - True, False - except NameError: - True = 1 - False = 0 - --- 42,45 ---- *************** *** 1101,1105 **** unless(not m1.is_multipart()) ! def test_no_parts_in_a_multipart(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' --- 1094,1132 ---- unless(not m1.is_multipart()) ! def test_empty_multipart_idempotent(self): ! text = """\ ! Content-Type: multipart/mixed; boundary="BOUNDARY" ! MIME-Version: 1.0 ! Subject: A subject ! To: aperson@dom.ain ! From: bperson@dom.ain ! ! ! --BOUNDARY ! ! ! --BOUNDARY-- ! """ ! msg = Parser().parsestr(text) ! self.ndiffAssertEqual(text, msg.as_string()) ! ! def test_no_parts_in_a_multipart_with_none_epilogue(self): ! outer = MIMEBase('multipart', 'mixed') ! outer['Subject'] = 'A subject' ! outer['To'] = 'aperson@dom.ain' ! outer['From'] = 'bperson@dom.ain' ! outer.set_boundary('BOUNDARY') ! self.ndiffAssertEqual(outer.as_string(), '''\ ! Content-Type: multipart/mixed; boundary="BOUNDARY" ! MIME-Version: 1.0 ! Subject: A subject ! To: aperson@dom.ain ! From: bperson@dom.ain ! ! --BOUNDARY ! ! --BOUNDARY--''') ! ! def test_no_parts_in_a_multipart_with_empty_epilogue(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' *************** *** 1109,1114 **** outer.epilogue = '' outer.set_boundary('BOUNDARY') ! msg = MIMEText('hello world') ! self.assertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 --- 1136,1140 ---- outer.epilogue = '' outer.set_boundary('BOUNDARY') ! self.ndiffAssertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 *************** *** 1117,1122 **** From: bperson@dom.ain - --BOUNDARY --BOUNDARY-- --- 1143,1148 ---- From: bperson@dom.ain + --BOUNDARY --BOUNDARY-- *************** *** 1129,1137 **** outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' outer.preamble = '' ! outer.epilogue = '' outer.set_boundary('BOUNDARY') msg = MIMEText('hello world') outer.attach(msg) eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" --- 1155,1265 ---- outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' + outer.set_boundary('BOUNDARY') + msg = MIMEText('hello world') + outer.attach(msg) + eq(outer.as_string(), '''\ + Content-Type: multipart/mixed; boundary="BOUNDARY" + MIME-Version: 1.0 + Subject: A subject + To: aperson@dom.ain + From: bperson@dom.ain + + --BOUNDARY + Content-Type: text/plain; charset="us-ascii" + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + + hello world + --BOUNDARY--''') + + def test_seq_parts_in_a_multipart_with_empty_preamble(self): + eq = self.ndiffAssertEqual + outer = MIMEBase('multipart', 'mixed') + outer['Subject'] = 'A subject' + outer['To'] = 'aperson@dom.ain' + outer['From'] = 'bperson@dom.ain' outer.preamble = '' ! msg = MIMEText('hello world') ! outer.attach(msg) ! outer.set_boundary('BOUNDARY') ! eq(outer.as_string(), '''\ ! Content-Type: multipart/mixed; boundary="BOUNDARY" ! MIME-Version: 1.0 ! Subject: A subject ! To: aperson@dom.ain ! From: bperson@dom.ain ! ! ! --BOUNDARY ! Content-Type: text/plain; charset="us-ascii" ! MIME-Version: 1.0 ! Content-Transfer-Encoding: 7bit ! ! hello world ! --BOUNDARY--''') ! ! ! def test_seq_parts_in_a_multipart_with_none_preamble(self): ! eq = self.ndiffAssertEqual ! outer = MIMEBase('multipart', 'mixed') ! outer['Subject'] = 'A subject' ! outer['To'] = 'aperson@dom.ain' ! outer['From'] = 'bperson@dom.ain' ! outer.preamble = None ! msg = MIMEText('hello world') ! outer.attach(msg) ! outer.set_boundary('BOUNDARY') ! eq(outer.as_string(), '''\ ! Content-Type: multipart/mixed; boundary="BOUNDARY" ! MIME-Version: 1.0 ! Subject: A subject ! To: aperson@dom.ain ! From: bperson@dom.ain ! ! --BOUNDARY ! Content-Type: text/plain; charset="us-ascii" ! MIME-Version: 1.0 ! Content-Transfer-Encoding: 7bit ! ! hello world ! --BOUNDARY--''') ! ! ! def test_seq_parts_in_a_multipart_with_none_epilogue(self): ! eq = self.ndiffAssertEqual ! outer = MIMEBase('multipart', 'mixed') ! outer['Subject'] = 'A subject' ! outer['To'] = 'aperson@dom.ain' ! outer['From'] = 'bperson@dom.ain' ! outer.epilogue = None ! msg = MIMEText('hello world') ! outer.attach(msg) outer.set_boundary('BOUNDARY') + eq(outer.as_string(), '''\ + Content-Type: multipart/mixed; boundary="BOUNDARY" + MIME-Version: 1.0 + Subject: A subject + To: aperson@dom.ain + From: bperson@dom.ain + + --BOUNDARY + Content-Type: text/plain; charset="us-ascii" + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + + hello world + --BOUNDARY--''') + + + def test_seq_parts_in_a_multipart_with_empty_epilogue(self): + eq = self.ndiffAssertEqual + outer = MIMEBase('multipart', 'mixed') + outer['Subject'] = 'A subject' + outer['To'] = 'aperson@dom.ain' + outer['From'] = 'bperson@dom.ain' + outer.epilogue = '' msg = MIMEText('hello world') outer.attach(msg) + outer.set_boundary('BOUNDARY') eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" *************** *** 1150,1154 **** ''') ! def test_seq_parts_in_a_multipart(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') --- 1278,1283 ---- ''') ! ! def test_seq_parts_in_a_multipart_with_nl_epilogue(self): eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') *************** *** 1156,1161 **** outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' ! outer.preamble = '' ! outer.epilogue = '' msg = MIMEText('hello world') outer.attach(msg) --- 1285,1289 ---- outer['To'] = 'aperson@dom.ain' outer['From'] = 'bperson@dom.ain' ! outer.epilogue = '\n' msg = MIMEText('hello world') outer.attach(msg) *************** *** 1175,1178 **** --- 1303,1307 ---- hello world --BOUNDARY-- + ''') *************** *** 1188,1210 **** eq(msg.get_subtype(), None) ! ## XXX: No longer fails with the new parser. Should it ? ! ## def test_bogus_boundary(self): ! ## fp = openfile(findfile('msg_15.txt')) ! ## try: ! ## data = fp.read() ! ## finally: ! ## fp.close() ! ## p = Parser(strict=True) ! ## # Note, under a future non-strict parsing mode, this would parse the ! ## # message into the intended message tree. ! ## self.assertRaises(Errors.BoundaryError, p.parsestr, data) def test_multipart_no_boundary(self): ! fp = openfile(findfile('msg_25.txt')) ! try: ! self.assertRaises(Errors.BoundaryError, ! email.message_from_file, fp) ! finally: ! fp.close() def test_invalid_content_type(self): --- 1317,1335 ---- eq(msg.get_subtype(), None) ! def test_same_boundary_inner_outer(self): ! unless = self.failUnless ! msg = self._msgobj('msg_15.txt') ! # XXX We can probably eventually do better ! inner = msg.get_payload(0) ! unless(hasattr(inner, 'defects')) ! self.assertEqual(len(inner.defects), 1) ! unless(isinstance(inner.defects[0], Errors.StartBoundaryNotFound)) def test_multipart_no_boundary(self): ! unless = self.failUnless ! msg = self._msgobj('msg_25.txt') ! unless(isinstance(msg.get_payload(), str)) ! self.assertEqual(len(msg.defects), 1) ! unless(isinstance(msg.defects[0], Errors.NoBoundaryInMultipart)) def test_invalid_content_type(self): *************** *** 1246,1265 **** """) ! ## XXX: No longer fails with the new parser. Should it ? ! ## def test_no_separating_blank_line(self): ! ## eq = self.ndiffAssertEqual ! ## msg = self._msgobj('msg_35.txt') ! ## eq(msg.as_string(), """\ ! ## From: aperson@dom.ain ! ## To: bperson@dom.ain ! ## Subject: here's something interesting ! ## ! ## counter to RFC 2822, there's no separating newline here ! ## """) ! ## # strict=True should raise an exception ! ## self.assertRaises(Errors.HeaderParseError, ! ## self._msgobj, 'msg_35.txt', True) ! ## ! ## # Test RFC 2047 header encoding and decoding --- 1371,1386 ---- """) ! def test_no_separating_blank_line(self): ! eq = self.ndiffAssertEqual ! msg = self._msgobj('msg_35.txt') ! eq(msg.as_string(), """\ ! From: aperson@dom.ain ! To: bperson@dom.ain ! Subject: here's something interesting ! ! counter to RFC 2822, there's no separating newline here ! """) ! ! # Test RFC 2047 header encoding and decoding *************** *** 1352,1356 **** eq(r.get_type(), 'message/rfc822') payload = r.get_payload() ! unless(type(payload), ListType) eq(len(payload), 1) subpart = payload[0] --- 1473,1477 ---- eq(r.get_type(), 'message/rfc822') payload = r.get_payload() ! unless(isinstance(payload, list)) eq(len(payload), 1) subpart = payload[0] *************** *** 1393,1397 **** eq(msg.get_type(), 'message/rfc822') payload = msg.get_payload() ! unless(isinstance(payload, ListType)) eq(len(payload), 1) submsg = payload[0] --- 1514,1518 ---- eq(msg.get_type(), 'message/rfc822') payload = msg.get_payload() ! unless(isinstance(payload, list)) eq(len(payload), 1) submsg = payload[0] *************** *** 1450,1454 **** eq(subpart.get_type(), 'message/rfc822') payload = subpart.get_payload() ! unless(isinstance(payload, ListType)) eq(len(payload), 1) subsubpart = payload[0] --- 1571,1575 ---- eq(subpart.get_type(), 'message/rfc822') payload = subpart.get_payload() ! unless(isinstance(payload, list)) eq(len(payload), 1) subsubpart = payload[0] *************** *** 1469,1473 **** msg['To'] = 'bperson@dom.ain' msg['Subject'] = 'Test' ! msg.preamble = 'MIME message\n' msg.epilogue = 'End of MIME message\n' msg1 = MIMEText('One') --- 1590,1594 ---- msg['To'] = 'bperson@dom.ain' msg['Subject'] = 'Test' ! msg.preamble = 'MIME message' msg.epilogue = 'End of MIME message\n' msg1 = MIMEText('One') *************** *** 1561,1565 **** # Set up container container = MIMEMultipart('digest', 'BOUNDARY') ! container.epilogue = '\n' # Set up subparts subpart1a = MIMEText('message 1\n') --- 1682,1686 ---- # Set up container container = MIMEMultipart('digest', 'BOUNDARY') ! container.epilogue = '' # Set up subparts subpart1a = MIMEText('message 1\n') *************** *** 1730,1733 **** --- 1851,1858 ---- self._idempotent(msg, text) + def test_nested_multipart_mixeds(self): + msg, text = self._msgobj('msg_12a.txt') + self._idempotent(msg, text) + def test_content_type(self): eq = self.assertEquals *************** *** 1742,1747 **** eq(params['report-type'], 'delivery-status') eq(params['boundary'], 'D1690A7AC1.996856090/mail.example.com') ! eq(msg.preamble, 'This is a MIME-encapsulated message.\n\n') ! eq(msg.epilogue, '\n\n') eq(len(msg.get_payload()), 3) # Make sure the subparts are what we expect --- 1867,1872 ---- eq(params['report-type'], 'delivery-status') eq(params['boundary'], 'D1690A7AC1.996856090/mail.example.com') ! eq(msg.preamble, 'This is a MIME-encapsulated message.\n') ! eq(msg.epilogue, '\n') eq(len(msg.get_payload()), 3) # Make sure the subparts are what we expect *************** *** 1756,1760 **** self.failUnless(isinstance(msg3, Message)) payload = msg3.get_payload() ! unless(isinstance(payload, ListType)) eq(len(payload), 1) msg4 = payload[0] --- 1881,1885 ---- self.failUnless(isinstance(msg3, Message)) payload = msg3.get_payload() ! unless(isinstance(payload, list)) eq(len(payload), 1) msg4 = payload[0] *************** *** 1771,1780 **** # that submessage has a type of text/plain payload = msg.get_payload() ! unless(isinstance(payload, ListType)) eq(len(payload), 1) msg1 = payload[0] self.failUnless(isinstance(msg1, Message)) eq(msg1.get_type(), 'text/plain') ! self.failUnless(isinstance(msg1.get_payload(), StringType)) eq(msg1.get_payload(), '\n') --- 1896,1905 ---- # that submessage has a type of text/plain payload = msg.get_payload() ! unless(isinstance(payload, list)) eq(len(payload), 1) msg1 = payload[0] self.failUnless(isinstance(msg1, Message)) eq(msg1.get_type(), 'text/plain') ! self.failUnless(isinstance(msg1.get_payload(), str)) eq(msg1.get_payload(), '\n') *************** *** 2028,2031 **** --- 2153,2157 ---- def test_body_line_iterator(self): eq = self.assertEqual + neq = self.ndiffAssertEqual # First a simple non-multipart message msg = self._msgobj('msg_01.txt') *************** *** 2033,2037 **** lines = list(it) eq(len(lines), 6) ! eq(EMPTYSTRING.join(lines), msg.get_payload()) # Now a more complicated multipart msg = self._msgobj('msg_02.txt') --- 2159,2163 ---- lines = list(it) eq(len(lines), 6) ! neq(EMPTYSTRING.join(lines), msg.get_payload()) # Now a more complicated multipart msg = self._msgobj('msg_02.txt') *************** *** 2041,2045 **** fp = openfile('msg_19.txt') try: ! eq(EMPTYSTRING.join(lines), fp.read()) finally: fp.close() --- 2167,2171 ---- fp = openfile('msg_19.txt') try: ! neq(EMPTYSTRING.join(lines), fp.read()) finally: fp.close() *************** *** 2095,2100 **** eq(msg['to'], 'ppp@zzz.org') eq(msg.get_type(), 'multipart/mixed') ! eq(msg.is_multipart(), 0) ! self.failUnless(isinstance(msg.get_payload(), StringType)) def test_whitespace_continuaton(self): --- 2221,2226 ---- eq(msg['to'], 'ppp@zzz.org') eq(msg.get_type(), 'multipart/mixed') ! self.failIf(msg.is_multipart()) ! self.failUnless(isinstance(msg.get_payload(), str)) def test_whitespace_continuaton(self): From bwarsaw at users.sourceforge.net Sat May 8 23:17:32 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:17:35 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_12a.txt, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9566 Added Files: msg_12a.txt Log Message: Like msg_12.txt but with some extra vertical whitespace around the inner message's end boundary. --- NEW FILE: msg_12a.txt --- MIME-Version: 1.0 From: Barry Warsaw To: Dingus Lovers Subject: Lyrics Date: Fri, 20 Apr 2001 19:35:02 -0400 Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY Content-Type: text/plain; charset="us-ascii" --BOUNDARY Content-Type: text/html; charset="iso-8859-1" --BOUNDARY Content-Type: multipart/mixed; boundary="ANOTHER" --ANOTHER Content-Type: text/plain; charset="iso-8859-2" --ANOTHER Content-Type: text/plain; charset="iso-8859-3" --ANOTHER-- --BOUNDARY Content-Type: text/plain; charset="us-ascii" --BOUNDARY Content-Type: text/plain; charset="koi8-r" --BOUNDARY-- From bwarsaw at users.sourceforge.net Sat May 8 23:24:45 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:24:49 2004 Subject: [Python-checkins] python/dist/src/Lib/email Charset.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10504 Modified Files: Charset.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud. Index: Charset.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Charset.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Charset.py 30 Dec 2003 16:52:25 -0000 1.14 --- Charset.py 9 May 2004 03:24:43 -0000 1.15 *************** *** 1,4 **** ! # Copyright (C) 2001,2002 Python Software Foundation ! # Author: che@debian.org (Ben Gertzfield), barry@zope.com (Barry Warsaw) # Python 2.3 doesn't come with any Asian codecs by default. Two packages are --- 1,6 ---- ! # Copyright (C) 2001-2004 Python Software Foundation ! # Author: che@debian.org (Ben Gertzfield), barry@python.org (Barry Warsaw) ! ! # XXX The following information needs updating. # Python 2.3 doesn't come with any Asian codecs by default. Two packages are *************** *** 13,30 **** # Some Japanese users prefer this codec package - from types import UnicodeType - from email.Encoders import encode_7or8bit import email.base64MIME import email.quopriMIME ! ! def _isunicode(s): ! return isinstance(s, UnicodeType) ! ! # Python 2.2.1 and beyond has these symbols ! try: ! True, False ! except NameError: ! True = 1 ! False = 0 --- 15,21 ---- # Some Japanese users prefer this codec package import email.base64MIME import email.quopriMIME ! from email.Encoders import encode_7or8bit *************** *** 281,285 **** with the Unicode replacement character U+FFFD. """ ! if _isunicode(s) or self.input_codec is None: return s try: --- 272,276 ---- with the Unicode replacement character U+FFFD. """ ! if isinstance(s, unicode) or self.input_codec is None: return s try: *************** *** 307,311 **** else: codec = self.input_codec ! if not _isunicode(ustr) or codec is None: return ustr try: --- 298,302 ---- else: codec = self.input_codec ! if not isinstance(ustr, unicode) or codec is None: return ustr try: From bwarsaw at users.sourceforge.net Sat May 8 23:26:10 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:26:13 2004 Subject: [Python-checkins] python/dist/src/Lib/email Errors.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10677 Modified Files: Errors.py Log Message: Add MessageDefect and subclasses. Index: Errors.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Errors.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Errors.py 1 Jun 2002 05:45:37 -0000 1.5 --- Errors.py 9 May 2004 03:26:07 -0000 1.6 *************** *** 1,7 **** ! # Copyright (C) 2001,2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) ! """email package exception classes. ! """ --- 1,6 ---- ! # Copyright (C) 2001-2004 Python Software Foundation ! # Author: barry@python.org (Barry Warsaw) ! """email package exception classes.""" *************** *** 25,26 **** --- 24,49 ---- class MultipartConversionError(MessageError, TypeError): """Conversion to a multipart is prohibited.""" + + + + # These are parsing defects which the parser was able to work around. + class MessageDefect: + """Base class for a message defect.""" + + def __init__(self, line=None): + self.line = line + + class NoBoundaryInMultipart(MessageDefect): + """A message claimed to be a multipart but had no boundary parameter.""" + + class StartBoundaryNotFound(MessageDefect): + """The claimed start boundary was never found.""" + + class FirstHeaderLineIsContinuation(MessageDefect): + """A message had a continuation line as its first header line.""" + + class MisplacedEnvelopeHeader(MessageDefect): + """A 'Unix-from' header was found in the middle of a header block.""" + + class MalformedHeader(MessageDefect): + """Found a header that was missing a colon, or was otherwise malformed""" From bwarsaw at users.sourceforge.net Sat May 8 23:29:25 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:29:31 2004 Subject: [Python-checkins] python/dist/src/Lib/email FeedParser.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11011/Lib/email Modified Files: FeedParser.py Log Message: An updated FeedParser that should be RFC complaint, passes all existing (standard) tests, and doesn't throw parse errors. I still need throw Anthony's torture test at it, but I wanted to get this checked in and off my disk. Index: FeedParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FeedParser.py 22 Mar 2004 00:33:28 -0000 1.1 --- FeedParser.py 9 May 2004 03:29:23 -0000 1.2 *************** *** 1,9 **** ! # A new Feed-style Parser - from email import Errors, Message import re NLCRE = re.compile('\r\n|\r|\n') ! EMPTYSTRING = '' NL = '\n' --- 1,31 ---- ! # Copyright (C) 2004 Python Software Foundation ! # Authors: Baxter, Wouters and Warsaw ! ! """FeedParser - An email feed parser. ! ! The feed parser implements an interface for incrementally parsing an email ! message, line by line. This has advantages for certain applications, such as ! those reading email messages off a socket. ! ! FeedParser.feed() is the primary interface for pushing new data into the ! parser. It returns when there's nothing more it can do with the available ! data. When you have no more data to push into the parser, call .close(). ! This completes the parsing and returns the root message object. ! ! The other advantage of this parser is that it will never throw a parsing ! exception. Instead, when it finds something unexpected, it adds a 'defect' to ! the current message. Defects are just instances that live on the message ! object's .defect attribute. ! """ import re + from email import Errors + from email import Message NLCRE = re.compile('\r\n|\r|\n') ! NLCRE_bol = re.compile('(\r\n|\r|\n)') ! NLCRE_eol = re.compile('(\r\n|\r|\n)$') ! NLCRE_crack = re.compile('(\r\n|\r|\n)') ! headerRE = re.compile(r'^(From |[-\w]{2,}:|[\t ])') EMPTYSTRING = '' NL = '\n' *************** *** 11,118 **** NeedMoreData = object() - class FeedableLumpOfText: - "A file-like object that can have new data loaded into it" def __init__(self): self._partial = '' ! self._done = False ! # _pending is a list of lines, in reverse order ! self._pending = [] ! def readline(self): ! """ Return a line of data. ! If data has been pushed back with unreadline(), the most recently ! returned unreadline()d data will be returned. ! """ ! if not self._pending: ! if self._done: ! return '' ! return NeedMoreData ! return self._pending.pop() ! def unreadline(self, line): ! """ Push a line back into the object. ! """ ! self._pending.append(line) ! def peekline(self): ! """ Non-destructively look at the next line """ ! if not self._pending: ! if self._done: return '' return NeedMoreData ! return self._pending[-1] ! ! ! # for r in self._input.readuntil(regexp): ! # if r is NeedMoreData: ! # yield NeedMoreData ! # preamble, matchobj = r ! def readuntil(self, matchre, afterblank=False, includematch=False): ! """ Read a line at a time until we get the specified RE. ! ! Returns the text up to (and including, if includematch is true) the ! matched text, and the RE match object. If afterblank is true, ! there must be a blank line before the matched text. Moves current ! filepointer to the line following the matched line. If we reach ! end-of-file, return what we've got so far, and return None as the ! RE match object. ! """ ! prematch = [] ! blankseen = 0 ! while 1: ! if not self._pending: ! if self._done: ! # end of file ! yield EMPTYSTRING.join(prematch), None ! else: ! yield NeedMoreData ! continue ! line = self._pending.pop() ! if afterblank: ! if NLCRE.match(line): ! blankseen = 1 ! continue ! else: ! blankseen = 0 ! m = matchre.match(line) ! if (m and not afterblank) or (m and afterblank and blankseen): ! if includematch: ! prematch.append(line) ! yield EMPTYSTRING.join(prematch), m ! prematch.append(line) ! ! NLatend = re.compile('(\r\n|\r|\n)$').match ! NLCRE_crack = re.compile('(\r\n|\r|\n)') def push(self, data): ! """ Push some new data into this object """ # Handle any previous leftovers ! data, self._partial = self._partial+data, '' ! # Crack into lines, but leave the newlines on the end of each ! lines = self.NLCRE_crack.split(data) ! # The *ahem* interesting behaviour of re.split when supplied ! # groups means that the last element is the data after the ! # final RE. In the case of a NL/CR terminated string, this is ! # the empty string. ! self._partial = lines.pop() ! o = [] ! for i in range(len(lines) / 2): ! o.append(EMPTYSTRING.join([lines[i*2], lines[i*2+1]])) ! self.pushlines(o) ! ! def pushlines(self, lines): ! """ Push a list of new lines into the object """ ! # Reverse and insert at the front of _pending ! self._pending[:0] = lines[::-1] ! def end(self): ! """ There is no more data """ ! self._done = True ! def is_done(self): ! return self._done def __iter__(self): --- 33,112 ---- NeedMoreData = object() + + class BufferedSubFile(object): + """A file-ish object that can have new data loaded into it. + + You can also push and pop line-matching predicates onto a stack. When the + current predicate matches the current line, a false EOF response + (i.e. empty string) is returned instead. This lets the parser adhere to a + simple abstraction -- it parses until EOF closes the current message. + """ def __init__(self): + # The last partial line pushed into this object. self._partial = '' ! # The list of full, pushed lines, in reverse order ! self._lines = [] ! # The stack of false-EOF checking predicates. ! self._eofstack = [] ! # A flag indicating whether the file has been closed or not. ! self._closed = False ! def push_eof_matcher(self, pred): ! self._eofstack.append(pred) ! def pop_eof_matcher(self): ! return self._eofstack.pop() ! def close(self): ! # Don't forget any trailing partial line. ! self._lines.append(self._partial) ! self._closed = True ! def readline(self): ! if not self._lines: ! if self._closed: return '' return NeedMoreData ! # Pop the line off the stack and see if it matches the current ! # false-EOF predicate. ! line = self._lines.pop() ! if self._eofstack: ! matches = self._eofstack[-1] ! if matches(line): ! # We're at the false EOF. But push the last line back first. ! self._lines.append(line) ! return '' ! return line ! def unreadline(self, line): ! # Let the consumer push a line back into the buffer. ! self._lines.append(line) def push(self, data): ! """Push some new data into this object.""" # Handle any previous leftovers ! data, self._partial = self._partial + data, '' ! # Crack into lines, but preserve the newlines on the end of each ! parts = NLCRE_crack.split(data) ! # The *ahem* interesting behaviour of re.split when supplied grouping ! # parentheses is that the last element of the resulting list is the ! # data after the final RE. In the case of a NL/CR terminated string, ! # this is the empty string. ! self._partial = parts.pop() ! # parts is a list of strings, alternating between the line contents ! # and the eol character(s). Gather up a list of lines after ! # re-attaching the newlines. ! lines = [] ! for i in range(len(parts) / 2): ! lines.append(parts[i*2] + parts[i*2+1]) ! self.pushlines(lines) ! def pushlines(self, lines): ! # Reverse and insert at the front of the lines. ! self._lines[:0] = lines[::-1] ! def is_closed(self): ! return self._closed def __iter__(self): *************** *** 120,145 **** def next(self): ! l = self.readline() ! if l == '': raise StopIteration ! return l class FeedParser: ! "A feed-style parser of email. copy docstring here" ! def __init__(self, _class=Message.Message): ! "fnord fnord fnord" ! self._class = _class ! self._input = FeedableLumpOfText() ! self._root = None ! self._objectstack = [] self._parse = self._parsegen().next ! def end(self): ! self._input.end() ! self._call_parse() ! return self._root def feed(self, data): self._input.push(data) self._call_parse() --- 114,143 ---- def next(self): ! line = self.readline() ! if line == '': raise StopIteration ! return line ! + class FeedParser: ! """A feed-style parser of email.""" ! def __init__(self, _factory=Message.Message): ! """_factory is called with no arguments to create a new message obj""" ! self._factory = _factory ! self._input = BufferedSubFile() ! self._msgstack = [] self._parse = self._parsegen().next + self._cur = None + self._last = None + self._headersonly = False ! # Non-public interface for supporting Parser's headersonly flag ! def _set_headersonly(self): ! self._headersonly = True def feed(self, data): + """Push more data into the parser.""" self._input.push(data) self._call_parse() *************** *** 151,362 **** pass ! headerRE = re.compile(r'^(From |[-\w]{2,}:|[\t ])') ! def _parse_headers(self,headerlist): ! # Passed a list of strings that are the headers for the ! # current object ! lastheader = '' ! lastvalue = [] ! for lineno, line in enumerate(headerlist): # Check for continuation if line[0] in ' \t': if not lastheader: ! raise Errors.HeaderParseError('First line must not be a continuation') lastvalue.append(line) continue - if lastheader: # XXX reconsider the joining of folded lines ! self._cur[lastheader] = EMPTYSTRING.join(lastvalue).rstrip() lastheader, lastvalue = '', [] ! ! # Check for Unix-From if line.startswith('From '): if lineno == 0: self._cur.set_unixfrom(line) continue ! elif lineno == len(headerlist) - 1: # Something looking like a unix-from at the end - it's ! # probably the first line of the body self._input.unreadline(line) return else: ! # Weirdly placed unix-from line. Ignore it. continue ! i = line.find(':') if i < 0: ! # The older parser had various special-cases here. We've ! # already handled them ! raise Errors.HeaderParseError( ! "Not a header, not a continuation: ``%s''" % line) lastheader = line[:i] lastvalue = [line[i+1:].lstrip()] ! if lastheader: # XXX reconsider the joining of folded lines self._cur[lastheader] = EMPTYSTRING.join(lastvalue).rstrip() - - - def _parsegen(self): - # Parse any currently available text - self._new_sub_object() - self._root = self._cur - completing = False - last = None - - for line in self._input: - if line is NeedMoreData: - yield None # Need More Data - continue - self._input.unreadline(line) - if not completing: - headers = [] - # Now collect all headers. - for line in self._input: - if line is NeedMoreData: - yield None # Need More Data - continue - if not self.headerRE.match(line): - self._parse_headers(headers) - # A message/rfc822 has no body and no internal - # boundary. - if self._cur.get_content_maintype() == "message": - self._new_sub_object() - completing = False - headers = [] - continue - if line.strip(): - # No blank line between headers and body. - # Push this line back, it's the first line of - # the body. - self._input.unreadline(line) - break - else: - headers.append(line) - else: - # We're done with the data and are still inside the headers - self._parse_headers(headers) - - # Now we're dealing with the body - boundary = self._cur.get_boundary() - isdigest = (self._cur.get_content_type() == 'multipart/digest') - if boundary and not self._cur._finishing: - separator = '--' + boundary - self._cur._boundaryRE = re.compile( - r'(?P' + re.escape(separator) + - r')(?P--)?(?P[ \t]*)(?P\r\n|\r|\n)$') - for r in self._input.readuntil(self._cur._boundaryRE): - if r is NeedMoreData: - yield NeedMoreData - else: - preamble, matchobj = r - break - if not matchobj: - # Broken - we hit the end of file. Just set the body - # to the text. - if completing: - self._attach_trailer(last, preamble) - else: - self._attach_preamble(self._cur, preamble) - # XXX move back to the parent container. - self._pop_container() - completing = True - continue - if preamble: - if completing: - preamble = preamble[:-len(matchobj.group('linesep'))] - self._attach_trailer(last, preamble) - else: - self._attach_preamble(self._cur, preamble) - elif not completing: - # The module docs specify an empty preamble is None, not '' - self._cur.preamble = None - # If we _are_ completing, the last object gets no payload - - if matchobj.group('end'): - # That was the end boundary tag. Bounce back to the - # parent container - last = self._pop_container() - self._input.unreadline(matchobj.group('linesep')) - completing = True - continue - - # A number of MTAs produced by a nameless large company - # we shall call "SicroMoft" produce repeated boundary - # lines. - while True: - line = self._input.peekline() - if line is NeedMoreData: - yield None - continue - if self._cur._boundaryRE.match(line): - self._input.readline() - else: - break - - self._new_sub_object() - - completing = False - if isdigest: - self._cur.set_default_type('message/rfc822') - continue - else: - # non-multipart or after end-boundary - if last is not self._root: - last = self._pop_container() - if self._cur.get_content_maintype() == "message": - # We double-pop to leave the RFC822 object - self._pop_container() - completing = True - elif self._cur._boundaryRE and last <> self._root: - completing = True - else: - # Non-multipart top level, or in the trailer of the - # top level multipart - while not self._input.is_done(): - yield None - data = list(self._input) - body = EMPTYSTRING.join(data) - self._attach_trailer(last, body) - - - def _attach_trailer(self, obj, trailer): - #import pdb ; pdb.set_trace() - if obj.get_content_maintype() in ( "multipart", "message" ): - obj.epilogue = trailer - else: - obj.set_payload(trailer) - - def _attach_preamble(self, obj, trailer): - if obj.get_content_maintype() in ( "multipart", "message" ): - obj.preamble = trailer - else: - obj.set_payload(trailer) - - - def _new_sub_object(self): - new = self._class() - #print "pushing", self._objectstack, repr(new) - if self._objectstack: - self._objectstack[-1].attach(new) - self._objectstack.append(new) - new._boundaryRE = None - new._finishing = False - self._cur = new - - def _pop_container(self): - # Move the pointer to the container of the current object. - # Returns the (old) current object - #import pdb ; pdb.set_trace() - #print "popping", self._objectstack - last = self._objectstack.pop() - if self._objectstack: - self._cur = self._objectstack[-1] - else: - self._cur._finishing = True - return last - - --- 149,432 ---- pass ! def close(self): ! """Parse all remaining data and return the root message object.""" ! self._input.close() ! self._call_parse() ! root = self._pop_message() ! assert not self._msgstack ! return root ! def _new_message(self): ! msg = self._factory() ! if self._cur and self._cur.get_content_type() == 'multipart/digest': ! msg.set_default_type('message/rfc822') ! if self._msgstack: ! self._msgstack[-1].attach(msg) ! self._msgstack.append(msg) ! self._cur = msg ! self._cur.defects = [] ! self._last = msg + def _pop_message(self): + retval = self._msgstack.pop() + if self._msgstack: + self._cur = self._msgstack[-1] + else: + self._cur = None + return retval ! def _parsegen(self): ! # Create a new message and start by parsing headers. ! self._new_message() ! headers = [] ! # Collect the headers, searching for a line that doesn't match the RFC ! # 2822 header or continuation pattern (including an empty line). ! for line in self._input: ! if line is NeedMoreData: ! yield NeedMoreData ! continue ! if not headerRE.match(line): ! # If we saw the RFC defined header/body separator ! # (i.e. newline), just throw it away. Otherwise the line is ! # part of the body so push it back. ! if not NLCRE.match(line): ! self._input.unreadline(line) ! break ! headers.append(line) ! # Done with the headers, so parse them and figure out what we're ! # supposed to see in the body of the message. ! self._parse_headers(headers) ! # Headers-only parsing is a backwards compatibility hack, which was ! # necessary in the older parser, which could throw errors. All ! # remaining lines in the input are thrown into the message body. ! if self._headersonly: ! lines = [] ! while True: ! line = self._input.readline() ! if line is NeedMoreData: ! yield NeedMoreData ! continue ! if line == '': ! break ! lines.append(line) ! self._cur.set_payload(EMPTYSTRING.join(lines)) ! return ! # So now the input is sitting at the first body line. If the message ! # claims to be a message/rfc822 type, then what follows is another RFC ! # 2822 message. ! if self._cur.get_content_type() == 'message/rfc822': ! for retval in self._parsegen(): ! if retval is NeedMoreData: ! yield NeedMoreData ! continue ! break ! self._pop_message() ! return ! if self._cur.get_content_type() == 'message/delivery-status': ! # message/delivery-status contains blocks of headers separated by ! # a blank line. We'll represent each header block as a separate ! # nested message object. A blank line separates the subparts. ! while True: ! self._input.push_eof_matcher(NLCRE.match) ! for retval in self._parsegen(): ! if retval is NeedMoreData: ! yield NeedMoreData ! continue ! break ! msg = self._pop_message() ! # We need to pop the EOF matcher in order to tell if we're at ! # the end of the current file, not the end of the last block ! # of message headers. ! self._input.pop_eof_matcher() ! # The input stream must be sitting at the newline or at the ! # EOF. We want to see if we're at the end of this subpart, so ! # first consume the blank line, then test the next line to see ! # if we're at this subpart's EOF. ! line = self._input.readline() ! line = self._input.readline() ! if line == '': ! break ! # Not at EOF so this is a line we're going to need. ! self._input.unreadline(line) ! return ! if self._cur.get_content_maintype() == 'multipart': ! boundary = self._cur.get_boundary() ! if boundary is None: ! # The message /claims/ to be a multipart but it has not ! # defined a boundary. That's a problem which we'll handle by ! # reading everything until the EOF and marking the message as ! # defective. ! self._cur.defects.append(Errors.NoBoundaryInMultipart()) ! lines = [] ! for line in self._input: ! if line is NeedMoreData: ! yield NeedMoreData ! continue ! lines.append(line) ! self._cur.set_payload(EMPTYSTRING.join(lines)) ! return ! # Create a line match predicate which matches the inter-part ! # boundary as well as the end-of-multipart boundary. Don't push ! # this onto the input stream until we've scanned past the ! # preamble. ! separator = '--' + boundary ! boundaryre = re.compile( ! '(?P' + re.escape(separator) + ! r')(?P--)?(?P[ \t]*)(?P\r\n|\r|\n)$') ! capturing_preamble = True ! preamble = [] ! linesep = False ! while True: ! line = self._input.readline() ! if line is NeedMoreData: ! yield NeedMoreData ! continue ! if line == '': ! break ! mo = boundaryre.match(line) ! if mo: ! # If we're looking at the end boundary, we're done with ! # this multipart. If there was a newline at the end of ! # the closing boundary, then we need to initialize the ! # epilogue with the empty string (see below). ! if mo.group('end'): ! linesep = mo.group('linesep') ! break ! # We saw an inter-part boundary. Were we in the preamble? ! if capturing_preamble: ! if preamble: ! # According to RFC 2046, the last newline belongs ! # to the boundary. ! lastline = preamble[-1] ! eolmo = NLCRE_eol.search(lastline) ! if eolmo: ! preamble[-1] = lastline[:-len(eolmo.group(0))] ! self._cur.preamble = EMPTYSTRING.join(preamble) ! capturing_preamble = False ! self._input.unreadline(line) ! continue ! # We saw a boundary separating two parts. Recurse to ! # parse this subpart; the input stream points at the ! # subpart's first line. ! self._input.push_eof_matcher(boundaryre.match) ! for retval in self._parsegen(): ! if retval is NeedMoreData: ! yield NeedMoreData ! continue ! break ! # Because of RFC 2046, the newline preceding the boundary ! # separator actually belongs to the boundary, not the ! # previous subpart's payload (or epilogue if the previous ! # part is a multipart). ! if self._last.get_content_maintype() == 'multipart': ! epilogue = self._last.epilogue ! if epilogue == '': ! self._last.epilogue = None ! elif epilogue is not None: ! mo = NLCRE_eol.search(epilogue) ! if mo: ! end = len(mo.group(0)) ! self._last.epilogue = epilogue[:-end] ! else: ! payload = self._last.get_payload() ! if isinstance(payload, basestring): ! mo = NLCRE_eol.search(payload) ! if mo: ! payload = payload[:-len(mo.group(0))] ! self._last.set_payload(payload) ! self._input.pop_eof_matcher() ! self._pop_message() ! # Set the multipart up for newline cleansing, which will ! # happen if we're in a nested multipart. ! self._last = self._cur ! else: ! # I think we must be in the preamble ! assert capturing_preamble ! preamble.append(line) ! # We've seen either the EOF or the end boundary. If we're still ! # capturing the preamble, we never saw the start boundary. Note ! # that as a defect and store the captured text as the payload. ! # Otherwise everything from here to the EOF is epilogue. ! if capturing_preamble: ! self._cur.defects.append(Errors.StartBoundaryNotFound()) ! self._cur.set_payload(EMPTYSTRING.join(preamble)) ! return ! # If the end boundary ended in a newline, we'll need to make sure ! # the epilogue isn't None ! if linesep: ! epilogue = [''] ! else: ! epilogue = [] ! for line in self._input: ! if line is NeedMoreData: ! yield NeedMoreData ! continue ! epilogue.append(line) ! # Any CRLF at the front of the epilogue is not technically part of ! # the epilogue. Also, watch out for an empty string epilogue, ! # which means a single newline. ! firstline = epilogue[0] ! bolmo = NLCRE_bol.match(firstline) ! if bolmo: ! epilogue[0] = firstline[len(bolmo.group(0)):] ! self._cur.epilogue = EMPTYSTRING.join(epilogue) ! return ! # Otherwise, it's some non-multipart type, so the entire rest of the ! # file contents becomes the payload. ! lines = [] ! for line in self._input: ! if line is NeedMoreData: ! yield NeedMoreData ! continue ! lines.append(line) ! self._cur.set_payload(EMPTYSTRING.join(lines)) ! ! def _parse_headers(self, lines): ! # Passed a list of lines that make up the headers for the current msg ! lastheader = '' ! lastvalue = [] ! for lineno, line in enumerate(lines): # Check for continuation if line[0] in ' \t': if not lastheader: ! # The first line of the headers was a continuation. This ! # is illegal, so let's note the defect, store the illegal ! # line, and ignore it for purposes of headers. ! defect = Errors.FirstHeaderLineIsContinuation(line) ! self._cur.defects.append(defect) ! continue lastvalue.append(line) continue if lastheader: # XXX reconsider the joining of folded lines ! self._cur[lastheader] = EMPTYSTRING.join(lastvalue)[:-1] lastheader, lastvalue = '', [] ! # Check for envelope header, i.e. unix-from if line.startswith('From '): if lineno == 0: self._cur.set_unixfrom(line) continue ! elif lineno == len(lines) - 1: # Something looking like a unix-from at the end - it's ! # probably the first line of the body, so push back the ! # line and stop. self._input.unreadline(line) return else: ! # Weirdly placed unix-from line. Note this as a defect ! # and ignore it. ! defect = Errors.MisplacedEnvelopeHeader(line) ! self._cur.defects.append(defect) continue ! # Split the line on the colon separating field name from value. i = line.find(':') if i < 0: ! defect = Errors.MalformedHeader(line) ! self._cur.defects.append(defect) ! continue lastheader = line[:i] lastvalue = [line[i+1:].lstrip()] ! # Done with all the lines, so handle the last header. if lastheader: # XXX reconsider the joining of folded lines self._cur[lastheader] = EMPTYSTRING.join(lastvalue).rstrip() From bwarsaw at users.sourceforge.net Sat May 8 23:35:19 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:35:24 2004 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11939 Modified Files: Generator.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud. Get rid of a bunch of module globals that aren't used. __maxheaderlen -> _maxheaderlen _handle_multipart(): This should be more RFC compliant now, and does match the updated/fixed semantics for preamble and epilogue. Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Generator.py 19 Nov 2003 02:23:01 -0000 1.22 --- Generator.py 9 May 2004 03:35:17 -0000 1.23 *************** *** 1,4 **** ! # Copyright (C) 2001,2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) """Classes to generate plain text from a message object tree. --- 1,4 ---- ! # Copyright (C) 2001-2004 Python Software Foundation ! # Author: barry@python.org (Barry Warsaw) """Classes to generate plain text from a message object tree. *************** *** 8,44 **** import sys import time - import locale import random - - from types import ListType, StringType from cStringIO import StringIO from email.Header import Header - from email.Parser import NLCRE - try: - from email._compat22 import _isstring - except SyntaxError: - from email._compat21 import _isstring - - try: - True, False - except NameError: - True = 1 - False = 0 - - EMPTYSTRING = '' - SEMISPACE = '; ' - BAR = '|' UNDERSCORE = '_' NL = '\n' - NLTAB = '\n\t' - SEMINLTAB = ';\n\t' - SPACE8 = ' ' * 8 fcre = re.compile(r'^From ', re.MULTILINE) def _is8bitstring(s): ! if isinstance(s, StringType): try: unicode(s, 'us-ascii') --- 8,23 ---- import sys import time import random from cStringIO import StringIO from email.Header import Header UNDERSCORE = '_' NL = '\n' fcre = re.compile(r'^From ', re.MULTILINE) def _is8bitstring(s): ! if isinstance(s, str): try: unicode(s, 'us-ascii') *************** *** 78,82 **** self._fp = outfp self._mangle_from_ = mangle_from_ ! self.__maxheaderlen = maxheaderlen def write(self, s): --- 57,61 ---- self._fp = outfp self._mangle_from_ = mangle_from_ ! self._maxheaderlen = maxheaderlen def write(self, s): *************** *** 107,111 **** def clone(self, fp): """Clone this generator with the exact same options.""" ! return self.__class__(fp, self._mangle_from_, self.__maxheaderlen) # --- 86,90 ---- def clone(self, fp): """Clone this generator with the exact same options.""" ! return self.__class__(fp, self._mangle_from_, self._maxheaderlen) # *************** *** 163,167 **** for h, v in msg.items(): print >> self._fp, '%s:' % h, ! if self.__maxheaderlen == 0: # Explicit no-wrapping print >> self._fp, v --- 142,146 ---- for h, v in msg.items(): print >> self._fp, '%s:' % h, ! if self._maxheaderlen == 0: # Explicit no-wrapping print >> self._fp, v *************** *** 180,184 **** # Header's got lots of smarts, so use it. print >> self._fp, Header( ! v, maxlinelen=self.__maxheaderlen, header_name=h, continuation_ws='\t').encode() # A blank line always separates headers from body --- 159,163 ---- # Header's got lots of smarts, so use it. print >> self._fp, Header( ! v, maxlinelen=self._maxheaderlen, header_name=h, continuation_ws='\t').encode() # A blank line always separates headers from body *************** *** 196,200 **** if cset is not None: payload = cset.body_encode(payload) ! if not _isstring(payload): raise TypeError, 'string payload expected: %s' % type(payload) if self._mangle_from_: --- 175,179 ---- if cset is not None: payload = cset.body_encode(payload) ! if not isinstance(payload, basestring): raise TypeError, 'string payload expected: %s' % type(payload) if self._mangle_from_: *************** *** 212,226 **** subparts = msg.get_payload() if subparts is None: ! # Nothing has ever been attached ! boundary = msg.get_boundary(failobj=_make_boundary()) ! print >> self._fp, '--' + boundary ! print >> self._fp, '\n' ! print >> self._fp, '--' + boundary + '--' ! return ! elif _isstring(subparts): # e.g. a non-strict parse of a message with no starting boundary. self._fp.write(subparts) return ! elif not isinstance(subparts, ListType): # Scalar payload subparts = [subparts] --- 191,200 ---- subparts = msg.get_payload() if subparts is None: ! subparts = [] ! elif isinstance(subparts, basestring): # e.g. a non-strict parse of a message with no starting boundary. self._fp.write(subparts) return ! elif not isinstance(subparts, list): # Scalar payload subparts = [subparts] *************** *** 243,268 **** if msg.get_boundary() <> boundary: msg.set_boundary(boundary) ! # Write out any preamble if msg.preamble is not None: ! self._fp.write(msg.preamble) ! # If preamble is the empty string, the length of the split will be ! # 1, but the last element will be the empty string. If it's ! # anything else but does not end in a line separator, the length ! # will be > 1 and not end in an empty string. We need to ! # guarantee a newline after the preamble, but don't add too many. ! plines = NLCRE.split(msg.preamble) ! if plines <> [''] and plines[-1] <> '': ! self._fp.write('\n') ! # First boundary is a bit different; it doesn't have a leading extra ! # newline. print >> self._fp, '--' + boundary ! # Join and write the individual parts ! joiner = '\n--' + boundary + '\n' ! self._fp.write(joiner.join(msgtexts)) ! print >> self._fp, '\n--' + boundary + '--', ! # Write out any epilogue if msg.epilogue is not None: ! if not msg.epilogue.startswith('\n'): ! print >> self._fp self._fp.write(msg.epilogue) --- 217,240 ---- if msg.get_boundary() <> boundary: msg.set_boundary(boundary) ! # If there's a preamble, write it out, with a trailing CRLF if msg.preamble is not None: ! print >> self._fp, msg.preamble ! # dash-boundary transport-padding CRLF print >> self._fp, '--' + boundary ! # body-part ! if msgtexts: ! self._fp.write(msgtexts.pop(0)) ! # *encapsulation ! # --> delimiter transport-padding ! # --> CRLF body-part ! for body_part in msgtexts: ! # delimiter transport-padding CRLF ! print >> self._fp, '\n--' + boundary ! # body-part ! self._fp.write(body_part) ! # close-delimiter transport-padding ! self._fp.write('\n--' + boundary + '--') if msg.epilogue is not None: ! print >> self._fp self._fp.write(msg.epilogue) From k at abuddysetyouup.com Sat May 8 22:33:56 2004 From: k at abuddysetyouup.com (Concepcion Mcfarland) Date: Sat May 8 23:36:05 2004 Subject: [Python-checkins] If Only You Knew Message-ID: <89668175.81566@v@abuddysetyouup.com> Your friend has prepared for you to meet up with another friend. http://abuddysetyouup.com/web/?oc=53036776 The FREE dating web site CREATED BY WOMEN From bwarsaw at users.sourceforge.net Sat May 8 23:40:20 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:40:26 2004 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12766 Modified Files: Header.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud. Get rid of a bunch of module globals that aren't used. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Header.py 30 Mar 2003 20:46:47 -0000 1.27 --- Header.py 9 May 2004 03:40:17 -0000 1.28 *************** *** 1,4 **** ! # Copyright (C) 2002 Python Software Foundation ! # Author: che@debian.org (Ben Gertzfield), barry@zope.com (Barry Warsaw) """Header encoding and decoding functionality.""" --- 1,4 ---- ! # Copyright (C) 2002-2004 Python Software Foundation ! # Author: che@debian.org (Ben Gertzfield), barry@python.org (Barry Warsaw) """Header encoding and decoding functionality.""" *************** *** 6,10 **** import re import binascii - from types import StringType, UnicodeType import email.quopriMIME --- 6,9 ---- *************** *** 13,42 **** from email.Charset import Charset - try: - from email._compat22 import _floordiv - except SyntaxError: - # Python 2.1 spells integer division differently - from email._compat21 import _floordiv - - try: - True, False - except NameError: - True = 1 - False = 0 - - CRLFSPACE = '\r\n ' - CRLF = '\r\n' NL = '\n' SPACE = ' ' USPACE = u' ' SPACE8 = ' ' * 8 - EMPTYSTRING = '' UEMPTYSTRING = u'' MAXLINELEN = 76 - ENCODE = 1 - DECODE = 2 - USASCII = Charset('us-ascii') UTF8 = Charset('utf-8') --- 12,23 ---- *************** *** 53,58 **** ''', re.VERBOSE | re.IGNORECASE) - pcre = re.compile('([,;])') - # Field name regexp, including trailing colon, but not separating whitespace, # according to RFC 2822. Character range is from tilde to exclamation mark. --- 34,37 ---- *************** *** 245,250 **** s may be a byte string or a Unicode string. If it is a byte string ! (i.e. isinstance(s, StringType) is true), then charset is the encoding ! of that byte string, and a UnicodeError will be raised if the string cannot be decoded with that charset. If s is a Unicode string, then charset is a hint specifying the character set of the characters in --- 224,229 ---- s may be a byte string or a Unicode string. If it is a byte string ! (i.e. isinstance(s, str) is true), then charset is the encoding of ! that byte string, and a UnicodeError will be raised if the string cannot be decoded with that charset. If s is a Unicode string, then charset is a hint specifying the character set of the characters in *************** *** 266,270 **** # back to a byte string, given the input and output codecs of the # charset. ! if isinstance(s, StringType): # Possibly raise UnicodeError if the byte string can't be # converted to a unicode with the input codec of the charset. --- 245,249 ---- # back to a byte string, given the input and output codecs of the # charset. ! if isinstance(s, str): # Possibly raise UnicodeError if the byte string can't be # converted to a unicode with the input codec of the charset. *************** *** 276,280 **** outcodec = charset.output_codec or 'us-ascii' ustr.encode(outcodec, errors) ! elif isinstance(s, UnicodeType): # Now we have to be sure the unicode string can be converted # to a byte string with a reasonable output codec. We want to --- 255,259 ---- outcodec = charset.output_codec or 'us-ascii' ustr.encode(outcodec, errors) ! elif isinstance(s, unicode): # Now we have to be sure the unicode string can be converted # to a byte string with a reasonable output codec. We want to From bwarsaw at users.sourceforge.net Sat May 8 23:42:39 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:42:42 2004 Subject: [Python-checkins] python/dist/src/Lib/email Iterators.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13144 Modified Files: Iterators.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud. We don't need the _compat21 or _compat22 modules either. Index: Iterators.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Iterators.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Iterators.py 1 Oct 2002 00:51:47 -0000 1.12 --- Iterators.py 9 May 2004 03:42:37 -0000 1.13 *************** *** 1,4 **** ! # Copyright (C) 2001,2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) """Various types of useful iterators and generators. --- 1,4 ---- ! # Copyright (C) 2001-2004 Python Software Foundation ! # Author: Barry Warsaw """Various types of useful iterators and generators. *************** *** 6,25 **** import sys ! try: ! from email._compat22 import body_line_iterator, typed_subpart_iterator ! except SyntaxError: ! # Python 2.1 doesn't have generators ! from email._compat21 import body_line_iterator, typed_subpart_iterator ! def _structure(msg, fp=None, level=0): """A handy debugging aid""" if fp is None: fp = sys.stdout tab = ' ' * (level * 4) ! print >> fp, tab + msg.get_content_type() if msg.is_multipart(): for subpart in msg.get_payload(): ! _structure(subpart, fp, level+1) --- 6,67 ---- import sys + from cStringIO import StringIO ! ! ! # This function will become a method of the Message class ! def walk(self): ! """Walk over the message tree, yielding each subpart. ! ! The walk is performed in depth-first order. This method is a ! generator. ! """ ! yield self ! if self.is_multipart(): ! for subpart in self.get_payload(): ! for subsubpart in subpart.walk(): ! yield subsubpart ! # These two functions are imported into the Iterators.py interface module. ! # The Python 2.2 version uses generators for efficiency. ! def body_line_iterator(msg, decode=False): ! """Iterate over the parts, returning string payloads line-by-line. ! ! Optional decode (default False) is passed through to .get_payload(). ! """ ! for subpart in msg.walk(): ! payload = subpart.get_payload(decode=decode) ! if isinstance(payload, basestring): ! for line in StringIO(payload): ! yield line ! ! ! def typed_subpart_iterator(msg, maintype='text', subtype=None): ! """Iterate over the subparts with a given MIME type. ! ! Use `maintype' as the main MIME type to match against; this defaults to ! "text". Optional `subtype' is the MIME subtype to match against; if ! omitted, only the main type is matched. ! """ ! for subpart in msg.walk(): ! if subpart.get_content_maintype() == maintype: ! if subtype is None or subpart.get_content_subtype() == subtype: ! yield subpart ! ! ! ! def _structure(msg, fp=None, level=0, include_default=False): """A handy debugging aid""" if fp is None: fp = sys.stdout tab = ' ' * (level * 4) ! print >> fp, tab + msg.get_content_type(), ! if include_default: ! print '[%s]' % msg.get_default_type() ! else: ! print if msg.is_multipart(): for subpart in msg.get_payload(): ! _structure(subpart, fp, level+1, include_default) From bwarsaw at users.sourceforge.net Sat May 8 23:44:58 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:45:02 2004 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13586 Modified Files: Message.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud. Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Message.py 20 Oct 2003 14:01:51 -0000 1.35 --- Message.py 9 May 2004 03:44:55 -0000 1.36 *************** *** 1,7 **** ! # Copyright (C) 2001,2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) ! """Basic message object for the email package object model. ! """ import re --- 1,6 ---- ! # Copyright (C) 2001-2004 Python Software Foundation ! # Author: barry@python.org (Barry Warsaw) ! """Basic message object for the email package object model.""" import re *************** *** 10,14 **** import warnings from cStringIO import StringIO - from types import ListType, TupleType, StringType # Intrapackage imports --- 9,12 ---- *************** *** 19,28 **** SEMISPACE = '; ' - try: - True, False - except NameError: - True = 1 - False = 0 - # Regular expression used to split header parameters. BAW: this may be too # simple. It isn't strictly RFC 2045 (section 5.1) compliant, but it catches --- 17,20 ---- *************** *** 43,50 **** """ if value is not None and len(value) > 0: ! # TupleType is used for RFC 2231 encoded parameter values where items # are (charset, language, value). charset is a string, not a Charset # instance. ! if isinstance(value, TupleType): # Encode as per RFC 2231 param += '*' --- 35,42 ---- """ if value is not None and len(value) > 0: ! # A tuple is used for RFC 2231 encoded parameter values where items # are (charset, language, value). charset is a string, not a Charset # instance. ! if isinstance(value, tuple): # Encode as per RFC 2231 param += '*' *************** *** 78,82 **** def _unquotevalue(value): ! if isinstance(value, TupleType): return value[0], value[1], Utils.unquote(value[2]) else: --- 70,74 ---- def _unquotevalue(value): ! if isinstance(value, tuple): return value[0], value[1], Utils.unquote(value[2]) else: *************** *** 133,137 **** def is_multipart(self): """Return True if the message consists of multiple parts.""" ! if isinstance(self._payload, ListType): return True return False --- 125,129 ---- def is_multipart(self): """Return True if the message consists of multiple parts.""" ! if isinstance(self._payload, list): return True return False *************** *** 161,165 **** if self._payload is None: self._payload = payload ! elif isinstance(self._payload, ListType): self._payload.append(payload) elif self.get_main_type() not in (None, 'multipart'): --- 153,157 ---- if self._payload is None: self._payload = payload ! elif isinstance(self._payload, list): self._payload.append(payload) elif self.get_main_type() not in (None, 'multipart'): *************** *** 203,207 **** if i is None: payload = self._payload ! elif not isinstance(self._payload, ListType): raise TypeError, 'Expected list, got %s' % type(self._payload) else: --- 195,199 ---- if i is None: payload = self._payload ! elif not isinstance(self._payload, list): raise TypeError, 'Expected list, got %s' % type(self._payload) else: *************** *** 260,264 **** self._charset = None return ! if isinstance(charset, StringType): charset = Charset.Charset(charset) if not isinstance(charset, Charset.Charset): --- 252,256 ---- self._charset = None return ! if isinstance(charset, str): charset = Charset.Charset(charset) if not isinstance(charset, Charset.Charset): *************** *** 632,636 **** to the empty string. Both charset and language should be strings. """ ! if not isinstance(value, TupleType) and charset: value = (charset, language, value) --- 624,628 ---- to the empty string. Both charset and language should be strings. """ ! if not isinstance(value, tuple) and charset: value = (charset, language, value) *************** *** 726,730 **** if filename is missing: return failobj ! if isinstance(filename, TupleType): # It's an RFC 2231 encoded parameter newvalue = _unquotevalue(filename) --- 718,722 ---- if filename is missing: return failobj ! if isinstance(filename, tuple): # It's an RFC 2231 encoded parameter newvalue = _unquotevalue(filename) *************** *** 744,748 **** if boundary is missing: return failobj ! if isinstance(boundary, TupleType): # RFC 2231 encoded, so decode. It better end up as ascii charset = boundary[0] or 'us-ascii' --- 736,740 ---- if boundary is missing: return failobj ! if isinstance(boundary, tuple): # RFC 2231 encoded, so decode. It better end up as ascii charset = boundary[0] or 'us-ascii' *************** *** 795,804 **** self._headers = newheaders - try: - from email._compat22 import walk - except SyntaxError: - # Must be using Python 2.1 - from email._compat21 import walk - def get_content_charset(self, failobj=None): """Return the charset parameter of the Content-Type header. --- 787,790 ---- *************** *** 812,816 **** if charset is missing: return failobj ! if isinstance(charset, TupleType): # RFC 2231 encoded, so decode it, and it better end up as ascii. pcharset = charset[0] or 'us-ascii' --- 798,802 ---- if charset is missing: return failobj ! if isinstance(charset, tuple): # RFC 2231 encoded, so decode it, and it better end up as ascii. pcharset = charset[0] or 'us-ascii' *************** *** 836,837 **** --- 822,826 ---- """ return [part.get_content_charset(failobj) for part in self.walk()] + + # I.e. def walk(self): ... + from email.Iterators import walk From bwarsaw at users.sourceforge.net Sat May 8 23:46:44 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:46:48 2004 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13873 Modified Files: Parser.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud. This Parser is now just a backward compatible front-end to the FeedParser. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Parser.py 20 Mar 2004 17:31:29 -0000 1.21 --- Parser.py 9 May 2004 03:46:42 -0000 1.22 *************** *** 1,99 **** ! # Copyright (C) 2001,2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) ! """A parser of RFC 2822 and MIME email messages. ! """ import re from cStringIO import StringIO ! from types import ListType ! ! from email import Errors ! from email import Message ! ! EMPTYSTRING = '' ! NL = '\n' ! ! try: ! True, False ! except NameError: ! True = 1 ! False = 0 NLCRE = re.compile('\r\n|\r|\n') - class TextUtil: - """ A utility class for wrapping a file object and providing a - couple of additional useful functions. - """ - - def __init__(self, fp): - self.fp = fp - self.unread = [] - - def readline(self): - """ Return a line of data. - - If data has been pushed back with unreadline(), the most recently - returned unreadline()d data will be returned. - """ - if self.unread: - return self.unread.pop() - else: - return self.fp.readline() - - def unreadline(self, line): - """Push a line back into the object. - """ - self.unread.append(line) - - def peekline(self): - """Non-destructively look at the next line""" - line = self.readline() - self.unreadline(line) - return line - - def read(self): - """Return the remaining data - """ - r = self.fp.read() - if self.unread: - r = "\n".join(self.unread) + r - self.unread = [] - return r - - def readuntil(self, re, afterblank=0, includematch=0): - """Read a line at a time until we get the specified RE. - - Returns the text up to (and including, if includematch is true) the - matched text, and the RE match object. If afterblank is true, - there must be a blank line before the matched text. Moves current - filepointer to the line following the matched line. If we reach - end-of-file, return what we've got so far, and return None as the - RE match object. - """ - prematch = [] - blankseen = 0 - while 1: - line = self.readline() - if not line: - # end of file - return EMPTYSTRING.join(prematch), None - if afterblank: - if NLCRE.match(line): - blankseen = 1 - continue - else: - blankseen = 0 - m = re.match(line) - if (m and not afterblank) or (m and afterblank and blankseen): - if includematch: - prematch.append(line) - return EMPTYSTRING.join(prematch), m - prematch.append(line) class Parser: ! def __init__(self, _class=Message.Message, strict=False): """Parser of RFC 2822 and MIME email messages. --- 1,19 ---- ! # Copyright (C) 2001-2004 Python Software Foundation ! # Author: Barry Warsaw, Thomas Wouters, Anthony Baxter ! # Contact: email-sig@python.org ! """A parser of RFC 2822 and MIME email messages.""" import re from cStringIO import StringIO ! from email.FeedParser import FeedParser ! from email.Message import Message NLCRE = re.compile('\r\n|\r|\n') class Parser: ! def __init__(self, _class=Message, strict=False): """Parser of RFC 2822 and MIME email messages. *************** *** 118,122 **** """ self._class = _class - self._strict = strict def parse(self, fp, headersonly=False): --- 38,41 ---- *************** *** 128,140 **** meaning it parses the entire contents of the file. """ ! root = self._class() ! fp = TextUtil(fp) ! self._parseheaders(root, fp) ! if not headersonly: ! obj = self._parsemessage(root, fp) ! trailer = fp.read() ! if obj and trailer: ! self._attach_trailer(obj, trailer) ! return root def parsestr(self, text, headersonly=False): --- 47,59 ---- meaning it parses the entire contents of the file. """ ! feedparser = FeedParser(self._class) ! if headersonly: ! feedparser._set_headersonly() ! while True: ! data = fp.read(8192) ! if not data: ! break ! feedparser.feed(data) ! return feedparser.close() def parsestr(self, text, headersonly=False): *************** *** 148,337 **** return self.parse(StringIO(text), headersonly=headersonly) - def _parseheaders(self, container, fp): - # Parse the headers, returning a list of header/value pairs. None as - # the header means the Unix-From header. - lastheader = '' - lastvalue = [] - lineno = 0 - while True: - # Don't strip the line before we test for the end condition, - # because whitespace-only header lines are RFC compliant - # continuation lines. - line = fp.readline() - if not line: - break - line = line.splitlines()[0] - if not line: - break - # Ignore the trailing newline - lineno += 1 - # Check for initial Unix From_ line - if line.startswith('From '): - if lineno == 1: - container.set_unixfrom(line) - continue - elif self._strict: - raise Errors.HeaderParseError( - 'Unix-from in headers after first rfc822 header') - else: - # ignore the wierdly placed From_ line - # XXX: maybe set unixfrom anyway? or only if not already? - continue - # Header continuation line - if line[0] in ' \t': - if not lastheader: - raise Errors.HeaderParseError( - 'Continuation line seen before first header') - lastvalue.append(line) - continue - # Normal, non-continuation header. BAW: this should check to make - # sure it's a legal header, e.g. doesn't contain spaces. Also, we - # should expose the header matching algorithm in the API, and - # allow for a non-strict parsing mode (that ignores the line - # instead of raising the exception). - i = line.find(':') - if i < 0: - if self._strict: - raise Errors.HeaderParseError( - "Not a header, not a continuation: ``%s''" % line) - elif lineno == 1 and line.startswith('--'): - # allow through duplicate boundary tags. - continue - else: - # There was no separating blank line as mandated by RFC - # 2822, but we're in non-strict mode. So just offer up - # this current line as the first body line. - fp.unreadline(line) - break - if lastheader: - container[lastheader] = NL.join(lastvalue) - lastheader = line[:i] - lastvalue = [line[i+1:].lstrip()] - # Make sure we retain the last header - if lastheader: - container[lastheader] = NL.join(lastvalue) - return - - def _parsemessage(self, container, fp): - # Parse the body. We walk through the body from top to bottom, - # keeping track of the current multipart nesting as we go. - # We return the object that gets the data at the end of this - # block. - boundary = container.get_boundary() - isdigest = (container.get_content_type() == 'multipart/digest') - if boundary: - separator = '--' + boundary - boundaryRE = re.compile( - r'(?P' + re.escape(separator) + - r')(?P--)?(?P[ \t]*)(?P\r\n|\r|\n)$') - preamble, matchobj = fp.readuntil(boundaryRE) - if not matchobj: - # Broken - we hit the end of file. Just set the body - # to the text. - container.set_payload(preamble) - return container - if preamble: - container.preamble = preamble - else: - # The module docs specify an empty preamble is None, not '' - container.preamble = None - while 1: - subobj = self._class() - if isdigest: - subobj.set_default_type('message/rfc822') - firstline = fp.peekline() - if firstline.strip(): - # we have MIME headers. all good. - self._parseheaders(subobj, fp) - else: - # no MIME headers. this is allowed for multipart/digest - # Consume the extra blank line - fp.readline() - pass - else: - self._parseheaders(subobj, fp) - container.attach(subobj) - maintype = subobj.get_content_maintype() - hassubparts = (subobj.get_content_maintype() in - ( "message", "multipart" )) - if hassubparts: - subobj = self._parsemessage(subobj, fp) - - trailer, matchobj = fp.readuntil(boundaryRE) - if matchobj is None or trailer: - mo = re.search('(?P\r\n|\r|\n){2}$', trailer) - if not mo: - mo = re.search('(?P\r\n|\r|\n)$', trailer) - if not mo: - raise Errors.BoundaryError( - 'No terminating boundary and no trailing empty line') - linesep = mo.group('sep') - trailer = trailer[:-len(linesep)] - if trailer: - self._attach_trailer(subobj, trailer) - if matchobj is None or matchobj.group('end'): - # That was the last piece of data. Let our caller attach - # the epilogue to us. But before we do that, push the - # line ending of the match group back into the readline - # buffer, as it's part of the epilogue. - if matchobj: - fp.unreadline(matchobj.group('linesep')) - return container - - elif container.get_content_maintype() == "multipart": - # Very bad. A message is a multipart with no boundary! - raise Errors.BoundaryError( - 'multipart message with no defined boundary') - elif container.get_content_maintype() == "message": - ct = container.get_content_type() - if ct == "message/rfc822": - submessage = self._class() - self._parseheaders(submessage, fp) - self._parsemessage(submessage, fp) - container.attach(submessage) - return submessage - elif ct == "message/delivery-status": - # This special kind of type contains blocks of headers - # separated by a blank line. We'll represent each header - # block as a separate Message object - while 1: - nextblock = self._class() - self._parseheaders(nextblock, fp) - container.attach(nextblock) - # next peek ahead to see whether we've hit the end or not - nextline = fp.peekline() - if nextline[:2] == "--": - break - return container - else: - # Other sort of message object (e.g. external-body) - msg = self._class() - self._parsemessage(msg, fp) - container.attach(msg) - return msg - else: - # single body section. We let our caller set the payload. - return container - - def _attach_trailer(self, obj, trailer): - if obj.get_content_maintype() in ("message", "multipart"): - obj.epilogue = trailer - else: - obj.set_payload(trailer) class HeaderParser(Parser): ! """A subclass of Parser, this one only meaningfully parses message headers. ! ! This class can be used if all you're interested in is the headers of a ! message. While it consumes the message body, it does not parse it, but ! simply makes it available as a string payload. ! Parsing with this subclass can be considerably faster if all you're ! interested in is the message headers. ! """ ! def _parsemessage(self, container, fp): ! # Consume but do not parse, the body ! text = fp.read() ! container.set_payload(text) ! return None --- 67,76 ---- return self.parse(StringIO(text), headersonly=headersonly) class HeaderParser(Parser): ! def parse(self, fp, headersonly=True): ! return Parser.parse(self, fp, True) ! def parsestr(self, text, headersonly=True): ! return Parser.parsestr(self, text, True) From bwarsaw at users.sourceforge.net Sat May 8 23:50:06 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:50:10 2004 Subject: [Python-checkins] python/dist/src/Lib/email Utils.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14650 Modified Files: Utils.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud. Index: Utils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Utils.py 19 Aug 2003 03:49:34 -0000 1.25 --- Utils.py 9 May 2004 03:50:04 -0000 1.26 *************** *** 1,16 **** ! # Copyright (C) 2001,2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) ! """Miscellaneous utilities. ! """ ! import time ! import socket import re import random ! import os import warnings from cStringIO import StringIO - from types import ListType from email._parseaddr import quote --- 1,15 ---- ! # Copyright (C) 2001-2004 Python Software Foundation ! # Author: barry@python.org (Barry Warsaw) ! """Miscellaneous utilities.""" ! import os import re + import time + import base64 import random ! import socket import warnings from cStringIO import StringIO from email._parseaddr import quote *************** *** 22,49 **** from email._parseaddr import parsedate_tz as _parsedate_tz ! try: ! True, False ! except NameError: ! True = 1 ! False = 0 ! ! try: ! from quopri import decodestring as _qdecode ! except ImportError: ! # Python 2.1 doesn't have quopri.decodestring() ! def _qdecode(s): ! import quopri as _quopri ! ! if not s: ! return s ! infp = StringIO(s) ! outfp = StringIO() ! _quopri.decode(infp, outfp) ! value = outfp.getvalue() ! if not s.endswith('\n') and value.endswith('\n'): ! return value[:-1] ! return value ! ! import base64 # Intrapackage imports --- 21,25 ---- from email._parseaddr import parsedate_tz as _parsedate_tz ! from quopri import decodestring as _qdecode # Intrapackage imports *************** *** 141,145 **** from email.Header import decode_header L = decode_header(s) ! if not isinstance(L, ListType): # s wasn't decoded return s --- 117,121 ---- from email.Header import decode_header L = decode_header(s) ! if not isinstance(L, list): # s wasn't decoded return s From bwarsaw at users.sourceforge.net Sat May 8 23:51:41 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:51:45 2004 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14907 Modified Files: __init__.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** __init__.py 30 Dec 2003 16:49:40 -0000 1.31 --- __init__.py 9 May 2004 03:51:39 -0000 1.32 *************** *** 1,9 **** ! # Copyright (C) 2001,2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) ! """A package for parsing, handling, and generating email messages. ! """ ! __version__ = '2.5.5' __all__ = [ --- 1,8 ---- ! # Copyright (C) 2001-2004 Python Software Foundation ! # Author: barry@python.org (Barry Warsaw) ! """A package for parsing, handling, and generating email messages.""" ! __version__ = '3.0a0' __all__ = [ *************** *** 30,39 **** ] - try: - True, False - except NameError: - True = 1 - False = 0 - --- 29,32 ---- *************** *** 52,55 **** --- 45,49 ---- return Parser(_class, strict=strict).parsestr(s) + def message_from_file(fp, _class=None, strict=False): """Read a file and parse its contents into a Message object model. *************** *** 62,72 **** _class = Message return Parser(_class, strict=strict).parse(fp) - - - - # Patch encodings.aliases to recognize 'ansi_x3.4_1968' which isn't a standard - # alias in Python 2.1.3, but is used by the email package test suite. - from encodings.aliases import aliases # The aliases dictionary - if not aliases.has_key('ansi_x3.4_1968'): - aliases['ansi_x3.4_1968'] = 'ascii' - del aliases # Not needed any more --- 56,57 ---- From bwarsaw at users.sourceforge.net Sat May 8 23:52:43 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:52:47 2004 Subject: [Python-checkins] python/dist/src/Lib/email _parseaddr.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15048 Modified Files: _parseaddr.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud. Index: _parseaddr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_parseaddr.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _parseaddr.py 13 Jun 2003 21:16:06 -0000 1.7 --- _parseaddr.py 9 May 2004 03:52:40 -0000 1.8 *************** *** 1,3 **** ! # Copyright (C) 2002 Python Software Foundation """Email address parsing code. --- 1,3 ---- ! # Copyright (C) 2002-2004 Python Software Foundation """Email address parsing code. *************** *** 7,17 **** import time - from types import TupleType - - try: - True, False - except NameError: - True = 1 - False = 0 SPACE = ' ' --- 7,10 ---- *************** *** 131,135 **** """Convert a time string to a time tuple.""" t = parsedate_tz(data) ! if isinstance(t, TupleType): return t[:9] else: --- 124,128 ---- """Convert a time string to a time tuple.""" t = parsedate_tz(data) ! if isinstance(t, tuple): return t[:9] else: From bwarsaw at users.sourceforge.net Sat May 8 23:53:52 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:53:55 2004 Subject: [Python-checkins] python/dist/src/Lib/email base64MIME.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15188 Modified Files: base64MIME.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud. Index: base64MIME.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/base64MIME.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** base64MIME.py 6 Mar 2003 05:25:00 -0000 1.6 --- base64MIME.py 9 May 2004 03:53:50 -0000 1.7 *************** *** 28,38 **** from email.Utils import fix_eols - try: - from email._compat22 import _floordiv - except SyntaxError: - # Python 2.1 spells integer division differently - from email._compat21 import _floordiv - - CRLF = '\r\n' NL = '\n' --- 28,31 ---- *************** *** 42,51 **** MISC_LEN = 7 - try: - True, False - except NameError: - True = 1 - False = 0 - --- 35,38 ---- *************** *** 101,105 **** base64ed = [] max_encoded = maxlinelen - len(charset) - MISC_LEN ! max_unencoded = _floordiv(max_encoded * 3, 4) for i in range(0, len(header), max_unencoded): --- 88,92 ---- base64ed = [] max_encoded = maxlinelen - len(charset) - MISC_LEN ! max_unencoded = max_encoded * 3 // 4 for i in range(0, len(header), max_unencoded): *************** *** 142,146 **** encvec = [] ! max_unencoded = _floordiv(maxlinelen * 3, 4) for i in range(0, len(s), max_unencoded): # BAW: should encode() inherit b2a_base64()'s dubious behavior in --- 129,133 ---- encvec = [] ! max_unencoded = maxlinelen * 3 // 4 for i in range(0, len(s), max_unencoded): # BAW: should encode() inherit b2a_base64()'s dubious behavior in From bwarsaw at users.sourceforge.net Sat May 8 23:55:14 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:55:17 2004 Subject: [Python-checkins] python/dist/src/Lib/email quopriMIME.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15431 Modified Files: quopriMIME.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud. Index: quopriMIME.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/quopriMIME.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** quopriMIME.py 6 Mar 2003 05:14:20 -0000 1.5 --- quopriMIME.py 9 May 2004 03:55:11 -0000 1.6 *************** *** 1,3 **** ! # Copyright (C) 2001,2002 Python Software Foundation # Author: che@debian.org (Ben Gertzfield) --- 1,3 ---- ! # Copyright (C) 2001-2004 Python Software Foundation # Author: che@debian.org (Ben Gertzfield) *************** *** 39,48 **** bqre = re.compile(r'[^ !-<>-~\t]') - try: - True, False - except NameError: - True = 1 - False = 0 - --- 39,42 ---- From bwarsaw at users.sourceforge.net Sat May 8 23:57:12 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 8 23:57:15 2004 Subject: [Python-checkins] python/dist/src/Lib/email _compat21.py, 1.8, NONE _compat22.py, 1.7, NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15622 Removed Files: _compat21.py _compat22.py Log Message: we dont support any Python's before 2.3 now. --- _compat21.py DELETED --- --- _compat22.py DELETED --- From bwarsaw at users.sourceforge.net Sun May 9 13:12:05 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun May 9 13:12:11 2004 Subject: [Python-checkins] python/dist/src README,1.180,1.181 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23014 Modified Files: README Log Message: Add this year to the copyright notices. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.180 retrieving revision 1.181 diff -C2 -d -r1.180 -r1.181 *** README 5 Mar 2004 14:33:21 -0000 1.180 --- README 9 May 2004 17:11:59 -0000 1.181 *************** *** 2,6 **** ================================== ! Copyright (c) 2001, 2002, 2003 Python Software Foundation. All rights reserved. --- 2,6 ---- ================================== ! Copyright (c) 2001, 2002, 2003, 2004 Python Software Foundation. All rights reserved. From bwarsaw at users.sourceforge.net Sun May 9 13:13:54 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun May 9 13:13:57 2004 Subject: [Python-checkins] python/dist/src README,1.177.4.8,1.177.4.9 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23313 Modified Files: Tag: release23-maint README Log Message: Add this year to the copyright notices, and label it 2.3.4. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.177.4.8 retrieving revision 1.177.4.9 diff -C2 -d -r1.177.4.8 -r1.177.4.9 *** README 22 Mar 2004 20:20:26 -0000 1.177.4.8 --- README 9 May 2004 17:13:51 -0000 1.177.4.9 *************** *** 1,6 **** ! This is Python version 2.3.3 ============================ ! Copyright (c) 2001, 2002, 2003 Python Software Foundation. All rights reserved. --- 1,6 ---- ! This is Python version 2.3.4 ============================ ! Copyright (c) 2001, 2002, 2003, 2004 Python Software Foundation. All rights reserved. From bwarsaw at users.sourceforge.net Sun May 9 14:00:04 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun May 9 14:00:11 2004 Subject: [Python-checkins] python/dist/src/Lib/email MIMEMultipart.py, 1.3, 1.3.20.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32290 Modified Files: Tag: release23-maint MIMEMultipart.py Log Message: SF patch # 884030 by Amit Aronovitch; fixes the _subpart argument to match documented semantics. Index: MIMEMultipart.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/MIMEMultipart.py,v retrieving revision 1.3 retrieving revision 1.3.20.1 diff -C2 -d -r1.3 -r1.3.20.1 *** MIMEMultipart.py 30 Sep 2002 21:24:00 -0000 1.3 --- MIMEMultipart.py 9 May 2004 18:00:02 -0000 1.3.20.1 *************** *** 1,4 **** ! # Copyright (C) 2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) """Base class for MIME multipart/* type messages. --- 1,4 ---- ! # Copyright (C) 2002-2004 Python Software Foundation ! # Author: barry@python.org (Barry Warsaw) """Base class for MIME multipart/* type messages. *************** *** 12,16 **** """Base class for MIME multipart/* type messages.""" ! def __init__(self, _subtype='mixed', boundary=None, *_subparts, **_params): """Creates a multipart/* type message. --- 12,17 ---- """Base class for MIME multipart/* type messages.""" ! def __init__(self, _subtype='mixed', boundary=None, _subparts=None, ! **_params): """Creates a multipart/* type message. *************** *** 25,29 **** _subparts is a sequence of initial subparts for the payload. It ! must be possible to convert this sequence to a list. You can always attach new subparts to the message by using the attach() method. --- 26,30 ---- _subparts is a sequence of initial subparts for the payload. It ! must be an iterable object, such as a list. You can always attach new subparts to the message by using the attach() method. *************** *** 33,37 **** MIMEBase.MIMEBase.__init__(self, 'multipart', _subtype, **_params) if _subparts: ! self.attach(*list(_subparts)) if boundary: self.set_boundary(boundary) --- 34,39 ---- MIMEBase.MIMEBase.__init__(self, 'multipart', _subtype, **_params) if _subparts: ! for p in _subparts: ! self.attach(p) if boundary: self.set_boundary(boundary) From bwarsaw at users.sourceforge.net Sun May 9 14:01:00 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun May 9 14:01:03 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.50.10.2, 1.50.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32533 Modified Files: Tag: release23-maint test_email.py Log Message: test_mime_attachments_in_constructor(): New test to check for SF bug # 884030. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.50.10.2 retrieving revision 1.50.10.3 diff -C2 -d -r1.50.10.2 -r1.50.10.3 *** test_email.py 3 Sep 2003 04:22:00 -0000 1.50.10.2 --- test_email.py 9 May 2004 18:00:56 -0000 1.50.10.3 *************** *** 1628,1631 **** --- 1628,1640 ---- ''') + def test_mime_attachments_in_constructor(self): + eq = self.assertEqual + text1 = MIMEText('') + text2 = MIMEText('') + msg = MIMEMultipart(_subparts=(text1, text2)) + eq(len(msg.get_payload()), 2) + eq(msg.get_payload(0), text1) + eq(msg.get_payload(1), text2) + From bwarsaw at users.sourceforge.net Sun May 9 14:03:51 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun May 9 14:03:54 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.54, 1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv483 Modified Files: test_email.py Log Message: test_mime_attachments_in_constructor(): New test to check for SF bug # 884030. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** test_email.py 9 May 2004 03:16:03 -0000 1.54 --- test_email.py 9 May 2004 18:03:36 -0000 1.55 *************** *** 1751,1754 **** --- 1751,1763 ---- ''') + def test_mime_attachments_in_constructor(self): + eq = self.assertEqual + text1 = MIMEText('') + text2 = MIMEText('') + msg = MIMEMultipart(_subparts=(text1, text2)) + eq(len(msg.get_payload()), 2) + eq(msg.get_payload(0), text1) + eq(msg.get_payload(1), text2) + From bwarsaw at users.sourceforge.net Sun May 9 14:04:27 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun May 9 14:04:31 2004 Subject: [Python-checkins] python/dist/src/Lib/email MIMEMultipart.py, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv641 Modified Files: MIMEMultipart.py Log Message: SF patch # 884030 by Amit Aronovitch; fixes the _subpart argument to match documented semantics. Index: MIMEMultipart.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/MIMEMultipart.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MIMEMultipart.py 30 Sep 2002 21:24:00 -0000 1.3 --- MIMEMultipart.py 9 May 2004 18:04:24 -0000 1.4 *************** *** 1,4 **** ! # Copyright (C) 2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) """Base class for MIME multipart/* type messages. --- 1,4 ---- ! # Copyright (C) 2002-2004 Python Software Foundation ! # Author: barry@python.org (Barry Warsaw) """Base class for MIME multipart/* type messages. *************** *** 12,16 **** """Base class for MIME multipart/* type messages.""" ! def __init__(self, _subtype='mixed', boundary=None, *_subparts, **_params): """Creates a multipart/* type message. --- 12,17 ---- """Base class for MIME multipart/* type messages.""" ! def __init__(self, _subtype='mixed', boundary=None, _subparts=None, ! **_params): """Creates a multipart/* type message. *************** *** 25,29 **** _subparts is a sequence of initial subparts for the payload. It ! must be possible to convert this sequence to a list. You can always attach new subparts to the message by using the attach() method. --- 26,30 ---- _subparts is a sequence of initial subparts for the payload. It ! must be an iterable object, such as a list. You can always attach new subparts to the message by using the attach() method. *************** *** 33,37 **** MIMEBase.MIMEBase.__init__(self, 'multipart', _subtype, **_params) if _subparts: ! self.attach(*list(_subparts)) if boundary: self.set_boundary(boundary) --- 34,39 ---- MIMEBase.MIMEBase.__init__(self, 'multipart', _subtype, **_params) if _subparts: ! for p in _subparts: ! self.attach(p) if boundary: self.set_boundary(boundary) From mhammond at users.sourceforge.net Sun May 9 20:32:37 2004 From: mhammond at users.sourceforge.net (mhammond@users.sourceforge.net) Date: Sun May 9 20:32:41 2004 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.53.6.5,1.53.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14860 Modified Files: Tag: release23-maint urllib2.py Log Message: Fix [ 738973 ] urllib2 CacheFTPHandler doesn't work on multiple dirs, as implemented in patch [ 851736 ]. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.53.6.5 retrieving revision 1.53.6.6 diff -C2 -d -r1.53.6.5 -r1.53.6.6 *** urllib2.py 6 May 2004 01:40:57 -0000 1.53.6.5 --- urllib2.py 10 May 2004 00:32:34 -0000 1.53.6.6 *************** *** 1080,1084 **** def connect_ftp(self, user, passwd, host, port, dirs): ! key = user, passwd, host, port if key in self.cache: self.timeout[key] = time.time() + self.delay --- 1080,1084 ---- def connect_ftp(self, user, passwd, host, port, dirs): ! key = user, host, port, '/'.join(dirs) if key in self.cache: self.timeout[key] = time.time() + self.delay From usdstk at vot.url.com.tw Sun May 9 07:24:42 2004 From: usdstk at vot.url.com.tw (Emile Kaiser) Date: Mon May 10 03:26:34 2004 Subject: [Python-checkins] DDO, dental care directory, rvdxtujmdjdoduxt Message-ID: NOTE: BONUS OFFER BELOW. `The best reference I`ve used to communicate with dentists``, Bob Frankford -- President, KY dental products. The new edition of The American Directory of Dentists is out!!!! (New Dentist directory, dental practice, dental labs, cosmetic dentists, DDO, dental care directory, directory of dentists, dentist CD, dentist lists, orthodontists, periodontology, oral surgeons, dental lists, tooth decay, dental products, gum disease, oral health, genral practice, dental directory.) >From our previous customer feedback, this directory is found to be the leading source of dentist reference in the United States. It is used by professionals and industry business development executives who must communicate with dentists in an efficient and timely manner.. The American Directory of Dentists contains relevant data on over 200,000 dentists in the United States. Each record is indexed by such features as name, address, phone/fax, county, year licensed, type of practice, type of dentist as well as specialty. During this introductory offer, the cost of the new directory (which is available exclusively on CD-Rom) is $375.00 (reg. $795). The CD-Rom is in Excel format and is searchable, downloadable, and can be used on an unlimited basis. To order the American Directory of Dentists, please print this e-mail, complete the information below and fax it to 905-751-0199. (tel: 905-751-0919). BONUS OFFER: ORDER NOW AND RECEIVE THE AMERICAN DIRECTORY OF DOCTORS ON CD-ROM FREE OF CHARGE ($845 value).. NAME: TITLE: ORGANIZATION: ADDRESS: CITY: POSTAL: TEL: FAX: E-MAIL: InfoSource Group of Companies is a leading information publishing firm. oodv pmzrpzg irpvc eca From mhammond at users.sourceforge.net Mon May 10 03:35:35 2004 From: mhammond at users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon May 10 03:35:40 2004 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14811 Modified Files: urllib2.py Log Message: Fix [ 738973 ] urllib2 CacheFTPHandler doesn't work on multiple dirs, as implemented in patch [ 851736 ]. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** urllib2.py 6 May 2004 01:41:26 -0000 1.65 --- urllib2.py 10 May 2004 07:35:33 -0000 1.66 *************** *** 1169,1173 **** def connect_ftp(self, user, passwd, host, port, dirs): ! key = user, passwd, host, port if key in self.cache: self.timeout[key] = time.time() + self.delay --- 1169,1173 ---- def connect_ftp(self, user, passwd, host, port, dirs): ! key = user, host, port, '/'.join(dirs) if key in self.cache: self.timeout[key] = time.time() + self.delay From rhettinger at users.sourceforge.net Mon May 10 10:08:47 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon May 10 10:08:53 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_deque.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31026 Modified Files: test_deque.py Log Message: Temporarily disable doctest until genexps are in CVS Index: test_deque.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_deque.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_deque.py 9 May 2004 01:15:01 -0000 1.8 --- test_deque.py 10 May 2004 14:08:42 -0000 1.9 *************** *** 556,560 **** # doctests from test import test_deque ! test_support.run_doctest(test_deque, verbose) if __name__ == "__main__": --- 556,560 ---- # doctests from test import test_deque ! # test_support.run_doctest(test_deque, verbose) if __name__ == "__main__": From bwarsaw at users.sourceforge.net Mon May 10 10:44:15 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon May 10 10:44:20 2004 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6010 Modified Files: Header.py Log Message: _split_ascii(): Small optimization by RH. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Header.py 9 May 2004 03:40:17 -0000 1.28 --- Header.py 10 May 2004 14:44:04 -0000 1.29 *************** *** 412,416 **** # whitespace. for ch in splitchars: ! if line.find(ch) >= 0: break else: --- 412,416 ---- # whitespace. for ch in splitchars: ! if ch in line: break else: From bwarsaw at users.sourceforge.net Mon May 10 10:48:33 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon May 10 10:48:36 2004 Subject: [Python-checkins] python/dist/src/Lib/email FeedParser.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7132 Modified Files: FeedParser.py Log Message: _parse_headers(): Strip a trailing newline from the envelope header. Closes SF #951088. Index: FeedParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FeedParser.py 9 May 2004 03:29:23 -0000 1.2 --- FeedParser.py 10 May 2004 14:48:30 -0000 1.3 *************** *** 405,408 **** --- 405,412 ---- if line.startswith('From '): if lineno == 0: + # Strip off the trailing newline + mo = NLCRE_eol.search(line) + if mo: + line = line[:-len(mo.group(0))] self._cur.set_unixfrom(line) continue From fdrake at users.sourceforge.net Mon May 10 14:39:05 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon May 10 14:39:13 2004 Subject: [Python-checkins] python/dist/src/Doc/doc doc.tex, 1.75.8.4, 1.75.8.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2367 Modified Files: Tag: release23-maint doc.tex Log Message: don't make assumptions about $PATH in Cygwin instructions Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.75.8.4 retrieving revision 1.75.8.5 diff -C2 -d -r1.75.8.4 -r1.75.8.5 *** doc.tex 25 Mar 2004 08:55:58 -0000 1.75.8.4 --- doc.tex 10 May 2004 18:39:01 -0000 1.75.8.5 *************** *** 1826,1830 **** \begin{verbatim} ! % configure && make install \end{verbatim} --- 1826,1830 ---- \begin{verbatim} ! % ./configure && make install \end{verbatim} From fdrake at users.sourceforge.net Mon May 10 14:39:36 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon May 10 14:39:39 2004 Subject: [Python-checkins] python/dist/src/Doc/doc doc.tex,1.84,1.85 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2495 Modified Files: doc.tex Log Message: don't make assumptions about $PATH in Cygwin instructions Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** doc.tex 25 Mar 2004 08:51:36 -0000 1.84 --- doc.tex 10 May 2004 18:39:32 -0000 1.85 *************** *** 1847,1851 **** \begin{verbatim} ! % configure && make install \end{verbatim} --- 1847,1851 ---- \begin{verbatim} ! % ./configure && make install \end{verbatim} From montanaro at users.sourceforge.net Mon May 10 14:53:03 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon May 10 14:53:06 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libtime.tex,1.63,1.64 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4965 Modified Files: libtime.tex Log Message: Point out that %p has no effect on the output hour in strptime unless %I is used to parse the hour. Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** libtime.tex 2 Mar 2004 04:38:10 -0000 1.63 --- libtime.tex 10 May 2004 18:53:00 -0000 1.64 *************** *** 235,240 **** \lineiii{\%m}{Month as a decimal number [01,12].}{} \lineiii{\%M}{Minute as a decimal number [00,59].}{} ! \lineiii{\%p}{Locale's equivalent of either AM or PM.}{} ! \lineiii{\%S}{Second as a decimal number [00,61].}{(1)} \lineiii{\%U}{Week number of the year (Sunday as the first day of the week) as a decimal number [00,53]. All days in a new year --- 235,240 ---- \lineiii{\%m}{Month as a decimal number [01,12].}{} \lineiii{\%M}{Minute as a decimal number [00,59].}{} ! \lineiii{\%p}{Locale's equivalent of either AM or PM.}{(1)} ! \lineiii{\%S}{Second as a decimal number [00,61].}{(2)} \lineiii{\%U}{Week number of the year (Sunday as the first day of the week) as a decimal number [00,53]. All days in a new year *************** *** 257,260 **** --- 257,264 ---- \begin{description} \item[(1)] + When used with the \function{strptime()} function, the \code{\%p} + directive only affects the output hour field if the \code{\%I} directive + is used to parse the hour. + \item[(2)] The range really is \code{0} to \code{61}; this accounts for leap seconds and the (very rare) double leap seconds. From bwarsaw at users.sourceforge.net Mon May 10 19:12:30 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon May 10 19:12:34 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libmailbox.tex, 1.26.10.1, 1.26.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30578 Modified Files: Tag: release23-maint libmailbox.tex Log Message: Added a note describing how fp should be opened in binary mode, especially on Windows. Closes SF # 586899. Index: libmailbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmailbox.tex,v retrieving revision 1.26.10.1 retrieving revision 1.26.10.2 diff -C2 -d -r1.26.10.1 -r1.26.10.2 *** libmailbox.tex 25 Aug 2003 04:34:46 -0000 1.26.10.1 --- libmailbox.tex 10 May 2004 23:12:27 -0000 1.26.10.2 *************** *** 19,22 **** --- 19,26 ---- \refmodule{rfc822} module -- and the note below). + \note{For reasons of this module's internal implementation, you will probably + want to open the \var{fp} object in binary mode. This is especially important + on Windows.} + For maximum portability, messages in a \UNIX-style mailbox are separated by any line that begins exactly with the string \code{'From From bwarsaw at users.sourceforge.net Mon May 10 19:12:55 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon May 10 19:12:59 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libmailbox.tex,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30651 Modified Files: libmailbox.tex Log Message: Added a note describing how fp should be opened in binary mode, especially on Windows. Closes SF # 586899. Index: libmailbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmailbox.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** libmailbox.tex 25 Aug 2003 04:28:04 -0000 1.27 --- libmailbox.tex 10 May 2004 23:12:52 -0000 1.28 *************** *** 19,22 **** --- 19,26 ---- \refmodule{rfc822} module -- and the note below). + \note{For reasons of this module's internal implementation, you will probably + want to open the \var{fp} object in binary mode. This is especially important + on Windows.} + For maximum portability, messages in a \UNIX-style mailbox are separated by any line that begins exactly with the string \code{'From From gward at users.sourceforge.net Mon May 10 21:33:11 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Mon May 10 21:33:16 2004 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c, 1.34, 1.34.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26885/Modules Modified Files: Tag: release23-maint ossaudiodev.c Log Message: SF #832236: wrap a bunch of _EXPORT_INT calls in #ifdef's, to avoid breaking the build on MkLinux (Linux 2.0). Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.34 retrieving revision 1.34.8.1 diff -C2 -d -r1.34 -r1.34.8.1 *** ossaudiodev.c 2 Jun 2003 14:15:34 -0000 1.34 --- ossaudiodev.c 11 May 2004 01:33:04 -0000 1.34.8.1 *************** *** 990,1001 **** --- 990,1017 ---- _EXPORT_INT(m, SOUND_MIXER_LINE2); _EXPORT_INT(m, SOUND_MIXER_LINE3); + #ifdef SOUND_MIXER_DIGITAL1 _EXPORT_INT(m, SOUND_MIXER_DIGITAL1); + #endif + #ifdef SOUND_MIXER_DIGITAL2 _EXPORT_INT(m, SOUND_MIXER_DIGITAL2); + #endif + #ifdef SOUND_MIXER_DIGITAL3 _EXPORT_INT(m, SOUND_MIXER_DIGITAL3); + #endif + #ifdef SOUND_MIXER_PHONEIN _EXPORT_INT(m, SOUND_MIXER_PHONEIN); + #endif + #ifdef SOUND_MIXER_PHONEOUT _EXPORT_INT(m, SOUND_MIXER_PHONEOUT); + #endif + #ifdef SOUND_MIXER_VIDEO _EXPORT_INT(m, SOUND_MIXER_VIDEO); + #endif + #ifdef SOUND_MIXER_RADIO _EXPORT_INT(m, SOUND_MIXER_RADIO); + #endif + #ifdef SOUND_MIXER_MONITOR _EXPORT_INT(m, SOUND_MIXER_MONITOR); + #endif /* Expose all the ioctl numbers for masochists who like to do this *************** *** 1023,1027 **** --- 1039,1045 ---- _EXPORT_INT(m, SNDCTL_DSP_GETIPTR); _EXPORT_INT(m, SNDCTL_DSP_GETISPACE); + #ifdef SNDCTL_DSP_GETODELAY _EXPORT_INT(m, SNDCTL_DSP_GETODELAY); + #endif _EXPORT_INT(m, SNDCTL_DSP_GETOPTR); _EXPORT_INT(m, SNDCTL_DSP_GETOSPACE); From gward at users.sourceforge.net Mon May 10 21:34:57 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Mon May 10 21:35:01 2004 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27142/Modules Modified Files: ossaudiodev.c Log Message: SF #832236: merge from release23-maint branch: wrap a bunch of _EXPORT_INT calls in #ifdef's, to avoid breaking the build on MkLinux (Linux 2.0). Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** ossaudiodev.c 2 Jun 2003 14:15:34 -0000 1.34 --- ossaudiodev.c 11 May 2004 01:34:55 -0000 1.35 *************** *** 990,1001 **** --- 990,1017 ---- _EXPORT_INT(m, SOUND_MIXER_LINE2); _EXPORT_INT(m, SOUND_MIXER_LINE3); + #ifdef SOUND_MIXER_DIGITAL1 _EXPORT_INT(m, SOUND_MIXER_DIGITAL1); + #endif + #ifdef SOUND_MIXER_DIGITAL2 _EXPORT_INT(m, SOUND_MIXER_DIGITAL2); + #endif + #ifdef SOUND_MIXER_DIGITAL3 _EXPORT_INT(m, SOUND_MIXER_DIGITAL3); + #endif + #ifdef SOUND_MIXER_PHONEIN _EXPORT_INT(m, SOUND_MIXER_PHONEIN); + #endif + #ifdef SOUND_MIXER_PHONEOUT _EXPORT_INT(m, SOUND_MIXER_PHONEOUT); + #endif + #ifdef SOUND_MIXER_VIDEO _EXPORT_INT(m, SOUND_MIXER_VIDEO); + #endif + #ifdef SOUND_MIXER_RADIO _EXPORT_INT(m, SOUND_MIXER_RADIO); + #endif + #ifdef SOUND_MIXER_MONITOR _EXPORT_INT(m, SOUND_MIXER_MONITOR); + #endif /* Expose all the ioctl numbers for masochists who like to do this *************** *** 1023,1027 **** --- 1039,1045 ---- _EXPORT_INT(m, SNDCTL_DSP_GETIPTR); _EXPORT_INT(m, SNDCTL_DSP_GETISPACE); + #ifdef SNDCTL_DSP_GETODELAY _EXPORT_INT(m, SNDCTL_DSP_GETODELAY); + #endif _EXPORT_INT(m, SNDCTL_DSP_GETOPTR); _EXPORT_INT(m, SNDCTL_DSP_GETOSPACE); From bwarsaw at users.sourceforge.net Mon May 10 22:05:17 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon May 10 22:05:21 2004 Subject: [Python-checkins] python/dist/src/Modules binascii.c,2.39,2.40 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31678 Modified Files: binascii.c Log Message: In order to fix SF bug # 824977, we replace calloc()/free() calls in binascii_a2b_qp() and binascii_b2a_qp() with calls to PyMem_Malloc() and PyMem_Free(). These won't return NULL unless the allocations actually fail, so it won't trigger a bogus memory error on some platforms AIX when passed a length of zero. Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.39 retrieving revision 2.40 diff -C2 -d -r2.39 -r2.40 *** binascii.c 17 Mar 2003 11:24:29 -0000 2.39 --- binascii.c 11 May 2004 02:05:11 -0000 2.40 *************** *** 1037,1047 **** return NULL; ! /* We allocate the output same size as input, this is overkill */ ! odata = (unsigned char *) calloc(1, datalen); ! if (odata == NULL) { PyErr_NoMemory(); return NULL; } in = out = 0; --- 1037,1050 ---- return NULL; ! /* We allocate the output same size as input, this is overkill. ! * The previous implementation used calloc() so we'll zero out the ! * memory here too, since PyMem_Malloc() does not guarantee that. ! */ ! odata = (unsigned char *) PyMem_Malloc(datalen); if (odata == NULL) { PyErr_NoMemory(); return NULL; } + memset(odata, datalen, 0); in = out = 0; *************** *** 1091,1098 **** } if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { ! free (odata); return NULL; } ! free (odata); return rv; } --- 1094,1101 ---- } if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { ! PyMem_Free(odata); return NULL; } ! PyMem_Free(odata); return rv; } *************** *** 1208,1217 **** } ! odata = (unsigned char *) calloc(1, odatalen); ! if (odata == NULL) { PyErr_NoMemory(); return NULL; } in = out = linelen = 0; --- 1211,1224 ---- } ! /* We allocate the output same size as input, this is overkill. ! * The previous implementation used calloc() so we'll zero out the ! * memory here too, since PyMem_Malloc() does not guarantee that. ! */ ! odata = (unsigned char *) PyMem_Malloc(odatalen); if (odata == NULL) { PyErr_NoMemory(); return NULL; } + memset(odata, odatalen, 0); in = out = linelen = 0; *************** *** 1282,1289 **** } if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { ! free (odata); return NULL; } ! free (odata); return rv; } --- 1289,1296 ---- } if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { ! PyMem_Free(odata); return NULL; } ! PyMem_Free(odata); return rv; } From bwarsaw at users.sourceforge.net Mon May 10 22:07:06 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon May 10 22:07:10 2004 Subject: [Python-checkins] python/dist/src/Modules binascii.c, 2.39, 2.39.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32060 Modified Files: Tag: release23-maint binascii.c Log Message: In order to fix SF bug # 824977, we replace calloc()/free() calls in binascii_a2b_qp() and binascii_b2a_qp() with calls to PyMem_Malloc() and PyMem_Free(). These won't return NULL unless the allocations actually fail, so it won't trigger a bogus memory error on some platforms AIX when passed a length of zero. Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.39 retrieving revision 2.39.10.1 diff -C2 -d -r2.39 -r2.39.10.1 *** binascii.c 17 Mar 2003 11:24:29 -0000 2.39 --- binascii.c 11 May 2004 02:07:03 -0000 2.39.10.1 *************** *** 1037,1047 **** return NULL; ! /* We allocate the output same size as input, this is overkill */ ! odata = (unsigned char *) calloc(1, datalen); ! if (odata == NULL) { PyErr_NoMemory(); return NULL; } in = out = 0; --- 1037,1050 ---- return NULL; ! /* We allocate the output same size as input, this is overkill. ! * The previous implementation used calloc() so we'll zero out the ! * memory here too, since PyMem_Malloc() does not guarantee that. ! */ ! odata = (unsigned char *) PyMem_Malloc(datalen); if (odata == NULL) { PyErr_NoMemory(); return NULL; } + memset(odata, datalen, 0); in = out = 0; *************** *** 1091,1098 **** } if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { ! free (odata); return NULL; } ! free (odata); return rv; } --- 1094,1101 ---- } if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { ! PyMem_Free(odata); return NULL; } ! PyMem_Free(odata); return rv; } *************** *** 1208,1217 **** } ! odata = (unsigned char *) calloc(1, odatalen); ! if (odata == NULL) { PyErr_NoMemory(); return NULL; } in = out = linelen = 0; --- 1211,1224 ---- } ! /* We allocate the output same size as input, this is overkill. ! * The previous implementation used calloc() so we'll zero out the ! * memory here too, since PyMem_Malloc() does not guarantee that. ! */ ! odata = (unsigned char *) PyMem_Malloc(odatalen); if (odata == NULL) { PyErr_NoMemory(); return NULL; } + memset(odata, odatalen, 0); in = out = linelen = 0; *************** *** 1282,1289 **** } if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { ! free (odata); return NULL; } ! free (odata); return rv; } --- 1289,1296 ---- } if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { ! PyMem_Free(odata); return NULL; } ! PyMem_Free(odata); return rv; } From fdrake at users.sourceforge.net Tue May 11 01:29:37 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 01:29:43 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libmailbox.tex,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32759 Modified Files: libmailbox.tex Log Message: markup adjustment Index: libmailbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmailbox.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** libmailbox.tex 10 May 2004 23:12:52 -0000 1.28 --- libmailbox.tex 11 May 2004 05:29:34 -0000 1.29 *************** *** 19,25 **** \refmodule{rfc822} module -- and the note below). ! \note{For reasons of this module's internal implementation, you will probably ! want to open the \var{fp} object in binary mode. This is especially important ! on Windows.} For maximum portability, messages in a \UNIX-style mailbox are --- 19,27 ---- \refmodule{rfc822} module -- and the note below). ! \begin{notice} ! For reasons of this module's internal implementation, you will ! probably want to open the \var{fp} object in binary mode. This is ! especially important on Windows. ! \end{notice} For maximum portability, messages in a \UNIX-style mailbox are From fdrake at users.sourceforge.net Tue May 11 01:30:12 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 01:30:16 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libmailbox.tex, 1.26.10.2, 1.26.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv452 Modified Files: Tag: release23-maint libmailbox.tex Log Message: markup adjustment Index: libmailbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmailbox.tex,v retrieving revision 1.26.10.2 retrieving revision 1.26.10.3 diff -C2 -d -r1.26.10.2 -r1.26.10.3 *** libmailbox.tex 10 May 2004 23:12:27 -0000 1.26.10.2 --- libmailbox.tex 11 May 2004 05:30:09 -0000 1.26.10.3 *************** *** 19,25 **** \refmodule{rfc822} module -- and the note below). ! \note{For reasons of this module's internal implementation, you will probably ! want to open the \var{fp} object in binary mode. This is especially important ! on Windows.} For maximum portability, messages in a \UNIX-style mailbox are --- 19,27 ---- \refmodule{rfc822} module -- and the note below). ! \begin{notice} ! For reasons of this module's internal implementation, you will ! probably want to open the \var{fp} object in binary mode. This is ! especially important on Windows. ! \end{notice} For maximum portability, messages in a \UNIX-style mailbox are From jarjfuputrd at fh-weihenstephan.de Tue May 11 08:36:30 2004 From: jarjfuputrd at fh-weihenstephan.de (Kari Olsen) Date: Tue May 11 07:44:43 2004 Subject: [Python-checkins] Winning advice gets you in on a strong rally Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040511/63e79129/attachment.html From fdrake at users.sourceforge.net Tue May 11 10:14:06 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 10:14:11 2004 Subject: [Python-checkins] python/dist/src/Doc/commontex reportingbugs.tex, 1.1.2.1, 1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4753 Modified Files: Tag: release23-maint reportingbugs.tex Log Message: update to reflect the current location of the SF bugs search box Index: reportingbugs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/reportingbugs.tex,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** reportingbugs.tex 27 Sep 2003 07:14:32 -0000 1.1.2.1 --- reportingbugs.tex 11 May 2004 14:14:02 -0000 1.1.2.2 *************** *** 22,26 **** release, or additional information is needed (in which case you are welcome to provide it if you can!). To do this, search the bug ! database using the search box near the bottom of the page. If the problem you're reporting is not already in the bug tracker, go --- 22,26 ---- release, or additional information is needed (in which case you are welcome to provide it if you can!). To do this, search the bug ! database using the search box on the left side of the page. If the problem you're reporting is not already in the bug tracker, go From fdrake at users.sourceforge.net Tue May 11 10:14:32 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 10:14:35 2004 Subject: [Python-checkins] python/dist/src/Doc/commontex reportingbugs.tex, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4832 Modified Files: reportingbugs.tex Log Message: update to reflect the current location of the SF bugs search box Index: reportingbugs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/reportingbugs.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** reportingbugs.tex 27 Sep 2003 07:11:17 -0000 1.1 --- reportingbugs.tex 11 May 2004 14:14:24 -0000 1.2 *************** *** 22,26 **** release, or additional information is needed (in which case you are welcome to provide it if you can!). To do this, search the bug ! database using the search box near the bottom of the page. If the problem you're reporting is not already in the bug tracker, go --- 22,26 ---- release, or additional information is needed (in which case you are welcome to provide it if you can!). To do this, search the bug ! database using the search box on the left side of the page. If the problem you're reporting is not already in the bug tracker, go From fdrake at users.sourceforge.net Tue May 11 10:26:05 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 10:26:13 2004 Subject: [Python-checkins] python/dist/src/Doc/tools getversioninfo,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8295 Modified Files: getversioninfo Log Message: remove assignment to unused variable Index: getversioninfo =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/getversioninfo,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** getversioninfo 27 Sep 2003 22:07:04 -0000 1.1 --- getversioninfo 11 May 2004 14:25:56 -0000 1.2 *************** *** 59,63 **** patchlevel_tex = os.path.join(Doc, "commontex", "patchlevel.tex") - Makefile_version = os.path.join(Doc, "Makefile.version") write_file(patchlevel_tex, --- 59,62 ---- From fdrake at users.sourceforge.net Tue May 11 10:35:22 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 10:35:27 2004 Subject: [Python-checkins] python/dist/src/Doc/tools getversioninfo, 1.1.2.1, 1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10606 Modified Files: Tag: release23-maint getversioninfo Log Message: remove assignment to unused variable Index: getversioninfo =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/getversioninfo,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** getversioninfo 5 Dec 2003 12:56:21 -0000 1.1.2.1 --- getversioninfo 11 May 2004 14:35:19 -0000 1.1.2.2 *************** *** 59,63 **** patchlevel_tex = os.path.join(Doc, "commontex", "patchlevel.tex") - Makefile_version = os.path.join(Doc, "Makefile.version") write_file(patchlevel_tex, --- 59,62 ---- From fdrake at users.sourceforge.net Tue May 11 10:37:31 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 10:37:35 2004 Subject: [Python-checkins] python/dist/src/Doc/tools mkpkglist,1.4,1.4.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10985 Modified Files: Tag: release23-maint mkpkglist Log Message: use tools/getversioninfo to extract the version number from the Python sources Index: mkpkglist =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkpkglist,v retrieving revision 1.4 retrieving revision 1.4.10.1 diff -C2 -d -r1.4 -r1.4.10.1 *** mkpkglist 29 May 2003 19:46:29 -0000 1.4 --- mkpkglist 11 May 2004 14:37:25 -0000 1.4.10.1 *************** *** 26,40 **** ] ! ! fp = open("Makefile") ! for line in fp: ! line = line.replace('=', ' ', 1) ! parts = line.split() ! if parts[:1] == ["RELEASE"]: ! release = parts[1] ! break ! else: ! print >>sys.stderr, "Could not locate RELEASE in Makefile." ! sys.exit(1) print '''\ --- 26,33 ---- ] ! getversioninfo = os.path.join(os.path.dirname(__file__), "getversioninfo") ! fp = os.popen('"%s" "%s"' % (sys.executable, getversioninfo), "r") ! release = fp.readline().strip() ! fp.close() print '''\ From fdrake at users.sourceforge.net Tue May 11 10:37:58 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 10:38:02 2004 Subject: [Python-checkins] python/dist/src/Doc/tools mkpkglist,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11055 Modified Files: mkpkglist Log Message: use tools/getversioninfo to extract the version number from the Python sources Index: mkpkglist =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkpkglist,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mkpkglist 29 May 2003 19:46:29 -0000 1.4 --- mkpkglist 11 May 2004 14:37:55 -0000 1.5 *************** *** 26,40 **** ] ! ! fp = open("Makefile") ! for line in fp: ! line = line.replace('=', ' ', 1) ! parts = line.split() ! if parts[:1] == ["RELEASE"]: ! release = parts[1] ! break ! else: ! print >>sys.stderr, "Could not locate RELEASE in Makefile." ! sys.exit(1) print '''\ --- 26,33 ---- ] ! getversioninfo = os.path.join(os.path.dirname(__file__), "getversioninfo") ! fp = os.popen('"%s" "%s"' % (sys.executable, getversioninfo), "r") ! release = fp.readline().strip() ! fp.close() print '''\ From theller at users.sourceforge.net Tue May 11 10:59:48 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Tue May 11 10:59:52 2004 Subject: [Python-checkins] python/dist/src/Lib modulefinder.py, 1.7.6.1, 1.7.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15607 Modified Files: Tag: release23-maint modulefinder.py Log Message: Fix SF item #876278: Unbounded recursion in modulefinder. Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/modulefinder.py,v retrieving revision 1.7.6.1 retrieving revision 1.7.6.2 diff -C2 -d -r1.7.6.1 -r1.7.6.2 *** modulefinder.py 14 Nov 2003 10:23:03 -0000 1.7.6.1 --- modulefinder.py 11 May 2004 14:59:45 -0000 1.7.6.2 *************** *** 246,249 **** --- 246,252 ---- self.msgout(3, "import_module -> None") return None + if parent and parent.__path__ is None: + self.msgout(3, "import_module -> None") + return None try: fp, pathname, stuff = self.find_module(partname, *************** *** 393,396 **** --- 396,400 ---- def find_module(self, name, path, parent=None): if parent is not None: + # assert path is not None fullname = parent.__name__+'.'+name else: From theller at users.sourceforge.net Tue May 11 11:00:11 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Tue May 11 11:00:15 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.109, 1.831.4.110 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15653 Modified Files: Tag: release23-maint NEWS Log Message: Fix SF item #876278: Unbounded recursion in modulefinder. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.109 retrieving revision 1.831.4.110 diff -C2 -d -r1.831.4.109 -r1.831.4.110 *** NEWS 8 May 2004 23:20:39 -0000 1.831.4.109 --- NEWS 11 May 2004 15:00:07 -0000 1.831.4.110 *************** *** 43,46 **** --- 43,48 ---- ------- + - Bug #876278: Unbounded recursion in modulefinder + - Brought platform.py in line with the 2.4 version, fixing support for newer Windows versions and a cache issue. From theller at users.sourceforge.net Tue May 11 11:10:00 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Tue May 11 11:10:06 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.971,1.972 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18087 Modified Files: NEWS Log Message: Fix SF item #876278: Unbounded recursion in modulefinder. Already backported to release23-maint. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.971 retrieving revision 1.972 diff -C2 -d -r1.971 -r1.972 *** NEWS 6 May 2004 01:54:35 -0000 1.971 --- NEWS 11 May 2004 15:09:57 -0000 1.972 *************** *** 307,310 **** --- 307,312 ---- ------- + - Bug #876278: Unbounded recursion in modulefinder + - Bug #780300: Swap public and system ID in LexicalHandler.startDTD. Applications relying on the wrong order need to be corrected. From theller at users.sourceforge.net Tue May 11 11:11:02 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Tue May 11 11:11:06 2004 Subject: [Python-checkins] python/dist/src/Lib modulefinder.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18411 Modified Files: modulefinder.py Log Message: Fix SF item #876278: Unbounded recursion in modulefinder. Already backported to release23-maint. Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/modulefinder.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** modulefinder.py 15 Feb 2004 16:43:20 -0000 1.10 --- modulefinder.py 11 May 2004 15:10:59 -0000 1.11 *************** *** 246,249 **** --- 246,252 ---- self.msgout(3, "import_module -> None") return None + if parent and parent.__path__ is None: + self.msgout(3, "import_module -> None") + return None try: fp, pathname, stuff = self.find_module(partname, *************** *** 393,396 **** --- 396,400 ---- def find_module(self, name, path, parent=None): if parent is not None: + # assert path is not None fullname = parent.__name__+'.'+name else: From fdrake at users.sourceforge.net Tue May 11 11:21:24 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 11:21:29 2004 Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.74.4.9, 2.74.4.10 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20757 Modified Files: Tag: release23-maint patchlevel.h Log Message: update the version information in preparation for release (the documentation tools use this) Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.74.4.9 retrieving revision 2.74.4.10 diff -C2 -d -r2.74.4.9 -r2.74.4.10 *** patchlevel.h 18 Dec 2003 15:06:58 -0000 2.74.4.9 --- patchlevel.h 11 May 2004 15:21:20 -0000 2.74.4.10 *************** *** 22,31 **** #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 3 ! #define PY_MICRO_VERSION 3 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL ! #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.3.3" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 22,31 ---- #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 3 ! #define PY_MICRO_VERSION 4 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA ! #define PY_RELEASE_SERIAL 1 /* Version as a string */ ! #define PY_VERSION "2.3.4c1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From tim_one at users.sourceforge.net Tue May 11 12:35:08 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue May 11 12:35:17 2004 Subject: [Python-checkins] python/dist/src/Objects typeobject.c, 2.241.6.8, 2.241.6.9 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3804/Objects Modified Files: Tag: release23-maint typeobject.c Log Message: super_getattro(): Repaired compiler warning about mixed-type comparison. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.241.6.8 retrieving revision 2.241.6.9 diff -C2 -d -r2.241.6.8 -r2.241.6.9 *** typeobject.c 25 Mar 2004 02:36:29 -0000 2.241.6.8 --- typeobject.c 11 May 2004 16:35:05 -0000 2.241.6.9 *************** *** 5502,5506 **** (See SF ID #743627) */ ! (su->obj==su->obj_type ? (PyObject *)NULL : su->obj), --- 5502,5507 ---- (See SF ID #743627) */ ! (su->obj == ! (PyObject *)su->obj_type ? (PyObject *)NULL : su->obj), From bwarsaw at users.sourceforge.net Tue May 11 14:10:19 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue May 11 14:10:22 2004 Subject: [Python-checkins] python/dist/src/Lib/email FeedParser.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32329 Modified Files: FeedParser.py Log Message: _parsegen(): Watch out for empty epilogues. Index: FeedParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FeedParser.py 10 May 2004 14:48:30 -0000 1.3 --- FeedParser.py 11 May 2004 18:10:15 -0000 1.4 *************** *** 366,373 **** # the epilogue. Also, watch out for an empty string epilogue, # which means a single newline. ! firstline = epilogue[0] ! bolmo = NLCRE_bol.match(firstline) ! if bolmo: ! epilogue[0] = firstline[len(bolmo.group(0)):] self._cur.epilogue = EMPTYSTRING.join(epilogue) return --- 366,374 ---- # the epilogue. Also, watch out for an empty string epilogue, # which means a single newline. ! if epilogue: ! firstline = epilogue[0] ! bolmo = NLCRE_bol.match(firstline) ! if bolmo: ! epilogue[0] = firstline[len(bolmo.group(0)):] self._cur.epilogue = EMPTYSTRING.join(epilogue) return From tim_one at users.sourceforge.net Tue May 11 14:11:14 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue May 11 14:11:19 2004 Subject: [Python-checkins] python/dist/src LICENSE,1.26.8.3,1.26.8.4 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32469 Modified Files: Tag: release23-maint LICENSE Log Message: Update copyright years. In the Windows resource, change the name of the company to the PSF (Zope Corp and PythonLabs no longer have anything to do with this!). Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.26.8.3 retrieving revision 1.26.8.4 diff -C2 -d -r1.26.8.3 -r1.26.8.4 *** LICENSE 4 Dec 2003 20:35:03 -0000 1.26.8.3 --- LICENSE 11 May 2004 18:11:10 -0000 1.26.8.4 *************** *** 47,50 **** --- 47,51 ---- 2.3.2 2.3.1 2002-2003 PSF yes 2.3.3 2.3.2 2002-2003 PSF yes + 2.3.4 2.3.4 2004 PSF yes Footnotes: *************** *** 82,86 **** alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) ! 2001, 2002, 2003 Python Software Foundation; All Rights Reserved" are retained in Python 2.3 alone or in any derivative version prepared by Licensee. --- 83,87 ---- alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) ! 2001, 2002, 2003, 2004 Python Software Foundation; All Rights Reserved" are retained in Python 2.3 alone or in any derivative version prepared by Licensee. From tim_one at users.sourceforge.net Tue May 11 14:11:15 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue May 11 14:11:21 2004 Subject: [Python-checkins] python/dist/src/PC python_nt.rc, 1.27.4.4, 1.27.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32469/PC Modified Files: Tag: release23-maint python_nt.rc Log Message: Update copyright years. In the Windows resource, change the name of the company to the PSF (Zope Corp and PythonLabs no longer have anything to do with this!). Index: python_nt.rc =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/python_nt.rc,v retrieving revision 1.27.4.4 retrieving revision 1.27.4.5 diff -C2 -d -r1.27.4.4 -r1.27.4.5 *** python_nt.rc 22 Oct 2003 19:38:04 -0000 1.27.4.4 --- python_nt.rc 11 May 2004 18:11:11 -0000 1.27.4.5 *************** *** 58,66 **** BLOCK "000004b0" BEGIN ! VALUE "CompanyName", "PythonLabs at Zope Corporation\0" VALUE "FileDescription", "Python Core\0" VALUE "FileVersion", PYTHON_VERSION VALUE "InternalName", "Python DLL\0" ! VALUE "LegalCopyright", "Copyright © 2001-2003 Python Software Foundation. Copyright © 2000 BeOpen.com. Copyright © 1995-2001 CNRI. Copyright © 1991-1995 SMC.\0" VALUE "OriginalFilename", PYTHON_DLL_NAME "\0" VALUE "ProductName", "Python\0" --- 58,66 ---- BLOCK "000004b0" BEGIN ! VALUE "CompanyName", "Python Software Foundation\0" VALUE "FileDescription", "Python Core\0" VALUE "FileVersion", PYTHON_VERSION VALUE "InternalName", "Python DLL\0" ! VALUE "LegalCopyright", "Copyright © 2001-2004 Python Software Foundation. Copyright © 2000 BeOpen.com. Copyright © 1995-2001 CNRI. Copyright © 1991-1995 SMC.\0" VALUE "OriginalFilename", PYTHON_DLL_NAME "\0" VALUE "ProductName", "Python\0" From tim_one at users.sourceforge.net Tue May 11 14:13:13 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue May 11 14:13:17 2004 Subject: [Python-checkins] python/dist/src LICENSE,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv345 Modified Files: LICENSE Log Message: Added 2.3.3 and 2.3.4 to the release table. Added 2004 to the list of copyright years. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** LICENSE 30 Sep 2003 07:07:08 -0000 1.28 --- LICENSE 11 May 2004 18:13:09 -0000 1.29 *************** *** 46,49 **** --- 46,51 ---- 2.3.1 2.3 2002-2003 PSF yes 2.3.2 2.3.1 2002-2003 PSF yes + 2.3.3 2.3.2 2002-2003 PSF yes + 2.3.4 2.3.3 2004 PSF yes Footnotes: *************** *** 81,87 **** alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) ! 2001, 2002, 2003 Python Software Foundation; All Rights Reserved" are ! retained in Python 2.3 alone or in any derivative version prepared by ! Licensee. 3. In the event Licensee prepares a derivative work that is based on --- 83,89 ---- alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) ! 2001, 2002, 2003, 2004 Python Software Foundation; All Rights Reserved" ! are retained in Python 2.3 alone or in any derivative version prepared ! by Licensee. 3. In the event Licensee prepares a derivative work that is based on From tim_one at users.sourceforge.net Tue May 11 14:13:13 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue May 11 14:13:20 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_ext.py, 1.93, 1.94 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv345/Lib/distutils/command Modified Files: build_ext.py Log Message: Added 2.3.3 and 2.3.4 to the release table. Added 2004 to the list of copyright years. Index: build_ext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_ext.py,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** build_ext.py 18 Jan 2004 20:39:35 -0000 1.93 --- build_ext.py 11 May 2004 18:13:10 -0000 1.94 *************** *** 172,178 **** # this allows distutils on windows to work in the source tree self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC')) ! self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild')) ! # OS/2 (EMX) doesn't support Debug vs Release builds, but has the # import libraries in its "Config" subdirectory if os.name == 'os2': --- 172,179 ---- # this allows distutils on windows to work in the source tree self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC')) ! self.library_dirs.append(os.path.join(sys.exec_prefix, 'PC', 'VC6')) ! #self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild')) ! # OS/2 (EMX) doesn't support Debug vs Release builds, but has the # import libraries in its "Config" subdirectory if os.name == 'os2': *************** *** 637,641 **** # believe VACPP does as well (though not confirmed) - AIM Apr01 template = "python%d%d" ! # debug versions of the main DLL aren't supported, at least # not at this time - AIM Apr01 #if self.debug: --- 638,642 ---- # believe VACPP does as well (though not confirmed) - AIM Apr01 template = "python%d%d" ! # debug versions of the main DLL aren't supported, at least # not at this time - AIM Apr01 #if self.debug: From tim_one at users.sourceforge.net Tue May 11 14:14:14 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue May 11 14:14:18 2004 Subject: [Python-checkins] python/dist/src/PC python_nt.rc,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv517/PC Modified Files: python_nt.rc Log Message: Changed company name to PSF. Added 2004 to copyright years. Index: python_nt.rc =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/python_nt.rc,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** python_nt.rc 10 Oct 2003 16:57:40 -0000 1.29 --- python_nt.rc 11 May 2004 18:14:05 -0000 1.30 *************** *** 58,66 **** BLOCK "000004b0" BEGIN ! VALUE "CompanyName", "PythonLabs at Zope Corporation\0" VALUE "FileDescription", "Python Core\0" VALUE "FileVersion", PYTHON_VERSION VALUE "InternalName", "Python DLL\0" ! VALUE "LegalCopyright", "Copyright © 2001-2003 Python Software Foundation. Copyright © 2000 BeOpen.com. Copyright © 1995-2001 CNRI. Copyright © 1991-1995 SMC.\0" VALUE "OriginalFilename", PYTHON_DLL_NAME "\0" VALUE "ProductName", "Python\0" --- 58,66 ---- BLOCK "000004b0" BEGIN ! VALUE "CompanyName", "Python Software Foundation\0" VALUE "FileDescription", "Python Core\0" VALUE "FileVersion", PYTHON_VERSION VALUE "InternalName", "Python DLL\0" ! VALUE "LegalCopyright", "Copyright © 2001-2004 Python Software Foundation. Copyright © 2000 BeOpen.com. Copyright © 1995-2001 CNRI. Copyright © 1991-1995 SMC.\0" VALUE "OriginalFilename", PYTHON_DLL_NAME "\0" VALUE "ProductName", "Python\0" From tim_one at users.sourceforge.net Tue May 11 14:18:54 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue May 11 14:18:57 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_ext.py, 1.94, 1.95 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1658 Modified Files: build_ext.py Log Message: Reverting local change checked in by mistake. Index: build_ext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_ext.py,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** build_ext.py 11 May 2004 18:13:10 -0000 1.94 --- build_ext.py 11 May 2004 18:18:35 -0000 1.95 *************** *** 172,179 **** # this allows distutils on windows to work in the source tree self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC')) ! self.library_dirs.append(os.path.join(sys.exec_prefix, 'PC', 'VC6')) ! #self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild')) ! # OS/2 (EMX) doesn't support Debug vs Release builds, but has the # import libraries in its "Config" subdirectory if os.name == 'os2': --- 172,178 ---- # this allows distutils on windows to work in the source tree self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC')) ! self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild')) ! # OS/2 (EMX) doesn't support Debug vs Release builds, but has the # import libraries in its "Config" subdirectory if os.name == 'os2': *************** *** 638,642 **** # believe VACPP does as well (though not confirmed) - AIM Apr01 template = "python%d%d" ! # debug versions of the main DLL aren't supported, at least # not at this time - AIM Apr01 #if self.debug: --- 637,641 ---- # believe VACPP does as well (though not confirmed) - AIM Apr01 template = "python%d%d" ! # debug versions of the main DLL aren't supported, at least # not at this time - AIM Apr01 #if self.debug: From bwarsaw at users.sourceforge.net Tue May 11 16:19:13 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue May 11 16:19:18 2004 Subject: [Python-checkins] python/dist/src/Lib/email FeedParser.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28747 Modified Files: FeedParser.py Log Message: _parsegen(): Move the message/rfc822 clause to after the message/delivery-status clause, and genericize it to handle all (other) message/* content types. This lets us correctly parse 2 more of Anthony's MIME torture tests (specifically, the message/external-body examples). Index: FeedParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FeedParser.py 11 May 2004 18:10:15 -0000 1.4 --- FeedParser.py 11 May 2004 20:19:09 -0000 1.5 *************** *** 212,230 **** self._cur.set_payload(EMPTYSTRING.join(lines)) return - # So now the input is sitting at the first body line. If the message - # claims to be a message/rfc822 type, then what follows is another RFC - # 2822 message. - if self._cur.get_content_type() == 'message/rfc822': - for retval in self._parsegen(): - if retval is NeedMoreData: - yield NeedMoreData - continue - break - self._pop_message() - return if self._cur.get_content_type() == 'message/delivery-status': # message/delivery-status contains blocks of headers separated by # a blank line. We'll represent each header block as a separate ! # nested message object. A blank line separates the subparts. while True: self._input.push_eof_matcher(NLCRE.match) --- 212,221 ---- self._cur.set_payload(EMPTYSTRING.join(lines)) return if self._cur.get_content_type() == 'message/delivery-status': # message/delivery-status contains blocks of headers separated by # a blank line. We'll represent each header block as a separate ! # nested message object, but the processing is a bit different ! # than standard message/* types because there is no body for the ! # nested messages. A blank line separates the subparts. while True: self._input.push_eof_matcher(NLCRE.match) *************** *** 250,253 **** --- 241,254 ---- self._input.unreadline(line) return + if self._cur.get_content_maintype() == 'message': + # The message claims to be a message/* type, then what follows is + # another RFC 2822 message. + for retval in self._parsegen(): + if retval is NeedMoreData: + yield NeedMoreData + continue + break + self._pop_message() + return if self._cur.get_content_maintype() == 'multipart': boundary = self._cur.get_boundary() From bwarsaw at users.sourceforge.net Tue May 11 18:20:08 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue May 11 18:20:14 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_37.txt, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24673 Added Files: msg_37.txt Log Message: An example with multiple boundary lines. --- NEW FILE: msg_37.txt --- Content-Type: multipart/mixed; boundary=ABCDE --ABCDE Content-Type: text/x-one Blah --ABCDE --ABCDE Content-Type: text/x-two Blah --ABCDE --ABCDE --ABCDE --ABCDE Content-Type: text/x-two Blah --ABCDE-- From bwarsaw at users.sourceforge.net Tue May 11 18:21:02 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue May 11 18:21:09 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_36.txt, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24792 Added Files: msg_36.txt Log Message: A boiled down message/external-body example from Anthony's torture test. --- NEW FILE: msg_36.txt --- Mime-Version: 1.0 Content-Type: Multipart/Mixed; Boundary="NextPart" To: IETF-Announce:; From: Internet-Drafts@ietf.org Subject: I-D ACTION:draft-ietf-mboned-mix-00.txt Date: Tue, 22 Dec 1998 16:55:06 -0500 --NextPart Blah blah blah --NextPart Content-Type: Multipart/Alternative; Boundary="OtherAccess" --OtherAccess Content-Type: Message/External-body; access-type="mail-server"; server="mailserv@ietf.org" Content-Type: text/plain Content-ID: <19981222151406.I-D@ietf.org> ENCODING mime FILE /internet-drafts/draft-ietf-mboned-mix-00.txt --OtherAccess Content-Type: Message/External-body; name="draft-ietf-mboned-mix-00.txt"; site="ftp.ietf.org"; access-type="anon-ftp"; directory="internet-drafts" Content-Type: text/plain Content-ID: <19981222151406.I-D@ietf.org> --OtherAccess-- --NextPart-- From bwarsaw at users.sourceforge.net Tue May 11 18:22:02 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue May 11 18:22:05 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.55, 1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24978 Modified Files: test_email.py Log Message: More boiled down tests from Anthony's big torture suite. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** test_email.py 9 May 2004 18:03:36 -0000 1.55 --- test_email.py 11 May 2004 22:21:56 -0000 1.56 *************** *** 1033,1038 **** ! # Test a more complicated multipart/mixed type message ! class TestMultipartMixed(TestEmailBase): def setUp(self): fp = openfile('PyBanner048.gif') --- 1033,1038 ---- ! # Test complicated multipart/* messages ! class TestMultipart(TestEmailBase): def setUp(self): fp = openfile('PyBanner048.gif') *************** *** 1306,1309 **** --- 1306,1329 ---- ''') + def test_message_external_body(self): + eq = self.assertEqual + msg = self._msgobj('msg_36.txt') + eq(len(msg.get_payload()), 2) + msg1 = msg.get_payload(1) + eq(msg1.get_content_type(), 'multipart/alternative') + eq(len(msg1.get_payload()), 2) + for subpart in msg1.get_payload(): + eq(subpart.get_content_type(), 'message/external-body') + eq(len(subpart.get_payload()), 1) + subsubpart = subpart.get_payload(0) + eq(subsubpart.get_content_type(), 'text/plain') + + def test_double_boundary(self): + # msg_37.txt is a multipart that contains two dash-boundary's in a + # row. Our interpretation of RFC 2046 calls for ignoring the second + # and subsequent boundaries. + msg = self._msgobj('msg_37.txt') + self.assertEqual(len(msg.get_payload()), 3) + *************** *** 1864,1867 **** --- 1884,1891 ---- self._idempotent(msg, text) + def test_message_external_body_idempotent(self): + msg, text = self._msgobj('msg_36.txt') + self._idempotent(msg, text) + def test_content_type(self): eq = self.assertEquals From bwarsaw at users.sourceforge.net Tue May 11 18:24:02 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue May 11 18:24:05 2004 Subject: [Python-checkins] python/dist/src/Lib/email FeedParser.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25298 Modified Files: FeedParser.py Log Message: Tests for message/external-body and for duplicate boundary lines. Index: FeedParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FeedParser.py 11 May 2004 20:19:09 -0000 1.5 --- FeedParser.py 11 May 2004 22:23:59 -0000 1.6 *************** *** 307,313 **** self._input.unreadline(line) continue ! # We saw a boundary separating two parts. Recurse to ! # parse this subpart; the input stream points at the ! # subpart's first line. self._input.push_eof_matcher(boundaryre.match) for retval in self._parsegen(): --- 307,322 ---- self._input.unreadline(line) continue ! # We saw a boundary separating two parts. Consume any ! # multiple boundary lines that may be following. Our ! # interpretation of RFC 2046 BNF grammar does not produce ! # body parts within such double boundaries. ! while True: ! line = self._input.readline() ! mo = boundaryre.match(line) ! if not mo: ! self._input.unreadline(line) ! break ! # Recurse to parse this subpart; the input stream points ! # at the subpart's first line. self._input.push_eof_matcher(boundaryre.match) for retval in self._parsegen(): From fdrake at users.sourceforge.net Tue May 11 22:47:59 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 22:48:06 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.129.8.8, 1.129.8.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9285 Modified Files: Tag: release23-maint libstdtypes.tex Log Message: add note about the __name__ read-only attribute (closes SF bug #952212) Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.129.8.8 retrieving revision 1.129.8.9 diff -C2 -d -r1.129.8.8 -r1.129.8.9 *** libstdtypes.tex 8 Jan 2004 00:33:04 -0000 1.129.8.8 --- libstdtypes.tex 12 May 2004 02:47:56 -0000 1.129.8.9 *************** *** 1650,1654 **** The implementation adds a few special read-only attributes to several ! object types, where they are relevant: \begin{memberdesc}[object]{__dict__} --- 1650,1655 ---- The implementation adds a few special read-only attributes to several ! object types, where they are relevant. Some of these are not reported ! by the \function{dir()} built-in function. \begin{memberdesc}[object]{__dict__} *************** *** 1675,1676 **** --- 1676,1681 ---- classes, this will be an empty tuple. \end{memberdesc} + + \begin{memberdesc}[class]{__name__} + The name of the class or type. + \end{memberdesc} From fdrake at users.sourceforge.net Tue May 11 22:48:31 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 22:48:36 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.152, 1.153 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9385 Modified Files: libstdtypes.tex Log Message: add note about the __name__ read-only attribute (closes SF bug #952212) Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** libstdtypes.tex 9 Mar 2004 05:53:15 -0000 1.152 --- libstdtypes.tex 12 May 2004 02:48:29 -0000 1.153 *************** *** 1786,1790 **** The implementation adds a few special read-only attributes to several ! object types, where they are relevant: \begin{memberdesc}[object]{__dict__} --- 1786,1791 ---- The implementation adds a few special read-only attributes to several ! object types, where they are relevant. Some of these are not reported ! by the \function{dir()} built-in function. \begin{memberdesc}[object]{__dict__} *************** *** 1811,1812 **** --- 1812,1817 ---- classes, this will be an empty tuple. \end{memberdesc} + + \begin{memberdesc}[class]{__name__} + The name of the class or type. + \end{memberdesc} From fdrake at users.sourceforge.net Tue May 11 23:03:48 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 23:03:55 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcode.tex, 1.14, 1.14.18.1 libinspect.tex, 1.13.10.2, 1.13.10.3 libregex.tex, 1.33.42.2, 1.33.42.3 liburllib2.tex, 1.13.8.1, 1.13.8.2 libxmlrpclib.tex, 1.13, 1.13.12.1 xmlsaxutils.tex, 1.5, 1.5.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11721 Modified Files: Tag: release23-maint libcode.tex libinspect.tex libregex.tex liburllib2.tex libxmlrpclib.tex xmlsaxutils.tex Log Message: fix various typos; thanks, George Yoshida! (closes SF patch #952047) Index: libcode.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcode.tex,v retrieving revision 1.14 retrieving revision 1.14.18.1 diff -C2 -d -r1.14 -r1.14.18.1 *** libcode.tex 5 Apr 2002 02:21:09 -0000 1.14 --- libcode.tex 12 May 2004 03:03:44 -0000 1.14.18.1 *************** *** 62,66 **** \exception{SyntaxError} if the command is complete and contains a syntax error, or raises \exception{OverflowError} or ! \exception{ValueError} if the command cotains an invalid literal. \end{funcdesc} --- 62,66 ---- \exception{SyntaxError} if the command is complete and contains a syntax error, or raises \exception{OverflowError} or ! \exception{ValueError} if the command contains an invalid literal. \end{funcdesc} Index: libinspect.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v retrieving revision 1.13.10.2 retrieving revision 1.13.10.3 diff -C2 -d -r1.13.10.2 -r1.13.10.3 *** libinspect.tex 1 Jan 2004 07:22:46 -0000 1.13.10.2 --- libinspect.tex 12 May 2004 03:03:44 -0000 1.13.10.3 *************** *** 121,125 **** 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. --- 121,125 ---- Return the name of the module named by the file \var{path}, without including the names of enclosing packages. This uses the same ! algorithm as the interpreter uses when searching for modules. If the name cannot be matched according to the interpreter's rules, \code{None} is returned. Index: libregex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libregex.tex,v retrieving revision 1.33.42.2 retrieving revision 1.33.42.3 diff -C2 -d -r1.33.42.2 -r1.33.42.3 *** libregex.tex 20 Oct 2003 14:34:44 -0000 1.33.42.2 --- libregex.tex 12 May 2004 03:03:44 -0000 1.33.42.3 *************** *** 45,49 **** from a document, you can use this pattern: \code{'[\e ]section\{\e (.*\e )\}'}. \emph{Another exception:} ! the escape sequece \samp{\e b} is significant in string literals (where it means the ASCII bell character) as well as in Emacs regular expressions (where it stands for a word boundary), so in order to --- 45,49 ---- from a document, you can use this pattern: \code{'[\e ]section\{\e (.*\e )\}'}. \emph{Another exception:} ! the escape sequence \samp{\e b} is significant in string literals (where it means the ASCII bell character) as well as in Emacs regular expressions (where it stands for a word boundary), so in order to Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.13.8.1 retrieving revision 1.13.8.2 diff -C2 -d -r1.13.8.1 -r1.13.8.2 *** liburllib2.tex 8 Feb 2004 20:26:17 -0000 1.13.8.1 --- liburllib2.tex 12 May 2004 03:03:44 -0000 1.13.8.2 *************** *** 480,484 **** \begin{methoddesc}[HTTPPasswordMgr]{add_password}{realm, uri, user, passwd} ! \var{uri} can be either a single URI, or a sequene of URIs. \var{realm}, \var{user} and \var{passwd} must be strings. This causes \code{(\var{user}, \var{passwd})} to be used as authentication tokens --- 480,484 ---- \begin{methoddesc}[HTTPPasswordMgr]{add_password}{realm, uri, user, passwd} ! \var{uri} can be either a single URI, or a sequence of URIs. \var{realm}, \var{user} and \var{passwd} must be strings. This causes \code{(\var{user}, \var{passwd})} to be used as authentication tokens Index: libxmlrpclib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libxmlrpclib.tex,v retrieving revision 1.13 retrieving revision 1.13.12.1 diff -C2 -d -r1.13 -r1.13.12.1 *** libxmlrpclib.tex 25 Apr 2003 00:29:31 -0000 1.13 --- libxmlrpclib.tex 12 May 2004 03:03:45 -0000 1.13.12.1 *************** *** 191,195 **** This class may initialized from string data (which may include NULs). ! The primary acess to the content of a \class{Binary} object is provided by an attribute: --- 191,195 ---- This class may initialized from string data (which may include NULs). ! The primary access to the content of a \class{Binary} object is provided by an attribute: Index: xmlsaxutils.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsaxutils.tex,v retrieving revision 1.5 retrieving revision 1.5.12.1 diff -C2 -d -r1.5 -r1.5.12.1 *** xmlsaxutils.tex 18 Apr 2003 22:04:34 -0000 1.5 --- xmlsaxutils.tex 12 May 2004 03:03:45 -0000 1.5.12.1 *************** *** 42,46 **** characters in the string. If both single- and double-quote characters are already in \var{data}, the double-quote characters ! will be encoded and \var{data} will be wrapped in doule-quotes. The resulting string can be used directly as an attribute value: --- 42,46 ---- characters in the string. If both single- and double-quote characters are already in \var{data}, the double-quote characters ! will be encoded and \var{data} will be wrapped in double-quotes. The resulting string can be used directly as an attribute value: From fdrake at users.sourceforge.net Tue May 11 23:07:31 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 23:07:37 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcode.tex, 1.14, 1.15 libinspect.tex, 1.15, 1.16 libregex.tex, 1.35, 1.36 liburllib2.tex, 1.16, 1.17 libxmlrpclib.tex, 1.15, 1.16 xmlsaxutils.tex, 1.5, 1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12213 Modified Files: libcode.tex libinspect.tex libregex.tex liburllib2.tex libxmlrpclib.tex xmlsaxutils.tex Log Message: fix various typos; thanks, George Yoshida! (closes SF patch #952047) Index: libcode.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcode.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libcode.tex 5 Apr 2002 02:21:09 -0000 1.14 --- libcode.tex 12 May 2004 03:07:27 -0000 1.15 *************** *** 62,66 **** \exception{SyntaxError} if the command is complete and contains a syntax error, or raises \exception{OverflowError} or ! \exception{ValueError} if the command cotains an invalid literal. \end{funcdesc} --- 62,66 ---- \exception{SyntaxError} if the command is complete and contains a syntax error, or raises \exception{OverflowError} or ! \exception{ValueError} if the command contains an invalid literal. \end{funcdesc} Index: libinspect.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libinspect.tex 1 Jan 2004 07:21:14 -0000 1.15 --- libinspect.tex 12 May 2004 03:07:27 -0000 1.16 *************** *** 121,125 **** 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. --- 121,125 ---- Return the name of the module named by the file \var{path}, without including the names of enclosing packages. This uses the same ! algorithm as the interpreter uses when searching for modules. If the name cannot be matched according to the interpreter's rules, \code{None} is returned. Index: libregex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libregex.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** libregex.tex 20 Oct 2003 14:01:47 -0000 1.35 --- libregex.tex 12 May 2004 03:07:27 -0000 1.36 *************** *** 45,49 **** from a document, you can use this pattern: \code{'[\e ]section\{\e (.*\e )\}'}. \emph{Another exception:} ! the escape sequece \samp{\e b} is significant in string literals (where it means the ASCII bell character) as well as in Emacs regular expressions (where it stands for a word boundary), so in order to --- 45,49 ---- from a document, you can use this pattern: \code{'[\e ]section\{\e (.*\e )\}'}. \emph{Another exception:} ! the escape sequence \samp{\e b} is significant in string literals (where it means the ASCII bell character) as well as in Emacs regular expressions (where it stands for a word boundary), so in order to Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** liburllib2.tex 28 Feb 2004 16:00:23 -0000 1.16 --- liburllib2.tex 12 May 2004 03:07:27 -0000 1.17 *************** *** 497,501 **** \begin{methoddesc}[HTTPPasswordMgr]{add_password}{realm, uri, user, passwd} ! \var{uri} can be either a single URI, or a sequene of URIs. \var{realm}, \var{user} and \var{passwd} must be strings. This causes \code{(\var{user}, \var{passwd})} to be used as authentication tokens --- 497,501 ---- \begin{methoddesc}[HTTPPasswordMgr]{add_password}{realm, uri, user, passwd} ! \var{uri} can be either a single URI, or a sequence of URIs. \var{realm}, \var{user} and \var{passwd} must be strings. This causes \code{(\var{user}, \var{passwd})} to be used as authentication tokens Index: libxmlrpclib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libxmlrpclib.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libxmlrpclib.tex 31 Oct 2003 13:49:36 -0000 1.15 --- libxmlrpclib.tex 12 May 2004 03:07:27 -0000 1.16 *************** *** 191,195 **** This class may initialized from string data (which may include NULs). ! The primary acess to the content of a \class{Binary} object is provided by an attribute: --- 191,195 ---- This class may initialized from string data (which may include NULs). ! The primary access to the content of a \class{Binary} object is provided by an attribute: Index: xmlsaxutils.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsaxutils.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** xmlsaxutils.tex 18 Apr 2003 22:04:34 -0000 1.5 --- xmlsaxutils.tex 12 May 2004 03:07:27 -0000 1.6 *************** *** 42,46 **** characters in the string. If both single- and double-quote characters are already in \var{data}, the double-quote characters ! will be encoded and \var{data} will be wrapped in doule-quotes. The resulting string can be used directly as an attribute value: --- 42,46 ---- characters in the string. If both single- and double-quote characters are already in \var{data}, the double-quote characters ! will be encoded and \var{data} will be wrapped in double-quotes. The resulting string can be used directly as an attribute value: From fdrake at users.sourceforge.net Tue May 11 23:15:13 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 23:15:21 2004 Subject: [Python-checkins] python/dist/src/Demo/threads sync.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/threads In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13458 Modified Files: sync.py Log Message: fix error message; closes SF patch #932796 Index: sync.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/threads/sync.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sync.py 12 Feb 2004 17:35:03 -0000 1.7 --- sync.py 12 May 2004 03:15:07 -0000 1.8 *************** *** 419,423 **** if self.count == self.maxcount: raise ValueError, '.v() tried to raise semaphore count above ' \ ! 'initial value %r' % (maxcount,)) self.count = self.count + 1 self.nonzero.signal() --- 419,423 ---- if self.count == self.maxcount: raise ValueError, '.v() tried to raise semaphore count above ' \ ! 'initial value %r' % self.maxcount self.count = self.count + 1 self.nonzero.signal() From fdrake at users.sourceforge.net Tue May 11 23:20:41 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 23:20:46 2004 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14339 Modified Files: exceptions.tex Log Message: minor wording cleanup Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** exceptions.tex 25 Mar 2004 14:25:28 -0000 1.17 --- exceptions.tex 12 May 2004 03:20:37 -0000 1.18 *************** *** 300,304 **** \begin{cfuncdesc}{void}{PyErr_SetInterrupt}{} ! It simulates the effect of a \constant{SIGINT}\ttindex{SIGINT} signal arriving --- the next time \cfunction{PyErr_CheckSignals()} is called, --- 300,304 ---- \begin{cfuncdesc}{void}{PyErr_SetInterrupt}{} ! This function simulates the effect of a \constant{SIGINT}\ttindex{SIGINT} signal arriving --- the next time \cfunction{PyErr_CheckSignals()} is called, From fdrake at users.sourceforge.net Tue May 11 23:22:59 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 23:23:03 2004 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex, 1.15.10.1, 1.15.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14635 Modified Files: Tag: release23-maint exceptions.tex Log Message: backport 1.17, 1.18 from the trunk: PyErr_SetInterrupt not Obsolete (closes SF patch #919299) Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.15.10.1 retrieving revision 1.15.10.2 diff -C2 -d -r1.15.10.1 -r1.15.10.2 *** exceptions.tex 7 Dec 2003 11:43:56 -0000 1.15.10.1 --- exceptions.tex 12 May 2004 03:22:57 -0000 1.15.10.2 *************** *** 300,304 **** \begin{cfuncdesc}{void}{PyErr_SetInterrupt}{} ! This function is obsolete. It simulates the effect of a \constant{SIGINT}\ttindex{SIGINT} signal arriving --- the next time \cfunction{PyErr_CheckSignals()} is called, --- 300,304 ---- \begin{cfuncdesc}{void}{PyErr_SetInterrupt}{} ! This function simulates the effect of a \constant{SIGINT}\ttindex{SIGINT} signal arriving --- the next time \cfunction{PyErr_CheckSignals()} is called, *************** *** 306,309 **** --- 306,311 ---- \exception{KeyboardInterrupt} will be raised. It may be called without holding the interpreter lock. + % XXX This was described as obsolete, but is used in + % thread.interrupt_main() (used from IDLE), so it's still needed. \end{cfuncdesc} From fdrake at users.sourceforge.net Tue May 11 23:47:03 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 23:47:08 2004 Subject: [Python-checkins] python/dist/src/Lib posixpath.py,1.62,1.62.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18856/Lib Modified Files: Tag: release23-maint posixpath.py Log Message: fix various descriptions of "ctime" (closes SF patch #870287) Index: posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v retrieving revision 1.62 retrieving revision 1.62.6.1 diff -C2 -d -r1.62 -r1.62.6.1 *** posixpath.py 17 Jul 2003 15:11:49 -0000 1.62 --- posixpath.py 12 May 2004 03:47:01 -0000 1.62.6.1 *************** *** 151,155 **** def getctime(filename): ! """Return the creation time of a file, reported by os.stat().""" return os.stat(filename).st_ctime --- 151,155 ---- def getctime(filename): ! """Return the metadata change time of a file, reported by os.stat().""" return os.stat(filename).st_ctime From fdrake at users.sourceforge.net Tue May 11 23:47:03 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 23:47:10 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex, 1.127.10.3, 1.127.10.4 libstat.tex, 1.23, 1.23.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18856/Doc/lib Modified Files: Tag: release23-maint libos.tex libstat.tex Log Message: fix various descriptions of "ctime" (closes SF patch #870287) Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.127.10.3 retrieving revision 1.127.10.4 diff -C2 -d -r1.127.10.3 -r1.127.10.4 *** libos.tex 10 Sep 2003 00:12:29 -0000 1.127.10.3 --- libos.tex 12 May 2004 03:47:01 -0000 1.127.10.4 *************** *** 893,897 **** \member{st_mtime} (time of most recent content modification), \member{st_ctime} ! (time of most recent content modification or metadata change). \versionchanged [If \function{stat_float_times} returns true, the time --- 893,898 ---- \member{st_mtime} (time of most recent content modification), \member{st_ctime} ! (platform dependent; time of most recent metadata change on \UNIX, or ! the time of creation on Windows). \versionchanged [If \function{stat_float_times} returns true, the time Index: libstat.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstat.tex,v retrieving revision 1.23 retrieving revision 1.23.10.1 diff -C2 -d -r1.23 -r1.23.10.1 *** libstat.tex 19 Jun 2003 18:10:37 -0000 1.23 --- libstat.tex 12 May 2004 03:47:01 -0000 1.23.10.1 *************** *** 111,115 **** \begin{datadesc}{ST_CTIME} ! Time of last status change (see manual pages for details). \end{datadesc} --- 111,118 ---- \begin{datadesc}{ST_CTIME} ! The ``ctime'' as reported by the operating system. On some systems ! (like \UNIX) is the time of the last metadata change, and, on others ! (like Windows), is the creation time (see platform documentation for ! details). \end{datadesc} From fdrake at users.sourceforge.net Tue May 11 23:51:42 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 23:51:46 2004 Subject: [Python-checkins] python/dist/src/Lib posixpath.py,1.64,1.65 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19816/Lib Modified Files: posixpath.py Log Message: fix various descriptions of "ctime" (closes SF patch #870287) Index: posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** posixpath.py 31 Dec 2003 22:44:29 -0000 1.64 --- posixpath.py 12 May 2004 03:51:39 -0000 1.65 *************** *** 147,151 **** def getctime(filename): ! """Return the creation time of a file, reported by os.stat().""" return os.stat(filename).st_ctime --- 147,151 ---- def getctime(filename): ! """Return the metadata change time of a file, reported by os.stat().""" return os.stat(filename).st_ctime From fdrake at users.sourceforge.net Tue May 11 23:51:43 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 11 23:51:49 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex, 1.134, 1.135 libstat.tex, 1.23, 1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19816/Doc/lib Modified Files: libos.tex libstat.tex Log Message: fix various descriptions of "ctime" (closes SF patch #870287) Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** libos.tex 16 Apr 2004 15:20:01 -0000 1.134 --- libos.tex 12 May 2004 03:51:40 -0000 1.135 *************** *** 910,914 **** \member{st_mtime} (time of most recent content modification), \member{st_ctime} ! (time of most recent content modification or metadata change). \versionchanged [If \function{stat_float_times} returns true, the time --- 910,915 ---- \member{st_mtime} (time of most recent content modification), \member{st_ctime} ! (platform dependent; time of most recent metadata change on \UNIX, or ! the time of creation on Windows). \versionchanged [If \function{stat_float_times} returns true, the time Index: libstat.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstat.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** libstat.tex 19 Jun 2003 18:10:37 -0000 1.23 --- libstat.tex 12 May 2004 03:51:40 -0000 1.24 *************** *** 111,115 **** \begin{datadesc}{ST_CTIME} ! Time of last status change (see manual pages for details). \end{datadesc} --- 111,118 ---- \begin{datadesc}{ST_CTIME} ! The ``ctime'' as reported by the operating system. On some systems ! (like \UNIX) is the time of the last metadata change, and, on others ! (like Windows), is the creation time (see platform documentation for ! details). \end{datadesc} From fdrake at users.sourceforge.net Wed May 12 00:13:21 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 12 00:13:27 2004 Subject: [Python-checkins] python/dist/src/Doc/commontex boilerplate.tex, 1.1.2.5, 1.1.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23207 Modified Files: Tag: release23-maint boilerplate.tex Log Message: set target date for Python 2.3.4 release Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/boilerplate.tex,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** boilerplate.tex 18 Dec 2003 15:11:05 -0000 1.1.2.5 --- boilerplate.tex 12 May 2004 04:13:18 -0000 1.1.2.6 *************** *** 6,9 **** } ! \date{December 19, 2003} % XXX update before final release! \input{patchlevel} % include Python version information --- 6,10 ---- } ! %\date{\today} ! \date{May 13, 2003} % XXX update before final release! \input{patchlevel} % include Python version information From nomkinmekcxw at hotmail.com Mon May 10 12:38:25 2004 From: nomkinmekcxw at hotmail.com (Saver's Choice) Date: Wed May 12 01:18:09 2004 Subject: [Python-checkins] Take advantage of low interest-rates! beriberiprowlschoolmaster Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040510/a0d1a33b/attachment.html From theller at users.sourceforge.net Wed May 12 14:04:46 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed May 12 14:04:50 2004 Subject: [Python-checkins] python/dist/src LICENSE,1.26.8.4,1.26.8.5 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32529 Modified Files: Tag: release23-maint LICENSE Log Message: 2.3.4 is derived from 2.3.3, not from itself. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.26.8.4 retrieving revision 1.26.8.5 diff -C2 -d -r1.26.8.4 -r1.26.8.5 *** LICENSE 11 May 2004 18:11:10 -0000 1.26.8.4 --- LICENSE 12 May 2004 18:04:42 -0000 1.26.8.5 *************** *** 47,51 **** 2.3.2 2.3.1 2002-2003 PSF yes 2.3.3 2.3.2 2002-2003 PSF yes ! 2.3.4 2.3.4 2004 PSF yes Footnotes: --- 47,51 ---- 2.3.2 2.3.1 2002-2003 PSF yes 2.3.3 2.3.2 2002-2003 PSF yes ! 2.3.4 2.3.3 2004 PSF yes Footnotes: From yjfsjf at bigfoot.com Wed May 12 14:27:50 2004 From: yjfsjf at bigfoot.com (Randal Pryor) Date: Wed May 12 14:42:29 2004 Subject: [Python-checkins] pycondc-2003@python.org: new salary structure Wed, 12 May 2004 19:24:50 +0100flipflop Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040513/261ad0ac/attachment.html From theller at users.sourceforge.net Wed May 12 15:49:58 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed May 12 15:50:02 2004 Subject: [Python-checkins] python/dist/src README,1.177.4.9,1.177.4.10 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26177 Modified Files: Tag: release23-maint README Log Message: Fix version number (2.3.4c1) and release date (12-May-2004). Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.177.4.9 retrieving revision 1.177.4.10 diff -C2 -d -r1.177.4.9 -r1.177.4.10 *** README 9 May 2004 17:13:51 -0000 1.177.4.9 --- README 12 May 2004 19:49:53 -0000 1.177.4.10 *************** *** 1,4 **** ! This is Python version 2.3.4 ! ============================ Copyright (c) 2001, 2002, 2003, 2004 Python Software Foundation. --- 1,4 ---- ! This is Python version 2.3.4c1 ! ============================== Copyright (c) 2001, 2002, 2003, 2004 Python Software Foundation. From theller at users.sourceforge.net Wed May 12 15:50:07 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed May 12 15:50:21 2004 Subject: [Python-checkins] python/dist/src/Lib/idlelib NEWS.txt, 1.23.4.5, 1.23.4.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26269 Modified Files: Tag: release23-maint NEWS.txt Log Message: Fix version number (2.3.4c1) and release date (12-May-2004). Index: NEWS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v retrieving revision 1.23.4.5 retrieving revision 1.23.4.6 diff -C2 -d -r1.23.4.5 -r1.23.4.6 *** NEWS.txt 30 Mar 2004 04:06:59 -0000 1.23.4.5 --- NEWS.txt 12 May 2004 19:50:04 -0000 1.23.4.6 *************** *** 2,6 **** =================================== ! *Release date: XX-XXX-2004* - Keybindings with the Shift modifier now work correctly. So do bindings which --- 2,6 ---- =================================== ! *Release date: 13-May-2004* - Keybindings with the Shift modifier now work correctly. So do bindings which From theller at users.sourceforge.net Wed May 12 15:50:21 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed May 12 15:50:25 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.110, 1.831.4.111 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26337 Modified Files: Tag: release23-maint NEWS Log Message: Fix version number (2.3.4c1) and release date (12-May-2004). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.110 retrieving revision 1.831.4.111 diff -C2 -d -r1.831.4.110 -r1.831.4.111 *** NEWS 11 May 2004 15:00:07 -0000 1.831.4.110 --- NEWS 12 May 2004 19:50:15 -0000 1.831.4.111 *************** *** 5,12 **** (editors: check NEWS.help for information about editing NEWS using ReST.) ! What's New in Python 2.3.4 (final)? =================================== ! *Release date: DD-MMM-2004* Core and builtins --- 5,12 ---- (editors: check NEWS.help for information about editing NEWS using ReST.) ! What's New in Python 2.3.4rc1? =================================== ! *Release date: 13-May-2004* Core and builtins From theller at users.sourceforge.net Wed May 12 15:50:30 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed May 12 15:50:35 2004 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.3.spec, 1.2.12.8, 1.2.12.9 Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26375 Modified Files: Tag: release23-maint python-2.3.spec Log Message: Fix version number (2.3.4c1) and release date (12-May-2004). Index: python-2.3.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.3.spec,v retrieving revision 1.2.12.8 retrieving revision 1.2.12.9 diff -C2 -d -r1.2.12.8 -r1.2.12.9 *** python-2.3.spec 31 Mar 2004 18:58:42 -0000 1.2.12.8 --- python-2.3.spec 12 May 2004 19:50:27 -0000 1.2.12.9 *************** *** 31,35 **** %define name python ! %define version 2.3.3 %define libvers 2.3 %define release 3pydotorg --- 31,35 ---- %define name python ! %define version 2.3.4c1 %define libvers 2.3 %define release 3pydotorg From theller at users.sourceforge.net Wed May 12 15:51:30 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed May 12 15:51:38 2004 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.dsp, 1.48.4.5, 1.48.4.6 BUILDno.txt, 1.51.4.5, 1.51.4.6 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26614 Modified Files: Tag: release23-maint pythoncore.dsp BUILDno.txt Log Message: Windows build number for 2.3.4c1 is 52. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/Attic/pythoncore.dsp,v retrieving revision 1.48.4.5 retrieving revision 1.48.4.6 diff -C2 -d -r1.48.4.5 -r1.48.4.6 *** pythoncore.dsp 18 Dec 2003 19:17:18 -0000 1.48.4.5 --- pythoncore.dsp 12 May 2004 19:51:26 -0000 1.48.4.6 *************** *** 259,263 **** SOURCE=..\Modules\getbuildinfo.c ! # ADD CPP /D BUILD=51 # End Source File # Begin Source File --- 259,263 ---- SOURCE=..\Modules\getbuildinfo.c ! # ADD CPP /D BUILD=52 # End Source File # Begin Source File Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.51.4.5 retrieving revision 1.51.4.6 diff -C2 -d -r1.51.4.5 -r1.51.4.6 *** BUILDno.txt 18 Dec 2003 19:16:59 -0000 1.51.4.5 --- BUILDno.txt 12 May 2004 19:51:26 -0000 1.51.4.6 *************** *** 34,38 **** Windows Python BUILD numbers ---------------------------- ! 51 2.3.3 19-Dec-2003 50 2.3.3c1 --- 34,40 ---- Windows Python BUILD numbers ---------------------------- ! 52 2.3.4c1 ! 13-May-2004 ! 51 2.3.3 (final) 19-Dec-2003 50 2.3.3c1 From theller at users.sourceforge.net Wed May 12 16:04:22 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed May 12 16:04:35 2004 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse, 1.133.4.7, 1.133.4.8 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29564 Modified Files: Tag: release23-maint python20.wse Log Message: Version '2.3.4c1' File name 'Python-2.3.4c1.exe' Change company to 'Python Software Foundation' Add year 2004 to the copyright. Include tix into the distribution. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.133.4.7 retrieving revision 1.133.4.8 diff -C2 -d -r1.133.4.7 -r1.133.4.8 *** python20.wse 18 Dec 2003 19:18:55 -0000 1.133.4.7 --- python20.wse 12 May 2004 20:04:18 -0000 1.133.4.8 *************** *** 2,6 **** item: Global Version=9.0 ! Title=Python 2.3.3 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=9.0 ! Title=Python 2.3.4c1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 21,30 **** MIF PDF Version=1.0 MIF SMS Version=2.0 ! EXE Filename=Python-2.3.3.exe Dialogs Version=8 ! Version File=2.3.3 Version Description=Python Programming Language ! Version Copyright=©2001-2003 Python Software Foundation ! Version Company=PythonLabs at Zope Corporation Crystal Format=10111100101100000010001001001001 Step View=&All --- 21,30 ---- MIF PDF Version=1.0 MIF SMS Version=2.0 ! EXE Filename=Python-2.3.4c1.exe Dialogs Version=8 ! Version File=2.3.4c1 Version Description=Python Programming Language ! Version Copyright=©2001-2004 Python Software Foundation ! Version Company=Python Software Foundation Crystal Format=10111100101100000010001001001001 Step View=&All *************** *** 74,81 **** Variable Name10=_ALIASTYPE_ Variable Flags10=00001000 end item: Set Variable Variable=PYVER_STRING ! Value=2.3.3 end item: Remark --- 74,86 ---- Variable Name10=_ALIASTYPE_ Variable Flags10=00001000 + Variable Name11=_TIXDIR_ + Variable Default11=tix + Variable Flags11=00001000 + end + item: Remark end item: Set Variable Variable=PYVER_STRING ! Value=2.3.4c1 end item: Remark *************** *** 114,117 **** --- 119,128 ---- end item: Remark + Text=When the version of Tix changes, the compiler vrbl + end + item: Remark + Text=_TIXDIR_ may also need to be changed. + end + item: Remark end item: Set Variable *************** *** 2165,2168 **** --- 2176,2196 ---- end item: Remark + Text=Tix + end + item: Install File + Source=..\..\%_tixdir_%\bin\*.dll + Destination=%MAINDIR%\DLLs + Description=Tix binaries and libraries + Flags=0000000000000010 + end + item: Install File + Source=..\..\%_tixdir_%\lib\*.* + Destination=%MAINDIR%\tcl + Description=Tix binaries and libraries + Flags=0000000100000010 + end + item: Remark + end + item: Remark Text=IDLE end *************** *** 2868,2872 **** Total Keys=1 Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% ! New Value=PythonLabs at Zope Corporation Value Name=Publisher Root=2 --- 2896,2900 ---- Total Keys=1 Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% ! New Value=Python Software Foundation Value Name=Publisher Root=2 From theller at users.sourceforge.net Wed May 12 16:12:14 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed May 12 16:12:18 2004 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31471 Modified Files: BUILDno.txt Log Message: Windows build number for 2.3.4c1 is 52. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** BUILDno.txt 20 Dec 2003 22:29:03 -0000 1.56 --- BUILDno.txt 12 May 2004 20:12:10 -0000 1.57 *************** *** 34,38 **** Windows Python BUILD numbers ---------------------------- ! 51 2.3.3 19-Dec-2003 50 2.3.3c1 --- 34,40 ---- Windows Python BUILD numbers ---------------------------- ! 52 2.3.4c1 ! 13-May-2004 ! 51 2.3.3 (final) 19-Dec-2003 50 2.3.3c1 From rhettinger at users.sourceforge.net Wed May 12 16:56:00 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 12 16:56:05 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcollections.tex, 1.8, 1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9217/Doc/lib Modified Files: libcollections.tex Log Message: Make sure "del d[n]" is properly supported. Was necessary because the same method that implements __setitem__ also implements __delitem__. Also, there were several good use cases (removing items from a queue and implementing Forth style stack ops). Index: libcollections.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcollections.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libcollections.tex 9 May 2004 01:15:00 -0000 1.8 --- libcollections.tex 12 May 2004 20:55:56 -0000 1.9 *************** *** 138,159 **** slicing and deletion: \begin{verbatim} def delete_nth(d, n): - "del d[n]" d.rotate(-n) d.popleft() d.rotate(n) - - >>> d = deque('abcdef') - >>> delete_nth(d, 2) # remove the entry at d[2] - >>> d - deque(['a', 'b', 'd', 'e', 'f']) - \end{verbatim} ! For slicing, the idea is the same. Use \method{rotate()} to bring a target ! element to the left side of the deque. Remove old entries with ! \method{popleft()}, add new entries with \method{extend()}, and then ! reverse the rotation. With minor variations on that approach, it is easy to implement Forth style --- 138,156 ---- slicing and deletion: + This pure python implementation of \code{del d[n]} shows how to use the + \method{rotate()} method as a building block for implementing a variety + of class{deque} operations: + \begin{verbatim} def delete_nth(d, n): d.rotate(-n) d.popleft() d.rotate(n) \end{verbatim} ! To implement \class{deque} slicing, use a similar approach applying ! \method{rotate()} to bring a target element to the left side of the deque. ! Remove old entries with \method{popleft()}, add new entries with ! \method{extend()}, and then reverse the rotation. With minor variations on that approach, it is easy to implement Forth style From rhettinger at users.sourceforge.net Wed May 12 16:55:59 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 12 16:56:08 2004 Subject: [Python-checkins] python/dist/src/Modules collectionsmodule.c, 1.13, 1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9217/Modules Modified Files: collectionsmodule.c Log Message: Make sure "del d[n]" is properly supported. Was necessary because the same method that implements __setitem__ also implements __delitem__. Also, there were several good use cases (removing items from a queue and implementing Forth style stack ops). Index: collectionsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/collectionsmodule.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** collectionsmodule.c 12 Apr 2004 18:10:01 -0000 1.13 --- collectionsmodule.c 12 May 2004 20:55:42 -0000 1.14 *************** *** 354,357 **** --- 354,395 ---- static int + deque_del_item(dequeobject *deque, int i) + { + PyObject *item=NULL, *minus_i=NULL, *plus_i=NULL; + int rv = -1; + + assert (i >= 0 && i < deque->len); + + minus_i = Py_BuildValue("(i)", -i); + if (minus_i == NULL) + goto fail; + + plus_i = Py_BuildValue("(i)", i); + if (plus_i == NULL) + goto fail; + + item = deque_rotate(deque, minus_i); + if (item == NULL) + goto fail; + Py_DECREF(item); + + item = deque_popleft(deque, NULL); + if (item == NULL) + goto fail; + Py_DECREF(item); + + item = deque_rotate(deque, plus_i); + if (item == NULL) + goto fail; + + rv = 0; + fail: + Py_XDECREF(item); + Py_XDECREF(minus_i); + Py_XDECREF(plus_i); + return rv; + } + + static int deque_ass_item(dequeobject *deque, int i, PyObject *v) { *************** *** 365,368 **** --- 403,409 ---- return -1; } + if (v == NULL) + return deque_del_item(deque, i); + i += deque->leftindex; n = i / BLOCKLEN; From rhettinger at users.sourceforge.net Wed May 12 16:56:00 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 12 16:56:11 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_deque.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9217/Lib/test Modified Files: test_deque.py Log Message: Make sure "del d[n]" is properly supported. Was necessary because the same method that implements __setitem__ also implements __delitem__. Also, there were several good use cases (removing items from a queue and implementing Forth style stack ops). Index: test_deque.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_deque.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_deque.py 10 May 2004 14:08:42 -0000 1.9 --- test_deque.py 12 May 2004 20:55:56 -0000 1.10 *************** *** 91,94 **** --- 91,108 ---- self.assertEqual(list(d), l) + def test_delitem(self): + n = 500 # O(n**2) test, don't make this too big + d = deque(xrange(n)) + self.assertRaises(IndexError, d.__delitem__, -n-1) + self.assertRaises(IndexError, d.__delitem__, n) + for i in xrange(n): + self.assertEqual(len(d), n-i) + j = random.randrange(-len(d), len(d)) + val = d[j] + self.assert_(val in d) + del d[j] + self.assert_(val not in d) + self.assertEqual(len(d), 0) + def test_rotate(self): s = tuple('abcde') *************** *** 477,483 **** - >>> def delete_nth(d, n): - ... "del d[n]" ... d.rotate(-n) ... d.popleft() --- 491,495 ---- *************** *** 525,529 **** [[[['a', 'b'], ['c', 'd']], [['e', 'f'], ['g', 'h']]]] - """ --- 537,540 ---- From rhettinger at users.sourceforge.net Wed May 12 17:35:11 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 12 17:35:16 2004 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.129,2.130 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19190 Modified Files: abstract.c Log Message: SF bug #952866: "can't multiply sequence *by* non-int" Minor wording fix. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.129 retrieving revision 2.130 diff -C2 -d -r2.129 -r2.130 *** abstract.c 5 Apr 2004 08:14:48 -0000 2.129 --- abstract.c 12 May 2004 21:35:06 -0000 2.130 *************** *** 637,641 **** else { return type_error( ! "can't multiply sequence to non-int"); } #if LONG_MAX != INT_MAX --- 637,641 ---- else { return type_error( ! "can't multiply sequence by non-int"); } #if LONG_MAX != INT_MAX From gward at users.sourceforge.net Wed May 12 21:45:39 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Wed May 12 21:45:52 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py, 1.22.8.1, 1.22.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3585/Lib/test Modified Files: Tag: release23-maint test_textwrap.py Log Message: SF #847346: add test_fix_sentence_endings() to ensure that sentence endings get fixed even if the input is too short to wrap. Also throw in a bunch of other tests for this rather tricky and under-tested feature. In WrapTestCase.setUp(), don't bother setting fix_sentence_endings=True for self.wrapper -- just use a separate wrapper in the two tests that care about it, namely test_whitespace() and test_fix_sentence_endings(). Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.22.8.1 retrieving revision 1.22.8.2 diff -C2 -d -r1.22.8.1 -r1.22.8.2 *** test_textwrap.py 30 Aug 2003 14:52:35 -0000 1.22.8.1 --- test_textwrap.py 13 May 2004 01:45:33 -0000 1.22.8.2 *************** *** 48,52 **** def setUp(self): ! self.wrapper = TextWrapper(width=45, fix_sentence_endings=True) def test_simple(self): --- 48,52 ---- def setUp(self): ! self.wrapper = TextWrapper(width=45) def test_simple(self): *************** *** 85,95 **** "mess!"] ! result = self.wrapper.wrap(text) self.check(result, expect) ! result = self.wrapper.fill(text) self.check(result, '\n'.join(expect)) def test_wrap_short(self): # Wrapping to make short lines longer --- 85,133 ---- "mess!"] ! wrapper = TextWrapper(45, fix_sentence_endings=True) ! result = wrapper.wrap(text) self.check(result, expect) ! result = wrapper.fill(text) self.check(result, '\n'.join(expect)) + def test_fix_sentence_endings(self): + wrapper = TextWrapper(60, fix_sentence_endings=True) + + # SF #847346: ensure that fix_sentence_endings=True does the + # right thing even on input short enough that it doesn't need to + # be wrapped. + text = "A short line. Note the single space." + expect = ["A short line. Note the single space."] + self.check(wrapper.wrap(text), expect) + + # Test some of the hairy end cases that _fix_sentence_endings() + # is supposed to handle (the easy stuff is tested in + # test_whitespace() above). + text = "Well, Doctor? What do you think?" + expect = ["Well, Doctor? What do you think?"] + self.check(wrapper.wrap(text), expect) + + text = "Well, Doctor?\nWhat do you think?" + self.check(wrapper.wrap(text), expect) + + text = 'I say, chaps! Anyone for "tennis?"\nHmmph!' + expect = ['I say, chaps! Anyone for "tennis?" Hmmph!'] + self.check(wrapper.wrap(text), expect) + + wrapper.width = 20 + expect = ['I say, chaps!', 'Anyone for "tennis?"', 'Hmmph!'] + self.check(wrapper.wrap(text), expect) + + text = 'And she said, "Go to hell!"\nCan you believe that?' + expect = ['And she said, "Go to', + 'hell!" Can you', + 'believe that?'] + self.check(wrapper.wrap(text), expect) + wrapper.width = 60 + expect = ['And she said, "Go to hell!" Can you believe that?'] + self.check(wrapper.wrap(text), expect) + def test_wrap_short(self): # Wrapping to make short lines longer From gward at users.sourceforge.net Wed May 12 21:48:18 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Wed May 12 21:48:22 2004 Subject: [Python-checkins] python/dist/src/Lib textwrap.py, 1.32.8.1, 1.32.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4211/Lib Modified Files: Tag: release23-maint textwrap.py Log Message: SF #847346: remove misguided optimization for short input from wrap() method. Premature optimization is indeed the root of all evil. Whitespace fix. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.32.8.1 retrieving revision 1.32.8.2 diff -C2 -d -r1.32.8.1 -r1.32.8.2 *** textwrap.py 30 Aug 2003 14:52:35 -0000 1.32.8.1 --- textwrap.py 13 May 2004 01:48:15 -0000 1.32.8.2 *************** *** 91,102 **** ! def __init__ (self, ! width=70, ! initial_indent="", ! subsequent_indent="", ! expand_tabs=True, ! replace_whitespace=True, ! fix_sentence_endings=False, ! break_long_words=True): self.width = width self.initial_indent = initial_indent --- 91,102 ---- ! def __init__(self, ! width=70, ! initial_indent="", ! subsequent_indent="", ! expand_tabs=True, ! replace_whitespace=True, ! fix_sentence_endings=False, ! break_long_words=True): self.width = width self.initial_indent = initial_indent *************** *** 269,274 **** text = self._munge_whitespace(text) indent = self.initial_indent - if len(text) + len(indent) <= self.width: - return [indent + text] chunks = self._split(text) if self.fix_sentence_endings: --- 269,272 ---- From gward at users.sourceforge.net Wed May 12 21:53:13 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Wed May 12 21:53:16 2004 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5197/Lib Modified Files: textwrap.py Log Message: SF #847346: merge from release23-maint branch: remove misguided optimization for short input; beef up tests for fix_sentence_endings feature. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** textwrap.py 30 Aug 2003 14:43:55 -0000 1.33 --- textwrap.py 13 May 2004 01:53:10 -0000 1.34 *************** *** 91,102 **** ! def __init__ (self, ! width=70, ! initial_indent="", ! subsequent_indent="", ! expand_tabs=True, ! replace_whitespace=True, ! fix_sentence_endings=False, ! break_long_words=True): self.width = width self.initial_indent = initial_indent --- 91,102 ---- ! def __init__(self, ! width=70, ! initial_indent="", ! subsequent_indent="", ! expand_tabs=True, ! replace_whitespace=True, ! fix_sentence_endings=False, ! break_long_words=True): self.width = width self.initial_indent = initial_indent *************** *** 269,274 **** text = self._munge_whitespace(text) indent = self.initial_indent - if len(text) + len(indent) <= self.width: - return [indent + text] chunks = self._split(text) if self.fix_sentence_endings: --- 269,272 ---- From gward at users.sourceforge.net Wed May 12 21:53:14 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Wed May 12 21:53:20 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py, 1.24, 1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5197/Lib/test Modified Files: test_textwrap.py Log Message: SF #847346: merge from release23-maint branch: remove misguided optimization for short input; beef up tests for fix_sentence_endings feature. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** test_textwrap.py 17 Sep 2003 05:50:59 -0000 1.24 --- test_textwrap.py 13 May 2004 01:53:08 -0000 1.25 *************** *** 48,52 **** def setUp(self): ! self.wrapper = TextWrapper(width=45, fix_sentence_endings=True) def test_simple(self): --- 48,52 ---- def setUp(self): ! self.wrapper = TextWrapper(width=45) def test_simple(self): *************** *** 85,95 **** "mess!"] ! result = self.wrapper.wrap(text) self.check(result, expect) ! result = self.wrapper.fill(text) self.check(result, '\n'.join(expect)) def test_wrap_short(self): # Wrapping to make short lines longer --- 85,133 ---- "mess!"] ! wrapper = TextWrapper(45, fix_sentence_endings=True) ! result = wrapper.wrap(text) self.check(result, expect) ! result = wrapper.fill(text) self.check(result, '\n'.join(expect)) + def test_fix_sentence_endings(self): + wrapper = TextWrapper(60, fix_sentence_endings=True) + + # SF #847346: ensure that fix_sentence_endings=True does the + # right thing even on input short enough that it doesn't need to + # be wrapped. + text = "A short line. Note the single space." + expect = ["A short line. Note the single space."] + self.check(wrapper.wrap(text), expect) + + # Test some of the hairy end cases that _fix_sentence_endings() + # is supposed to handle (the easy stuff is tested in + # test_whitespace() above). + text = "Well, Doctor? What do you think?" + expect = ["Well, Doctor? What do you think?"] + self.check(wrapper.wrap(text), expect) + + text = "Well, Doctor?\nWhat do you think?" + self.check(wrapper.wrap(text), expect) + + text = 'I say, chaps! Anyone for "tennis?"\nHmmph!' + expect = ['I say, chaps! Anyone for "tennis?" Hmmph!'] + self.check(wrapper.wrap(text), expect) + + wrapper.width = 20 + expect = ['I say, chaps!', 'Anyone for "tennis?"', 'Hmmph!'] + self.check(wrapper.wrap(text), expect) + + text = 'And she said, "Go to hell!"\nCan you believe that?' + expect = ['And she said, "Go to', + 'hell!" Can you', + 'believe that?'] + self.check(wrapper.wrap(text), expect) + wrapper.width = 60 + expect = ['And she said, "Go to hell!" Can you believe that?'] + self.check(wrapper.wrap(text), expect) + def test_wrap_short(self): # Wrapping to make short lines longer From anthonybaxter at users.sourceforge.net Thu May 13 01:34:47 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu May 13 01:34:53 2004 Subject: [Python-checkins] python/dist/src/Lib/idlelib idlever.py, 1.15.4.2, 1.15.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11069/Lib/idlelib Modified Files: Tag: release23-maint idlever.py Log Message: update to match Lib/idlelib/NEWS version number Index: idlever.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/idlever.py,v retrieving revision 1.15.4.2 retrieving revision 1.15.4.3 diff -C2 -d -r1.15.4.2 -r1.15.4.3 *** idlever.py 4 Dec 2003 20:44:28 -0000 1.15.4.2 --- idlever.py 13 May 2004 05:34:43 -0000 1.15.4.3 *************** *** 1 **** ! IDLE_VERSION = "1.0.2" --- 1 ---- ! IDLE_VERSION = "1.0.3" From anthonybaxter at users.sourceforge.net Thu May 13 03:20:24 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu May 13 03:20:38 2004 Subject: [Python-checkins] python/nondist/peps pep-0102.txt,1.20,1.21 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29538 Modified Files: pep-0102.txt Log Message: updates Index: pep-0102.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0102.txt,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** pep-0102.txt 5 Dec 2003 08:37:41 -0000 1.20 --- pep-0102.txt 13 May 2004 07:20:16 -0000 1.21 *************** *** 94,101 **** ___ For the Windows build, additional files have to be updated. ! PCBuild/BUILDno.txt contains the Windows build number, see the instructions in this file how to change it. Saving the project ! file PCBuild/pythoncore.dsp results in a change to ! PCBuild/pythoncore.dsp as well. PCbuild/python20.wse sets up the Windows installer version --- 94,101 ---- ___ For the Windows build, additional files have to be updated. ! PCbuild/BUILDno.txt contains the Windows build number, see the instructions in this file how to change it. Saving the project ! file PCbuild/pythoncore.dsp results in a change to ! PCbuild/pythoncore.dsp as well. PCbuild/python20.wse sets up the Windows installer version *************** *** 213,220 **** on the tar command because 1) that's only supported by GNU tar as far as we know, and 2) we're going to max out the compression ! level, which isn't a supported option. % tar -cf - Python-2.1.2 | gzip -9 > Python-2.1.2.tgz ! ___ Calculate the MD5 checksum of the tgz file you just created % md5sum Python-2.1.2.tgz --- 213,224 ---- on the tar command because 1) that's only supported by GNU tar as far as we know, and 2) we're going to max out the compression ! level, which isn't a supported option. We generate both tar.gz ! tar.bz2 formats, as the latter is about 1/6th smaller. ! % tar -cf - Python-2.1.2 | gzip -9 > Python-2.1.2.tgz + % tar -cf - Python-2.1.2 | bzip2 -9 > Python-2.1.2.tar.bz2 ! ___ Calculate the MD5 checksum of the tgz and tar.bz2 files you ! just created % md5sum Python-2.1.2.tgz *************** *** 222,225 **** --- 226,235 ---- Python replacement in the Tools/scripts/md5sum.py file. + ___ Create GPG keys for each of the files. + + % gpg -ba Python-2.1.2.tgz + % gpg -ba Python-2.1.2.tar.bz2 + % gpg -ba Python-2.1.2.exe + ___ Now you want to perform the very important step of checking the tarball you just created, to make sure a completely clean, *************** *** 268,271 **** --- 278,283 ---- Python since the previous release for this version of Python. + ___ Copy the .asc GPG signatures you created earlier here as well. + ___ Also, update the MD5 checksums. From anthonybaxter at users.sourceforge.net Thu May 13 07:53:35 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu May 13 07:53:40 2004 Subject: [Python-checkins] python/dist/src/Python getcopyright.c, 1.17, 1.17.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17143 Modified Files: Tag: release23-maint getcopyright.c Log Message: how many @*&(*$# places do we include the years?? Index: getcopyright.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getcopyright.c,v retrieving revision 1.17 retrieving revision 1.17.12.1 diff -C2 -d -r1.17 -r1.17.12.1 *** getcopyright.c 2 Jan 2003 16:27:15 -0000 1.17 --- getcopyright.c 13 May 2004 11:53:29 -0000 1.17.12.1 *************** *** 5,9 **** static char cprt[] = "\ ! Copyright (c) 2001, 2002, 2003 Python Software Foundation.\n\ All Rights Reserved.\n\ \n\ --- 5,9 ---- static char cprt[] = "\ ! Copyright (c) 2001, 2002, 2003, 2004 Python Software Foundation.\n\ All Rights Reserved.\n\ \n\ From anthonybaxter at users.sourceforge.net Thu May 13 07:54:24 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu May 13 07:54:29 2004 Subject: [Python-checkins] python/dist/src/Python getcopyright.c,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17294 Modified Files: getcopyright.c Log Message: forward-port 1.17.12.1 Index: getcopyright.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getcopyright.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** getcopyright.c 2 Jan 2003 16:27:15 -0000 1.17 --- getcopyright.c 13 May 2004 11:54:19 -0000 1.18 *************** *** 5,9 **** static char cprt[] = "\ ! Copyright (c) 2001, 2002, 2003 Python Software Foundation.\n\ All Rights Reserved.\n\ \n\ --- 5,9 ---- static char cprt[] = "\ ! Copyright (c) 2001-2004 Python Software Foundation.\n\ All Rights Reserved.\n\ \n\ From anthonybaxter at users.sourceforge.net Thu May 13 07:54:41 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu May 13 07:54:47 2004 Subject: [Python-checkins] python/dist/src/Python getcopyright.c, 1.17.12.1, 1.17.12.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17377 Modified Files: Tag: release23-maint getcopyright.c Log Message: better yet Index: getcopyright.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getcopyright.c,v retrieving revision 1.17.12.1 retrieving revision 1.17.12.2 diff -C2 -d -r1.17.12.1 -r1.17.12.2 *** getcopyright.c 13 May 2004 11:53:29 -0000 1.17.12.1 --- getcopyright.c 13 May 2004 11:54:38 -0000 1.17.12.2 *************** *** 5,9 **** static char cprt[] = "\ ! Copyright (c) 2001, 2002, 2003, 2004 Python Software Foundation.\n\ All Rights Reserved.\n\ \n\ --- 5,9 ---- static char cprt[] = "\ ! Copyright (c) 2001-2004 Python Software Foundation.\n\ All Rights Reserved.\n\ \n\ From anthonybaxter at users.sourceforge.net Thu May 13 08:00:48 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu May 13 08:00:52 2004 Subject: [Python-checkins] python/nondist/peps pep-0006.txt,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19147 Modified Files: pep-0006.txt Log Message: has it been _that_ many? sheesh Index: pep-0006.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0006.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pep-0006.txt 23 Oct 2003 18:20:31 -0000 1.9 --- pep-0006.txt 13 May 2004 12:00:45 -0000 1.10 *************** *** 100,104 **** Patch Czar History ! Anthony Baxter is the Patch Czar for 2.3.1 and 2.3.2. Barry Warsaw is the Patch Czar for 2.2.3. --- 100,104 ---- Patch Czar History ! Anthony Baxter is the Patch Czar for 2.3.1 through 2.3.4. Barry Warsaw is the Patch Czar for 2.2.3. From hwhzqwcwyshl at grandtech.com.tw Thu May 13 16:53:42 2004 From: hwhzqwcwyshl at grandtech.com.tw (Jaclyn Mcelroy) Date: Thu May 13 15:58:41 2004 Subject: [Python-checkins] Can't get the job because you don't have a university degree? Wrong! Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040513/c66558fe/attachment.html From bwarsaw at users.sourceforge.net Thu May 13 16:12:37 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 16:12:44 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_38.txt, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1880 Added Files: msg_38.txt Log Message: A boiled down example from Anthony's MIME torture tests. This one has a separating boundary for an outer part inside an inner part. --- NEW FILE: msg_38.txt --- MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" ------- =_aaaaaaaaaa0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa1" Content-ID: <20592.1022586929.1@example.com> ------- =_aaaaaaaaaa1 Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa2" Content-ID: <20592.1022586929.2@example.com> ------- =_aaaaaaaaaa2 Content-Type: text/plain Content-ID: <20592.1022586929.3@example.com> Content-Description: very tricky Content-Transfer-Encoding: 7bit Unlike the test test_nested-multiples-with-internal-boundary, this piece of text not only contains the outer boundary tags ------- =_aaaaaaaaaa1 and ------- =_aaaaaaaaaa0 but puts them at the start of a line! And, to be even nastier, it even includes a couple of end tags, such as this one: ------- =_aaaaaaaaaa1-- and this one, which is from a multipart we haven't even seen yet! ------- =_aaaaaaaaaa4-- This will, I'm sure, cause much breakage of MIME parsers. But, as far as I can tell, it's perfectly legal. I have not yet ever seen a case of this in the wild, but I've seen *similar* things. ------- =_aaaaaaaaaa2 Content-Type: application/octet-stream Content-ID: <20592.1022586929.4@example.com> Content-Description: patch2 Content-Transfer-Encoding: base64 XXX ------- =_aaaaaaaaaa2-- ------- =_aaaaaaaaaa1 Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa3" Content-ID: <20592.1022586929.6@example.com> ------- =_aaaaaaaaaa3 Content-Type: application/octet-stream Content-ID: <20592.1022586929.7@example.com> Content-Description: patch3 Content-Transfer-Encoding: base64 XXX ------- =_aaaaaaaaaa3 Content-Type: application/octet-stream Content-ID: <20592.1022586929.8@example.com> Content-Description: patch4 Content-Transfer-Encoding: base64 XXX ------- =_aaaaaaaaaa3-- ------- =_aaaaaaaaaa1 Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa4" Content-ID: <20592.1022586929.10@example.com> ------- =_aaaaaaaaaa4 Content-Type: application/octet-stream Content-ID: <20592.1022586929.11@example.com> Content-Description: patch5 Content-Transfer-Encoding: base64 XXX ------- =_aaaaaaaaaa4 Content-Type: application/octet-stream Content-ID: <20592.1022586929.12@example.com> Content-Description: patch6 Content-Transfer-Encoding: base64 XXX ------- =_aaaaaaaaaa4-- ------- =_aaaaaaaaaa1-- ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20592.1022586929.15@example.com> -- It's never too late to have a happy childhood. ------- =_aaaaaaaaaa0-- From bwarsaw at users.sourceforge.net Thu May 13 16:13:51 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 16:13:58 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_39.txt, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2349 Added Files: msg_39.txt Log Message: Another evil test from Anthony's suite. This one has an inner part with the same boundary as the outer part. --- NEW FILE: msg_39.txt --- MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" ------- =_aaaaaaaaaa0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa1" Content-ID: <20592.1022586929.1@example.com> ------- =_aaaaaaaaaa1 Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1" Content-ID: <20592.1022586929.2@example.com> ------- =_aaaaaaaaaa1 Content-Type: application/octet-stream Content-ID: <20592.1022586929.3@example.com> Content-Description: patch1 Content-Transfer-Encoding: base64 XXX ------- =_aaaaaaaaaa1 Content-Type: application/octet-stream Content-ID: <20592.1022586929.4@example.com> Content-Description: patch2 Content-Transfer-Encoding: base64 XXX ------- =_aaaaaaaaaa1-- ------- =_aaaaaaaaaa1 Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1" Content-ID: <20592.1022586929.6@example.com> ------- =_aaaaaaaaaa1 Content-Type: application/octet-stream Content-ID: <20592.1022586929.7@example.com> Content-Description: patch3 Content-Transfer-Encoding: base64 XXX ------- =_aaaaaaaaaa1 Content-Type: application/octet-stream Content-ID: <20592.1022586929.8@example.com> Content-Description: patch4 Content-Transfer-Encoding: base64 XXX ------- =_aaaaaaaaaa1-- ------- =_aaaaaaaaaa1 Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1" Content-ID: <20592.1022586929.10@example.com> ------- =_aaaaaaaaaa1 Content-Type: application/octet-stream Content-ID: <20592.1022586929.11@example.com> Content-Description: patch5 Content-Transfer-Encoding: base64 XXX ------- =_aaaaaaaaaa1 Content-Type: application/octet-stream Content-ID: <20592.1022586929.12@example.com> Content-Description: patch6 Content-Transfer-Encoding: base64 XXX ------- =_aaaaaaaaaa1-- ------- =_aaaaaaaaaa1-- ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20592.1022586929.15@example.com> -- It's never too late to have a happy childhood. ------- =_aaaaaaaaaa0-- From bwarsaw at users.sourceforge.net Thu May 13 16:14:23 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 16:14:28 2004 Subject: [Python-checkins] python/dist/src/Lib/email Iterators.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2543 Modified Files: Iterators.py Log Message: _structure(): Make sure all output goes the to fp object. Index: Iterators.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Iterators.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Iterators.py 9 May 2004 03:42:37 -0000 1.13 --- Iterators.py 13 May 2004 20:14:20 -0000 1.14 *************** *** 60,66 **** print >> fp, tab + msg.get_content_type(), if include_default: ! print '[%s]' % msg.get_default_type() else: ! print if msg.is_multipart(): for subpart in msg.get_payload(): --- 60,66 ---- print >> fp, tab + msg.get_content_type(), if include_default: ! print >> fp, '[%s]' % msg.get_default_type() else: ! print >> fp if msg.is_multipart(): for subpart in msg.get_payload(): From bwarsaw at users.sourceforge.net Thu May 13 16:15:29 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 16:15:33 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.56, 1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2760 Modified Files: test_email.py Log Message: test_nested_inner_contains_outer_boundary(), test_nested_with_same_boundary(): Two evil samples from Anthony's MIME torture tests. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** test_email.py 11 May 2004 22:21:56 -0000 1.56 --- test_email.py 13 May 2004 20:15:20 -0000 1.57 *************** *** 1326,1329 **** --- 1326,1365 ---- self.assertEqual(len(msg.get_payload()), 3) + def test_nested_inner_contains_outer_boundary(self): + eq = self.ndiffAssertEqual + # msg_38.txt has an inner part that contains outer boundaries. My + # interpretation of RFC 2046 (based on sections 5.1 and 5.1.2) say + # these are illegal and should be interpreted as unterminated inner + # parts. + msg = self._msgobj('msg_38.txt') + sfp = StringIO() + Iterators._structure(msg, sfp) + eq(sfp.getvalue(), """\ + multipart/mixed + multipart/mixed + multipart/alternative + text/plain + text/plain + text/plain + text/plain + """) + + def test_nested_with_same_boundary(self): + eq = self.ndiffAssertEqual + # msg 39.txt is similarly evil in that it's got inner parts that use + # the same boundary as outer parts. Again, I believe the way this is + # parsed is closest to the spirit of RFC 2046 + msg = self._msgobj('msg_39.txt') + sfp = StringIO() + Iterators._structure(msg, sfp) + eq(sfp.getvalue(), """\ + multipart/mixed + multipart/mixed + multipart/alternative + application/octet-stream + application/octet-stream + text/plain + """) + From bwarsaw at users.sourceforge.net Thu May 13 16:17:54 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 16:17:59 2004 Subject: [Python-checkins] python/dist/src/Lib/email FeedParser.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3223 Modified Files: FeedParser.py Log Message: readline(): RFC 2046, section 5.1.2 (and partially 5.1) both state that the parser must recognize outer boundaries in inner parts. So cruise through the EOF stack backwards testing each predicate against the current line. There's still some discussion about whether this is (always) the best thing to do. Anthony would rather parse these messages as if the outer boundaries were ignored. I think that's counter to the RFC, but might be practically more useful. Can you say behavior flag? (ug). Index: FeedParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FeedParser.py 11 May 2004 22:23:59 -0000 1.6 --- FeedParser.py 13 May 2004 20:17:51 -0000 1.7 *************** *** 72,78 **** # false-EOF predicate. line = self._lines.pop() ! if self._eofstack: ! matches = self._eofstack[-1] ! if matches(line): # We're at the false EOF. But push the last line back first. self._lines.append(line) --- 72,80 ---- # false-EOF predicate. line = self._lines.pop() ! # RFC 2046, section 5.1.2 requires us to recognize outer level ! # boundaries at any level of inner nesting. Do this, but be sure it's ! # in the order of most to least nested. ! for ateof in self._eofstack[::-1]: ! if ateof(line): # We're at the false EOF. But push the last line back first. self._lines.append(line) From bwarsaw at users.sourceforge.net Thu May 13 18:50:15 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 18:50:21 2004 Subject: [Python-checkins] python/dist/src/Lib/email Encoders.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1804 Modified Files: Encoders.py Log Message: encode_7or8bit(): Clearing out some old patches; iso-2202 is non-ASCII but still 7-bit. Index: Encoders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Encoders.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Encoders.py 1 Oct 2002 00:05:24 -0000 1.7 --- Encoders.py 13 May 2004 22:50:12 -0000 1.8 *************** *** 1,7 **** ! # Copyright (C) 2001,2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) ! """Module containing encoding functions for Image.Image and Text.Text. ! """ import base64 --- 1,6 ---- ! # Copyright (C) 2001-2004 Python Software Foundation ! # Author: barry@python.org (Barry Warsaw) ! """Encodings and related functions.""" import base64 *************** *** 85,89 **** orig.encode('ascii') except UnicodeError: ! msg['Content-Transfer-Encoding'] = '8bit' else: msg['Content-Transfer-Encoding'] = '7bit' --- 84,94 ---- orig.encode('ascii') except UnicodeError: ! # iso-2022-* is non-ASCII but still 7-bit ! charset = msg.get_charset() ! output_cset = charset and charset.output_charset ! if output_cset and output_cset.lower().startswith('iso-2202-'): ! msg['Content-Transfer-Encoding'] = '7bit' ! else: ! msg['Content-Transfer-Encoding'] = '8bit' else: msg['Content-Transfer-Encoding'] = '7bit' From bwarsaw at users.sourceforge.net Thu May 13 18:53:28 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 18:53:33 2004 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py, 1.29.10.1, 1.29.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2538 Modified Files: Tag: release23-maint __init__.py Log Message: Waugh! we need to bump the email package to 2.5.5 for Python 2.3.4. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.29.10.1 retrieving revision 1.29.10.2 diff -C2 -d -r1.29.10.1 -r1.29.10.2 *** __init__.py 19 Aug 2003 04:52:29 -0000 1.29.10.1 --- __init__.py 13 May 2004 22:53:25 -0000 1.29.10.2 *************** *** 1,9 **** ! # Copyright (C) 2001,2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) """A package for parsing, handling, and generating email messages. """ ! __version__ = '2.5.4' __all__ = [ --- 1,9 ---- ! # Copyright (C) 2001-2004 Python Software Foundation ! # Author: barry@python.org (Barry Warsaw) """A package for parsing, handling, and generating email messages. """ ! __version__ = '2.5.5' __all__ = [ From bwarsaw at users.sourceforge.net Thu May 13 19:12:36 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 19:12:41 2004 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py, 1.20, 1.20.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6339 Modified Files: Tag: release23-maint Parser.py Log Message: _parsebody(): Do not create subparts unless the container has a main type of 'multipart' and the boundary is defined. This fixes SF bug # 846938, and several recent email-sig bugs where something like a text/html message also had a boundary parameter. This would later crash the Generator, which only consulted the Content-Type to decide how to generate the message (and it would expect just a string, but find a list there instead). Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.20 retrieving revision 1.20.12.1 diff -C2 -d -r1.20 -r1.20.12.1 *** Parser.py 6 Mar 2003 05:25:35 -0000 1.20 --- Parser.py 13 May 2004 23:12:33 -0000 1.20.12.1 *************** *** 1,4 **** ! # Copyright (C) 2001,2002 Python Software Foundation ! # Author: barry@zope.com (Barry Warsaw) """A parser of RFC 2822 and MIME email messages. --- 1,4 ---- ! # Copyright (C) 2001-2004 Python Software Foundation ! # Author: barry@python.org (Barry Warsaw) """A parser of RFC 2822 and MIME email messages. *************** *** 146,154 **** boundary = container.get_boundary() isdigest = (container.get_content_type() == 'multipart/digest') ! # If there's a boundary, split the payload text into its constituent ! # parts and parse each separately. Otherwise, just parse the rest of ! # the body as a single message. Note: any exceptions raised in the ! # recursive parse need to have their line numbers coerced. ! if boundary: preamble = epilogue = None # Split into subparts. The first boundary we're looking for won't --- 146,155 ---- boundary = container.get_boundary() isdigest = (container.get_content_type() == 'multipart/digest') ! # If there's a boundary and the message has a main type of ! # 'multipart', split the payload text into its constituent parts and ! # parse each separately. Otherwise, just parse the rest of the body ! # as a single message. Note: any exceptions raised in the recursive ! # parse need to have their line numbers coerced. ! if container.get_content_maintype() == 'multipart' and boundary: preamble = epilogue = None # Split into subparts. The first boundary we're looking for won't From bwarsaw at users.sourceforge.net Thu May 13 19:13:27 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 19:13:30 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.50.10.3, 1.50.10.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6567 Modified Files: Tag: release23-maint test_email.py Log Message: test_boundary_in_non_multipart(): Added a test for SF bug # 846938. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.50.10.3 retrieving revision 1.50.10.4 diff -C2 -d -r1.50.10.3 -r1.50.10.4 *** test_email.py 9 May 2004 18:00:56 -0000 1.50.10.3 --- test_email.py 13 May 2004 23:13:24 -0000 1.50.10.4 *************** *** 1177,1180 **** --- 1177,1195 ---- ''') + def test_boundary_in_non_multipart(self): + msg = self._msgobj('msg_40.txt') + self.assertEqual(msg.as_string(), '''\ + MIME-Version: 1.0 + Content-Type: text/html; boundary="--961284236552522269" + + ----961284236552522269 + Content-Type: text/html; + Content-Transfer-Encoding: 7Bit + + + + ----961284236552522269-- + ''') + From bwarsaw at users.sourceforge.net Thu May 13 19:14:33 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 19:14:36 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_40.txt, NONE, 1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6800 Added Files: Tag: release23-maint msg_40.txt Log Message: Added a sample message for the test for SF bug # 846938. I'm naming this msg_40.txt because msg_3[6-9].txt are already used in email3/py2.4 and I'm going to forward port this test. --- NEW FILE: msg_40.txt --- MIME-Version: 1.0 Content-Type: text/html; boundary="--961284236552522269" ----961284236552522269 Content-Type: text/html; Content-Transfer-Encoding: 7Bit ----961284236552522269-- From bwarsaw at users.sourceforge.net Thu May 13 19:17:06 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 19:17:11 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.57, 1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7420 Modified Files: test_email.py Log Message: test_boundary_in_non_multipart(): Added a test for SF bug # 846938. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** test_email.py 13 May 2004 20:15:20 -0000 1.57 --- test_email.py 13 May 2004 23:17:04 -0000 1.58 *************** *** 1362,1365 **** --- 1362,1380 ---- """) + def test_boundary_in_non_multipart(self): + msg = self._msgobj('msg_40.txt') + self.assertEqual(msg.as_string(), '''\ + MIME-Version: 1.0 + Content-Type: text/html; boundary="--961284236552522269" + + ----961284236552522269 + Content-Type: text/html; + Content-Transfer-Encoding: 7Bit + + + + ----961284236552522269-- + ''') + From bwarsaw at users.sourceforge.net Thu May 13 19:18:56 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu May 13 19:18:59 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_40.txt, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7769/data Added Files: msg_40.txt Log Message: forward porting from release23-maint From tim.one at comcast.net Thu May 13 19:31:07 2004 From: tim.one at comcast.net (Tim Peters) Date: Thu May 13 19:31:13 2004 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py, 1.20, 1.20.12.1 In-Reply-To: Message-ID: [Barry] > Log Message: > _parsebody(): Do not create subparts unless the container has a main > type of 'multipart' and the boundary is defined. This fixes SF bug # > 846938, and several recent email-sig bugs ... Yadda yadda yadda. At this point, the more obvious solution is to ignore all that MIME crap, and just guess a good structure for the email. The spambayes Outlook addin does that all the time . From barry at python.org Thu May 13 19:45:44 2004 From: barry at python.org (Barry Warsaw) Date: Thu May 13 19:46:04 2004 Subject: [Python-Dev] RE: [Python-checkins] python/dist/src/Lib/email Parser.py, 1.20, 1.20.12.1 In-Reply-To: References: Message-ID: <1084491944.28228.854.camel@anthem.wooz.org> On Thu, 2004-05-13 at 19:31, Tim Peters wrote: > Yadda yadda yadda. At this point, the more obvious solution is to ignore > all that MIME crap, and just guess a good structure for the email. The > spambayes Outlook addin does that all the time . Structure's for monkeyboys and pointy-bracket lovers, not for studly w1nd0z 1nst4ll3r d00dz and 3m41l l33t h4x0rz. From fdrake at users.sourceforge.net Fri May 14 01:09:14 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri May 14 01:09:20 2004 Subject: [Python-checkins] python/dist/src/Doc/commontex boilerplate.tex, 1.1.2.6, 1.1.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2694/Doc/commontex Modified Files: Tag: release23-maint boilerplate.tex Log Message: update for the predicted 2.3.4 final release date, getting the year right this time Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/boilerplate.tex,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** boilerplate.tex 12 May 2004 04:13:18 -0000 1.1.2.6 --- boilerplate.tex 14 May 2004 05:09:10 -0000 1.1.2.7 *************** *** 7,10 **** %\date{\today} ! \date{May 13, 2003} % XXX update before final release! \input{patchlevel} % include Python version information --- 7,10 ---- %\date{\today} ! \date{May 20, 2004} % XXX update before final release! \input{patchlevel} % include Python version information From montanaro at users.sourceforge.net Fri May 14 12:32:02 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri May 14 12:32:09 2004 Subject: [Python-checkins] python/dist/src/Lib pprint.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4900 Modified Files: pprint.py Log Message: typo - fixes 954030. Index: pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pprint.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** pprint.py 12 Feb 2004 17:35:07 -0000 1.29 --- pprint.py 14 May 2004 16:31:56 -0000 1.30 *************** *** 27,31 **** pprint() ! Pretty-print a Python object to a stream [default is sys.sydout]. saferepr() --- 27,31 ---- pprint() ! Pretty-print a Python object to a stream [default is sys.stdout]. saferepr() *************** *** 50,54 **** def pprint(object, stream=None, indent=1, width=80, depth=None): ! """Pretty-print a Python object to a stream [default is sys.sydout].""" printer = PrettyPrinter( stream=stream, indent=indent, width=width, depth=depth) --- 50,54 ---- def pprint(object, stream=None, indent=1, width=80, depth=None): ! """Pretty-print a Python object to a stream [default is sys.stdout].""" printer = PrettyPrinter( stream=stream, indent=indent, width=width, depth=depth) From theller at users.sourceforge.net Fri May 14 15:50:01 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Fri May 14 15:50:07 2004 Subject: [Python-checkins] python/dist/src/PCbuild pydebug.iss, 1.1.2.1, 1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19172 Modified Files: Tag: release23-maint pydebug.iss Log Message: Current version is 2.3.4. Index: pydebug.iss =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/Attic/pydebug.iss,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** pydebug.iss 22 Apr 2004 18:24:30 -0000 1.1.2.1 --- pydebug.iss 14 May 2004 19:49:57 -0000 1.1.2.2 *************** *** 23,27 **** SourceDir=. OutputDir=. ! OutputBaseFilename=Python-Debug-2.3.3 DefaultDirName={reg:HKLM\SOFTWARE\Python\PythonCore\2.3\InstallPath,|} --- 23,27 ---- SourceDir=. OutputDir=. ! OutputBaseFilename=Python-Debug-2.3.4 DefaultDirName={reg:HKLM\SOFTWARE\Python\PythonCore\2.3\InstallPath,|} From rhettinger at users.sourceforge.net Sat May 15 03:39:05 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 15 03:39:11 2004 Subject: [Python-checkins] python/dist/src/PC/example_nt example.dsp, 1.6, 1.7 Message-ID: Update of /cvsroot/python/python/dist/src/PC/example_nt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18495 Modified Files: example.dsp Log Message: Update the DLL example to work with Py2.4. Index: example.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/example_nt/example.dsp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** example.dsp 15 Dec 2001 22:27:01 -0000 1.6 --- example.dsp 15 May 2004 07:39:00 -0000 1.7 *************** *** 54,58 **** 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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib python22.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\PCbuild" /export:initexample # SUBTRACT LINK32 /pdb:none --- 54,58 ---- 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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib python24.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\PCbuild" /export:initexample # SUBTRACT LINK32 /pdb:none *************** *** 81,85 **** 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 ! # ADD 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 python22_d.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:".\Debug/example_d.dll" /libpath:"..\PCbuild" /export:initexample # SUBTRACT LINK32 /pdb:none --- 81,85 ---- 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 ! # ADD 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 python24_d.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:".\Debug/example_d.dll" /libpath:"..\PCbuild" /export:initexample # SUBTRACT LINK32 /pdb:none From atn at i-webmail.net Sat May 15 03:22:37 2004 From: atn at i-webmail.net (ATN Enterprises, LLC) Date: Sat May 15 05:51:51 2004 Subject: [Python-checkins] Stock Traders Daily OTC Alert: FDEI (OTC:BB) Message-ID: <200405150718.i4F7IwpV025075@mxzilla4.xs4all.nl> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040515/98a750cb/attachment.html From bwarsaw at users.sourceforge.net Sat May 15 12:26:30 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat May 15 12:26:34 2004 Subject: [Python-checkins] python/dist/src/Lib/email FeedParser.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18722 Modified Files: FeedParser.py Log Message: _parsegen(): Add a missing check for NeedMoreData. Index: FeedParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FeedParser.py 13 May 2004 20:17:51 -0000 1.7 --- FeedParser.py 15 May 2004 16:26:28 -0000 1.8 *************** *** 315,318 **** --- 315,321 ---- while True: line = self._input.readline() + if line is NeedMoreData: + yield NeedMoreData + continue mo = boundaryre.match(line) if not mo: From greg at users.sourceforge.net Sat May 15 17:37:37 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Sat May 15 17:37:42 2004 Subject: [Python-checkins] python/dist/src/Lib/bsddb/test test_basics.py, 1.7.6.1, 1.7.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17494 Modified Files: Tag: release23-maint test_basics.py Log Message: Remove the offending added bit of a test case that doesn't apply to the python 2.3.x branch as the bsddb.set_get_returns_none() default behaviour is different than on 2.4 and leter. (yes a correct test case for this branch could be written; removing this bad test gets things not-failing fastest) Index: test_basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_basics.py,v retrieving revision 1.7.6.1 retrieving revision 1.7.6.2 diff -C2 -d -r1.7.6.1 -r1.7.6.2 *** test_basics.py 26 Feb 2004 10:21:13 -0000 1.7.6.1 --- test_basics.py 15 May 2004 21:37:34 -0000 1.7.6.2 *************** *** 373,381 **** if rec[1] != '': self.fail('expected empty data portion') - ev = c.set_range('empty value') - if verbose: - print "search for 'empty value' returned", ev - if ev[1] != '': self.fail('empty value lookup failed') - c.set('0499') c.delete() --- 373,376 ---- From Claudio at breaksmyheart.com Sat May 15 14:41:56 2004 From: Claudio at breaksmyheart.com (Deana Jolly) Date: Sat May 15 19:23:16 2004 Subject: [Python-checkins] Could this be love? Message-ID: <59604vx17lei986$v362R57lzd4$790NK64DE7@fsw65578> Is love just around the corner? It is, if you’re looking in the right places. Click on the link below and discover where thousands of people have fallen in love… and it’s free http://breaksmyheart.com/confirm/?oc=50791252 Don't want these notifications?: http://breaksmyheart.com/remove/?oc=50791252 sobligedivisive bedford vulture rooftop bernice grater unit inhomogeneity buses coleus arteriosclerosis maximilian regret sequestration belligerent backpack altercate convolute authoritarian descriptor annulus condolence vietnamese eventual splat dynastic demon screwworm flourish disc grease handgun emotion foldout coachman crossbill spoonful offensive alaska hcurbsideeastland well asunder davison f denial for spilt aphid regiment ut seward snowball bloomfield substantial fragment comprehensive From tim_one at users.sourceforge.net Sun May 16 01:36:33 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun May 16 01:36:39 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_winsound.py, 1.8, 1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3404/Lib/test Modified Files: test_winsound.py Log Message: test_alias_nofallback(): Someone broke this test, after 2.3, by converting it into assertRaises() form. Restored the 2.3 code, and explained why assertRaises() cannot be used instead. Index: test_winsound.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_winsound.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_winsound.py 22 Sep 2003 18:41:53 -0000 1.8 --- test_winsound.py 16 May 2004 05:36:30 -0000 1.9 *************** *** 86,91 **** def test_alias_nofallback(self): ! self.assertRaises(RuntimeError, winsound.PlaySound, '!"$%&/(#+*', ! winsound.SND_ALIAS | winsound.SND_NODEFAULT) def test_stopasync(self): --- 86,107 ---- def test_alias_nofallback(self): ! # Note that this is not the same as asserting RuntimeError ! # will get raised: you cannot convert this to ! # self.assertRaises(...) form. The attempt may or may not ! # raise RuntimeError, but it shouldn't raise anything other ! # than RuntimeError, and that's all we're trying to test here. ! # The MS docs aren't clear about whether the SDK PlaySound() ! # with SND_ALIAS and SND_NODEFAULT will return True or False when ! # the alias is unknown. On Tim's WinXP box today, it returns ! # True (no exception is raised). What we'd really like to test ! # is that no sound is played, but that requires first wiring an ! # eardrum class into unittest . ! try: ! winsound.PlaySound( ! '!"$%&/(#+*', ! winsound.SND_ALIAS | winsound.SND_NODEFAULT ! ) ! except RuntimeError: ! pass def test_stopasync(self): From montanaro at users.sourceforge.net Mon May 17 09:17:40 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon May 17 09:17:45 2004 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.3.spec,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21046 Modified Files: python-2.3.spec Log Message: date typo in %changelog Index: python-2.3.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.3.spec,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** python-2.3.spec 31 Mar 2004 18:59:04 -0000 1.5 --- python-2.3.spec 17 May 2004 13:17:38 -0000 1.6 *************** *** 128,132 **** %changelog ! * Sat Mar 27 2003 Sean Reifschneider [2.3.2-3pydotorg] - Being more agressive about finding the paths to fix for #!/usr/local/bin/python. --- 128,132 ---- %changelog ! * Sat Mar 27 2004 Sean Reifschneider [2.3.2-3pydotorg] - Being more agressive about finding the paths to fix for #!/usr/local/bin/python. From fdrake at users.sourceforge.net Mon May 17 22:25:53 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon May 17 22:25:58 2004 Subject: [Python-checkins] python/dist/src/Lib ConfigParser.py,1.63,1.64 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1097/Lib Modified Files: ConfigParser.py Log Message: ConfigParser: - ensure that option names in interpolations are handled by self.optionxform in the same way that other references to option names - add tests, documentation (closes SF bug #857881, patch #865455) Index: ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** ConfigParser.py 4 May 2004 09:21:43 -0000 1.63 --- ConfigParser.py 18 May 2004 02:25:50 -0000 1.64 *************** *** 556,559 **** --- 556,560 ---- depth -= 1 if "%(" in value: + value = self._KEYCRE.sub(self._interpolation_replace, value) try: value = value % vars *************** *** 567,570 **** --- 568,580 ---- return value + _KEYCRE = re.compile(r"%\(([^)]*)\)s|.") + + def _interpolation_replace(self, match): + s = match.group(1) + if s is None: + return match.group() + else: + return "%%(%s)s" % self.optionxform(s) + class SafeConfigParser(ConfigParser): *************** *** 599,603 **** raise InterpolationSyntaxError(option, section, "bad interpolation variable reference %r" % rest) ! var = m.group(1) rest = rest[m.end():] try: --- 609,613 ---- raise InterpolationSyntaxError(option, section, "bad interpolation variable reference %r" % rest) ! var = self.optionxform(m.group(1)) rest = rest[m.end():] try: From fdrake at users.sourceforge.net Mon May 17 22:25:54 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon May 17 22:26:03 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_cfgparser.py, 1.20, 1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1097/Lib/test Modified Files: test_cfgparser.py Log Message: ConfigParser: - ensure that option names in interpolations are handled by self.optionxform in the same way that other references to option names - add tests, documentation (closes SF bug #857881, patch #865455) Index: test_cfgparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_cfgparser.py 1 May 2003 17:45:34 -0000 1.20 --- test_cfgparser.py 18 May 2004 02:25:51 -0000 1.21 *************** *** 223,231 **** "with10=%(with9)s\n" "with9=%(with8)s\n" ! "with8=%(with7)s\n" ! "with7=%(with6)s\n" "with6=%(with5)s\n" ! "with5=%(with4)s\n" ! "with4=%(with3)s\n" "with3=%(with2)s\n" "with2=%(with1)s\n" --- 223,231 ---- "with10=%(with9)s\n" "with9=%(with8)s\n" ! "with8=%(With7)s\n" ! "with7=%(WITH6)s\n" "with6=%(with5)s\n" ! "With5=%(with4)s\n" ! "WITH4=%(with3)s\n" "with3=%(with2)s\n" "with2=%(with1)s\n" From fdrake at users.sourceforge.net Mon May 17 22:25:54 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon May 17 22:26:05 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcfgparser.tex, 1.34, 1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1097/Doc/lib Modified Files: libcfgparser.tex Log Message: ConfigParser: - ensure that option names in interpolations are handled by self.optionxform in the same way that other references to option names - add tests, documentation (closes SF bug #857881, patch #865455) Index: libcfgparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcfgparser.tex,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** libcfgparser.tex 8 Jan 2004 15:01:08 -0000 1.34 --- libcfgparser.tex 18 May 2004 02:25:51 -0000 1.35 *************** *** 63,66 **** --- 63,73 ---- \var{__name__} is an intrinsic default; its value is the section name, and will override any value provided in \var{defaults}. + + All option names used in interpolation will be passed through the + \method{optionxform()} method just like any other option name + reference. For example, using the default implementation of + \method{optionxform()} (which converts option names to lower case), + the values \samp{foo \%(bar)s} and \samp{foo \%(BAR)s} are + equivalent. \end{classdesc} *************** *** 272,275 **** --- 279,284 ---- The \class{ConfigParser} class extends some methods of the \class{RawConfigParser} interface, adding some optional arguments. + The \class{SafeConfigParser} class implements the same extended + interface. \begin{methoddesc}{get}{section, option\optional{, raw\optional{, vars}}} From fdrake at users.sourceforge.net Mon May 17 23:29:54 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon May 17 23:30:00 2004 Subject: [Python-checkins] python/dist/src/Lib ConfigParser.py,1.64,1.65 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11581/Lib Modified Files: ConfigParser.py Log Message: ConfigParser: - don't allow setting options to non-string values; raise TypeError when the value is set, instead of raising an arbitrary exception later (such as when string interpolation is performed) - add tests, documentation (closes SF bug #810843) Index: ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** ConfigParser.py 18 May 2004 02:25:50 -0000 1.64 --- ConfigParser.py 18 May 2004 03:29:52 -0000 1.65 *************** *** 344,347 **** --- 344,349 ---- def set(self, section, option, value): """Set an option.""" + if not isinstance(value, basestring): + raise TypeError("option values must be strings") if not section or section == DEFAULTSECT: sectdict = self._defaults From fdrake at users.sourceforge.net Mon May 17 23:29:54 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon May 17 23:30:06 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_cfgparser.py, 1.21, 1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11581/Lib/test Modified Files: test_cfgparser.py Log Message: ConfigParser: - don't allow setting options to non-string values; raise TypeError when the value is set, instead of raising an arbitrary exception later (such as when string interpolation is performed) - add tests, documentation (closes SF bug #810843) Index: test_cfgparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** test_cfgparser.py 18 May 2004 02:25:51 -0000 1.21 --- test_cfgparser.py 18 May 2004 03:29:52 -0000 1.22 *************** *** 212,215 **** --- 212,246 ---- ) + def test_set_string_types(self): + cf = self.fromstring("[sect]\n" + "option1=foo\n") + # Check that we don't get an exception when setting values in + # an existing section using strings: + class mystr(str): + pass + cf.set("sect", "option1", "splat") + cf.set("sect", "option1", mystr("splat")) + cf.set("sect", "option2", "splat") + cf.set("sect", "option2", mystr("splat")) + try: + unicode + except NameError: + pass + else: + cf.set("sect", "option1", unicode("splat")) + cf.set("sect", "option2", unicode("splat")) + + def test_set_nonstring_types(self): + cf = self.fromstring("[sect]\n" + "option1=foo\n") + # Check that we get a TypeError when setting non-string values + # in an existing section: + self.assertRaises(TypeError, cf.set, "sect", "option1", 1) + self.assertRaises(TypeError, cf.set, "sect", "option1", 1.0) + self.assertRaises(TypeError, cf.set, "sect", "option1", object()) + self.assertRaises(TypeError, cf.set, "sect", "option2", 1) + self.assertRaises(TypeError, cf.set, "sect", "option2", 1.0) + self.assertRaises(TypeError, cf.set, "sect", "option2", object()) + # shared by subclasses def get_interpolation_config(self): From fdrake at users.sourceforge.net Mon May 17 23:29:54 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon May 17 23:30:10 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcfgparser.tex, 1.35, 1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11581/Doc/lib Modified Files: libcfgparser.tex Log Message: ConfigParser: - don't allow setting options to non-string values; raise TypeError when the value is set, instead of raising an arbitrary exception later (such as when string interpolation is performed) - add tests, documentation (closes SF bug #810843) Index: libcfgparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcfgparser.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** libcfgparser.tex 18 May 2004 02:25:51 -0000 1.35 --- libcfgparser.tex 18 May 2004 03:29:51 -0000 1.36 *************** *** 239,243 **** \begin{methoddesc}{set}{section, option, value} If the given section exists, set the given option to the specified value; ! otherwise raise \exception{NoSectionError}. \versionadded{1.6} \end{methoddesc} --- 239,245 ---- \begin{methoddesc}{set}{section, option, value} If the given section exists, set the given option to the specified value; ! otherwise raise \exception{NoSectionError}. \var{value} must be a ! string (\class{str} or \class{unicode}); if not, \exception{TypeError} ! is raised. \versionadded{1.6} \end{methoddesc} From fdrake at users.sourceforge.net Mon May 17 23:56:54 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon May 17 23:56:58 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcfgparser.tex, 1.36, 1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16525 Modified Files: libcfgparser.tex Log Message: ConfigParser: - DuplicateSectionError is only raised by add_section() (closes SF bug #830449) Index: libcfgparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcfgparser.tex,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** libcfgparser.tex 18 May 2004 03:29:51 -0000 1.36 --- libcfgparser.tex 18 May 2004 03:56:51 -0000 1.37 *************** *** 87,93 **** \begin{excdesc}{DuplicateSectionError} ! Exception raised when multiple sections with the same name are found, ! or if \method{add_section()} is called with the name of a section that ! is already present. \end{excdesc} --- 87,92 ---- \begin{excdesc}{DuplicateSectionError} ! Exception raised if \method{add_section()} is called with the name of ! a section that is already present. \end{excdesc} From fdrake at users.sourceforge.net Tue May 18 00:24:05 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 18 00:24:10 2004 Subject: [Python-checkins] python/dist/src/Lib ConfigParser.py,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21743/Lib Modified Files: ConfigParser.py Log Message: ConfigParser: - read() method returns a list of files parsed successfully - add tests, documentation (closes SF patch #677651) Index: ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** ConfigParser.py 18 May 2004 03:29:52 -0000 1.65 --- ConfigParser.py 18 May 2004 04:24:02 -0000 1.66 *************** *** 46,50 **** read and parse the list of named configuration files, given by name. A single filename is also allowed. Non-existing files ! are ignored. readfp(fp, filename=None) --- 46,50 ---- read and parse the list of named configuration files, given by name. A single filename is also allowed. Non-existing files ! are ignored. Return list of successfully read files. readfp(fp, filename=None) *************** *** 253,259 **** --- 253,262 ---- configuration files in the list will be read. A single filename may also be given. + + Return list of successfully read files. """ if isinstance(filenames, basestring): filenames = [filenames] + read_ok = [] for filename in filenames: try: *************** *** 263,266 **** --- 266,271 ---- self._read(fp, filename) fp.close() + read_ok.append(filename) + return read_ok def readfp(self, fp, filename=None): From fdrake at users.sourceforge.net Tue May 18 00:24:05 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 18 00:24:12 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcfgparser.tex, 1.37, 1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21743/Doc/lib Modified Files: libcfgparser.tex Log Message: ConfigParser: - read() method returns a list of files parsed successfully - add tests, documentation (closes SF patch #677651) Index: libcfgparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcfgparser.tex,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** libcfgparser.tex 18 May 2004 03:56:51 -0000 1.37 --- libcfgparser.tex 18 May 2004 04:24:02 -0000 1.38 *************** *** 178,182 **** \begin{methoddesc}{read}{filenames} ! Read and parse a list of filenames. If \var{filenames} is a string or Unicode string, it is treated as a single filename. If a file named in \var{filenames} cannot be opened, that file will be --- 178,183 ---- \begin{methoddesc}{read}{filenames} ! Attempt to read and parse a list of filenames, returning a list of filenames ! which were successfully parsed. If \var{filenames} is a string or Unicode string, it is treated as a single filename. If a file named in \var{filenames} cannot be opened, that file will be *************** *** 198,201 **** --- 199,203 ---- config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')]) \end{verbatim} + \versionchanged[Returns list of successfully parsed filenames]{2.4} \end{methoddesc} From fdrake at users.sourceforge.net Tue May 18 00:24:05 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 18 00:24:15 2004 Subject: [Python-checkins] python/dist/src/Lib/test cfgparser.1, NONE, 1.1 test_cfgparser.py, 1.22, 1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21743/Lib/test Modified Files: test_cfgparser.py Added Files: cfgparser.1 Log Message: ConfigParser: - read() method returns a list of files parsed successfully - add tests, documentation (closes SF patch #677651) --- NEW FILE: cfgparser.1 --- [Foo Bar] foo=newbar Index: test_cfgparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test_cfgparser.py 18 May 2004 03:29:52 -0000 1.22 --- test_cfgparser.py 18 May 2004 04:24:02 -0000 1.23 *************** *** 243,246 **** --- 243,267 ---- self.assertRaises(TypeError, cf.set, "sect", "option2", object()) + def test_read_returns_file_list(self): + file1 = test_support.findfile("cfgparser.1") + # check when we pass a mix of readable and non-readable files: + cf = self.newconfig() + parsed_files = cf.read([file1, "nonexistant-file"]) + self.assertEqual(parsed_files, [file1]) + self.assertEqual(cf.get("Foo Bar", "foo"), "newbar") + # check when we pass only a filename: + cf = self.newconfig() + parsed_files = cf.read(file1) + self.assertEqual(parsed_files, [file1]) + self.assertEqual(cf.get("Foo Bar", "foo"), "newbar") + # check when we pass only missing files: + cf = self.newconfig() + parsed_files = cf.read(["nonexistant-file"]) + self.assertEqual(parsed_files, []) + # check when we pass no files: + cf = self.newconfig() + parsed_files = cf.read([]) + self.assertEqual(parsed_files, []) + # shared by subclasses def get_interpolation_config(self): From fdrake at users.sourceforge.net Tue May 18 00:30:02 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 18 00:30:07 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.42, 1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22771 Modified Files: whatsnew24.tex Log Message: add some notes about the changes to ConfigParser Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** whatsnew24.tex 6 May 2004 02:55:35 -0000 1.42 --- whatsnew24.tex 18 May 2004 04:30:00 -0000 1.43 *************** *** 368,371 **** --- 368,377 ---- \module{threading}, and \module{pydoc}. + \item The \module{ConfigParser} classes have been enhanced slightly. + The \method{read()} method now returns a list of the files that + were successfully parsed, and the \method{set()} method raises + \exception{TypeError} if passed a \var{value} argument that isn't a + string. + \item The \module{heapq} module has been converted to C. The resulting tenfold improvement in speed makes the module suitable for handling From hsgxesc at msn.com Tue May 18 03:12:37 2004 From: hsgxesc at msn.com (Freeman Capps) Date: Tue May 18 02:15:06 2004 Subject: [Python-checkins] pydotorg@python.org: you are nominated for mba Tue, 18 May 2004 12:12:37 +0500holmdel Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040518/0c363f5f/attachment.html From rhettinger at users.sourceforge.net Tue May 18 14:15:08 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue May 18 14:15:13 2004 Subject: [Python-checkins] python/dist/src/Modules collectionsmodule.c, 1.14, 1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1812 Modified Files: collectionsmodule.c Log Message: Make type check work with subclasses Index: collectionsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/collectionsmodule.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** collectionsmodule.c 12 May 2004 20:55:42 -0000 1.14 --- collectionsmodule.c 18 May 2004 18:15:03 -0000 1.15 *************** *** 588,592 **** int i, b, vs, ws, minlen, cmp=-1; ! if (v->ob_type != &deque_type || w->ob_type != &deque_type) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; --- 588,593 ---- int i, b, vs, ws, minlen, cmp=-1; ! if (!PyObject_TypeCheck(v, &deque_type) || ! !PyObject_TypeCheck(w, &deque_type)) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; From fdrake at users.sourceforge.net Tue May 18 23:14:31 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 18 23:14:35 2004 Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.74.4.10, 2.74.4.11 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17924 Modified Files: Tag: release23-maint patchlevel.h Log Message: update version number for 2.3.4 final Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.74.4.10 retrieving revision 2.74.4.11 diff -C2 -d -r2.74.4.10 -r2.74.4.11 *** patchlevel.h 11 May 2004 15:21:20 -0000 2.74.4.10 --- patchlevel.h 19 May 2004 03:14:27 -0000 2.74.4.11 *************** *** 23,31 **** #define PY_MINOR_VERSION 3 #define PY_MICRO_VERSION 4 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA ! #define PY_RELEASE_SERIAL 1 /* Version as a string */ ! #define PY_VERSION "2.3.4c1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 23,31 ---- #define PY_MINOR_VERSION 3 #define PY_MICRO_VERSION 4 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL ! #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.3.4" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From rhettinger at users.sourceforge.net Wed May 19 04:20:36 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 04:20:56 2004 Subject: [Python-checkins] python/dist/src/Python compile.c, 2.301, 2.302 graminit.c, 2.34, 2.35 symtable.c, 2.11, 2.12 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9770/Python Modified Files: compile.c graminit.c symtable.c Log Message: SF patch #872326: Generator expression implementation (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.301 retrieving revision 2.302 diff -C2 -d -r2.301 -r2.302 *** compile.c 22 Mar 2004 17:52:53 -0000 2.301 --- compile.c 19 May 2004 08:20:15 -0000 2.302 *************** *** 745,753 **** --- 745,757 ---- static int com_addname(struct compiling *, PyObject *); static void com_addopname(struct compiling *, int, node *); + static void com_test(struct compiling *c, node *n); static void com_list(struct compiling *, node *, int); static void com_list_iter(struct compiling *, node *, node *, char *); + static void com_gen_iter(struct compiling *, node *, node *); static int com_argdefs(struct compiling *, node *); static void com_assign(struct compiling *, node *, int, node *); static void com_assign_name(struct compiling *, node *, int); + static int com_make_closure(struct compiling *c, PyCodeObject *co); + static PyCodeObject *icompile(node *, struct compiling *); static PyCodeObject *jcompile(node *, const char *, struct compiling *, *************** *** 760,763 **** --- 764,768 ---- /* symtable operations */ + static int symtable_lookup(struct symtable *st, char *name); static struct symtable *symtable_build(node *, PyFutureFeatures *, const char *filename); *************** *** 778,782 **** --- 783,790 ---- static void symtable_assign(struct symtable *, node *, int); static void symtable_list_comprehension(struct symtable *, node *); + static void symtable_generator_expression(struct symtable *, node *); static void symtable_list_for(struct symtable *, node *); + static void symtable_gen_for(struct symtable *, node *, int); + static void symtable_gen_iter(struct symtable *, node *); static int symtable_update_free_vars(struct symtable *); *************** *** 1590,1594 **** int save_begin = c->c_begin; ! /* list_iter: for v in expr [list_iter] */ com_node(c, CHILD(n, 3)); /* expr */ com_addbyte(c, GET_ITER); --- 1598,1602 ---- int save_begin = c->c_begin; ! /* list_for: for v in expr [list_iter] */ com_node(c, CHILD(n, 3)); /* expr */ com_addbyte(c, GET_ITER); *************** *** 1607,1610 **** --- 1615,1664 ---- static void + com_gen_for(struct compiling *c, node *n, node *t, int is_outmost) + { + int break_anchor = 0; + int anchor = 0; + int save_begin = c->c_begin; + + REQ(n, gen_for); + /* gen_for: for v in test [gen_iter] */ + + com_addfwref(c, SETUP_LOOP, &break_anchor); + block_push(c, SETUP_LOOP); + + if (is_outmost) { + com_addop_varname(c, VAR_LOAD, "[outmost-iterable]"); + com_push(c, 1); + } + else { + com_node(c, CHILD(n, 3)); + com_addbyte(c, GET_ITER); + } + + c->c_begin = c->c_nexti; + com_set_lineno(c, c->c_last_line); + com_addfwref(c, FOR_ITER, &anchor); + com_push(c, 1); + com_assign(c, CHILD(n, 1), OP_ASSIGN, NULL); + + if (NCH(n) == 5) + com_gen_iter(c, CHILD(n, 4), t); + else { + com_test(c, t); + com_addbyte(c, YIELD_VALUE); + com_pop(c, 1); + } + + com_addoparg(c, JUMP_ABSOLUTE, c->c_begin); + 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); + com_backpatch(c, break_anchor); + } + + static void com_list_if(struct compiling *c, node *n, node *e, char *t) { *************** *** 1625,1628 **** --- 1679,1708 ---- static void + com_gen_if(struct compiling *c, node *n, node *t) + { + /* gen_if: 'if' test [gen_iter] */ + int anchor = 0; + int a=0; + + com_node(c, CHILD(n, 1)); + com_addfwref(c, JUMP_IF_FALSE, &a); + com_addbyte(c, POP_TOP); + com_pop(c, 1); + + if (NCH(n) == 3) + com_gen_iter(c, CHILD(n, 2), t); + else { + com_test(c, t); + com_addbyte(c, YIELD_VALUE); + com_pop(c, 1); + } + com_addfwref(c, JUMP_FORWARD, &anchor); + com_backpatch(c, a); + /* We jump here with an extra entry which we now pop */ + com_addbyte(c, POP_TOP); + com_backpatch(c, anchor); + } + + static void com_list_iter(struct compiling *c, node *p, /* parent of list_iter node */ *************** *** 1656,1659 **** --- 1736,1761 ---- static void + com_gen_iter(struct compiling *c, node *n, node *t) + { + /* gen_iter: gen_for | gen_if */ + node *ch; + REQ(n, gen_iter); + + ch = CHILD(n, 0); + + switch (TYPE(ch)) { + case gen_for: + com_gen_for(c, ch, t, 0); + break; + case gen_if: + com_gen_if(c, ch, t); + break; + default: + com_error(c, PyExc_SystemError, + "invalid gen_iter node type"); + } + } + + static void com_list_comprehension(struct compiling *c, node *n) { *************** *** 1690,1693 **** --- 1792,1841 ---- static void + com_generator_expression(struct compiling *c, node *n) + { + /* testlist_gexp: test gen_for */ + /* argument: test gen_for */ + PyCodeObject *co; + + REQ(CHILD(n, 0), test); + REQ(CHILD(n, 1), gen_for); + + symtable_enter_scope(c->c_symtable, "", TYPE(n), + n->n_lineno); + co = icompile(n, c); + symtable_exit_scope(c->c_symtable); + + if (co == NULL) + c->c_errors++; + else { + int closure = com_make_closure(c, co); + int i = com_addconst(c, (PyObject *)co); + + com_addoparg(c, LOAD_CONST, i); + com_push(c, 1); + if (closure) + com_addoparg(c, MAKE_CLOSURE, 0); + else + com_addoparg(c, MAKE_FUNCTION, 0); + + com_test(c, CHILD(CHILD(n, 1), 3)); + com_addbyte(c, GET_ITER); + com_addoparg(c, CALL_FUNCTION, 1); + com_pop(c, 1); + + Py_DECREF(co); + } + } + + static void + com_testlist_gexp(struct compiling *c, node *n) + { + /* testlist_gexp: test ( gen_for | (',' test)* [','] ) */ + if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == gen_for) + com_generator_expression(c, n); + else com_list(c, n, 0); + } + + static void com_dictmaker(struct compiling *c, node *n) { *************** *** 1722,1726 **** } else ! com_node(c, CHILD(n, 1)); break; case LSQB: /* '[' [listmaker] ']' */ --- 1870,1874 ---- } else ! com_testlist_gexp(c, CHILD(n, 1)); break; case LSQB: /* '[' [listmaker] ']' */ *************** *** 1858,1862 **** { node *m; ! REQ(n, argument); /* [test '='] test; really [keyword '='] test */ if (NCH(n) == 1) { if (*pkeywords != NULL) { --- 2006,2010 ---- { node *m; ! REQ(n, argument); /* [test '='] test [gen_for]; really [keyword '='] test */ if (NCH(n) == 1) { if (*pkeywords != NULL) { *************** *** 1869,1872 **** --- 2017,2025 ---- return; } + if (NCH(n) == 2) { + com_generator_expression(c, n); + return; + } + m = n; do { *************** *** 2724,2728 **** { int i; ! if (TYPE(n) != testlist && TYPE(n) != listmaker) REQ(n, exprlist); if (assigning) { --- 2877,2882 ---- { int i; ! if (TYPE(n) != testlist && TYPE(n) != testlist_gexp && ! TYPE(n) != listmaker) REQ(n, exprlist); if (assigning) { *************** *** 2766,2770 **** --- 2920,2930 ---- case testlist: case testlist1: + case testlist_gexp: if (NCH(n) > 1) { + if (TYPE(CHILD(n, 1)) == gen_for) { + com_error(c, PyExc_SystemError, + "assign to generator expression not possible"); + return; + } if (assigning > OP_APPLY) { com_error(c, PyExc_SyntaxError, *************** *** 4254,4257 **** --- 4414,4434 ---- static void + compile_generator_expression(struct compiling *c, node *n) + { + /* testlist_gexp: test gen_for */ + /* argument: test gen_for */ + REQ(CHILD(n, 0), test); + REQ(CHILD(n, 1), gen_for); + + c->c_name = ""; + com_gen_for(c, CHILD(n, 1), CHILD(n, 0), 1); + + com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None)); + com_push(c, 1); + com_addbyte(c, RETURN_VALUE); + com_pop(c, 1); + } + + static void compile_node(struct compiling *c, node *n) { *************** *** 4301,4304 **** --- 4478,4486 ---- break; + case testlist_gexp: /* A generator expression */ + case argument: /* A generator expression */ + compile_generator_expression(c, n); + break; + default: com_error(c, PyExc_SystemError, *************** *** 4977,4981 **** } } - assert(PyDict_Size(c->c_freevars) == si.si_nfrees); --- 5159,5162 ---- *************** *** 5347,5355 **** case yield_stmt: ! return 1; default: if (look_for_yield(kid)) ! return 1; } } --- 5528,5536 ---- case yield_stmt: ! return GENERATOR; default: if (look_for_yield(kid)) ! return GENERATOR; } } *************** *** 5495,5498 **** --- 5676,5691 ---- symtable_node(st, CHILD(n, i)); break; + case arglist: + if (NCH(n) > 1) + for (i = 0; i < NCH(n); ++i) { + node *ch = CHILD(n, i); + if (TYPE(ch) == argument && NCH(ch) == 2 && + TYPE(CHILD(ch, 1)) == gen_for) { + PyErr_SetString(PyExc_SyntaxError, + "invalid syntax"); + symtable_error(st, n->n_lineno); + return; + } + } /* The remaining cases fall through to default except in special circumstances. This requires the individual cases *************** *** 5505,5508 **** --- 5698,5706 ---- goto loop; } + else if (TYPE(n) == argument && NCH(n) == 2 && + TYPE(CHILD(n, 1)) == gen_for) { + symtable_generator_expression(st, n); + break; + } /* fall through */ case listmaker: *************** *** 5512,5515 **** --- 5710,5720 ---- } /* fall through */ + case testlist_gexp: + if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == gen_for) { + symtable_generator_expression(st, n); + break; + } + /* fall through */ + case atom: if (TYPE(n) == atom && TYPE(CHILD(n, 0)) == NAME) { *************** *** 5716,5719 **** --- 5921,5944 ---- static void + symtable_generator_expression(struct symtable *st, node *n) + { + /* testlist_gexp: test gen_for */ + REQ(CHILD(n, 0), test); + REQ(CHILD(n, 1), gen_for); + + symtable_enter_scope(st, "", TYPE(n), n->n_lineno); + st->st_cur->ste_generator = GENERATOR_EXPRESSION; + + symtable_add_def(st, "[outmost-iterable]", DEF_PARAM); + + symtable_gen_for(st, CHILD(n, 1), 1); + symtable_node(st, CHILD(n, 0)); + symtable_exit_scope(st); + + /* for outmost iterable precomputation */ + symtable_node(st, CHILD(CHILD(n, 1), 3)); + } + + static void symtable_list_for(struct symtable *st, node *n) { *************** *** 5727,5730 **** --- 5952,5988 ---- static void + symtable_gen_for(struct symtable *st, node *n, int is_outmost) + { + REQ(n, gen_for); + + /* gen_for: for v in test [gen_iter] */ + symtable_assign(st, CHILD(n, 1), 0); + if (is_outmost) + symtable_add_use(st, "[outmost-iterable]"); + else + symtable_node(st, CHILD(n, 3)); + + if (NCH(n) == 5) + symtable_gen_iter(st, CHILD(n, 4)); + } + + static void + symtable_gen_iter(struct symtable *st, node *n) + { + REQ(n, gen_iter); + + n = CHILD(n, 0); + if (TYPE(n) == gen_for) + symtable_gen_for(st, n, 0); + else { + REQ(n, gen_if); + symtable_node(st, CHILD(n, 1)); + + if (NCH(n) == 3) + symtable_gen_iter(st, CHILD(n, 2)); + } + } + + static void symtable_import(struct symtable *st, node *n) { *************** *** 5814,5817 **** --- 6072,6086 ---- } return; + case testlist_gexp: + if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == gen_for) { + /* XXX This is an error, but the next pass + will catch it. */ + return; + } else { + for (i = 0; i < NCH(n); i += 2) + symtable_assign(st, CHILD(n, i), def_flag); + } + return; + case exprlist: case testlist: Index: graminit.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/graminit.c,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** graminit.c 4 Aug 2002 17:29:52 -0000 2.34 --- graminit.c 19 May 2004 08:20:16 -0000 2.35 *************** *** 1017,1041 **** static arc arcs_49_0[7] = { {16, 1}, ! {127, 2}, ! {130, 3}, ! {133, 4}, {12, 5}, ! {135, 5}, ! {136, 6}, }; static arc arcs_49_1[2] = { [...1310 lines suppressed...] {1, "lambda"}, ! {318, 0}, {310, 0}, {311, 0}, ! {312, 0}, ! {315, 0}, {1, "class"}, {319, 0}, ! {320, 0}, ! {322, 0}, {323, 0}, + {325, 0}, + {327, 0}, }; grammar _PyParser_Grammar = { ! 72, dfas, ! {153, labels}, 256 }; Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -d -r2.11 -r2.12 *** symtable.c 21 May 2003 17:34:50 -0000 2.11 --- symtable.c 19 May 2004 08:20:32 -0000 2.12 *************** *** 67,70 **** --- 67,72 ---- case funcdef: case lambdef: + case testlist_gexp: /* generator expression */ + case argument: /* generator expression */ ste->ste_type = TYPE_FUNCTION; break; From rhettinger at users.sourceforge.net Wed May 19 04:20:35 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 04:21:05 2004 Subject: [Python-checkins] python/dist/src/Tools/compiler ast.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9770/Tools/compiler Modified Files: ast.txt Log Message: SF patch #872326: Generator expression implementation (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release. Index: ast.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/ast.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ast.txt 14 Sep 2001 22:40:36 -0000 1.4 --- ast.txt 19 May 2004 08:20:33 -0000 1.5 *************** *** 39,42 **** --- 39,46 ---- ListCompFor: assign, list, ifs! ListCompIf: test + GenExpr: code + GenExprInner: expr, quals! + GenExprFor: assign, iter, ifs! + GenExprIf: test List: nodes! Dict: items! *************** *** 86,87 **** --- 90,98 ---- if flags & CO_VARKEYWORDS: self.kwargs = 1 + + init(GenExpr): + self.argnames = ['[outmost-iterable]'] + self.varargs = self.kwargs = None + + init(GenExprFor): + self.is_outmost = False From rhettinger at users.sourceforge.net Wed May 19 04:20:37 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 04:21:12 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.43, 1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9770/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: SF patch #872326: Generator expression implementation (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** whatsnew24.tex 18 May 2004 04:30:00 -0000 1.43 --- whatsnew24.tex 19 May 2004 08:20:04 -0000 1.44 *************** *** 90,93 **** --- 90,171 ---- %====================================================================== + \section{PEP 229: Generator Expressions} + + Generator expressions create in-line generators using a syntax similar + to list comprehensions but with parenthesis instead of the surrounding + brackets. + + Genexps allow simple generators to be constructed without a separate function + definition. Writing: + + \begin{verbatim} + g = (tgtexp for var1 in exp1 for var2 in exp2 if exp3) + \end{verbatim} + + is equivalent to: + + \begin{verbatim} + def _generator(exp): + for var1 in exp: + for var2 in exp2: + if exp3: + yield tgtexp + g = _generator(exp1) + del _generator + \end{verbatim} + + The advantage over full generator definitions is in economy of + expression. Their advantage over list comprehensions is in saving + memory by creating data only when it is needed rather than forming + a whole list is memory all at once. Applications using memory + friendly generator expressions may scale-up to high volumes of data + more readily than with list comprehensions. + + Generator expressions are intended to be used inside functions + such as \function{sum()}, \function{min()}, \function{set()}, and + \function{dict()}. These functions consume their data all at once + and would not benefit from having a full list instead of a generator + an input: + + \begin{verbatim} + >>> sum(i*i for i in range(10)) + 285 + + >>> sorted(set(i*i for i in xrange(-10, 11))) + [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100] + + >>> words = "Adam apple baker Bill Nancy NASA nut".split() + >>> dict((word.lower(), word) for word in words) + {'apple': 'apple', 'baker': 'baker', 'bill': 'Bill', 'nasa': 'NASA', + 'adam': 'Adam', 'nancy': 'Nancy', 'nut': 'nut'} + + >>> xvec = [10, 20, 30] + >>> yvec = [7, 5, 3] + >>> sum(x*y for x,y in itertools.izip(xvec, yvec)) # dot product + 260 + + \end{verbatim} + + These examples show the intended use for generator expressions + in situations where the values get consumed immediately after the + generator is created. In these situations, they operate like + memory efficient versions of list comprehensions. + + For more complex uses of generators, it is strongly recommended that + the traditional full generator definitions be used instead. In a + generator expression, the first for-loop expression is evaluated + as soon as the expression is defined while the other expressions do + not get evaluated until the generator is run. This nuance is never + an issue when the generator is used immediately. If it is not used + right away, then it is better to write a full generator definition + which more clearly reveals when the expressions are evaluated and is + more obvious about the visibility and lifetime of its looping variables. + + \begin{seealso} + \seepep{289}{Generator Expressions}{Proposed by Raymond Hettinger and + implemented by Jiwon Seo with early efforts steered by Hye-Shik Chang.} + \end{seealso} + + %====================================================================== \section{PEP 322: Reverse Iteration} From rhettinger at users.sourceforge.net Wed May 19 04:20:37 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 04:21:17 2004 Subject: [Python-checkins] python/dist/src/Grammar Grammar,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Grammar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9770/Grammar Modified Files: Grammar Log Message: SF patch #872326: Generator expression implementation (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release. Index: Grammar =================================================================== RCS file: /cvsroot/python/python/dist/src/Grammar/Grammar,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** Grammar 4 Aug 2002 17:29:52 -0000 1.48 --- Grammar 19 May 2004 08:20:04 -0000 1.49 *************** *** 81,86 **** factor: ('+'|'-'|'~') factor | power power: atom trailer* ['**' factor] ! atom: '(' [testlist] ')' | '[' [listmaker] ']' | '{' [dictmaker] '}' | '`' testlist1 '`' | NAME | NUMBER | STRING+ listmaker: test ( list_for | (',' test)* [','] ) lambdef: 'lambda' [varargslist] ':' test trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME --- 81,87 ---- factor: ('+'|'-'|'~') factor | power power: atom trailer* ['**' factor] ! atom: '(' [testlist_gexp] ')' | '[' [listmaker] ']' | '{' [dictmaker] '}' | '`' testlist1 '`' | NAME | NUMBER | STRING+ listmaker: test ( list_for | (',' test)* [','] ) + testlist_gexp: test ( gen_for | (',' test)* [','] ) lambdef: 'lambda' [varargslist] ':' test trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME *************** *** 96,100 **** arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test) ! argument: [test '='] test # Really [keyword '='] test list_iter: list_for | list_if --- 97,101 ---- arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test) ! argument: [test '='] test [gen_for] # Really [keyword '='] test list_iter: list_for | list_if *************** *** 102,105 **** --- 103,110 ---- list_if: 'if' test [list_iter] + gen_iter: gen_for | gen_if + gen_for: 'for' exprlist 'in' test [gen_iter] + gen_if: 'if' test [gen_iter] + testlist1: test (',' test)* From rhettinger at users.sourceforge.net Wed May 19 04:20:38 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 04:21:22 2004 Subject: [Python-checkins] python/dist/src/Lib symbol.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9770/Lib Modified Files: symbol.py Log Message: SF patch #872326: Generator expression implementation (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release. Index: symbol.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/symbol.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** symbol.py 3 Oct 2002 09:42:01 -0000 1.15 --- symbol.py 19 May 2004 08:20:05 -0000 1.16 *************** *** 62,82 **** atom = 305 listmaker = 306 ! lambdef = 307 ! trailer = 308 ! subscriptlist = 309 ! subscript = 310 ! sliceop = 311 ! exprlist = 312 ! testlist = 313 ! testlist_safe = 314 ! dictmaker = 315 ! classdef = 316 ! arglist = 317 ! argument = 318 ! list_iter = 319 ! list_for = 320 ! list_if = 321 ! testlist1 = 322 ! encoding_decl = 323 #--end constants-- --- 62,86 ---- atom = 305 listmaker = 306 ! testlist_gexp = 307 ! lambdef = 308 ! trailer = 309 ! subscriptlist = 310 ! subscript = 311 ! sliceop = 312 ! exprlist = 313 ! testlist = 314 ! testlist_safe = 315 ! dictmaker = 316 ! classdef = 317 ! arglist = 318 ! argument = 319 ! list_iter = 320 ! list_for = 321 ! list_if = 322 ! gen_iter = 323 ! gen_for = 324 ! gen_if = 325 ! testlist1 = 326 ! encoding_decl = 327 #--end constants-- From rhettinger at users.sourceforge.net Wed May 19 04:20:46 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 04:21:28 2004 Subject: [Python-checkins] python/dist/src/Misc ACKS, 1.261, 1.262 NEWS, 1.972, 1.973 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9770/Misc Modified Files: ACKS NEWS Log Message: SF patch #872326: Generator expression implementation (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.261 retrieving revision 1.262 diff -C2 -d -r1.261 -r1.262 *** ACKS 23 Mar 2004 23:29:01 -0000 1.261 --- ACKS 19 May 2004 08:20:10 -0000 1.262 *************** *** 501,504 **** --- 501,505 ---- Nick Seidenman Fred Sells + Jiwon Seo Denis Severson Ha Shao Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.972 retrieving revision 1.973 diff -C2 -d -r1.972 -r1.973 *** NEWS 11 May 2004 15:09:57 -0000 1.972 --- NEWS 19 May 2004 08:20:10 -0000 1.973 *************** *** 13,16 **** --- 13,18 ---- ----------------- + - Implemented generator expressions (PEP 289). Coded by Jiwon Seo. + - Enabled the profiling of C extension functions (and builtins) - check new documentation and modified profiler and bdb modules for more details From rhettinger at users.sourceforge.net Wed May 19 04:20:47 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 04:21:33 2004 Subject: [Python-checkins] python/dist/src/Modules parsermodule.c,2.81,2.82 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9770/Modules Modified Files: parsermodule.c Log Message: SF patch #872326: Generator expression implementation (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release. Index: parsermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v retrieving revision 2.81 retrieving revision 2.82 diff -C2 -d -r2.81 -r2.82 *** parsermodule.c 20 Nov 2003 01:44:58 -0000 2.81 --- parsermodule.c 19 May 2004 08:20:13 -0000 2.82 *************** *** 856,860 **** VALIDATER(arglist); VALIDATER(argument); VALIDATER(listmaker); VALIDATER(yield_stmt); ! VALIDATER(testlist1); #undef VALIDATER --- 856,862 ---- VALIDATER(arglist); VALIDATER(argument); VALIDATER(listmaker); VALIDATER(yield_stmt); ! VALIDATER(testlist1); VALIDATER(gen_for); ! VALIDATER(gen_iter); VALIDATER(gen_if); ! VALIDATER(testlist_gexp); #undef VALIDATER *************** *** 1247,1250 **** --- 1249,1267 ---- } + /* gen_iter: gen_for | gen_if + */ + static int + validate_gen_iter(node *tree) + { + int res = (validate_ntype(tree, gen_iter) + && validate_numnodes(tree, 1, "gen_iter")); + if (res && TYPE(CHILD(tree, 0)) == gen_for) + res = validate_gen_for(CHILD(tree, 0)); + else + res = validate_gen_if(CHILD(tree, 0)); + + return res; + } + /* list_for: 'for' exprlist 'in' testlist [list_iter] */ *************** *** 1269,1272 **** --- 1286,1311 ---- } + /* gen_for: 'for' exprlist 'in' test [gen_iter] + */ + static int + validate_gen_for(node *tree) + { + int nch = NCH(tree); + int res; + + if (nch == 5) + res = validate_gen_iter(CHILD(tree, 4)); + else + res = validate_numnodes(tree, 4, "gen_for"); + + if (res) + res = (validate_name(CHILD(tree, 0), "for") + && validate_exprlist(CHILD(tree, 1)) + && validate_name(CHILD(tree, 2), "in") + && validate_test(CHILD(tree, 3))); + + return res; + } + /* list_if: 'if' test [list_iter] */ *************** *** 1289,1292 **** --- 1328,1350 ---- } + /* gen_if: 'if' test [gen_iter] + */ + static int + validate_gen_if(node *tree) + { + int nch = NCH(tree); + int res; + + if (nch == 3) + res = validate_gen_iter(CHILD(tree, 2)); + else + res = validate_numnodes(tree, 2, "gen_if"); + + if (res) + res = (validate_name(CHILD(tree, 0), "if") + && validate_test(CHILD(tree, 1))); + + return res; + } /* validate_fpdef() *************** *** 2188,2192 **** if (res && (nch == 3)) ! res = validate_testlist(CHILD(tree, 1)); break; case LSQB: --- 2246,2250 ---- if (res && (nch == 3)) ! res = validate_testlist_gexp(CHILD(tree, 1)); break; case LSQB: *************** *** 2245,2249 **** /* ! * list_iter | (',' test)* [','] */ if (nch == 2 && TYPE(CHILD(tree, 1)) == list_for) --- 2303,2307 ---- /* ! * list_for | (',' test)* [','] */ if (nch == 2 && TYPE(CHILD(tree, 1)) == list_for) *************** *** 2267,2270 **** --- 2325,2365 ---- } + /* testlist_gexp: + * test ( gen_for | (',' test)* [','] ) + */ + static int + validate_testlist_gexp(node *tree) + { + int nch = NCH(tree); + int ok = nch; + + if (nch == 0) + err_string("missing child nodes of testlist_gexp"); + else { + ok = validate_test(CHILD(tree, 0)); + } + + /* + * gen_for | (',' test)* [','] + */ + if (nch == 2 && TYPE(CHILD(tree, 1)) == gen_for) + ok = validate_gen_for(CHILD(tree, 1)); + else { + /* (',' test)* [','] */ + int i = 1; + while (ok && nch - i >= 2) { + ok = (validate_comma(CHILD(tree, i)) + && validate_test(CHILD(tree, i+1))); + i += 2; + } + if (ok && i == nch-1) + ok = validate_comma(CHILD(tree, i)); + else if (i != nch) { + ok = 0; + err_string("illegal trailing nodes for testlist_gexp"); + } + } + return ok; + } /* funcdef: *************** *** 2319,2322 **** --- 2414,2429 ---- return validate_numnodes(tree, nch + 1, "arglist"); + if (nch > 1) { + for (i=0; i= 2) { /* skip leading (argument ',') */ *************** *** 2378,2382 **** /* argument: * ! * [test '='] test */ static int --- 2485,2489 ---- /* argument: * ! * [test '='] test [gen_for] */ static int *************** *** 2385,2392 **** int nch = NCH(tree); int res = (validate_ntype(tree, argument) ! && ((nch == 1) || (nch == 3)) && validate_test(CHILD(tree, 0))); ! if (res && (nch == 3)) res = (validate_equal(CHILD(tree, 1)) && validate_test(CHILD(tree, 2))); --- 2492,2501 ---- int nch = NCH(tree); int res = (validate_ntype(tree, argument) ! && ((nch == 1) || (nch == 2) || (nch == 3)) && validate_test(CHILD(tree, 0))); ! if (res && (nch == 2)) ! res = validate_gen_for(CHILD(tree, 1)); ! else if (res && (nch == 3)) res = (validate_equal(CHILD(tree, 1)) && validate_test(CHILD(tree, 2))); From WKVLAWNDGJDM at vinet.or.jp Wed May 19 07:13:37 2004 From: WKVLAWNDGJDM at vinet.or.jp (Randall Bass) Date: Wed May 19 06:16:47 2004 Subject: [Python-checkins] Your employer said they can't hire you because you don't have a diploma Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040519/08a461df/attachment.html From fdrake at users.sourceforge.net Wed May 19 09:42:34 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 19 09:42:43 2004 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.3.spec, 1.2.12.9, 1.2.12.10 Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7112 Modified Files: Tag: release23-maint python-2.3.spec Log Message: repair date Index: python-2.3.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.3.spec,v retrieving revision 1.2.12.9 retrieving revision 1.2.12.10 diff -C2 -d -r1.2.12.9 -r1.2.12.10 *** python-2.3.spec 12 May 2004 19:50:27 -0000 1.2.12.9 --- python-2.3.spec 19 May 2004 13:42:31 -0000 1.2.12.10 *************** *** 128,132 **** %changelog ! * Sat Mar 27 2003 Sean Reifschneider [2.3.2-3pydotorg] - Being more agressive about finding the paths to fix for #!/usr/local/bin/python. --- 128,132 ---- %changelog ! * Sat Mar 27 2004 Sean Reifschneider [2.3.2-3pydotorg] - Being more agressive about finding the paths to fix for #!/usr/local/bin/python. From akuchling at users.sourceforge.net Wed May 19 10:39:11 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed May 19 10:39:15 2004 Subject: [Python-checkins] python/dist/src/Modules mmapmodule.c,2.47,2.48 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20451 Modified Files: mmapmodule.c Log Message: Set data pointer to NULL after an error; this keeps the mmap_dealloc() function from trying to do msync(-1);munmap(-1). 2.3 bugfix candidate, but this bug isn't critical enough that the fix has to go into 2.3.4 Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -d -r2.47 -r2.48 *** mmapmodule.c 17 Jan 2004 14:19:44 -0000 2.47 --- mmapmodule.c 19 May 2004 14:39:08 -0000 2.48 *************** *** 913,916 **** --- 913,917 ---- fd, 0); if (m_obj->data == (char *)-1) { + m_obj->data = NULL; Py_DECREF(m_obj); PyErr_SetFromErrno(mmap_module_error); From fdrake at users.sourceforge.net Wed May 19 11:01:19 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed May 19 11:01:26 2004 Subject: [Python-checkins] python/dist/src/Doc/commontex boilerplate.tex, 1.1.2.7, 1.1.2.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24724 Modified Files: Tag: release23-maint boilerplate.tex Log Message: reverse the order of the two \date lines so the processing tools pick up on the right one Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/boilerplate.tex,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -d -r1.1.2.7 -r1.1.2.8 *** boilerplate.tex 14 May 2004 05:09:10 -0000 1.1.2.7 --- boilerplate.tex 19 May 2004 15:01:15 -0000 1.1.2.8 *************** *** 6,10 **** } - %\date{\today} \date{May 20, 2004} % XXX update before final release! \input{patchlevel} % include Python version information --- 6,10 ---- } \date{May 20, 2004} % XXX update before final release! + %\date{\today} \input{patchlevel} % include Python version information From arigo at users.sourceforge.net Wed May 19 15:10:20 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Wed May 19 15:10:27 2004 Subject: [Python-checkins] python/dist/src/Lib stringprep.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11125/Lib Modified Files: stringprep.py Log Message: Applying SF patch #949329 on behalf of Raymond Hettinger. Index: stringprep.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/stringprep.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stringprep.py 24 Apr 2003 16:02:43 -0000 1.2 --- stringprep.py 19 May 2004 19:10:17 -0000 1.3 *************** *** 6,10 **** """ ! import unicodedata, sets assert unicodedata.unidata_version == '3.2.0' --- 6,10 ---- """ ! import unicodedata assert unicodedata.unidata_version == '3.2.0' *************** *** 17,21 **** ! b1_set = sets.Set([173, 847, 6150, 6155, 6156, 6157, 8203, 8204, 8205, 8288, 65279] + range(65024,65040)) def in_table_b1(code): return ord(code) in b1_set --- 17,21 ---- ! b1_set = set([173, 847, 6150, 6155, 6156, 6157, 8203, 8204, 8205, 8288, 65279] + range(65024,65040)) def in_table_b1(code): return ord(code) in b1_set *************** *** 218,222 **** return ord(code) < 128 and unicodedata.category(code) == "Cc" ! c22_specials = sets.Set([1757, 1807, 6158, 8204, 8205, 8232, 8233, 65279] + range(8288,8292) + range(8298,8304) + range(65529,65533) + range(119155,119163)) def in_table_c22(code): c = ord(code) --- 218,222 ---- return ord(code) < 128 and unicodedata.category(code) == "Cc" ! c22_specials = set([1757, 1807, 6158, 8204, 8205, 8232, 8233, 65279] + range(8288,8292) + range(8298,8304) + range(65529,65533) + range(119155,119163)) def in_table_c22(code): c = ord(code) *************** *** 245,264 **** ! c6_set = sets.Set(range(65529,65534)) def in_table_c6(code): return ord(code) in c6_set ! c7_set = sets.Set(range(12272,12284)) def in_table_c7(code): return ord(code) in c7_set ! c8_set = sets.Set([832, 833, 8206, 8207] + range(8234,8239) + range(8298,8304)) def in_table_c8(code): return ord(code) in c8_set ! c9_set = sets.Set([917505] + range(917536,917632)) def in_table_c9(code): return ord(code) in c9_set --- 245,264 ---- ! c6_set = set(range(65529,65534)) def in_table_c6(code): return ord(code) in c6_set ! c7_set = set(range(12272,12284)) def in_table_c7(code): return ord(code) in c7_set ! c8_set = set([832, 833, 8206, 8207] + range(8234,8239) + range(8298,8304)) def in_table_c8(code): return ord(code) in c8_set ! c9_set = set([917505] + range(917536,917632)) def in_table_c9(code): return ord(code) in c9_set *************** *** 271,272 **** --- 271,273 ---- def in_table_d2(code): return unicodedata.bidirectional(code) == "L" + From arigo at users.sourceforge.net Wed May 19 15:10:22 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Wed May 19 15:10:35 2004 Subject: [Python-checkins] python/dist/src/Tools/unicode mkstringprep.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/unicode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11125/Tools/unicode Modified Files: mkstringprep.py Log Message: Applying SF patch #949329 on behalf of Raymond Hettinger. Index: mkstringprep.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/unicode/mkstringprep.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mkstringprep.py 18 Apr 2003 10:39:54 -0000 1.1 --- mkstringprep.py 19 May 2004 19:10:18 -0000 1.2 *************** *** 1,4 **** ! import re, unicodedata, sys, sets ! from sets import Set if sys.maxunicode == 65535: --- 1,3 ---- ! import re, unicodedata, sys if sys.maxunicode == 65535: *************** *** 41,48 **** tuple = " + ".join(["range(%d,%d)" % t for t in tuple]) if not single: ! return "sets.Set(%s)" % tuple if not tuple: ! return "sets.Set(%s)" % repr(single) ! return "sets.Set(%s + %s)" % (repr(single),tuple) ############## Read the tables in the RFC ####################### --- 40,47 ---- tuple = " + ".join(["range(%d,%d)" % t for t in tuple]) if not single: ! return "set(%s)" % tuple if not tuple: ! return "set(%s)" % repr(single) ! return "set(%s + %s)" % (repr(single),tuple) ############## Read the tables in the RFC ####################### *************** *** 115,119 **** \"\"\" ! import unicodedata, sets """ --- 114,118 ---- \"\"\" ! import unicodedata """ *************** *** 125,136 **** del tables[0] assert name == "A.1" ! table = Set(table.keys()) ! Cn = Set(gen_category(["Cn"])) # FDD0..FDEF are process internal codes ! Cn -= Set(range(0xFDD0, 0xFDF0)) # not a character ! Cn -= Set(range(0xFFFE, 0x110000, 0x10000)) ! Cn -= Set(range(0xFFFF, 0x110000, 0x10000)) # assert table == Cn --- 124,135 ---- del tables[0] assert name == "A.1" ! table = set(table.keys()) ! Cn = set(gen_category(["Cn"])) # FDD0..FDEF are process internal codes ! Cn -= set(range(0xFDD0, 0xFDF0)) # not a character ! Cn -= set(range(0xFFFE, 0x110000, 0x10000)) ! Cn -= set(range(0xFFFF, 0x110000, 0x10000)) # assert table == Cn *************** *** 252,257 **** assert name == "C.1.2" ! # table = Set(table.keys()) ! # Zs = Set(gen_category(["Zs"])) - Set([0x20]) # assert Zs == table --- 251,256 ---- assert name == "C.1.2" ! # table = set(table.keys()) ! # Zs = set(gen_category(["Zs"])) - set([0x20]) # assert Zs == table *************** *** 269,275 **** assert name == "C.2.1" ! Cc = Set(gen_category(["Cc"])) ! Cc_ascii = Cc & Set(range(128)) ! table_c21 = Set(table_c21.keys()) assert Cc_ascii == table_c21 --- 268,274 ---- assert name == "C.2.1" ! Cc = set(gen_category(["Cc"])) ! Cc_ascii = Cc & set(range(128)) ! table_c21 = set(table_c21.keys()) assert Cc_ascii == table_c21 *************** *** 286,290 **** Cc_nonascii = Cc - Cc_ascii ! table_c22 = Set(table_c22.keys()) assert len(Cc_nonascii - table_c22) == 0 --- 285,289 ---- Cc_nonascii = Cc - Cc_ascii ! table_c22 = set(table_c22.keys()) assert len(Cc_nonascii - table_c22) == 0 *************** *** 309,314 **** assert name == "C.3" ! Co = Set(gen_category(["Co"])) ! assert Set(table.keys()) == Co print """ --- 308,313 ---- assert name == "C.3" ! Co = set(gen_category(["Co"])) ! assert set(table.keys()) == Co print """ *************** *** 323,330 **** assert name == "C.4" ! nonchar = Set(range(0xFDD0,0xFDF0) + range(0xFFFE,0x110000,0x10000) + range(0xFFFF,0x110000,0x10000)) ! table = Set(table.keys()) assert table == nonchar --- 322,329 ---- assert name == "C.4" ! nonchar = set(range(0xFDD0,0xFDF0) + range(0xFFFE,0x110000,0x10000) + range(0xFFFF,0x110000,0x10000)) ! table = set(table.keys()) assert table == nonchar *************** *** 342,347 **** assert name == "C.5" ! Cs = Set(gen_category(["Cs"])) ! assert Set(table.keys()) == Cs print """ --- 341,346 ---- assert name == "C.5" ! Cs = set(gen_category(["Cs"])) ! assert set(table.keys()) == Cs print """ *************** *** 411,416 **** assert name == "D.1" ! RandAL = Set(gen_bidirectional(["R","AL"])) ! assert Set(table.keys()) == RandAL print """ --- 410,415 ---- assert name == "D.1" ! RandAL = set(gen_bidirectional(["R","AL"])) ! assert set(table.keys()) == RandAL print """ *************** *** 424,429 **** assert name == "D.2" ! L = Set(gen_bidirectional(["L"])) ! assert Set(table.keys()) == L print """ --- 423,428 ---- assert name == "D.2" ! L = set(gen_bidirectional(["L"])) ! assert set(table.keys()) == L print """ From rhettinger at users.sourceforge.net Wed May 19 15:45:21 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 15:45:25 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.44, 1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18118/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: Add more docs for generator expressions. * Put in a brief, example driven tutorial entry. * Use better examples in whatsnew24.tex. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** whatsnew24.tex 19 May 2004 08:20:04 -0000 1.44 --- whatsnew24.tex 19 May 2004 19:45:19 -0000 1.45 *************** *** 126,130 **** \function{dict()}. These functions consume their data all at once and would not benefit from having a full list instead of a generator ! an input: \begin{verbatim} --- 126,130 ---- \function{dict()}. These functions consume their data all at once and would not benefit from having a full list instead of a generator ! as an input: \begin{verbatim} *************** *** 132,148 **** 285 ! >>> sorted(set(i*i for i in xrange(-10, 11))) ! [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100] ! ! >>> words = "Adam apple baker Bill Nancy NASA nut".split() ! >>> dict((word.lower(), word) for word in words) ! {'apple': 'apple', 'baker': 'baker', 'bill': 'Bill', 'nasa': 'NASA', ! 'adam': 'Adam', 'nancy': 'Nancy', 'nut': 'nut'} >>> xvec = [10, 20, 30] >>> yvec = [7, 5, 3] ! >>> sum(x*y for x,y in itertools.izip(xvec, yvec)) # dot product 260 \end{verbatim} --- 132,151 ---- 285 ! >>> sorted(set(i*i for i in xrange(-20, 20) if i%2==1)) # odd squares ! [1, 9, 25, 49, 81, 121, 169, 225, 289, 361] + >>> from itertools import izip >>> xvec = [10, 20, 30] >>> yvec = [7, 5, 3] ! >>> sum(x*y for x,y in izip(xvec, yvec)) # dot product 260 + >>> from math import pi, sin + >>> sine_table = dict((x, sin(x*pi/180)) for x in xrange(0, 91)) + + >>> unique_words = set(word for line in page for word in line.split()) + + >>> valedictorian = max((student.gpa, student.name) for student in graduates) + \end{verbatim} From rhettinger at users.sourceforge.net Wed May 19 15:45:21 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 15:45:28 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.227,1.228 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18118/Doc/tut Modified Files: tut.tex Log Message: Add more docs for generator expressions. * Put in a brief, example driven tutorial entry. * Use better examples in whatsnew24.tex. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.227 retrieving revision 1.228 diff -C2 -d -r1.227 -r1.228 *** tut.tex 6 May 2004 01:35:45 -0000 1.227 --- tut.tex 19 May 2004 19:45:16 -0000 1.228 *************** *** 4400,4403 **** --- 4400,4436 ---- more effort than writing a regular function. + \section{Generator Expressions\label{genexps}} + + Some simple generators can be coded succinctly as expressions using a syntax + like list comprehensions but with parentheses instead of brackets. These + expressions are designed for situations where the generator is used right + away by an enclosing function. Generator expressions are more compact but + less versatile than full generator definitions and the tend to be more memory + friendly than equivalent list comprehensions. + + Examples: + + \begin{verbatim} + >>> sum(i*i for i in range(10)) # sum of squares + 285 + + >>> xvec = [10, 20, 30] + >>> yvec = [7, 5, 3] + >>> sum(x*y for x,y in zip(xvec, yvec)) # dot product + 260 + + >>> from math import pi, sin + >>> sine_table = dict((x, sin(x*pi/180)) for x in range(0, 91)) + + >>> unique_words = set(word for line in page for word in line.split()) + + >>> valedictorian = max((student.gpa, student.name) for student in graduates) + + >>> data = 'golf' + >>> list(data[i] for i in range(len(data)-1,-1,-1)) + ['f', 'l', 'o', 'g'] + + \end{verbatim} + From rhettinger at users.sourceforge.net Wed May 19 15:56:47 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 15:56:51 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.973,1.974 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20181 Modified Files: NEWS Log Message: SF bug #949329: sets.Set() --> set() Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.973 retrieving revision 1.974 diff -C2 -d -r1.973 -r1.974 *** NEWS 19 May 2004 08:20:10 -0000 1.973 --- NEWS 19 May 2004 19:56:44 -0000 1.974 *************** *** 309,312 **** --- 309,314 ---- ------- + - stringprep.py now uses built-in set() instead of sets.Set(). + - Bug #876278: Unbounded recursion in modulefinder From rhettinger at users.sourceforge.net Wed May 19 17:18:58 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 17:19:03 2004 Subject: [Python-checkins] python/nondist/peps pep-0000.txt, 1.271, 1.272 pep-0289.txt, 1.11, 1.12 pep-0320.txt, 1.10, 1.11 pep-0322.txt, 1.17, 1.18 pep-0329.txt, 1.4, 1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5591 Modified Files: pep-0000.txt pep-0289.txt pep-0320.txt pep-0322.txt pep-0329.txt Log Message: Various PEP updates mostly related to generator expressions. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.271 retrieving revision 1.272 diff -C2 -d -r1.271 -r1.272 *** pep-0000.txt 20 Apr 2004 17:50:52 -0000 1.271 --- pep-0000.txt 19 May 2004 21:18:54 -0000 1.272 *************** *** 63,67 **** S 252 Making Types Look More Like Classes GvR S 253 Subtyping Built-in Types GvR - SA 289 Generator Expressions Hettinger SA 309 Partial Function Application Harris SA 328 Imports: Multi-Line and Absolute/Relative Aahz --- 63,66 ---- *************** *** 162,165 **** --- 161,165 ---- IF 283 Python 2.3 Release Schedule GvR SF 285 Adding a bool type GvR + SF 289 Generator Expressions Hettinger SF 293 Codec Error Handling Callbacks Dörwald SF 311 Simplified GIL Acquisition for Extensions Hammond *************** *** 312,316 **** I 287 reStructuredText Docstring Format Goodger S 288 Generators Attributes and Exceptions Hettinger ! SA 289 Generator Expressions Hettinger I 290 Code Migration and Modernization Hettinger I 291 Backward Compatibility for Standard Library Norwitz --- 312,316 ---- I 287 reStructuredText Docstring Format Goodger S 288 Generators Attributes and Exceptions Hettinger ! SF 289 Generator Expressions Hettinger I 290 Code Migration and Modernization Hettinger I 291 Backward Compatibility for Standard Library Norwitz Index: pep-0289.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0289.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pep-0289.txt 28 Oct 2003 18:06:32 -0000 1.11 --- pep-0289.txt 19 May 2004 21:18:54 -0000 1.12 *************** *** 3,12 **** Version: $Revision$ Last-Modified: $Date$ ! Author: python@rcn.com (Raymond D. Hettinger) ! Status: Accepted Type: Standards Track Content-Type: text/x-rst Created: 30-Jan-2002 ! Python-Version: 2.3 Post-History: 22-Oct-2003 --- 3,12 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: python at rcn.com (Raymond D. Hettinger) ! Status: Final Type: Standards Track Content-Type: text/x-rst Created: 30-Jan-2002 ! Python-Version: 2.4 Post-History: 22-Oct-2003 *************** *** 34,39 **** sum([x*x for x in range(10)]) ! Time, clarity, and memory are conserved by using an generator ! expession instead:: sum(x*x for x in range(10)) --- 34,38 ---- sum([x*x for x in range(10)]) ! Memory is conserved by using an generator expession instead:: sum(x*x for x in range(10)) *************** *** 71,74 **** --- 70,80 ---- application. + Early timings showed that generators had a significant performance + advantage over list comprehensions. However, the latter were highly + optimized for Py2.4 and now the performance is roughly comparable + for small to mid-sized data sets. As the data volumes grow larger, + generator expressions tend to perform better because they do not + exhaust cache memory and they allow Python to re-use objects between + iterations. BDFL Pronouncements *************** *** 94,103 **** is equivalent to:: ! def __gen(): ! for x in range(10): yield x**2 ! g = __gen() print g.next() 2. The syntax requires that a generator expression always needs to be directly inside a set of parentheses and cannot have a comma on --- 100,126 ---- is equivalent to:: ! def __gen(exp): ! for x in exp: yield x**2 ! g = __gen(range(10)) print g.next() + Only the outermost for-expression is evaluated immediately, the other + expressions are deferred until the generator is run:: + + + g = (tgtexp for var1 in exp1 if exp2 for var2 in exp3 if exp4) + + is equivalent to:: + + def __gen(bound_exp): + for var1 in bound_exp: + if exp2: + for var2 in exp3: + if exp4: + yield tgtexp + g = __generator(exp1) + del __gen + 2. The syntax requires that a generator expression always needs to be directly inside a set of parentheses and cannot have a comma on *************** *** 111,118 **** changes to:: ! atom: '(' [listmaker1] ')' ! where listmaker1 is almost the same as listmaker, but only ! allows a single test after 'for' ... 'in'. b) The rule for arglist needs similar changes. --- 134,143 ---- changes to:: ! atom: '(' [testlist_gexp] ')' ! ! where testlist_gexp is almost the same as listmaker, but only ! allows a single test after 'for' ... 'in':: ! testlist_gexp: test ( gen_for | (',' test)* [','] ) b) The rule for arglist needs similar changes. *************** *** 134,137 **** --- 159,164 ---- cases you have to parenthesize it. + The exact details were checked in to Grammar/Grammar version 1.49. + 3. The loop variable (if it is a simple variable or a tuple of simple variables) is not exposed to the surrounding function. This *************** *** 148,175 **** print x # prints "hello", not "c" ! 4. All free variable bindings are captured at the time this function ! is defined, and passed into it using default argument values. For ! example:: ! ! x = 0 ! g = (x for c in "abc") # x is not the loop variable! ! x = 1 ! print g.next() # prints 0 (captured x), not 1 (current x) ! ! This behavior of free variables is almost always what you want when ! the generator expression is evaluated at a later point than its ! definition. In fact, to date, no examples have been found of code ! where it would be better to use the execution-time instead of the ! definition-time value of a free variable. ! ! Note that free variables aren't copied, only their binding is ! captured. They may still change if they are mutable, for example:: ! ! x = [] ! g = (x for c in "abc") ! x.append(1) ! print g.next() # prints [1], not [] ! ! 5. List comprehensions will remain unchanged. For example:: [x for x in S] # This is a list comprehension. --- 175,179 ---- print x # prints "hello", not "c" ! 4. List comprehensions will remain unchanged. For example:: [x for x in S] # This is a list comprehension. *************** *** 203,206 **** --- 207,249 ---- immediately surrounding scope. + Early Binding versus Late Binding + ================================= + + After much discussion, it was decided that the first (outermost) + for-expression should be evaluated immediately and that the remaining + expressions be evaluated when the generator is executed. + + Asked to summarize the reasoning for binding the first expression, + Guido offered [5]_:: + + Consider sum(x for x in foo()). Now suppose there's a bug in foo() + that raises an exception, and a bug in sum() that raises an + exception before it starts iterating over its argument. Which + exception would you expect to see? I'd be surprised if the one in + sum() was raised rather the one in foo(), since the call to foo() + is part of the argument to sum(), and I expect arguments to be + processed before the function is called. + + OTOH, in sum(bar(x) for x in foo()), where sum() and foo() + are bugfree, but bar() raises an exception, we have no choice but + to delay the call to bar() until sum() starts iterating -- that's + part of the contract of generators. (They do nothing until their + next() method is first called.) + + Various use cases were proposed for binding all free variables when + the generator is defined. And some proponents felt that the resulting + expressions would be easier to understand and debug if bound immediately. + + However, Python takes a late binding approach to lambda expressions and + has no precedent for automatic, early binding. It was felt that + introducing a new paradigm would unnecessarily introduce complexity. + + After exploring many possibilities, a consensus emerged that binding + issues were hard to understand and that users should be strongly + encouraged to use generator expressions inside functions that consume + their arguments immediately. For more complex applications, full + generator definitions are always superior in terms of being obvious + about scope, lifetime, and binding [6]_. + Reduction Functions *************** *** 208,215 **** The utility of generator expressions is greatly enhanced when combined ! with reduction functions like sum(), min(), and max(). Separate ! proposals are forthcoming that recommend several new accumulation ! functions possibly including: product(), average(), alltrue(), ! anytrue(), nlargest(), nsmallest(). --- 251,257 ---- The utility of generator expressions is greatly enhanced when combined ! with reduction functions like sum(), min(), and max(). The sandbox ! contains a draft statistics module with several new accumulation ! functions including: product(), average(), nlargest(), and nsmallest(). *************** *** 227,237 **** strong arguments that they were a desirable thing to have. - * Samuele Pedroni provided the example of late binding. Various - contributors have made arguments for and against late binding. - * Phillip Eby suggested "iterator expressions" as the name. * Subsequently, Tim Peters suggested the name "generator expressions". References --- 269,286 ---- strong arguments that they were a desirable thing to have. * Phillip Eby suggested "iterator expressions" as the name. * Subsequently, Tim Peters suggested the name "generator expressions". + * Armin Rigo, Tim Peters, Guido van Rossum, Samuele Pedroni, + Hye-Shik Chang and Raymond Hettinger teased out the issues surrounding + early versus late binding [5]_. + + * Jiwon Seo single handedly implemented various versions of the proposal + including the final version loaded into CVS. Along the way, there + were periodic code reviews by Hye-Shik Chang and Raymond Hettinger. + Guido van Rossum made the key design decisions after comments from + Armin Rigo and newsgroup discussions. Raymond Hettinger provided + the test suite, documentation, tutorial, and examples [6]_. References *************** *** 251,254 **** --- 300,310 ---- http://python.org/sf/795947 + .. [5] Discussion over the relative merits of early versus late binding + http://mail.python.org/pipermail/python-dev/2004-April/044555.html + + .. [6] Patch discussion and alternative patches on Source Forge + http://www.python.org/sf/872326 + + Copyright ========= Index: pep-0320.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0320.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pep-0320.txt 24 Mar 2004 03:10:55 -0000 1.10 --- pep-0320.txt 19 May 2004 21:18:55 -0000 1.11 *************** *** 38,44 **** Completed features for 2.4 ! PEP 218 Builtin Set Objects ! PEP 322 Reverse Iteration Encapsulate the decorate-sort-undecorate pattern in a keyword for --- 38,46 ---- Completed features for 2.4 ! PEP 218 Builtin Set Objects. ! ! PEP 289 Generator expressions. ! PEP 322 Reverse Iteration. Encapsulate the decorate-sort-undecorate pattern in a keyword for *************** *** 49,58 **** The itertools module has two new functions, tee() and groupby(). ! Planned features for 2.4 - PEP 289 Generator expressions. - PEP 292 Simpler String Substitutions to be implemented as a module. --- 51,58 ---- The itertools module has two new functions, tee() and groupby(). ! Add a collections module with a deque() object. Planned features for 2.4 PEP 292 Simpler String Substitutions to be implemented as a module. *************** *** 72,84 **** Add a module for statistical and reduction functions: stddev, average, nlargest, nsmallest, product, etc. ! ! Add collections package: ! - deque/queue (suggested by Raymond) ! - BTrees (suggested by Tim) ! - ? bag (only if use cases established) ! - ? heap (with a min/max option flag, a key= option, ! and implemented as a fibonacci heap) ! ! Possibly add 'diff3' and 'patch' functions to the difflib module. Finish implementing the Distutils bdist_dpkg command. (AMK) --- 72,79 ---- Add a module for statistical and reduction functions: stddev, average, nlargest, nsmallest, product, etc. ! (There is a tested implementation in the sandbox but it ! may be held-off until Py2.5 because there doesn't not ! appear to be any user demand and the author is concerned ! that the module may not offer a sufficiently rich API). Finish implementing the Distutils bdist_dpkg command. (AMK) Index: pep-0322.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0322.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pep-0322.txt 6 Nov 2003 12:22:37 -0000 1.17 --- pep-0322.txt 19 May 2004 21:18:55 -0000 1.18 *************** *** 4,8 **** Last-Modified: $Date$ Author: Raymond Hettinger ! Status: Accepted Type: Standards Track Content-Type: text/x-rst --- 4,8 ---- Last-Modified: $Date$ Author: Raymond Hettinger ! Status: Final Type: Standards Track Content-Type: text/x-rst Index: pep-0329.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0329.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0329.txt 20 Apr 2004 17:51:11 -0000 1.4 --- pep-0329.txt 19 May 2004 21:18:55 -0000 1.5 *************** *** 12,21 **** - Status - ====== - - The PEP is self rejected by the author due to the unprecedented - level of enmity it generated from developers. - Abstract --- 12,15 ---- *************** *** 25,28 **** --- 19,37 ---- constants and to apply that function throughout the standard library. + Status + ====== + + The PEP is self rejected by the author. Though the ASPN recipe was + well received, there was less willingness to consider this for + inclusion in the core distribution. + + The Jython implementation does not use byte codes, so its performance + would suffer if the current ``_len=len`` optimizations were removed. + + Also, altering byte codes is one of the least clean ways to improve + performance and enable cleaner coding. A more robust solution would + likely involve compiler pragma directives or metavariables indicating + what can be optimized (similar to const/volatile declarations). + Motivation From rhettinger at users.sourceforge.net Wed May 19 18:30:28 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 19 18:30:32 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.45, 1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18496 Modified Files: whatsnew24.tex Log Message: Improved wording for generator expressions. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** whatsnew24.tex 19 May 2004 19:45:19 -0000 1.45 --- whatsnew24.tex 19 May 2004 22:30:25 -0000 1.46 *************** *** 15,20 **** \tableofcontents ! This article explains the new features in Python 2.4. No release date ! for Python 2.4 has been set; expect that this will happen mid-2004. While Python 2.3 was primarily a library development release, Python --- 15,20 ---- \tableofcontents ! This article explains the new features in Python 2.4. The release ! date is expected to be around September 2004. While Python 2.3 was primarily a library development release, Python *************** *** 92,101 **** \section{PEP 229: Generator Expressions} ! Generator expressions create in-line generators using a syntax similar ! to list comprehensions but with parenthesis instead of the surrounding ! brackets. ! ! Genexps allow simple generators to be constructed without a separate function ! definition. Writing: \begin{verbatim} --- 92,101 ---- \section{PEP 229: Generator Expressions} ! Now, simple generators can be coded succinctly as expressions using a syntax ! like list comprehensions but with parentheses instead of brackets. These ! expressions are designed for situations where the generator is used right ! away by an enclosing function. Generator expressions are more compact but ! less versatile than full generator definitions and the tend to be more memory ! friendly than equivalent list comprehensions. \begin{verbatim} *************** *** 122,130 **** more readily than with list comprehensions. ! Generator expressions are intended to be used inside functions ! such as \function{sum()}, \function{min()}, \function{set()}, and ! \function{dict()}. These functions consume their data all at once ! and would not benefit from having a full list instead of a generator ! as an input: \begin{verbatim} --- 122,128 ---- more readily than with list comprehensions. ! Generator expressions are best used in functions that consume their ! data all at once and would not benefit from having a full list instead ! of a generator as an input: \begin{verbatim} *************** *** 150,158 **** \end{verbatim} - These examples show the intended use for generator expressions - in situations where the values get consumed immediately after the - generator is created. In these situations, they operate like - memory efficient versions of list comprehensions. - For more complex uses of generators, it is strongly recommended that the traditional full generator definitions be used instead. In a --- 148,151 ---- *************** *** 160,167 **** as soon as the expression is defined while the other expressions do not get evaluated until the generator is run. This nuance is never ! an issue when the generator is used immediately. If it is not used ! right away, then it is better to write a full generator definition ! which more clearly reveals when the expressions are evaluated and is ! more obvious about the visibility and lifetime of its looping variables. \begin{seealso} --- 153,160 ---- as soon as the expression is defined while the other expressions do not get evaluated until the generator is run. This nuance is never ! an issue when the generator is used immediately; however, if it is not ! used right away, a full generator definition would be much more clear ! about when the sub-expressions are evaluated and would be more obvious ! about the visibility and lifetime of the variables. \begin{seealso} From pierslauder at users.sourceforge.net Wed May 19 21:16:18 2004 From: pierslauder at users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Wed May 19 21:16:22 2004 Subject: [Python-checkins] python/dist/src/Lib imaplib.py,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17355/dist/src/Lib Modified Files: imaplib.py Log Message: Fixed IMAP4_SSL read and readlines code per patch 956394 Index: imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** imaplib.py 25 Mar 2004 00:12:21 -0000 1.67 --- imaplib.py 20 May 2004 01:16:14 -0000 1.68 *************** *** 1101,1109 **** """Read 'size' bytes from remote.""" # sslobj.read() sometimes returns < size bytes ! data = self.sslobj.read(size) ! while len(data) < size: ! data += self.sslobj.read(size-len(data)) ! return data --- 1101,1112 ---- """Read 'size' bytes from remote.""" # sslobj.read() sometimes returns < size bytes ! chunks = [] ! read = 0 ! while read < size: ! data = self.sslobj.read(size-read) ! read += len(data) ! chunks.append(size) ! return ''.join(chunks) *************** *** 1111,1119 **** """Read line from remote.""" # NB: socket.ssl needs a "readline" method, or perhaps a "makefile" method. ! line = "" while 1: char = self.sslobj.read(1) ! line += char ! if char == "\n": return line --- 1114,1122 ---- """Read line from remote.""" # NB: socket.ssl needs a "readline" method, or perhaps a "makefile" method. ! line = [] while 1: char = self.sslobj.read(1) ! line.append(char) ! if char == "\n": return ''.join(line) From rhettinger at users.sourceforge.net Wed May 19 04:20:42 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu May 20 05:13:42 2004 Subject: [Python-checkins] python/dist/src/Lib/compiler ast.py, 1.22, 1.23 pycodegen.py, 1.66, 1.67 symbols.py, 1.13, 1.14 transformer.py, 1.38, 1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9770/Lib/compiler Modified Files: ast.py pycodegen.py symbols.py transformer.py Log Message: SF patch #872326: Generator expression implementation (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release. Index: ast.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/ast.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ast.py 11 Aug 2003 16:20:39 -0000 1.22 --- ast.py 19 May 2004 08:20:06 -0000 1.23 *************** *** 1237,1240 **** --- 1237,1316 ---- return "ListCompFor(%s, %s, %s)" % (repr(self.assign), repr(self.list), repr(self.ifs)) + class GenExpr(Node): + nodes["genexpr"] = "GenExpr" + def __init__(self, code): + self.code = code + self.argnames = ['[outmost-iterable]'] + self.varargs = self.kwargs = None + + def getChildren(self): + return self.code, + + def getChildNodes(self): + return self.code, + + def __repr__(self): + return "GenExpr(%s)" % (repr(self.code),) + + class GenExprInner(Node): + nodes["genexprinner"] = "GenExprInner" + def __init__(self, expr, quals): + self.expr = expr + self.quals = quals + + def getChildren(self): + children = [] + children.append(self.expr) + children.extend(flatten(self.quals)) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.expr) + nodelist.extend(flatten_nodes(self.quals)) + return tuple(nodelist) + + def __repr__(self): + return "GenExprInner(%s, %s)" % (repr(self.expr), repr(self.quals)) + + class GenExprFor(Node): + nodes["genexprfor"] = "GenExprFor" + def __init__(self, assign, iter, ifs): + self.assign = assign + self.iter = iter + self.ifs = ifs + self.is_outmost = False + + def getChildren(self): + children = [] + children.append(self.assign) + children.append(self.iter) + children.extend(flatten(self.ifs)) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.assign) + nodelist.append(self.iter) + nodelist.extend(flatten_nodes(self.ifs)) + return tuple(nodelist) + + def __repr__(self): + return "GenExprFor(%s, %s, %s)" % (repr(self.assign), repr(self.iter), repr(self.ifs)) + + class GenExprIf(Node): + nodes["genexprif"] = "GenExprIf" + def __init__(self, test): + self.test = test + + def getChildren(self): + return self.test, + + def getChildNodes(self): + return self.test, + + def __repr__(self): + return "GenExprIf(%s)" % (repr(self.test),) + klasses = globals() for k in nodes.keys(): Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/pycodegen.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** pycodegen.py 21 Mar 2004 15:18:50 -0000 1.66 --- pycodegen.py 19 May 2004 08:20:07 -0000 1.67 *************** *** 620,623 **** --- 620,696 ---- self.emit('POP_TOP') + def visitGenExpr(self, node): + gen = GenExprCodeGenerator(node, self.scopes, self.class_name, + self.get_module()) + walk(node.code, gen) + gen.finish() + self.set_lineno(node) + 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', 0) + else: + self.emit('LOAD_CONST', gen) + self.emit('MAKE_FUNCTION', 0) + + # precomputation of outmost iterable + self.visit(node.code.quals[0].iter) + self.emit('GET_ITER') + self.emit('CALL_FUNCTION', 1) + + def visitGenExprInner(self, node): + self.set_lineno(node) + # setup list + + stack = [] + for i, for_ in zip(range(len(node.quals)), node.quals): + start, anchor = self.visit(for_) + cont = None + for if_ in for_.ifs: + if cont is None: + cont = self.newBlock() + self.visit(if_, cont) + stack.insert(0, (start, cont, anchor)) + + self.visit(node.expr) + self.emit('YIELD_VALUE') + + for start, cont, anchor in stack: + if cont: + skip_one = self.newBlock() + self.emit('JUMP_FORWARD', skip_one) + self.startBlock(cont) + self.emit('POP_TOP') + self.nextBlock(skip_one) + self.emit('JUMP_ABSOLUTE', start) + self.startBlock(anchor) + self.emit('LOAD_CONST', None) + + def visitGenExprFor(self, node): + start = self.newBlock() + anchor = self.newBlock() + + if node.is_outmost: + self.loadName('[outmost-iterable]') + else: + self.visit(node.iter) + self.emit('GET_ITER') + + self.nextBlock(start) + self.set_lineno(node, force=True) + self.emit('FOR_ITER', anchor) + self.nextBlock() + self.visit(node.assign) + return start, anchor + + def visitGenExprIf(self, node, branch): + self.set_lineno(node, force=True) + self.visit(node.test) + self.emit('JUMP_IF_FALSE', branch) + self.newBlock() + self.emit('POP_TOP') + # exception related *************** *** 1200,1203 **** --- 1273,1277 ---- else: name = func.name + args, hasTupleArg = generateArgList(func.argnames) self.graph = pyassem.PyFlowGraph(name, func.filename, args, *************** *** 1264,1267 **** --- 1338,1356 ---- self.graph.setFlag(CO_GENERATOR) + class GenExprCodeGenerator(NestedScopeMixin, AbstractFunctionCode, + CodeGenerator): + super_init = CodeGenerator.__init__ # call be other init + scopes = None + + __super_init = AbstractFunctionCode.__init__ + + def __init__(self, gexp, scopes, class_name, mod): + self.scopes = scopes + self.scope = scopes[gexp] + self.__super_init(gexp, scopes, 1, class_name, mod) + self.graph.setFreeVars(self.scope.get_free_vars()) + self.graph.setCellVars(self.scope.get_cell_vars()) + self.graph.setFlag(CO_GENERATOR) + class AbstractClassCode: Index: symbols.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/symbols.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** symbols.py 28 Aug 2003 02:09:26 -0000 1.13 --- symbols.py 19 May 2004 08:20:08 -0000 1.14 *************** *** 180,183 **** --- 180,198 ---- pass + class GenExprScope(Scope): + __super_init = Scope.__init__ + + __counter = 1 + + def __init__(self, module, klass=None): + i = self.__counter + self.__counter += 1 + self.__super_init("generator expression<%d>"%i, module, klass) + self.add_param('[outmost-iterable]') + + def get_names(self): + keys = Scope.get_names() + return keys + class LambdaScope(FunctionScope): __super_init = Scope.__init__ *************** *** 221,224 **** --- 236,265 ---- self.handle_free_vars(scope, parent) + def visitGenExpr(self, node, parent): + scope = GenExprScope(self.module, self.klass); + if parent.nested or isinstance(parent, FunctionScope) \ + or isinstance(parent, GenExprScope): + scope.nested = 1 + + self.scopes[node] = scope + self.visit(node.code, scope) + + self.handle_free_vars(scope, parent) + + def visitGenExprInner(self, node, scope): + for genfor in node.quals: + self.visit(genfor, scope) + + self.visit(node.expr, scope) + + def visitGenExprFor(self, node, scope): + self.visit(node.assign, scope, 1) + self.visit(node.iter, scope) + for if_ in node.ifs: + self.visit(if_, scope) + + def visitGenExprIf(self, node, scope): + self.visit(node.test, scope) + def visitLambda(self, node, parent, assign=0): # Lambda is an expression, so it could appear in an expression Index: transformer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/transformer.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** transformer.py 6 Apr 2003 09:00:45 -0000 1.38 --- transformer.py 19 May 2004 08:20:08 -0000 1.39 *************** *** 535,538 **** --- 535,544 ---- exprlist = testlist + def testlist_gexp(self, nodelist): + if len(nodelist) == 2 and nodelist[1][0] == symbol.gen_for: + test = self.com_node(nodelist[0]) + return self.com_generator_expression(test, nodelist[1]) + return self.testlist(nodelist) + def test(self, nodelist): # and_test ('or' and_test)* | lambdef *************** *** 1086,1089 **** --- 1092,1137 ---- return List(values) + if hasattr(symbol, 'gen_for'): + def com_generator_expression(self, expr, node): + # gen_iter: gen_for | gen_if + # gen_for: 'for' exprlist 'in' test [gen_iter] + # gen_if: 'if' test [gen_iter] + + lineno = node[1][2] + fors = [] + while node: + t = node[1][1] + if t == 'for': + assignNode = self.com_assign(node[2], OP_ASSIGN) + genNode = self.com_node(node[4]) + newfor = GenExprFor(assignNode, genNode, []) + newfor.lineno = node[1][2] + fors.append(newfor) + if (len(node)) == 5: + node = None + else: + node = self.com_gen_iter(node[5]) + elif t == 'if': + test = self.com_node(node[2]) + newif = GenExprIf(test) + newif.lineno = node[1][2] + newfor.ifs.append(newif) + if len(node) == 3: + node = None + else: + node = self.com_gen_iter(node[3]) + else: + raise SyntaxError, \ + ("unexpected generator expression element: %s %d" + % (node, lineno)) + fors[0].is_outmost = True + n = GenExpr(GenExprInner(expr, fors)) + n.lineno = lineno + return n + + def com_gen_iter(self, node): + assert node[0] == symbol.gen_iter + return node[1] + def com_dictmaker(self, nodelist): # dictmaker: test ':' test (',' test ':' value)* [','] *************** *** 1123,1126 **** --- 1171,1176 ---- break kw, result = self.com_argument(node, kw) + if len_nodelist != 2 and isinstance(result, GenExpr): + raise SyntaxError, 'generator expression needs parenthesis' args.append(result) else: *************** *** 1149,1152 **** --- 1199,1205 ---- def com_argument(self, nodelist, kw): + if len(nodelist) == 3 and nodelist[2][0] == symbol.gen_for: + test = self.com_node(nodelist[1]) + return 0, self.com_generator_expression(test, nodelist[2]) if len(nodelist) == 2: if kw: From rhettinger at users.sourceforge.net Wed May 19 04:20:43 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu May 20 06:14:22 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_genexps.py, NONE, 1.1 test_deque.py, 1.10, 1.11 test_grammar.py, 1.49, 1.50 test_parser.py, 1.17, 1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9770/Lib/test Modified Files: test_deque.py test_grammar.py test_parser.py Added Files: test_genexps.py Log Message: SF patch #872326: Generator expression implementation (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release. --- NEW FILE: test_genexps.py --- doctests = """ Test simple loop with conditional >>> sum(i*i for i in range(100) if i&1 == 1) 166650 Test simple nesting >>> list((i,j) for i in range(3) for j in range(4) ) [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)] Test nesting with the inner expression dependent on the outer >>> list((i,j) for i in range(4) for j in range(i) ) [(1, 0), (2, 0), (2, 1), (3, 0), (3, 1), (3, 2)] Make sure the induction variable is not exposed >>> i = 20 >>> sum(i*i for i in range(100)) 328350 >>> i 20 Test first class >>> g = (i*i for i in range(4)) >>> type(g) >>> list(g) [0, 1, 4, 9] Test direct calls to next() >>> g = (i*i for i in range(3)) >>> g.next() 0 >>> g.next() 1 >>> g.next() 4 >>> g.next() Traceback (most recent call last): File "", line 1, in -toplevel- g.next() StopIteration Does it stay stopped? >>> g.next() Traceback (most recent call last): File "", line 1, in -toplevel- g.next() StopIteration >>> list(g) [] Test running gen when defining function is out of scope >>> def f(n): ... return (i*i for i in xrange(n)) ... >>> list(f(10)) [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] >>> def f(n): ... return ((i,j) for i in xrange(3) for j in xrange(n)) ... >>> list(f(4)) [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)] >>> def f(n): ... return ((i,j) for i in xrange(3) for j in xrange(4) if j in xrange(n)) ... >>> list(f(4)) [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)] >>> list(f(2)) [(0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (2, 1)] #Verify that parenthesis are required in a statement #>>> def f(n): #... return i*i for i in xrange(n) #... #SyntaxError: invalid syntax Verify early binding for the outermost for-expression >>> x=10 >>> g = (i*i for i in range(x)) >>> x = 5 >>> list(g) [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] Verify late binding for the outermost if-expression >>> include = (2,4,6,8) >>> g = (i*i for i in range(10) if i in include) >>> include = (1,3,5,7,9) >>> list(g) [1, 9, 25, 49, 81] Verify late binding for the innermost for-expression >>> g = ((i,j) for i in range(3) for j in range(x)) >>> x = 4 >>> list(g) [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)] Verify re-use of tuples (a side benefit of using genexps over listcomps) >>> tupleids = map(id, ((i,i) for i in xrange(10))) >>> max(tupleids) - min(tupleids) 0 ########### Tests borrowed from or inspired by test_generators.py ############ Make a generator that acts like range() >>> yrange = lambda n: (i for i in xrange(n)) >>> list(yrange(10)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Generators always return to the most recent caller: >>> def creator(): ... r = yrange(5) ... print "creator", r.next() ... return r ... >>> def caller(): ... r = creator() ... for i in r: ... print "caller", i ... >>> caller() creator 0 caller 1 caller 2 caller 3 caller 4 Generators can call other generators: >>> def zrange(n): ... for i in yrange(n): ... yield i ... >>> list(zrange(5)) [0, 1, 2, 3, 4] Verify that a gen exp cannot be resumed while it is actively running: >>> g = (me.next() for i in xrange(10)) >>> me = g >>> me.next() Traceback (most recent call last): File "", line 1, in -toplevel- me.next() File "", line 1, in g = (me.next() for i in xrange(10)) ValueError: generator already executing Verify exception propagation >>> g = (10 // i for i in (5, 0, 2)) >>> g.next() 2 >>> g.next() Traceback (most recent call last): File "", line 1, in -toplevel- g.next() File "", line 1, in g = (10 // i for i in (5, 0, 2)) ZeroDivisionError: integer division or modulo by zero >>> g.next() Traceback (most recent call last): File "", line 1, in -toplevel- g.next() StopIteration Make sure that None is a valid return value >>> list(None for i in xrange(10)) [None, None, None, None, None, None, None, None, None, None] Check that generator attributes are present >>> g = (i*i for i in range(3)) >>> expected = set(['gi_frame', 'gi_running', 'next']) >>> set(attr for attr in dir(g) if not attr.startswith('__')) >= expected True >>> print g.next.__doc__ x.next() -> the next value, or raise StopIteration >>> import types >>> isinstance(g, types.GeneratorType) True Check the __iter__ slot is defined to return self >>> iter(g) is g True Verify that the running flag is set properly >>> g = (me.gi_running for i in (0,1)) >>> me = g >>> me.gi_running 0 >>> me.next() 1 >>> me.gi_running 0 Verify that genexps are weakly referencable >>> import weakref >>> g = (i*i for i in range(4)) >>> wr = weakref.ref(g) >>> wr() is g True >>> p = weakref.proxy(g) >>> list(p) [0, 1, 4, 9] """ __test__ = {'doctests' : doctests} def test_main(verbose=None): import sys from test import test_support from test import test_genexps test_support.run_doctest(test_genexps, verbose) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): test_support.run_doctest(test_genexps, verbose) gc.collect() counts[i] = sys.gettotalrefcount() print counts if __name__ == "__main__": test_main(verbose=True) Index: test_deque.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_deque.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_deque.py 12 May 2004 20:55:56 -0000 1.10 --- test_deque.py 19 May 2004 08:20:08 -0000 1.11 *************** *** 567,571 **** # doctests from test import test_deque ! # test_support.run_doctest(test_deque, verbose) if __name__ == "__main__": --- 567,571 ---- # doctests from test import test_deque ! test_support.run_doctest(test_deque, verbose) if __name__ == "__main__": Index: test_grammar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** test_grammar.py 12 Feb 2004 17:35:11 -0000 1.49 --- test_grammar.py 19 May 2004 08:20:09 -0000 1.50 *************** *** 740,741 **** --- 740,784 ---- if sno == sp_sno and pno == sp_pno ] + + # generator expression tests + g = ([x for x in range(10)] for x in range(1)) + verify(g.next() == [x for x in range(10)]) + try: + g.next() + raise TestFailed, 'should produce StopIteration exception' + except StopIteration: + pass + + a = 1 + try: + g = (a for d in a) + g.next() + raise TestFailed, 'should produce TypeError' + except TypeError: + pass + + verify(list((x, y) for x in 'abcd' for y in 'abcd') == [(x, y) for x in 'abcd' for y in 'abcd']) + verify(list((x, y) for x in 'ab' for y in 'xy') == [(x, y) for x in 'ab' for y in 'xy']) + + a = [x for x in range(10)] + b = (x for x in (y for y in a)) + verify(sum(b) == sum([x for x in range(10)])) + + verify(sum(x**2 for x in range(10)) == sum([x**2 for x in range(10)])) + verify(sum(x*x for x in range(10) if x%2) == sum([x*x for x in range(10) if x%2])) + verify(sum(x for x in (y for y in range(10))) == sum([x for x in range(10)])) + verify(sum(x for x in (y for y in (z for z in range(10)))) == sum([x for x in range(10)])) + verify(sum(x for x in [y for y in (z for z in range(10))]) == sum([x for x in range(10)])) + verify(sum(x for x in (y for y in (z for z in range(10) if True)) if True) == sum([x for x in range(10)])) + verify(sum(x for x in (y for y in (z for z in range(10) if True) if False) if True) == 0) + check_syntax("foo(x for x in range(10), 100)") + check_syntax("foo(100, x for x in range(10))") + + # test for outmost iterable precomputation + x = 10; g = (i for i in range(x)); x = 5 + verify(len(list(g)) == 10) + + # This should hold, since we're only precomputing outmost iterable. + x = 10; t = False; g = ((i,j) for i in range(x) if t for j in range(x)) + x = 5; t = True; + verify([(i,j) for i in range(10) for j in range(5)] == list(g)) Index: test_parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_parser.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_parser.py 1 May 2003 17:45:44 -0000 1.17 --- test_parser.py 19 May 2004 08:20:09 -0000 1.18 *************** *** 68,71 **** --- 68,73 ---- self.check_expr("lambda foo=bar, blaz=blat+2, *y, **z: 0") self.check_expr("lambda x, *y, **z: 0") + self.check_expr("(x for x in range(10))") + self.check_expr("foo(x for x in range(10))") def test_print(self): From pierslauder at users.sourceforge.net Thu May 20 07:32:38 2004 From: pierslauder at users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Thu May 20 07:32:42 2004 Subject: [Python-checkins] python/dist/src/Lib imaplib.py,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20690/dist/src/Lib Modified Files: imaplib.py Log Message: Fixed IMAP4_SSL read bug introduced by patch 956394 Index: imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** imaplib.py 20 May 2004 01:16:14 -0000 1.68 --- imaplib.py 20 May 2004 11:32:35 -0000 1.69 *************** *** 1106,1110 **** data = self.sslobj.read(size-read) read += len(data) ! chunks.append(size) return ''.join(chunks) --- 1106,1110 ---- data = self.sslobj.read(size-read) read += len(data) ! chunks.append(data) return ''.join(chunks) From pierslauder at users.sourceforge.net Thu May 20 08:13:00 2004 From: pierslauder at users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Thu May 20 08:13:07 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libimaplib.tex,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27664/dist/src/Doc/lib Modified Files: libimaplib.tex Log Message: Added description for authenticate and namespace Index: libimaplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimaplib.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** libimaplib.tex 10 Nov 2003 06:44:43 -0000 1.25 --- libimaplib.tex 20 May 2004 12:12:58 -0000 1.26 *************** *** 139,148 **** \begin{methoddesc}{append}{mailbox, flags, date_time, message} ! Append message to named mailbox. \end{methoddesc} ! \begin{methoddesc}{authenticate}{func} ! Authenticate command --- requires response processing. This is ! currently unimplemented, and raises an exception. \end{methoddesc} --- 139,162 ---- \begin{methoddesc}{append}{mailbox, flags, date_time, message} ! Append \var{message} to named mailbox. \end{methoddesc} ! \begin{methoddesc}{authenticate}{mechanism, authobject} ! Authenticate command --- requires response processing. ! ! \var{mechanism} specifies which authentication mechanism is to ! be used - it should appear in the instance variable \code{capabilities} in the ! form \code{AUTH=mechanism}. ! ! \var{authobject} must be a callable object: ! ! \begin{verbatim} ! data = authobject(response) ! \end{verbatim} ! ! It will be called to process server continuation responses. ! It should return \code{data} that will be encoded and sent to server. ! It should return \code{None} if the client abort response \samp{*} should ! be sent instead. \end{methoddesc} *************** *** 229,232 **** --- 243,251 ---- \end{methoddesc} + \begin{methoddesc}{namespace}{} + Returns IMAP namespaces as defined in RFC2342. + \versionadded{2.3} + \end{methoddesc} + \begin{methoddesc}{noop}{} Send \samp{NOOP} to server. From Ward at nothingtodate.com Wed May 19 10:57:45 2004 From: Ward at nothingtodate.com (Joanna Dickinson) Date: Thu May 20 10:18:20 2004 Subject: [Python-checkins] Bed of Roses Message-ID: <3560z225mj2$ma88V9e80$4B6WM539@c694281861099> A friend is sending you on a surprise date. Click Here Now to Confirm or Reschedule your Date: http://nothingtodate.com/confirm/?oc=50794544 Don't want these notifications?: http://nothingtodate.com/remove/?oc=50794544 ffriggamisogynist quell edwardine postdoctoral headboard terrace medium topnotch collocation queue cash bestow manslaughter eugenia bible failure butt optimist colonial heritage crowd balance beethoven serviceable least bedlam claustrophobic concerti outlandish wiley corinth showdown cease beetle dutiful switchgear rfollysmelt bedfast ordinary ralston orange styrofoam b's godmother millard redcoat jellyfish windstorm shortcoming who'd swung cutlet cleat wangle original drunkard chief egret maloney From mvshcwpkpm at hotmail.com Thu May 20 17:16:24 2004 From: mvshcwpkpm at hotmail.com (OEM on Sale) Date: Thu May 20 16:13:06 2004 Subject: [Python-checkins] 123 DOLLARS For You, Just For Opening This Notice, Thu, 20 May 2004 17:14:24 -0400 Message-ID: Looking for not expensive high-quality software? We have All Softwares that you may need. Windows XP Professional ............. $50 Adobe Photoshop 7.0 ...................... $60 Microsoft Office XP Professional .... $60 Corel Draw Graphics Suite 11 ............. $60 and lots more... http://sujike.biz/OE017/?affiliate_id=233633&campaign_id=601 From wikqafsz at msn.com Thu May 20 08:10:26 2004 From: wikqafsz at msn.com (wikqafsz@msn.com) Date: Thu May 20 16:21:03 2004 Subject: [Python-checkins] No place like home Message-ID: <37265frk59s0rk$51zk2g6b40$446n0a@radiophysics.msn.com> Greetings, This is an email to notify you that you have been accepted into our "Lowest_Mortgage_Rate" program. Please visit the following link to complete your application which has been pre-approved. http://riverlender.com/?partid=wh6 Thank You Angelina Senior Mortgage Consultant to opt out of this program click here...it may take up to 48 hours to complete thank you http://riverlender.com/st.html From rhettinger at users.sourceforge.net Wed May 19 04:20:38 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu May 20 16:39:12 2004 Subject: [Python-checkins] python/dist/src/Include graminit.h, 2.20, 2.21 symtable.h, 2.12, 2.13 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9770/Include Modified Files: graminit.h symtable.h Log Message: SF patch #872326: Generator expression implementation (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release. Index: graminit.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/graminit.h,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** graminit.h 4 Aug 2002 17:29:52 -0000 2.20 --- graminit.h 19 May 2004 08:20:05 -0000 2.21 *************** *** 50,68 **** #define atom 305 #define listmaker 306 ! #define lambdef 307 ! #define trailer 308 ! #define subscriptlist 309 ! #define subscript 310 ! #define sliceop 311 ! #define exprlist 312 ! #define testlist 313 ! #define testlist_safe 314 ! #define dictmaker 315 ! #define classdef 316 ! #define arglist 317 ! #define argument 318 ! #define list_iter 319 ! #define list_for 320 ! #define list_if 321 ! #define testlist1 322 ! #define encoding_decl 323 --- 50,72 ---- #define atom 305 #define listmaker 306 ! #define testlist_gexp 307 ! #define lambdef 308 ! #define trailer 309 ! #define subscriptlist 310 ! #define subscript 311 ! #define sliceop 312 ! #define exprlist 313 ! #define testlist 314 ! #define testlist_safe 315 ! #define dictmaker 316 ! #define classdef 317 ! #define arglist 318 ! #define argument 319 ! #define list_iter 320 ! #define list_for 321 ! #define list_if 322 ! #define gen_iter 323 ! #define gen_for 324 ! #define gen_if 325 ! #define testlist1 326 ! #define encoding_decl 327 Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -d -r2.12 -r2.13 *** symtable.h 21 May 2003 17:34:49 -0000 2.12 --- symtable.h 19 May 2004 08:20:05 -0000 2.13 *************** *** 47,51 **** int ste_generator; /* true if namespace is a generator */ int ste_opt_lineno; /* lineno of last exec or import * */ ! int ste_tmpname; /* temporary name counter */ struct symtable *ste_table; } PySymtableEntryObject; --- 47,51 ---- int ste_generator; /* true if namespace is a generator */ int ste_opt_lineno; /* lineno of last exec or import * */ ! int ste_tmpname; /* temporary name counter */ struct symtable *ste_table; } PySymtableEntryObject; *************** *** 94,97 **** --- 94,100 ---- #define OPT_BARE_EXEC 4 + #define GENERATOR 1 + #define GENERATOR_EXPRESSION 2 + #ifdef __cplusplus } From rhettinger at users.sourceforge.net Thu May 20 18:57:05 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu May 20 18:57:12 2004 Subject: [Python-checkins] python/nondist/peps pep-0289.txt,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29368 Modified Files: pep-0289.txt Log Message: Clarify when the iter() is called. Index: pep-0289.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0289.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pep-0289.txt 19 May 2004 21:18:54 -0000 1.12 --- pep-0289.txt 20 May 2004 22:57:01 -0000 1.13 *************** *** 103,107 **** for x in exp: yield x**2 ! g = __gen(range(10)) print g.next() --- 103,107 ---- for x in exp: yield x**2 ! g = __gen(iter(range(10))) print g.next() *************** *** 120,124 **** if exp4: yield tgtexp ! g = __generator(exp1) del __gen --- 120,124 ---- if exp4: yield tgtexp ! g = __gen(iter(exp1)) del __gen From rhettinger at users.sourceforge.net Thu May 20 18:59:29 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu May 20 18:59:32 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.46, 1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30009 Modified Files: whatsnew24.tex Log Message: Clarify when iter() is first called in generator expressions. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** whatsnew24.tex 19 May 2004 22:30:25 -0000 1.46 --- whatsnew24.tex 20 May 2004 22:59:26 -0000 1.47 *************** *** 106,116 **** \begin{verbatim} ! def _generator(exp): for var1 in exp: for var2 in exp2: if exp3: yield tgtexp ! g = _generator(exp1) ! del _generator \end{verbatim} --- 106,116 ---- \begin{verbatim} ! def __gen(exp): for var1 in exp: for var2 in exp2: if exp3: yield tgtexp ! g = __gen(iter(exp1)) ! del __gen \end{verbatim} From rhettinger at users.sourceforge.net Thu May 20 19:04:16 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu May 20 19:04:22 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_genexps.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31168 Modified Files: test_genexps.py Log Message: Add a test to verify an early call to iter() on the outermost for expression. Index: test_genexps.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_genexps.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_genexps.py 19 May 2004 08:20:09 -0000 1.1 --- test_genexps.py 20 May 2004 23:04:13 -0000 1.2 *************** *** 92,95 **** --- 92,104 ---- [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] + Verify that the outermost for-expression makes an immediate check + for iterability + + >>> (i for i in 6) + Traceback (most recent call last): + File "", line 1, in -toplevel- + (i for i in 6) + TypeError: iteration over non-sequence + Verify late binding for the outermost if-expression From rhettinger at users.sourceforge.net Fri May 21 19:01:21 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri May 21 19:01:27 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_repr.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8307/test Modified Files: test_repr.py Log Message: * teach repr.repr() about collections.deque() * rename a variable for clarity Index: test_repr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_repr.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_repr.py 21 May 2004 10:00:15 -0000 1.18 --- test_repr.py 21 May 2004 23:01:18 -0000 1.19 *************** *** 36,39 **** --- 36,40 ---- def test_container(self): from array import array + from collections import deque eq = self.assertEquals *************** *** 66,69 **** --- 67,73 ---- eq(r(frozenset([1, 2, 3, 4, 5, 6, 7])), "frozenset([1, 2, 3, 4, 5, 6, ...])") + # collections.deque after 6 + eq(r(deque([1, 2, 3, 4, 5, 6, 7])), "deque([1, 2, 3, 4, 5, 6, ...])") + # Dictionaries give up after 4. eq(r({}), "{}") From rhettinger at users.sourceforge.net Fri May 21 19:01:21 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri May 21 19:01:32 2004 Subject: [Python-checkins] python/dist/src/Lib repr.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8307 Modified Files: repr.py Log Message: * teach repr.repr() about collections.deque() * rename a variable for clarity Index: repr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/repr.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** repr.py 21 May 2004 10:00:14 -0000 1.17 --- repr.py 21 May 2004 23:01:17 -0000 1.18 *************** *** 16,19 **** --- 16,20 ---- self.maxset = 6 self.maxfrozenset = 6 + self.maxdeque = 6 self.maxstring = 30 self.maxlong = 40 *************** *** 38,42 **** return s ! def _repr_iterable(self, x, level, left, right, maxiter, final=''): n = len(x) if level <= 0 and n: --- 39,43 ---- return s ! def _repr_iterable(self, x, level, left, right, maxiter, trail=''): n = len(x) if level <= 0 and n: *************** *** 48,52 **** if n > maxiter: pieces.append('...') s = ', '.join(pieces) ! if n == 1 and final: s += final return '%s%s%s' % (left, s, right) --- 49,53 ---- if n > maxiter: pieces.append('...') s = ', '.join(pieces) ! if n == 1 and trail: right = trail + right return '%s%s%s' % (left, s, right) *************** *** 68,71 **** --- 69,75 ---- self.maxfrozenset) + def repr_deque(self, x, level): + return self._repr_iterable(x, level, 'deque([', '])', self.maxdeque) + def repr_dict(self, x, level): n = len(x) From rhettinger at users.sourceforge.net Fri May 21 06:00:18 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 22 07:28:39 2004 Subject: [Python-checkins] python/dist/src/Lib repr.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11427 Modified Files: repr.py Log Message: * Updated repr.py to handle set() and frozenset(). * Factored out common code to a single private function. * Use str.join() instead of + concatenation * Loop over elements directly instead of using indexing * Use % operator for formatting Index: repr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/repr.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** repr.py 12 Feb 2004 17:35:07 -0000 1.16 --- repr.py 21 May 2004 10:00:14 -0000 1.17 *************** *** 4,9 **** --- 4,11 ---- import __builtin__ + from itertools import islice class Repr: + def __init__(self): self.maxlevel = 6 *************** *** 12,20 **** --- 14,26 ---- self.maxarray = 5 self.maxdict = 4 + self.maxset = 6 + self.maxfrozenset = 6 self.maxstring = 30 self.maxlong = 40 self.maxother = 20 + def repr(self, x): return self.repr1(x, self.maxlevel) + def repr1(self, x, level): typename = type(x).__name__ *************** *** 31,71 **** s = s[:i] + '...' + s[len(s)-j:] return s ! def repr_tuple(self, x, level): n = len(x) ! if n == 0: return '()' ! if level <= 0: return '(...)' ! s = '' ! for i in range(min(n, self.maxtuple)): ! if s: s = s + ', ' ! s = s + self.repr1(x[i], level-1) ! if n > self.maxtuple: s = s + ', ...' ! elif n == 1: s = s + ',' ! return '(' + s + ')' def repr_list(self, x, level): ! n = len(x) ! if n == 0: return '[]' ! if level <= 0: return '[...]' ! s = '' ! for i in range(min(n, self.maxlist)): ! if s: s = s + ', ' ! s = s + self.repr1(x[i], level-1) ! if n > self.maxlist: s = s + ', ...' ! return '[' + s + ']' def repr_array(self, x, level): - n = len(x) header = "array('%s', [" % x.typecode ! if n == 0: ! return header + "])" ! if level <= 0: ! return header + "...])" ! s = '' ! for i in range(min(n, self.maxarray)): ! if s: ! s += ', ' ! s += self.repr1(x[i], level-1) ! if n > self.maxarray: ! s += ', ...' ! return header + s + "])" def repr_dict(self, x, level): --- 37,70 ---- s = s[:i] + '...' + s[len(s)-j:] return s ! ! def _repr_iterable(self, x, level, left, right, maxiter, final=''): n = len(x) ! if level <= 0 and n: ! s = '...' ! else: ! newlevel = level - 1 ! repr1 = self.repr1 ! pieces = [repr1(elem, newlevel) for elem in islice(x, maxiter)] ! if n > maxiter: pieces.append('...') ! s = ', '.join(pieces) ! if n == 1 and final: s += final ! return '%s%s%s' % (left, s, right) ! ! def repr_tuple(self, x, level): ! return self._repr_iterable(x, level, '(', ')', self.maxlist, ',') ! def repr_list(self, x, level): ! return self._repr_iterable(x, level, '[', ']', self.maxlist) def repr_array(self, x, level): header = "array('%s', [" % x.typecode ! return self._repr_iterable(x, level, header, '])', self.maxarray) ! ! def repr_set(self, x, level): ! return self._repr_iterable(x, level, 'set([', '])', self.maxset) ! ! def repr_frozenset(self, x, level): ! return self._repr_iterable(x, level, 'frozenset([', '])', ! self.maxfrozenset) def repr_dict(self, x, level): *************** *** 73,86 **** if n == 0: return '{}' if level <= 0: return '{...}' ! s = '' ! keys = x.keys() ! keys.sort() ! for i in range(min(n, self.maxdict)): ! if s: s = s + ', ' ! key = keys[i] ! s = s + self.repr1(key, level-1) ! s = s + ': ' + self.repr1(x[key], level-1) ! if n > self.maxdict: s = s + ', ...' ! return '{' + s + '}' def repr_str(self, x, level): s = __builtin__.repr(x[:self.maxstring]) --- 72,86 ---- if n == 0: return '{}' if level <= 0: return '{...}' ! newlevel = level - 1 ! repr1 = self.repr1 ! pieces = [] ! for key in islice(sorted(x), self.maxdict): ! keyrepr = repr1(key, newlevel) ! valrepr = repr1(x[key], newlevel) ! pieces.append('%s: %s' % (keyrepr, valrepr)) ! if n > self.maxdict: pieces.append('...') ! s = ', '.join(pieces) ! return '{%s}' % (s,) ! def repr_str(self, x, level): s = __builtin__.repr(x[:self.maxstring]) *************** *** 91,94 **** --- 91,95 ---- s = s[:i] + '...' + s[len(s)-j:] return s + def repr_long(self, x, level): s = __builtin__.repr(x) # XXX Hope this isn't too slow... *************** *** 98,101 **** --- 99,103 ---- s = s[:i] + '...' + s[len(s)-j:] return s + def repr_instance(self, x, level): try: From rhettinger at users.sourceforge.net Fri May 21 06:00:19 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 22 07:37:55 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_repr.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11427/test Modified Files: test_repr.py Log Message: * Updated repr.py to handle set() and frozenset(). * Factored out common code to a single private function. * Use str.join() instead of + concatenation * Loop over elements directly instead of using indexing * Use % operator for formatting Index: test_repr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_repr.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_repr.py 12 Feb 2004 17:35:11 -0000 1.17 --- test_repr.py 21 May 2004 10:00:15 -0000 1.18 *************** *** 52,55 **** --- 52,69 ---- eq(r([1, 2, 3, 4, 5, 6, 7]), "[1, 2, 3, 4, 5, 6, ...]") + # Sets give up after 6 as well + eq(r(set([])), "set([])") + eq(r(set([1])), "set([1])") + eq(r(set([1, 2, 3])), "set([1, 2, 3])") + eq(r(set([1, 2, 3, 4, 5, 6])), "set([1, 2, 3, 4, 5, 6])") + eq(r(set([1, 2, 3, 4, 5, 6, 7])), "set([1, 2, 3, 4, 5, 6, ...])") + + # Frozensets give up after 6 as well + eq(r(frozenset([])), "frozenset([])") + eq(r(frozenset([1])), "frozenset([1])") + eq(r(frozenset([1, 2, 3])), "frozenset([1, 2, 3])") + eq(r(frozenset([1, 2, 3, 4, 5, 6])), "frozenset([1, 2, 3, 4, 5, 6])") + eq(r(frozenset([1, 2, 3, 4, 5, 6, 7])), "frozenset([1, 2, 3, 4, 5, 6, ...])") + # Dictionaries give up after 4. eq(r({}), "{}") From VUOXUQBQHYBUH at ccuma.sci.uma.es Sat May 22 09:53:43 2004 From: VUOXUQBQHYBUH at ccuma.sci.uma.es (Jamaal Avery) Date: Sat May 22 08:56:50 2004 Subject: [Python-checkins] dental practice, Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040522/dc41a2a3/attachment.html From rhettinger at users.sourceforge.net Sat May 22 12:38:14 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 22 12:38:19 2004 Subject: [Python-checkins] python/dist/src/Doc/lib librepr.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23458 Modified Files: librepr.tex Log Message: Updated to reflect new types. Index: librepr.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librepr.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** librepr.tex 12 May 2003 03:23:51 -0000 1.4 --- librepr.tex 22 May 2004 16:38:11 -0000 1.5 *************** *** 53,59 **** \memberline{maxlist} \memberline{maxtuple} Limits on the number of entries represented for the named object ! type. The default for \member{maxdict} is \code{4}, for the others, ! \code{6}. \end{memberdesc} --- 53,65 ---- \memberline{maxlist} \memberline{maxtuple} + \memberline{maxset} + \memberline{maxfrozenset} + \memberline{maxdeque} + \memberline{maxarray} Limits on the number of entries represented for the named object ! type. The default is \code{4} for \member{maxdict}, \code{5} for ! \member{maxarray}, and \code{6} for the others. ! \versionadded[\member{maxset}, \member{maxfrozenset}, ! and \member{set}]{2.4}. \end{memberdesc} From rhettinger at users.sourceforge.net Sat May 22 15:37:24 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat May 22 15:37:30 2004 Subject: [Python-checkins] python/dist/src/Lib repr.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23575 Modified Files: repr.py Log Message: Make sure sets are printed in sorted order Index: repr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/repr.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** repr.py 21 May 2004 23:01:17 -0000 1.18 --- repr.py 22 May 2004 19:37:21 -0000 1.19 *************** *** 63,69 **** --- 63,71 ---- def repr_set(self, x, level): + x = sorted(x) return self._repr_iterable(x, level, 'set([', '])', self.maxset) def repr_frozenset(self, x, level): + x = sorted(x) return self._repr_iterable(x, level, 'frozenset([', '])', self.maxfrozenset) From wozevkn at yahoo.com Sun May 23 08:54:45 2004 From: wozevkn at yahoo.com (Dante Belcher) Date: Sun May 23 07:57:04 2004 Subject: [Python-checkins] Maintain an er.ection desire Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040523/54154eae/attachment.html From montanaro at users.sourceforge.net Sun May 23 13:46:53 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sun May 23 13:46:57 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libreadline.tex, 1.12, 1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6098/Doc/lib Modified Files: libreadline.tex Log Message: Exposed readline() function from the readline module. Index: libreadline.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libreadline.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libreadline.tex 4 May 2004 19:20:22 -0000 1.12 --- libreadline.tex 23 May 2004 17:46:49 -0000 1.13 *************** *** 16,19 **** --- 16,23 ---- + \begin{funcdesc}{readline}{\optional{prompt}} + Get a single line of input from the user. + \end{funcdesc} + \begin{funcdesc}{parse_and_bind}{string} Parse and execute single line of a readline init file. *************** *** 155,156 **** --- 159,161 ---- del os, histfile \end{verbatim} + From montanaro at users.sourceforge.net Sun May 23 13:46:53 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sun May 23 13:47:02 2004 Subject: [Python-checkins] python/dist/src/Modules readline.c,2.68,2.69 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6098/Modules Modified Files: readline.c Log Message: Exposed readline() function from the readline module. Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** readline.c 25 Mar 2004 02:16:22 -0000 2.68 --- readline.c 23 May 2004 17:46:49 -0000 2.69 *************** *** 33,36 **** --- 33,58 ---- + /* Exported function to get a line from the user */ + + static PyObject * + py_readline(PyObject *self, PyObject *args) + { + char *s = NULL; + char *line = NULL; + if (!PyArg_ParseTuple(args, "|s:readline", &s)) + return NULL; + line = readline(s); + if (line == NULL) { + PyErr_SetString(PyExc_EOFError, "End of file on input"); + return NULL; + } + return PyString_FromString(line); + } + + PyDoc_STRVAR(doc_py_readline, + "readline([prompt]) -> line\n\ + Prompt for and read a line of text. Raise EOFError on EOF."); + + /* Exported function to send one line to readline's init file parser */ *************** *** 469,472 **** --- 491,495 ---- static struct PyMethodDef readline_methods[] = { + {"readline", py_readline, METH_VARARGS, doc_py_readline}, {"parse_and_bind", parse_and_bind, METH_VARARGS, doc_parse_and_bind}, {"get_line_buffer", get_line_buffer, METH_NOARGS, doc_get_line_buffer}, From montanaro at users.sourceforge.net Sun May 23 13:46:53 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sun May 23 13:47:04 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.974,1.975 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6098/Misc Modified Files: NEWS Log Message: Exposed readline() function from the readline module. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.974 retrieving revision 1.975 diff -C2 -d -r1.974 -r1.975 *** NEWS 19 May 2004 19:56:44 -0000 1.974 --- NEWS 23 May 2004 17:46:50 -0000 1.975 *************** *** 208,211 **** --- 208,216 ---- ----------------- + - The readline module now exposes the readline() function to the Python + programmer. readline.readline() should be a drop-in replacement for + raw_input() but coupled with the other readline module functionality allow + programmers to offer history and input recall to their users. + - operator.isMappingType() and operator.isSequenceType() now give fewer false positives. From montanaro at users.sourceforge.net Sun May 23 15:06:44 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sun May 23 15:06:47 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libreadline.tex, 1.13, 1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24714 Modified Files: libreadline.tex Log Message: Add example that uses readline.readline(). Index: libreadline.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libreadline.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libreadline.tex 23 May 2004 17:46:49 -0000 1.13 --- libreadline.tex 23 May 2004 19:06:41 -0000 1.14 *************** *** 160,161 **** --- 160,194 ---- \end{verbatim} + The following example extends the \class{code.InteractiveConsole} class to + support command line editing and history save/restore. + + \begin{verbatim} + import code + import readline + import atexit + import os + + class HistoryConsole(code.InteractiveConsole): + def __init__(self, locals=None, filename="", + histfile=os.path.expanduser("~/.console-history")): + code.InteractiveConsole.__init__(self) + self.init_history(histfile) + + def init_history(self, histfile): + readline.parse_and_bind("tab: complete") + if hasattr(readline, "read_history_file"): + try: + readline.read_history_file(histfile) + except IOError: + pass + atexit.register(self.save_history, histfile) + + def raw_input(self, prompt=""): + line = readline.readline(prompt) + if line: + readline.add_history(line) + return line + + def save_history(self, histfile): + readline.write_history_file(histfile) + \end{verbatim} From montanaro at users.sourceforge.net Mon May 24 10:20:19 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon May 24 10:20:31 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.975,1.976 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25522/Misc Modified Files: NEWS Log Message: stupid, stupid, stupid... raw_input() already supports readline() if the readline module is loaded. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.975 retrieving revision 1.976 diff -C2 -d -r1.975 -r1.976 *** NEWS 23 May 2004 17:46:50 -0000 1.975 --- NEWS 24 May 2004 14:20:16 -0000 1.976 *************** *** 208,216 **** ----------------- - - The readline module now exposes the readline() function to the Python - programmer. readline.readline() should be a drop-in replacement for - raw_input() but coupled with the other readline module functionality allow - programmers to offer history and input recall to their users. - - operator.isMappingType() and operator.isSequenceType() now give fewer false positives. --- 208,211 ---- From montanaro at users.sourceforge.net Mon May 24 10:20:18 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon May 24 10:20:34 2004 Subject: [Python-checkins] python/dist/src/Modules readline.c,2.69,2.70 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25522/Modules Modified Files: readline.c Log Message: stupid, stupid, stupid... raw_input() already supports readline() if the readline module is loaded. Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.69 retrieving revision 2.70 diff -C2 -d -r2.69 -r2.70 *** readline.c 23 May 2004 17:46:49 -0000 2.69 --- readline.c 24 May 2004 14:20:15 -0000 2.70 *************** *** 33,58 **** - /* Exported function to get a line from the user */ - - static PyObject * - py_readline(PyObject *self, PyObject *args) - { - char *s = NULL; - char *line = NULL; - if (!PyArg_ParseTuple(args, "|s:readline", &s)) - return NULL; - line = readline(s); - if (line == NULL) { - PyErr_SetString(PyExc_EOFError, "End of file on input"); - return NULL; - } - return PyString_FromString(line); - } - - PyDoc_STRVAR(doc_py_readline, - "readline([prompt]) -> line\n\ - Prompt for and read a line of text. Raise EOFError on EOF."); - - /* Exported function to send one line to readline's init file parser */ --- 33,36 ---- *************** *** 491,495 **** static struct PyMethodDef readline_methods[] = { - {"readline", py_readline, METH_VARARGS, doc_py_readline}, {"parse_and_bind", parse_and_bind, METH_VARARGS, doc_parse_and_bind}, {"get_line_buffer", get_line_buffer, METH_NOARGS, doc_get_line_buffer}, --- 469,472 ---- From montanaro at users.sourceforge.net Mon May 24 10:20:19 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon May 24 10:20:40 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libreadline.tex, 1.14, 1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25522/Doc/lib Modified Files: libreadline.tex Log Message: stupid, stupid, stupid... raw_input() already supports readline() if the readline module is loaded. Index: libreadline.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libreadline.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libreadline.tex 23 May 2004 19:06:41 -0000 1.14 --- libreadline.tex 24 May 2004 14:20:16 -0000 1.15 *************** *** 16,23 **** - \begin{funcdesc}{readline}{\optional{prompt}} - Get a single line of input from the user. - \end{funcdesc} - \begin{funcdesc}{parse_and_bind}{string} Parse and execute single line of a readline init file. --- 16,19 ---- *************** *** 161,165 **** The following example extends the \class{code.InteractiveConsole} class to ! support command line editing and history save/restore. \begin{verbatim} --- 157,161 ---- The following example extends the \class{code.InteractiveConsole} class to ! support history save/restore. \begin{verbatim} *************** *** 184,193 **** atexit.register(self.save_history, histfile) - def raw_input(self, prompt=""): - line = readline.readline(prompt) - if line: - readline.add_history(line) - return line - def save_history(self, histfile): readline.write_history_file(histfile) --- 180,183 ---- From rhettinger at users.sourceforge.net Tue May 25 12:08:32 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue May 25 12:08:37 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.228,1.229 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30943 Modified Files: tut.tex Log Message: Follow official recommendation for domain names in examples. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.228 retrieving revision 1.229 diff -C2 -d -r1.228 -r1.229 *** tut.tex 19 May 2004 19:45:16 -0000 1.228 --- tut.tex 25 May 2004 16:08:28 -0000 1.229 *************** *** 4600,4606 **** >>> import smtplib >>> server = smtplib.SMTP('localhost') ! >>> server.sendmail('soothsayer@tmp.org', 'jceasar@tmp.org', ! """To: jceasar@tmp.org ! From: soothsayer@tmp.org Beware the Ides of March. --- 4600,4606 ---- >>> import smtplib >>> server = smtplib.SMTP('localhost') ! >>> server.sendmail('soothsayer@example.org', 'jceasar@example.org', ! """To: jceasar@example.org ! From: soothsayer@example.org Beware the Ides of March. From fdrake at acm.org Tue May 25 12:12:43 2004 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue May 25 12:12:57 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.228,1.229 In-Reply-To: References: Message-ID: <200405251212.43580.fdrake@acm.org> On Tuesday 25 May 2004 12:08 pm, rhettinger@users.sourceforge.net wrote: > Modified Files: > tut.tex > Log Message: > Follow official recommendation for domain names in examples. Yay! Thanks, Raymond! -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From theller at users.sourceforge.net Tue May 25 14:35:51 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Tue May 25 14:35:54 2004 Subject: [Python-checkins] python/dist/src/PC/bdist_wininst wininst.dsp, 1.2, 1.2.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/PC/bdist_wininst In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28245 Modified Files: Tag: release23-maint wininst.dsp Log Message: To avoid licensing issues, the stub exe for the bdist_wininst installer is no longer compressed with upx. This adds about 35 kB to any installer. Index: wininst.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/bdist_wininst/wininst.dsp,v retrieving revision 1.2 retrieving revision 1.2.14.1 diff -C2 -d -r1.2 -r1.2.14.1 *** wininst.dsp 22 Nov 2002 20:43:30 -0000 1.2 --- wininst.dsp 25 May 2004 18:35:48 -0000 1.2.14.1 *************** *** 55,63 **** # 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 /machine:I386 # ADD LINK32 ..\..\..\zlib-1.1.4\zlib.lib imagehlp.lib comdlg32.lib ole32.lib comctl32.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"LIBC" - # Begin Special Build Tool - TargetPath=\sf\python\dist\src\lib\distutils\command\wininst.exe - SOURCE="$(InputPath)" - PostBuild_Cmds=upx.exe --best $(TARGETPATH) || echo "wininst.exe not compressed" - # End Special Build Tool !ELSEIF "$(CFG)" == "wininst - Win32 Debug" --- 55,58 ---- From theller at users.sourceforge.net Tue May 25 14:36:48 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Tue May 25 14:36:52 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.111, 1.831.4.112 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28426 Modified Files: Tag: release23-maint NEWS Log Message: Set release date for Python 2.3.4 (final). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.111 retrieving revision 1.831.4.112 diff -C2 -d -r1.831.4.111 -r1.831.4.112 *** NEWS 12 May 2004 19:50:15 -0000 1.831.4.111 --- NEWS 25 May 2004 18:36:41 -0000 1.831.4.112 *************** *** 5,11 **** (editors: check NEWS.help for information about editing NEWS using ReST.) ! What's New in Python 2.3.4rc1? =================================== *Release date: 13-May-2004* --- 5,16 ---- (editors: check NEWS.help for information about editing NEWS using ReST.) ! What's New in Python 2.3.4 (final)? =================================== + *Release date: 27-May-2004* + + What's New in Python 2.3.4rc1? + ============================== + *Release date: 13-May-2004* From theller at users.sourceforge.net Tue May 25 14:43:34 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Tue May 25 14:43:38 2004 Subject: [Python-checkins] python/dist/src README,1.177.4.10,1.177.4.11 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29899 Modified Files: Tag: release23-maint README Log Message: Set release date for Python 2.3.4 (final). Windows build number is 53. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.177.4.10 retrieving revision 1.177.4.11 diff -C2 -d -r1.177.4.10 -r1.177.4.11 *** README 12 May 2004 19:49:53 -0000 1.177.4.10 --- README 25 May 2004 18:43:25 -0000 1.177.4.11 *************** *** 1,4 **** ! This is Python version 2.3.4c1 ! ============================== Copyright (c) 2001, 2002, 2003, 2004 Python Software Foundation. --- 1,4 ---- ! This is Python version 2.3.4 ! ============================ Copyright (c) 2001, 2002, 2003, 2004 Python Software Foundation. From theller at users.sourceforge.net Tue May 25 14:43:47 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Tue May 25 14:43:51 2004 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.3.spec, 1.2.12.10, 1.2.12.11 Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29950 Modified Files: Tag: release23-maint python-2.3.spec Log Message: Set release date for Python 2.3.4 (final). Windows build number is 53. Index: python-2.3.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.3.spec,v retrieving revision 1.2.12.10 retrieving revision 1.2.12.11 diff -C2 -d -r1.2.12.10 -r1.2.12.11 *** python-2.3.spec 19 May 2004 13:42:31 -0000 1.2.12.10 --- python-2.3.spec 25 May 2004 18:43:41 -0000 1.2.12.11 *************** *** 31,35 **** %define name python ! %define version 2.3.4c1 %define libvers 2.3 %define release 3pydotorg --- 31,35 ---- %define name python ! %define version 2.3.4 %define libvers 2.3 %define release 3pydotorg From theller at users.sourceforge.net Tue May 25 14:43:57 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Tue May 25 14:44:00 2004 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.dsp, 1.48.4.6, 1.48.4.7 BUILDno.txt, 1.51.4.6, 1.51.4.7 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29976 Modified Files: Tag: release23-maint pythoncore.dsp BUILDno.txt Log Message: Set release date for Python 2.3.4 (final). Windows build number is 53. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/Attic/pythoncore.dsp,v retrieving revision 1.48.4.6 retrieving revision 1.48.4.7 diff -C2 -d -r1.48.4.6 -r1.48.4.7 *** pythoncore.dsp 12 May 2004 19:51:26 -0000 1.48.4.6 --- pythoncore.dsp 25 May 2004 18:43:54 -0000 1.48.4.7 *************** *** 259,263 **** SOURCE=..\Modules\getbuildinfo.c ! # ADD CPP /D BUILD=52 # End Source File # Begin Source File --- 259,263 ---- SOURCE=..\Modules\getbuildinfo.c ! # ADD CPP /D BUILD=53 # End Source File # Begin Source File Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.51.4.6 retrieving revision 1.51.4.7 diff -C2 -d -r1.51.4.6 -r1.51.4.7 *** BUILDno.txt 12 May 2004 19:51:26 -0000 1.51.4.6 --- BUILDno.txt 25 May 2004 18:43:54 -0000 1.51.4.7 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 53 2.3.4 (final) + 27-May-2004 52 2.3.4c1 13-May-2004 From theller at users.sourceforge.net Tue May 25 14:47:39 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Tue May 25 14:47:42 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command wininst.exe, 1.1.16.1, 1.1.16.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30771 Modified Files: Tag: release23-maint wininst.exe Log Message: This file no longer compressed with upx. Index: wininst.exe =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/Attic/wininst.exe,v retrieving revision 1.1.16.1 retrieving revision 1.1.16.2 diff -C2 -d -r1.1.16.1 -r1.1.16.2 Binary files /tmp/cvsC1AU1W and /tmp/cvsi7WOcD differ From theller at users.sourceforge.net Tue May 25 14:50:15 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Tue May 25 14:51:22 2004 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse, 1.133.4.8, 1.133.4.9 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31309 Modified Files: Tag: release23-maint python20.wse Log Message: Changes for Python 2.3.4. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.133.4.8 retrieving revision 1.133.4.9 diff -C2 -d -r1.133.4.8 -r1.133.4.9 *** python20.wse 12 May 2004 20:04:18 -0000 1.133.4.8 --- python20.wse 25 May 2004 18:50:10 -0000 1.133.4.9 *************** *** 2,6 **** item: Global Version=9.0 ! Title=Python 2.3.4c1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=9.0 ! Title=Python 2.3.4 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 21,27 **** MIF PDF Version=1.0 MIF SMS Version=2.0 ! EXE Filename=Python-2.3.4c1.exe Dialogs Version=8 ! Version File=2.3.4c1 Version Description=Python Programming Language Version Copyright=©2001-2004 Python Software Foundation --- 21,27 ---- MIF PDF Version=1.0 MIF SMS Version=2.0 ! EXE Filename=Python-2.3.4.exe Dialogs Version=8 ! Version File=2.3.4 Version Description=Python Programming Language Version Copyright=©2001-2004 Python Software Foundation *************** *** 82,86 **** item: Set Variable Variable=PYVER_STRING ! Value=2.3.4c1 end item: Remark --- 82,86 ---- item: Set Variable Variable=PYVER_STRING ! Value=2.3.4 end item: Remark From fdrake at users.sourceforge.net Tue May 25 20:11:05 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue May 25 20:11:11 2004 Subject: [Python-checkins] python/nondist/peps pep-0320.txt,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28481 Modified Files: pep-0320.txt Log Message: Features planned for 2.4 aren't being pushed off to 2.4. Index: pep-0320.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0320.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pep-0320.txt 19 May 2004 21:18:55 -0000 1.11 --- pep-0320.txt 26 May 2004 00:11:02 -0000 1.12 *************** *** 61,67 **** PEP 327: A Decimal package for fixed precision arithmetic. ! PEP 328: Imports: Multi-line and Absolute/Relative. (Possibly ! the absolute/relative stuff is too controversial and will be ! pushed off to 2.4.) Deprecate and/or remove the modules listed in PEP 4 (posixfile, --- 61,66 ---- PEP 327: A Decimal package for fixed precision arithmetic. ! PEP 328: Imports: Multi-line and Absolute/Relative. (Still quite ! controversial.) Deprecate and/or remove the modules listed in PEP 4 (posixfile, From rhettinger at users.sourceforge.net Wed May 26 09:53:18 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 26 09:53:24 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.229,1.230 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30188 Modified Files: tut.tex Log Message: Add a further tour of the standard library. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.229 retrieving revision 1.230 diff -C2 -d -r1.229 -r1.230 *** tut.tex 25 May 2004 16:08:28 -0000 1.229 --- tut.tex 26 May 2004 13:52:59 -0000 1.230 *************** *** 4764,4767 **** --- 4764,5057 ---- + \chapter{Brief Tour of the Standard Library -- Part II\label{briefTourTwo}} + + + \section{Output Formatting\label{output-formatting}} + + The \ulink{\module{repr}}{../lib/module-repr.html} module provides an + version of \function{repr()} for abbreviated displays of large or deeply + nested containers: + + \begin{verbatim} + >>> import repr + >>> repr.repr(set('supercalifragilisticexpialidocious')) + "set(['a', 'c', 'd', 'e', 'f', 'g', ...])" + \end{verbatim} + + The \ulink{\module{pprint}}{../lib/module-pprint.html} module offers + more sophisticated control over printing both built-in and user defined + objects in a way that is readable by the interpreter. When the result + is longer than one line, the ``pretty printer'' adds line breaks and + indentation to more clearly reveal data structure: + + \begin{verbatim} + >>> import pprint + >>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta', + ... 'yellow'], 'blue']]] + ... + >>> pprint.pprint(t, width=30) + [[[['black', 'cyan'], + 'white', + ['green', 'red']], + [['magenta', 'yellow'], + 'blue']]] + \end{verbatim} + + The \ulink{\module{textwrap}}{../lib/module-textwrap.html} module + formats paragraphs of text to fit a given screen width: + + \begin{verbatim} + >>> import textwrap + >>> doc = """The wrap() method is just like fill() except that it returns + ... a list of strings instead of one big string with newlines to separate + ... the wrapped lines.""" + ... + >>> print textwrap.fill(doc, width=40) + The wrap() method is just like fill() + except that it returns a list of strings + instead of one big string with newlines + to separate the wrapped lines. + \end{verbatim} + + The \ulink{\module{locale}}{../lib/module-locale.html} module accesses + a database of culture specific data formats. The grouping attribute + of locale's format function provides a direct way of formatting numbers + with group separators: + + \begin{verbatim} + >>> import locale + >>> locale.setlocale(locale.LC_ALL, 'English_United States.1252') + 'English_United States.1252' + >>> conv = locale.localeconv() # get a mapping of conventions + >>> x = 1234567.8 + >>> locale.format("%d", x, grouping=True) + '1,234,567' + >>> locale.format("%s%.*f", (conv['currency_symbol'], + ... conv['int_frac_digits'], x), grouping=True) + '$1,234,567.80' + \end{verbatim} + + + \section{Working with Binary Data Record Layouts\label{binary-formats}} + + The \ulink{\module{struct}}{../lib/module-struct.html} module provides + \function{pack()} and \function{unpack()} functions for working with + variable length binary record formats. The following example shows how + to loop through header information in a ZIP file (with pack codes + \code{"H"} and \code{"L"} representing two and four byte unsigned + numbers respectively): + + \begin{verbatim} + import struct + + data = open('myfile.zip', 'rb').read() + start = 0 + for i in range(3): # show the first 3 file headers + start += 14 + fields = struct.unpack('LLLHH', data[start:start+16]) + crc32, comp_size, uncomp_size, filenamesize, extra_size = fields + + start += 16 + filename = data[start:start+filenamesize] + start += filenamesize + extra = data[start:start+extra_size] + print filename, hex(crc32), comp_size, uncomp_size + + start += extra_size + comp_size # skip to the next header + \end{verbatim} + + + \section{Multi-threading\label{multi-threading}} + + Threading is a technique for decoupling tasks which are not sequentially + dependent. Python threads are driven by the operating system and run + in a single process and share memory space in a single interpreter. + + Threads can be used to improve the responsiveness of applications that + accept user input while other tasks run in the background. The + following code shows how the high level + \ulink{\module{threading}}{../lib/module-threading.html} module can run + tasks in background while the main program continues to run: + + \begin{verbatim} + import threading, zipfile + + class AsyncZip(threading.Thread): + def __init__(self, infile, outfile): + threading.Thread.__init__(self) + self.infile = infile + self.outfile = outfile + def run(self): + f = zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED) + f.write(self.infile) + f.close() + print 'Finished background zip of: ', self.infile + + AsyncZip('mydata.txt', 'myarchive.zip').start() + print 'The main program continues to run' + \end{verbatim} + + The principal challenge of multi-thread applications is coordinating + threads that share data or other resources. To that end, the threading + module provides a number of synchronization primitives including locks, + events, condition variables, and semaphores. + + While those tools are powerful, minor design errors can result in + problems that are difficult to reproduce. A simpler and more robust + approach to task coordination is concentrating all access to a resource + in a single thread and then using the + \ulink{\module{Queue}}{../lib/module-Queue.html} module to feed that + thread with requests from other threads. Applications that use + \class{Queue} objects for inter-thread communication and coordination + tend to be easier to design, more readable, and more reliable. + + + \section{Logging\label{logging}} + + The \ulink{\module{logging}}{../lib/module-logging.html} module offers + a full featured and flexible logging system. At its simplest, log + messages are sent to a file or to \code{sys.stderr}: + + \begin{verbatim} + import logging + logging.debug('Debugging information') + logging.info('Informational message') + logging.warning('Warning:config file %s not found', 'server.conf') + logging.error('Error occurred') + logging.critical('Critical error -- shutting down') + \end{verbatim} + + This produces the following output: + + \begin{verbatim} + WARNING:root:Warning:config file server.conf not found + ERROR:root:Error occurred + CRITICAL:root:Critical error -- shutting down + \end{verbatim} + + By default, informational and debugging messages are suppressed and the + output is sent to standard error. Other output options include routing + messages through email, datagrams, sockets, or to an HTTP Server. New + filters select different routing based on message priority: DEBUG, + INFO, WARNING, ERROR, and CRITICAL. + + The logging system can be configured directly from Python or can be + loaded from a user editable configuration file for customized logging + without altering the application. + + + \section{Weak References\label{weak-references}} + + Python does automatic memory management (reference counting for most + objects and garbage collection to eliminate cycles). The memory is + freed shortly after the last reference to it has been eliminated. + + This approach works fine for most applications but occasionally there + is a need to track objects only as long as they are being used by + something else. Unfortunately, just tracking them creates a reference + that makes them permanent. The + \ulink{\module{weakref}}{../lib/module-weakref.html} module provides + tools for tracking objects without creating a reference. When the + object is no longer needed, it is automatically removed from a weakref + table and a callback is triggered for weakref objects. Typical + applications include caching objects that are expensive to create: + + \begin{verbatim} + >>> import weakref, gc + >>> class A: + ... def __init__(self, value): + ... self.value = value + ... def __repr__(self): + ... return str(self.value) + ... + >>> a = A(10) # create a reference + >>> d = weakref.WeakValueDictionary() + >>> d['primary'] = a # does not create a reference + >>> d['primary'] # fetch the object if it is still alive + 10 + >>> del a # remove the one reference + >>> gc.collect() # run garbage collection right away + 0 + >>> d['primary'] # entry was automatically removed + Traceback (most recent call last): + File "", line 1, in -toplevel- + d['primary'] # entry was automatically removed + File "C:/PY24/lib/weakref.py", line 46, in __getitem__ + o = self.data[key]() + KeyError: 'primary' + \end{verbatim} + + \section{Tools for Working with Lists\label{list-tools}} + + Many data structure needs can be met with the built-in list type. + However, sometimes there is a need for alternative implementations + with different performance trade-offs. + + The \ulink{\module{array}}{../lib/module-array.html} module provides an + \class{array()} object that is like a list that stores only homogenous + data but stores it more compactly. The following example shows an array + of numbers stored as two byte unsigned binary numbers (typecode + \code{"H"}) rather than the usual 16 bytes per entry for regular lists + of python int objects: + + \begin{verbatim} + >>> from array import array + >>> a = array('H', [4000, 10, 700, 22222]) + >>> sum(a) + 26932 + >>> a[1:3] + array('H', [10, 700]) + \end{verbatim} + + The \ulink{\module{collections}}{../lib/module-collections.html} module + provides a \class{deque()} object that is like a list with faster + appends and pops from the left side but slower lookups in the middle. + These objects are well suited for implementing queues and breadth first + tree searches: + + \begin{verbatim} + >>> from collections import deque + >>> d = deque(["task1", "task2", "task3"]) + >>> d.append("task4") + >>> print "Handling", d.popleft() + Handling task1 + + unsearched = deque([starting_node]) + def breadth_first_search(unsearched): + node = unsearched.popleft() + for m in gen_moves(node): + if is_goal(m): + return m + unsearched.append(m) + \end{verbatim} + + In addition to alternative list implementations, the library also offers + other tools such as the \ulink{\module{bisect}}{../lib/module-bisect.html} + module with functions for manipulating sorted lists: + + \begin{verbatim} + >>> import bisect + >>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')] + >>> bisect.insort(scores, (300, 'ruby')) + >>> scores + [(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, 'python')] + \end{verbatim} + + The \ulink{\module{heapq}}{../lib/module-heapq.html} module provides + functions for implementing heaps based on regular lists. The lowest + valued entry is always kept at position zero. This is useful for + applications which repeatedly access the smallest element but do not + want to run a full list sort: + + \begin{verbatim} + >>> from heapq import heapify, heappop, heappush + >>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0] + >>> heapify(data) # rearrange the list into heap order + >>> heappush(data, -5) # add a new entry + >>> [heappop(data) for i in range(3)] # fetch the three smallest entries + [-5, 0, 1] + \end{verbatim} + + \chapter{What Now? \label{whatNow}} From rhettinger at users.sourceforge.net Wed May 26 09:57:57 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed May 26 09:58:02 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.230,1.231 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31172 Modified Files: tut.tex Log Message: Fill-in the introductory paragraph for the library tour. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.230 retrieving revision 1.231 diff -C2 -d -r1.230 -r1.231 *** tut.tex 26 May 2004 13:52:59 -0000 1.230 --- tut.tex 26 May 2004 13:57:54 -0000 1.231 *************** *** 4766,4769 **** --- 4766,4772 ---- \chapter{Brief Tour of the Standard Library -- Part II\label{briefTourTwo}} + This second tour covers more advanced modules that support professional + programming needs. These modules rarely occur in small scripts. + \section{Output Formatting\label{output-formatting}} From mwh at users.sourceforge.net Wed May 26 12:10:38 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed May 26 12:10:42 2004 Subject: [Python-checkins] python/nondist/peps pep-0003.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27052 Modified Files: pep-0003.txt Log Message: Make this a little bit less hilariously out of date. Index: pep-0003.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0003.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0003.txt 30 Sep 2002 01:55:41 -0000 1.3 --- pep-0003.txt 26 May 2004 16:10:30 -0000 1.4 *************** *** 15,18 **** --- 15,25 ---- expertise. + These are guidlines for the developers of Python, not the + submitters of bugs. Those are at + + http://docs.python.org/lib/reporting-bugs.html + + (though this hardly seems the best place). + Guidelines *************** *** 28,31 **** --- 35,40 ---- saying that this is the case (mentioning the PEP explicitly). + XXX do we prefer the feature request tracker or PEP 42? + 3. Assign the bug a reasonable priority. We don't yet have a clear sense of what each priority should mean, except than 9 is *************** *** 34,41 **** 4. If a bug report doesn't have enough information to allow you to ! reproduce or diagnose it, send email to the original submittor ! and ask for more information. If the original report is really ! thin and your email doesn't get a response after a reasonable ! waiting period, you can close the bug. 5. If you fix a bug, mark the status as "Fixed" and close it. In --- 43,50 ---- 4. If a bug report doesn't have enough information to allow you to ! reproduce or diagnose it, ask the original submitter for more ! information. If the original report is really thin and your ! email doesn't get a response after a reasonable waiting period, ! you can close the bug. 5. If you fix a bug, mark the status as "Fixed" and close it. In *************** *** 45,52 **** change. ! 6. If you are assigned a bug that you are unable to deal with ! assign it to someone else. The guys at PythonLabs get paid to ! fix these bugs, so pick one of them if there is no other ! obvious candidate. --- 54,60 ---- change. ! 6. If you are assigned a bug that you are unable to deal with, ! assign it to someone else if you think they will be able to ! deal with it, otherwise it's probably best to unassign it. From mwh at users.sourceforge.net Wed May 26 12:17:43 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed May 26 12:17:48 2004 Subject: [Python-checkins] python/nondist/peps pep-0042.txt,1.76,1.77 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28569 Modified Files: pep-0042.txt Log Message: Remove an implemented request. Index: pep-0042.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0042.txt,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** pep-0042.txt 8 Jan 2004 01:58:29 -0000 1.76 --- pep-0042.txt 26 May 2004 16:17:39 -0000 1.77 *************** *** 296,308 **** http://www.python.org/sf/216326 - - There's a name conflict on case insensitive filesystems (in - particular Mac OSX) between the directory "Python" and the key - build target "python". That's currently solved by abusing the - --with-suffix option, but that's not ideal (since that also - causes the binary to be *installed* as python.exe). What should - be the solution? - - http://www.python.org/sf/222215 - - Building from source should not attempt to overwrite the Include/graminit.h and Parser/graminit.c files, at least for --- 296,299 ---- From akuchling at users.sourceforge.net Wed May 26 13:02:39 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed May 26 13:02:44 2004 Subject: [Python-checkins] python/nondist/peps pep-0003.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5157 Modified Files: pep-0003.txt Log Message: Typo fix Index: pep-0003.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0003.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0003.txt 26 May 2004 16:10:30 -0000 1.4 --- pep-0003.txt 26 May 2004 17:02:35 -0000 1.5 *************** *** 15,19 **** expertise. ! These are guidlines for the developers of Python, not the submitters of bugs. Those are at --- 15,19 ---- expertise. ! These are guidelines for the developers of Python, not the submitters of bugs. Those are at From mwh at users.sourceforge.net Wed May 26 13:06:34 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed May 26 13:06:37 2004 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c, 1.288, 1.289 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5830 Modified Files: socketmodule.c Log Message: Band-aid type fix for [ 728330 ] Don't define _SGAPI on IRIX The Right Thing would be nice, for now this'll do. At least it isn't going to break anything *other* than IRIX... Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.288 retrieving revision 1.289 diff -C2 -d -r1.288 -r1.289 *** socketmodule.c 11 Apr 2004 12:02:25 -0000 1.288 --- socketmodule.c 26 May 2004 17:06:31 -0000 1.289 *************** *** 62,65 **** --- 62,69 ---- */ + #if defined(__sgi) && _COMPILER_VERSION>700 && !_SGIAPI + #define _BSD_TYPES + #endif + #include "Python.h" *************** *** 193,198 **** --- 197,212 ---- /* XXX Using _SGIAPI is the wrong thing, but I don't know what the right thing is. */ + #undef _SGIAPI /* to avoid warning */ #define _SGIAPI 1 + #undef _XOPEN_SOURCE + #include + #include + #include + #ifdef _SS_ALIGNSIZE + #define HAVE_GETADDRINFO 1 + #define HAVE_GETNAMEINFO 1 + #endif + #define HAVE_INET_PTON #include *************** *** 258,262 **** --- 272,281 ---- #endif + #if defined(__sgi) && _COMPILER_VERSION>700 \ + && !defined(_SS_ALIGNSIZE) /* defined in sys/socket.h */ + /* by some newer versions of IRIX */ + /* (e.g. not by 6.5.10 but by 6.5.21) */ #include "addrinfo.h" + #endif #ifndef HAVE_INET_PTON From mwh at users.sourceforge.net Wed May 26 13:36:15 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed May 26 13:36:23 2004 Subject: [Python-checkins] python/dist/src/Objects floatobject.c, 2.129, 2.130 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12065 Modified Files: floatobject.c Log Message: Remove float_compare as per [ 899109 ] 1==float('nan') which can now finally be closed, I think. Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.129 retrieving revision 2.130 diff -C2 -d -r2.129 -r2.130 *** floatobject.c 26 Feb 2004 13:16:03 -0000 2.129 --- floatobject.c 26 May 2004 17:36:12 -0000 2.130 *************** *** 353,364 **** } - static int - float_compare(PyFloatObject *v, PyFloatObject *w) - { - double i = v->ob_fval; - double j = w->ob_fval; - return (i < j) ? -1 : (i > j) ? 1 : 0; - } - static PyObject* float_richcompare(PyObject *v, PyObject *w, int op) --- 353,356 ---- *************** *** 853,857 **** 0, /* tp_getattr */ 0, /* tp_setattr */ ! (cmpfunc)float_compare, /* tp_compare */ (reprfunc)float_repr, /* tp_repr */ &float_as_number, /* tp_as_number */ --- 845,849 ---- 0, /* tp_getattr */ 0, /* tp_setattr */ ! 0, /* tp_compare */ (reprfunc)float_repr, /* tp_repr */ &float_as_number, /* tp_as_number */ From xznkyrefe at hotmail.com Wed May 26 19:19:17 2004 From: xznkyrefe at hotmail.com (Jaime Mcneill) Date: Wed May 26 15:17:20 2004 Subject: [Python-checkins] Pre-qualify, and apply for home [loans] and [mortgages] Message-ID: <7815608RND_LC_CHAR[1-5]81866byuhr$21305064nmn285$849t312xu3@hesse> Good Day, You have been Pre-Selected to join our exculsive "Extreme_Low_Rate" mortgage program. The only catch is that this Extreme Rate won't last so you must ACT NOW as there are limited spots available. Please visit the following link to complete your application which has been pre-approved. http://thehomeloanguy.com/?partid=wh6 Thank You Patty Merritt Senior Mortgage Consultant to opt out of this special program click here...it may take up to 48 hours to complete thank you http://thehomeloanguy.com/st.html From anthonybaxter at users.sourceforge.net Thu May 27 01:55:59 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu May 27 01:56:07 2004 Subject: [Python-checkins] python/nondist/peps pep-0101.txt, 1.48, 1.49 pep-0102.txt, 1.21, 1.22 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16561 Modified Files: pep-0101.txt pep-0102.txt Log Message: more rpm goodness Index: pep-0101.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0101.txt,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** pep-0101.txt 5 Dec 2003 00:45:13 -0000 1.48 --- pep-0101.txt 27 May 2004 05:55:55 -0000 1.49 *************** *** 160,163 **** --- 160,166 ---- %define libvers 2.3 + You also probably want to reset the %define release line + to '1pydotorg' if it's not already that. + If the new release uses a major/minor version which is different than is in the name of the current Index: pep-0102.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0102.txt,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** pep-0102.txt 13 May 2004 07:20:16 -0000 1.21 --- pep-0102.txt 27 May 2004 05:55:55 -0000 1.22 *************** *** 73,76 **** --- 73,79 ---- %define version 2.3.1 + You also probably want to reset the %define release line + to '1pydotorg' if it's not already that. + ___ If you're changing the version number for Python (e.g. from Python 2.1.1 to Python 2.1.2), you also need to update the From anthonybaxter at users.sourceforge.net Thu May 27 01:56:16 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu May 27 01:56:22 2004 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.3.spec, 1.2.12.11, 1.2.12.12 Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16644/Misc/RPM Modified Files: Tag: release23-maint python-2.3.spec Log Message: reset release Index: python-2.3.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.3.spec,v retrieving revision 1.2.12.11 retrieving revision 1.2.12.12 diff -C2 -d -r1.2.12.11 -r1.2.12.12 *** python-2.3.spec 25 May 2004 18:43:41 -0000 1.2.12.11 --- python-2.3.spec 27 May 2004 05:56:12 -0000 1.2.12.12 *************** *** 33,37 **** %define version 2.3.4 %define libvers 2.3 ! %define release 3pydotorg %define __prefix /usr --- 33,37 ---- %define version 2.3.4 %define libvers 2.3 ! %define release 1pydotorg %define __prefix /usr From anthonybaxter at users.sourceforge.net Thu May 27 01:59:19 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu May 27 01:59:23 2004 Subject: [Python-checkins] python/dist/src/Lib/idlelib NEWS.txt, 1.23.4.6, 1.23.4.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16984/Lib/idlelib Modified Files: Tag: release23-maint NEWS.txt Log Message: formatting nit Index: NEWS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v retrieving revision 1.23.4.6 retrieving revision 1.23.4.7 diff -C2 -d -r1.23.4.6 -r1.23.4.7 *** NEWS.txt 12 May 2004 19:50:04 -0000 1.23.4.6 --- NEWS.txt 27 May 2004 05:59:16 -0000 1.23.4.7 *************** *** 1,4 **** What's New in IDLE 1.0.3? ! =================================== *Release date: 13-May-2004* --- 1,4 ---- What's New in IDLE 1.0.3? ! ========================= *Release date: 13-May-2004* *************** *** 9,13 **** What's New in IDLE 1.0.2? ! =================================== *Release date: 05-Dec-2003* --- 9,13 ---- What's New in IDLE 1.0.2? ! ========================= *Release date: 05-Dec-2003* *************** *** 23,27 **** What's New in IDLE 1.0.1? ! =================================== *Release date: 23-Sep-2003* --- 23,27 ---- What's New in IDLE 1.0.1? ! ========================= *Release date: 23-Sep-2003* *************** *** 34,38 **** What's New in IDLE 1.0? ! =================================== *Release date: 29-Jul-2003* --- 34,38 ---- What's New in IDLE 1.0? ! ======================= *Release date: 29-Jul-2003* *************** *** 43,47 **** What's New in IDLE 1.0 release candidate 2? ! =================================== *Release date: 24-Jul-2003* --- 43,47 ---- What's New in IDLE 1.0 release candidate 2? ! =========================================== *Release date: 24-Jul-2003* *************** *** 51,55 **** What's New in IDLE 1.0 release candidate 1? ! =================================== *Release date: 18-Jul-2003* --- 51,55 ---- What's New in IDLE 1.0 release candidate 1? ! =========================================== *Release date: 18-Jul-2003* *************** *** 72,76 **** What's New in IDLE 1.0b2? ! =================================== *Release date: 29-Jun-2003* --- 72,76 ---- What's New in IDLE 1.0b2? ! ========================= *Release date: 29-Jun-2003* *************** *** 113,117 **** What's New in IDLEfork 0.9b1? ! =================================== *Release date: 02-Jun-2003* --- 113,117 ---- What's New in IDLEfork 0.9b1? ! ============================= *Release date: 02-Jun-2003* From doerwalter at users.sourceforge.net Thu May 27 05:41:07 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu May 27 05:42:31 2004 Subject: [Python-checkins] python/dist/src/Lib UserDict.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21578/Lib Modified Files: UserDict.py Log Message: The default argument in dict.setdefault() defaults to None. Add this default to UserDict.DictMixin.setdefault() too. Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** UserDict.py 4 Mar 2004 08:25:44 -0000 1.27 --- UserDict.py 27 May 2004 09:41:04 -0000 1.28 *************** *** 114,118 **** for key in self.keys(): del self[key] ! def setdefault(self, key, default): try: return self[key] --- 114,118 ---- for key in self.keys(): del self[key] ! def setdefault(self, key, default=None): try: return self[key] From doerwalter at users.sourceforge.net Thu May 27 14:16:28 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu May 27 14:16:35 2004 Subject: [Python-checkins] python/dist/src/Lib weakref.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21761/Lib Modified Files: weakref.py Log Message: The default argument in dict.setdefault() defaults to None. Add this default to weakref.WeakValueDictionary.setdefault() and weakref.WeakKeyDictionary.setdefault() too. Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** weakref.py 4 Mar 2004 08:25:44 -0000 1.21 --- weakref.py 27 May 2004 18:16:25 -0000 1.22 *************** *** 114,118 **** return o ! def setdefault(self, key, default): try: wr = self.data[key] --- 114,118 ---- return o ! def setdefault(self, key, default=None): try: wr = self.data[key] *************** *** 242,246 **** return self.data.pop(ref(key), *args) ! def setdefault(self, key, default): return self.data.setdefault(ref(key, self._remove),default) --- 242,246 ---- return self.data.pop(ref(key), *args) ! def setdefault(self, key, default=None): return self.data.setdefault(ref(key, self._remove),default) From goodger at users.sourceforge.net Thu May 27 21:45:37 2004 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu May 27 21:45:42 2004 Subject: [Python-checkins] python/nondist/peps pep-0330.txt, NONE, 1.1 pep-0000.txt, 1.272, 1.273 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4467 Modified Files: pep-0000.txt Added Files: pep-0330.txt Log Message: added PEP 330, Python Bytecode Verification, by Michel Pelletier --- NEW FILE: pep-0330.txt --- PEP: 330 Title: Python Bytecode Verification Version: $Revision: 1.1 $ Last-Modified: $Date: 2004/05/28 01:45:34 $ Author: Michel Pelletier Status: Draft Type: Standards Track Content-Type: text/plain Created: 17-Jun-2004 Python-Version: 2.6? Post-History: Abstract If Python Virtual Machine (PVM) bytecode is not "well-formed" it is possible to crash or exploit the PVM by causing various errors such as under/overflowing the value stack or reading/writing into arbitrary areas of the PVM program space. Most of these kinds of errors can be eliminated by verifying that PVM bytecode does not violate a set of simple constraints before execution. This PEP proposes a set of constraints on the format and structure of Python Virtual Machine (PVM) bytecode and provides an implementation in Python of this verification process. Motivation The Python Virtual Machine executes Python programs that have been compiled from the Python language into a bytecode representation. The PVM assumes that any bytecode being executed is "well-formed" with regard to a number implicit constraints. Some of these constraints are checked at run-time, but most of them are not due to the overhead they would create. When running in debug mode the PVM does do several run-time checks to ensure that any particular bytecode cannot violate these constraints that, to a degree, prevent bytecode from crashing or exploiting the interpreter. These checks add a measurable overhead to the interpreter, and are typically turned off in common use. Bytecode that is not well-formed and executed by a PVM not running in debug mode may create a variety of fatal and non-fatal errors. Typically, ill-formed code will cause the PVM to seg-fault and cause the OS to immediately and abruptly terminate the interpreter. Conceivably, ill-formed bytecode could exploit the interpreter and allow Python bytecode to execute arbitrary C-level machine instructions or to modify private, internal data structures in the interpreter. If used cleverly this could subvert any form of security policy an application may want to apply to it's objects. Practically, it would be difficult for a malicious user to "inject" invalid bytecode into a PVM for the purposes of exploitation, but not impossible. Buffer overflow and memory overwrite attacks are commonly understood, particularly when the exploit payload is transmitted unencrypted over a network or when a file or network security permission weakness is used as a foothold for further attacks. Ideally, no bytecode should ever be allowed to read or write underlying C-level data structures to subvert the operation of the PVM, whether the bytecode was maliciously crafted or not. A simple pre-execution verification step could ensure that bytecode cannot over/underflow the value stack or access other sensitive areas of PVM program space at run-time. This PEP proposes several validation steps that should be taken on Python bytecode before it is executed by the PVM so that it compiles with static and structure constraints on its instructions and their operands. These steps are simple and catch a large class of invalid bytecode that can cause crashes. There is also some possibility that some run-time checks can be eliminated up front by a verification pass. There is, of course, no way to verify that bytecode is "completely safe", for every definition of complete and safe. Even with bytecode verification, Python programs can and most likely in the future will seg-fault for a variety of reasons and continue to cause many different classes of run-time errors, fatal or not. The verification step proposed here simply plugs an easy hole that can cause a large class of fatal and subtle errors at the bytecode level. Currently, the Java Virtual Machine (JVM) verifies Java bytecode in a way very similar to what is proposed here. The JVM Specification version 2 [1], Sections 4.8 and 4.9 were therefore used as a basis for some of the constraints explained below. Any Python bytecode verification implementation at a minimum must enforce these constraints, but may not be limited to them. Static Constraints on Bytecode Instructions 1. The bytecode string must not be empty. (len(co_code) > 0). 2. The bytecode string cannot exceed a maximum size (len(co_code) < sizeof(unsigned char) - 1). 3. The first instruction in the bytecode string begins at index 0. 4. Only valid byte-codes with the correct number of operands can be in the bytecode string. Static Constraints on Bytecode Instruction Operands 1. The target of a jump instruction must be within the code boundaries and must fall on an instruction, never between an instruction and its operands. 2. The operand of a LOAD_* instruction must be an valid index into its corresponding data structure. 3. The operand of a STORE_* instruction must be an valid index into its corresponding data structure. Structural Constraints between Bytecode Instructions 1. Each instruction must only be executed with the appropriate number of arguments in the value stack, regardless of the execution path that leads to its invocation. 2. If an instruction can be executed along several different execution paths, the value stack must have the same depth prior to the execution of the instruction, regardless of the path taken. 3. At no point during execution can the value stack grow to a depth greater than that implied by co_stacksize. 4. Execution never falls off the bottom of co_code. Implementation This PEP is the working document for an Python bytecode verification implementation written in Python. This implementation is not used implicitly by the PVM before executing any bytecode, but is to be used explicitly by users concerned about possibly invalid bytecode with the following snippet: import verify verify.verify(object) The `verify` module provides a `verify` function which accepts the same kind of arguments as `dis.dis`: classes, methods, functions, or code objects. It verifies that the object's bytecode is well-formed according to the specifications of this PEP. If the code is well-formed the call to `verify` returns silently without error. If an error is encountered, it throws a 'VerificationError' whose argument indicates the cause of the failure. It is up to the programmer whether or not to handle the error in some way or execute the invalid code regardless. Phillip Eby has proposed a pseudo-code algorithm for bytecode stack depth verification used by the reference implementation. Verification Issues This PEP describes only a small number of verifications. While discussion and analysis will lead to many more, it is highly possible that future verification may need to be done or custom, project-specific verifications. For this reason, it might be desirable to add a verification registration interface to the test implementation to register future verifiers. The need for this is minimal since custom verifiers can subclass and extend the current implementation for added behavior. Required Changes Armin Rigo noted that several byte-codes will need modification in order for their stack effect to be statically analyzed. These are END_FINALLY, POP_BLOCK, and MAKE_CLOSURE. Armin and Guido have already agreed on how to correct the instructions. Currently the Python implementation punts on these instructions. This PEP does not propose to add the verification step to the interpreter, but only to provide the Python implementation in the standard library for optional use. Whether or not this verification procedure is translated into C, included with the PVM or enforced in any way is left for future discussion. References [1] The Java Virtual Machine Specification 2nd Edition http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.272 retrieving revision 1.273 diff -C2 -d -r1.272 -r1.273 *** pep-0000.txt 19 May 2004 21:18:54 -0000 1.272 --- pep-0000.txt 28 May 2004 01:45:32 -0000 1.273 *************** *** 123,126 **** --- 123,127 ---- S 325 Resource-Release Support for Generators Pedroni S 327 Decimal Data Type Batista + S 330 Python Bytecode Verification Pelletier S 754 IEEE 754 Floating Point Special Values Warnes *************** *** 352,355 **** --- 353,357 ---- SA 328 Imports: Multi-Line and Absolute/Relative Aahz SR 329 Treating Builtins as Constants in the Standard Library Hettinger + S 330 Python Bytecode Verification Pelletier SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes From knpfy at jcdc.com Fri May 28 02:17:12 2004 From: knpfy at jcdc.com (Tonia Connolly) Date: Fri May 28 01:26:24 2004 Subject: [Python-checkins] pydotorg-redesign-request@python.org: your academic qualification expired Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040528/fd8ee532/attachment.html From otfxaxi at inwind.it Fri May 28 07:25:24 2004 From: otfxaxi at inwind.it (Eula Cash) Date: Fri May 28 06:30:52 2004 Subject: [Python-checkins] Fw: the saving site we were talking bout -Sig Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040528/35ec407c/attachment.html From dlfodmhdus at informatik.uni-rostock.de Fri May 28 13:30:04 2004 From: dlfodmhdus at informatik.uni-rostock.de (Marcy Gleason) Date: Fri May 28 12:39:06 2004 Subject: [Python-checkins] university degrees to the highest bidder :) Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040528/aaaf41d5/attachment.html From jbexqpwc at msn.com Fri May 28 19:27:27 2004 From: jbexqpwc at msn.com (jbexqpwc@msn.com) Date: Fri May 28 15:17:50 2004 Subject: [Python-checkins] Specialize in hard to qualify-borrowers Message-ID: <26652b8vj9n$70xe35m4z57$51yxw624f@twirly.msn.com> Good Day, You have been Pre-Selected from a previous application to join our New Exclusive Program while still in the launch phase. During this phase we are offering a Ridiculously Low Rate that we can't afford to give away for long so you must jump on this now. Please visit the following link to finish up business on a secure site: http://easysavings.net/?partid=wh6 Thank You Willard Meredith Senior M O R T G A G E Consultant to opt out of this special program click here...it may take up to 48 hours to complete thank you http://easysavings.net/st.html swiss germicidal complaisant alchemy tyrant adelia From fdrake at users.sourceforge.net Fri May 28 16:21:39 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri May 28 16:21:43 2004 Subject: [Python-checkins] python/dist/src/Python import.c,2.230,2.231 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6304 Modified Files: import.c Log Message: starting to add comments to explain what's here Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.230 retrieving revision 2.231 diff -C2 -d -r2.230 -r2.231 *** import.c 1 Apr 2004 02:45:22 -0000 2.230 --- import.c 28 May 2004 20:21:36 -0000 2.231 *************** *** 1914,1917 **** --- 1914,1928 ---- } + /* Return the package that an import is being performed in. If globals comes + from the module foo.bar.bat (not itself a package), this returns the + sys.modules entry for foo.bar. If globals is from a package's __init__.py, + the package's entry in sys.modules is returned. + + The *name* of the returned package is returned in buf, with the length of + the name in *p_buflen. + + If globals doesn't come from a package or a module in a package, or a + corresponding entry is not found in sys.modules, Py_None is returned. + */ static PyObject * get_parent(PyObject *globals, char *buf, int *p_buflen) From doerwalter at users.sourceforge.net Fri May 28 16:59:27 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Fri May 28 16:59:45 2004 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.159,2.160 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12926/Objects Modified Files: dictobject.c Log Message: Update docstring for dict.update() to match the new realities. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.159 retrieving revision 2.160 diff -C2 -d -r2.159 -r2.160 *** dictobject.c 12 Apr 2004 18:10:01 -0000 2.159 --- dictobject.c 28 May 2004 20:59:21 -0000 2.160 *************** *** 1780,1784 **** PyDoc_STRVAR(update__doc__, ! "D.update(E) -> None. Update D from E: for k in E.keys(): D[k] = E[k]"); PyDoc_STRVAR(fromkeys__doc__, --- 1780,1785 ---- PyDoc_STRVAR(update__doc__, ! "D.update(E, **F) -> None. Update D from E and F: for k in E: D[k] = E[k]\n\ ! (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]"); PyDoc_STRVAR(fromkeys__doc__, From zvrkmidatz at fronttraining.com Sat May 29 03:29:12 2004 From: zvrkmidatz at fronttraining.com (Francesca Jimenez) Date: Sat May 29 02:37:35 2004 Subject: [Python-checkins] Microsoft- Adobe software and plugins. Cheapest prices - Pydotorg-redesign CEO 04 ruffians Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040529/dc1c5fa4/attachment.html From rhettinger at users.sourceforge.net Sun May 30 03:26:48 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 03:26:53 2004 Subject: [Python-checkins] python/dist/src/Include setobject.h,2.3,2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv735/Include Modified Files: setobject.h Log Message: Make sets and deques weak referencable. Index: setobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/setobject.h,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -d -r2.3 -r2.4 *** setobject.h 24 Nov 2003 02:57:33 -0000 2.3 --- setobject.h 30 May 2004 07:26:45 -0000 2.4 *************** *** 16,19 **** --- 16,20 ---- PyObject *data; long hash; /* only used by frozenset objects */ + PyObject *weakreflist; /* List of weak references */ } PySetObject; From rhettinger at users.sourceforge.net Sun May 30 03:26:49 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 03:26:58 2004 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv735/Objects Modified Files: setobject.c Log Message: Make sets and deques weak referencable. Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** setobject.c 8 Mar 2004 18:31:10 -0000 1.22 --- setobject.c 30 May 2004 07:26:45 -0000 1.23 *************** *** 1,3 **** --- 1,4 ---- #include "Python.h" + #include "structmember.h" /* set object implementation *************** *** 62,65 **** --- 63,67 ---- so->data = data; so->hash = -1; + so->weakreflist = NULL; if (iterable != NULL) { *************** *** 114,117 **** --- 116,121 ---- { PyObject_GC_UnTrack(so); + if (so->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) so); Py_XDECREF(so->data); so->ob_type->tp_free(so); *************** *** 1010,1019 **** 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES | ! Py_TPFLAGS_BASETYPE, /* tp_flags */ set_doc, /* tp_doc */ (traverseproc)set_traverse, /* tp_traverse */ (inquiry)set_tp_clear, /* tp_clear */ (richcmpfunc)set_richcompare, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ (getiterfunc)set_iter, /* tp_iter */ 0, /* tp_iternext */ --- 1014,1023 ---- 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES | ! Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ set_doc, /* tp_doc */ (traverseproc)set_traverse, /* tp_traverse */ (inquiry)set_tp_clear, /* tp_clear */ (richcmpfunc)set_richcompare, /* tp_richcompare */ ! offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */ (getiterfunc)set_iter, /* tp_iter */ 0, /* tp_iternext */ *************** *** 1105,1114 **** 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES | ! Py_TPFLAGS_BASETYPE, /* tp_flags */ frozenset_doc, /* tp_doc */ (traverseproc)set_traverse, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)set_richcompare, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ (getiterfunc)set_iter, /* tp_iter */ 0, /* tp_iternext */ --- 1109,1118 ---- 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES | ! Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ frozenset_doc, /* tp_doc */ (traverseproc)set_traverse, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)set_richcompare, /* tp_richcompare */ ! offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */ (getiterfunc)set_iter, /* tp_iter */ 0, /* tp_iternext */ From rhettinger at users.sourceforge.net Sun May 30 03:26:49 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 03:27:01 2004 Subject: [Python-checkins] python/dist/src/Modules collectionsmodule.c, 1.15, 1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv735/Modules Modified Files: collectionsmodule.c Log Message: Make sets and deques weak referencable. Index: collectionsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/collectionsmodule.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** collectionsmodule.c 18 May 2004 18:15:03 -0000 1.15 --- collectionsmodule.c 30 May 2004 07:26:46 -0000 1.16 *************** *** 1,3 **** --- 1,4 ---- #include "Python.h" + #include "structmember.h" /* collections module implementation of a deque() datatype *************** *** 33,36 **** --- 34,38 ---- int rightindex; int len; + PyObject *weakreflist; /* List of weak references */ } dequeobject; *************** *** 59,62 **** --- 61,65 ---- deque->rightindex = BLOCKLEN / 2; deque->len = 0; + deque->weakreflist = NULL; return (PyObject *)deque; *************** *** 440,443 **** --- 443,448 ---- { PyObject_GC_UnTrack(deque); + if (deque->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) deque); if (deque->leftblock != NULL) { int err = deque_clear(deque); *************** *** 745,754 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ deque_doc, /* tp_doc */ (traverseproc)deque_traverse, /* tp_traverse */ (inquiry)deque_clear, /* tp_clear */ (richcmpfunc)deque_richcompare, /* tp_richcompare */ ! 0, /* tp_weaklistoffset*/ (getiterfunc)deque_iter, /* tp_iter */ 0, /* tp_iternext */ --- 750,760 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | ! Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ deque_doc, /* tp_doc */ (traverseproc)deque_traverse, /* tp_traverse */ (inquiry)deque_clear, /* tp_clear */ (richcmpfunc)deque_richcompare, /* tp_richcompare */ ! offsetof(dequeobject, weakreflist), /* tp_weaklistoffset*/ (getiterfunc)deque_iter, /* tp_iter */ 0, /* tp_iternext */ From rhettinger at users.sourceforge.net Sun May 30 03:26:51 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 03:27:05 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_deque.py, 1.11, 1.12 test_set.py, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv735/Lib/test Modified Files: test_deque.py test_set.py Log Message: Make sets and deques weak referencable. Index: test_deque.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_deque.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_deque.py 19 May 2004 08:20:08 -0000 1.11 --- test_deque.py 30 May 2004 07:26:47 -0000 1.12 *************** *** 2,5 **** --- 2,6 ---- import unittest from test import test_support + from weakref import proxy import copy import cPickle as pickle *************** *** 436,439 **** --- 437,446 ---- self.assertEqual(list(d), list(e)) + def test_weakref(self): + d = deque('gallahad') + p = proxy(d) + self.assertEqual(str(p), str(d)) + d = None + self.assertRaises(ReferenceError, str, p) #============================================================================== Index: test_set.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_set.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_set.py 12 Feb 2004 17:35:11 -0000 1.11 --- test_set.py 30 May 2004 07:26:47 -0000 1.12 *************** *** 1,4 **** --- 1,5 ---- import unittest from test import test_support + from weakref import proxy import operator import copy *************** *** 347,350 **** --- 348,358 ---- self.assert_(c not in self.s) + def test_weakref(self): + s = self.thetype('gallahad') + p = proxy(s) + self.assertEqual(str(p), str(s)) + s = None + self.assertRaises(ReferenceError, str, p) + class SetSubclass(set): pass From FDBBCLXXHGAmac199 at sgi.com Sun May 30 11:22:33 2004 From: FDBBCLXXHGAmac199 at sgi.com (Christy Noel) Date: Sun May 30 11:25:36 2004 Subject: [Python-checkins] The M.ortgage Information you wanted Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040530/9f66ad2f/attachment.html From vbaczhyypho at ah163.com Sun May 30 15:04:56 2004 From: vbaczhyypho at ah163.com (Ignacio Bolden) Date: Sun May 30 14:05:20 2004 Subject: [Python-checkins] University selection underway Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040530/cb6f043a/attachment.html From WSBHGVBSER at atheer.net.sa Sun May 30 17:00:26 2004 From: WSBHGVBSER at atheer.net.sa (Bernadine Hopper) Date: Sun May 30 16:08:23 2004 Subject: [Python-checkins] imagine if you had a diploma Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040530/c8ac945f/attachment.html From rhettinger at users.sourceforge.net Sun May 30 20:35:54 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 20:35:58 2004 Subject: [Python-checkins] python/dist/src/Include fileobject.h,2.34,2.35 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10541/Include Modified Files: fileobject.h Log Message: Add weakref support to array.array and file objects. Index: fileobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/fileobject.h,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** fileobject.h 7 Feb 2004 13:53:45 -0000 2.34 --- fileobject.h 31 May 2004 00:35:51 -0000 2.35 *************** *** 25,28 **** --- 25,29 ---- int f_skipnextlf; /* Skip next \n */ PyObject *f_encoding; + PyObject *weakreflist; /* List of weak references */ } PyFileObject; From rhettinger at users.sourceforge.net Sun May 30 20:35:54 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 20:36:03 2004 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.190,2.191 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10541/Objects Modified Files: fileobject.c Log Message: Add weakref support to array.array and file objects. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.190 retrieving revision 2.191 diff -C2 -d -r2.190 -r2.191 *** fileobject.c 4 Apr 2004 06:58:27 -0000 2.190 --- fileobject.c 31 May 2004 00:35:51 -0000 2.191 *************** *** 308,311 **** --- 308,313 ---- file_dealloc(PyFileObject *f) { + if (f->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) f); if (f->f_fp != NULL && f->f_close != NULL) { Py_BEGIN_ALLOW_THREADS *************** *** 1822,1825 **** --- 1824,1828 ---- Py_INCREF(Py_None); ((PyFileObject *)self)->f_encoding = Py_None; + ((PyFileObject *)self)->weakreflist = NULL; } return self; *************** *** 1943,1952 **** PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ file_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ (getiterfunc)file_getiter, /* tp_iter */ (iternextfunc)file_iternext, /* tp_iternext */ --- 1946,1955 ---- PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ file_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ ! offsetof(PyFileObject, weakreflist), /* tp_weaklistoffset */ (getiterfunc)file_getiter, /* tp_iter */ (iternextfunc)file_iternext, /* tp_iternext */ From rhettinger at users.sourceforge.net Sun May 30 20:35:55 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 20:36:06 2004 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.95,2.96 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10541/Modules Modified Files: arraymodule.c Log Message: Add weakref support to array.array and file objects. Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.95 retrieving revision 2.96 diff -C2 -d -r2.95 -r2.96 *** arraymodule.c 14 Mar 2004 05:43:59 -0000 2.95 --- arraymodule.c 31 May 2004 00:35:52 -0000 2.96 *************** *** 5,8 **** --- 5,9 ---- #include "Python.h" + #include "structmember.h" #ifdef STDC_HEADERS *************** *** 33,36 **** --- 34,38 ---- int allocated; struct arraydescr *ob_descr; + PyObject *weakreflist; /* List of weak references */ } arrayobject; *************** *** 443,446 **** --- 445,449 ---- op->ob_descr = descr; op->allocated = size; + op->weakreflist = NULL; return (PyObject *) op; } *************** *** 491,494 **** --- 494,499 ---- array_dealloc(arrayobject *op) { + if (op->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) op); if (op->ob_item != NULL) PyMem_DEL(op->ob_item); *************** *** 1951,1960 **** 0, /* tp_setattro */ &array_as_buffer, /* tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ arraytype_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ array_richcompare, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ (getiterfunc)array_iter, /* tp_iter */ 0, /* tp_iternext */ --- 1956,1965 ---- 0, /* tp_setattro */ &array_as_buffer, /* tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ arraytype_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ array_richcompare, /* tp_richcompare */ ! offsetof(arrayobject, weakreflist), /* tp_weaklistoffset */ (getiterfunc)array_iter, /* tp_iter */ 0, /* tp_iternext */ From rhettinger at users.sourceforge.net Sun May 30 20:35:55 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 20:36:10 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_array.py, 1.28, 1.29 test_file.py, 1.14, 1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10541/Lib/test Modified Files: test_array.py test_file.py Log Message: Add weakref support to array.array and file objects. Index: test_array.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** test_array.py 14 Mar 2004 05:43:58 -0000 1.28 --- test_array.py 31 May 2004 00:35:52 -0000 1.29 *************** *** 6,9 **** --- 6,10 ---- import unittest from test import test_support + from weakref import proxy import array, cStringIO, math *************** *** 615,618 **** --- 616,626 ---- self.assertEqual(b[0], a.tostring()[0]) + def test_weakref(self): + s = array.array(self.typecode, self.example) + p = proxy(s) + self.assertEqual(p.tostring(), s.tostring()) + s = None + self.assertRaises(ReferenceError, len, p) + def test_bug_782369(self): import sys *************** *** 625,628 **** --- 633,638 ---- self.assertEqual(rc, sys.getrefcount(10)) + + class StringTest(BaseTest): Index: test_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_file.py 4 Apr 2004 07:00:07 -0000 1.14 --- test_file.py 31 May 2004 00:35:52 -0000 1.15 *************** *** 2,9 **** --- 2,24 ---- import os from array import array + from weakref import proxy from test.test_support import verify, TESTFN, TestFailed from UserList import UserList + # verify weak references + f = file(TESTFN, 'w') + p = proxy(f) + p.write('teststring') + verify(f.tell(), p.tell()) + f.close() + f = None + try: + p.tell() + except ReferenceError: + pass + else: + raise TestFailed('file proxy still exists when the file is gone') + # verify expected attributes exist f = file(TESTFN, 'w') From rhettinger at users.sourceforge.net Sun May 30 23:09:28 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 23:09:32 2004 Subject: [Python-checkins] python/dist/src/Modules _sre.c, 2.104, 2.105 sre.h, 2.25, 2.26 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv432/Modules Modified Files: _sre.c sre.h Log Message: Add weakref support to sockets and re pattern objects. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.104 retrieving revision 2.105 diff -C2 -d -r2.104 -r2.105 *** _sre.c 14 Feb 2004 00:31:13 -0000 2.104 --- _sre.c 31 May 2004 03:09:24 -0000 2.105 *************** *** 1674,1677 **** --- 1674,1679 ---- self->indexgroup = indexgroup; + self->weakreflist = NULL; + return (PyObject*) self; } *************** *** 1986,1989 **** --- 1988,1993 ---- pattern_dealloc(PatternObject* self) { + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) self); Py_XDECREF(self->pattern); Py_XDECREF(self->groupindex); *************** *** 2633,2636 **** --- 2637,2641 ---- memcpy((char*) copy + offset, (char*) self + offset, sizeof(PatternObject) + self->codesize * sizeof(SRE_CODE) - offset); + copy->weakreflist = NULL; return (PyObject*) copy; *************** *** 2723,2727 **** (destructor)pattern_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)pattern_getattr /*tp_getattr*/ }; --- 2728,2750 ---- (destructor)pattern_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)pattern_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_HAVE_WEAKREFS, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! offsetof(PatternObject, weakreflist), /* tp_weaklistoffset */ }; Index: sre.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/sre.h,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -d -r2.25 -r2.26 *** sre.h 7 May 2004 07:18:13 -0000 2.25 --- sre.h 31 May 2004 03:09:24 -0000 2.26 *************** *** 30,33 **** --- 30,34 ---- PyObject* pattern; /* pattern source (or None) */ int flags; /* flags used when compiling pattern source */ + PyObject *weakreflist; /* List of weak references */ /* pattern code */ int codesize; From rhettinger at users.sourceforge.net Sun May 30 23:09:28 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 23:09:38 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libweakref.tex,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv432/Doc/lib Modified Files: libweakref.tex Log Message: Add weakref support to sockets and re pattern objects. Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** libweakref.tex 3 Feb 2004 20:55:15 -0000 1.24 --- libweakref.tex 31 May 2004 03:09:25 -0000 1.25 *************** *** 49,55 **** Not all objects can be weakly referenced; those objects which can include class instances, functions written in Python (but not in C), ! and methods (both bound and unbound). Extension types can easily ! be made to support weak references; see section \ref{weakref-extension}, ! ``Weak References in Extension Types,'' for more information. --- 49,69 ---- Not all objects can be weakly referenced; those objects which can include class instances, functions written in Python (but not in C), ! methods (both bound and unbound), sets, frozensets, file objects, ! sockets, arrays, deques, and regular expression pattern objects. ! \versionchanged[Added support for files, sockets, arrays, and patterns]{2.4} ! ! Several builtin types such as \class{list} and \class{dict} do not ! directly support weak references but can add support through subclassing: ! ! \begin{verbatim} ! class Dict(dict): ! pass ! ! obj = Dict(red=1, green=2, blue=3) # this object is weak referencable ! \end{verbatim} ! ! Extension types can easily be made to support weak references; see section ! \ref{weakref-extension}, ``Weak References in Extension Types,'' for more ! information. From rhettinger at users.sourceforge.net Sun May 30 23:09:28 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 23:09:40 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.976,1.977 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv432/Misc Modified Files: NEWS Log Message: Add weakref support to sockets and re pattern objects. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.976 retrieving revision 1.977 diff -C2 -d -r1.976 -r1.977 *** NEWS 24 May 2004 14:20:16 -0000 1.976 --- NEWS 31 May 2004 03:09:23 -0000 1.977 *************** *** 208,211 **** --- 208,214 ---- ----------------- + - the weakref module now supports additional objects: array.array, + sre.pattern_objects, file objects, and sockets. + - operator.isMappingType() and operator.isSequenceType() now give fewer false positives. From rhettinger at users.sourceforge.net Sun May 30 23:09:29 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 23:09:44 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_re.py, 1.49, 1.50 test_socket.py, 1.68, 1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv432/Lib/test Modified Files: test_re.py test_socket.py Log Message: Add weakref support to sockets and re pattern objects. Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** test_re.py 7 May 2004 07:18:12 -0000 1.49 --- test_re.py 31 May 2004 03:09:25 -0000 1.50 *************** *** 6,9 **** --- 6,10 ---- from sre import Scanner import sys, os, traceback + from weakref import proxy # Misc tests from Tim Peters' re.doc *************** *** 16,19 **** --- 17,27 ---- class ReTests(unittest.TestCase): + + def test_weakref(self): + s = 'QabbbcR' + x = re.compile('ab+c') + y = proxy(x) + self.assertEqual(x.findall('QabbbcR'), y.findall('QabbbcR')) + def test_search_star_plus(self): self.assertEqual(re.search('x*', 'axx').span(0), (0, 0)) Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** test_socket.py 28 Mar 2004 02:20:45 -0000 1.68 --- test_socket.py 31 May 2004 03:09:25 -0000 1.69 *************** *** 10,13 **** --- 10,14 ---- import Queue import sys + from weakref import proxy PORT = 50007 *************** *** 192,195 **** --- 193,209 ---- class GeneralModuleTests(unittest.TestCase): + def test_weakref(self): + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + p = proxy(s) + self.assertEqual(p.fileno(), s.fileno()) + s.close() + s = None + try: + p.fileno() + except ReferenceError: + pass + else: + self.fail('Socket proxy still exists') + def testSocketError(self): # Testing socket module exceptions From rhettinger at users.sourceforge.net Sun May 30 23:09:56 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 23:10:00 2004 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv432/Lib Modified Files: socket.py Log Message: Add weakref support to sockets and re pattern objects. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** socket.py 28 Mar 2004 02:20:44 -0000 1.43 --- socket.py 31 May 2004 03:09:22 -0000 1.44 *************** *** 148,152 **** __doc__ = _realsocket.__doc__ ! __slots__ = ["_sock", "send", "recv", "sendto", "recvfrom"] def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, _sock=None): --- 148,153 ---- __doc__ = _realsocket.__doc__ ! __slots__ = ["_sock", "send", "recv", "sendto", "recvfrom", ! "__weakref__"] def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, _sock=None): From rhettinger at users.sourceforge.net Sun May 30 23:15:05 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun May 30 23:15:14 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.47, 1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1425 Modified Files: whatsnew24.tex Log Message: Add weakref support to sockets and re pattern objects. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** whatsnew24.tex 20 May 2004 22:59:26 -0000 1.47 --- whatsnew24.tex 31 May 2004 03:15:02 -0000 1.48 *************** *** 559,562 **** --- 559,566 ---- regular expression pattern \var{A} will be tested against the string; if the group didn't match, the pattern \var{B} will be used instead. + + \item The \module{weakref} module now supports a wider variety of objects + including Python functions, class instances, sets, frozensets, deques, + arrays, files, sockets, and regular expression pattern objects. \end{itemize} From wordzy at 163.com Mon May 31 08:13:01 2004 From: wordzy at 163.com (Percy Posey) Date: Mon May 31 10:15:39 2004 Subject: [Python-checkins] Unbeatable prices - Get yours now monologist delusion grail i'll Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040531/6efdd39a/attachment.html From doerwalter at users.sourceforge.net Mon May 31 11:12:32 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon May 31 11:12:36 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils filelist.py, 1.15, 1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21393/Lib/distutils Modified Files: filelist.py Log Message: Fix typo (from SF bug #962602) Index: filelist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/filelist.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** filelist.py 19 Nov 2002 13:12:27 -0000 1.15 --- filelist.py 31 May 2004 15:12:27 -0000 1.16 *************** *** 167,171 **** for pattern in patterns: if not self.include_pattern(pattern, prefix=dir): ! log.warn(("warngin: no files found matching '%s' " + "under directory '%s'"), pattern, dir) --- 167,171 ---- for pattern in patterns: if not self.include_pattern(pattern, prefix=dir): ! log.warn(("warning: no files found matching '%s' " + "under directory '%s'"), pattern, dir) From doerwalter at users.sourceforge.net Mon May 31 12:29:08 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon May 31 12:29:12 2004 Subject: [Python-checkins] python/dist/src/Lib/test/output test_types, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3029/Lib/test/output Modified Files: test_types Log Message: Port the dictionary tests from test_types.py to unittest. Collect as much mapping tests as possible in mapping_test.py and reuse the tests in test_dict.py, test_userdict.py, test_weakref.py, test_os.py and test_shelve.py. >From SF patch #736962. Index: test_types =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_types,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_types 8 Dec 2003 11:38:45 -0000 1.3 --- test_types 31 May 2004 16:29:04 -0000 1.4 *************** *** 12,15 **** 6.5.2 Tuples [see test_tuple.py] 6.5.3 Lists [see test_list.py] ! 6.6 Mappings == Dictionaries Buffers --- 12,15 ---- 6.5.2 Tuples [see test_tuple.py] 6.5.3 Lists [see test_list.py] ! 6.6 Mappings == Dictionaries [see test_dict.py] Buffers From doerwalter at users.sourceforge.net Mon May 31 12:29:09 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon May 31 12:29:18 2004 Subject: [Python-checkins] python/dist/src/Lib/test mapping_tests.py, NONE, 1.1 test_os.py, 1.21, 1.22 test_shelve.py, 1.6, 1.7 test_types.py, 1.59, 1.60 test_userdict.py, 1.18, 1.19 test_weakref.py, 1.38, 1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3029/Lib/test Modified Files: test_os.py test_shelve.py test_types.py test_userdict.py test_weakref.py Added Files: mapping_tests.py Log Message: Port the dictionary tests from test_types.py to unittest. Collect as much mapping tests as possible in mapping_test.py and reuse the tests in test_dict.py, test_userdict.py, test_weakref.py, test_os.py and test_shelve.py. >From SF patch #736962. --- NEW FILE: mapping_tests.py --- # tests common to dict and UserDict import unittest import UserDict class BasicTestMappingProtocol(unittest.TestCase): # This base class can be used to check that an object conforms to the # mapping protocol # Functions that can be useful to override to adapt to dictionary # semantics _tested_class = None # which class is being tested (overwrite in subclasses) def _reference(self): """Return a dictionary of values which are invariant by storage in the object under test.""" return {1:2, "key1":"value1", "key2":(1,2,3)} def _empty_mapping(self): """Return an empty mapping object""" return self._tested_class() def _full_mapping(self, data): """Return a mapping object with the value contained in data dictionary""" x = self._empty_mapping() for key, value in data.items(): x[key] = value return x def __init__(self, *args, **kw): unittest.TestCase.__init__(self, *args, **kw) self.reference = self._reference().copy() # A (key, value) pair not in the mapping key, value = self.reference.popitem() self.other = {key:value} # A (key, value) pair in the mapping key, value = self.reference.popitem() self.inmapping = {key:value} self.reference[key] = value def test_read(self): # Test for read only operations on mapping p = self._empty_mapping() p1 = dict(p) #workaround for singleton objects d = self._full_mapping(self.reference) if d is p: p = p1 #Indexing for key, value in self.reference.items(): self.assertEqual(d[key], value) knownkey = self.other.keys()[0] self.failUnlessRaises(KeyError, lambda:d[knownkey]) #len self.assertEqual(len(p), 0) self.assertEqual(len(d), len(self.reference)) #has_key for k in self.reference: self.assert_(d.has_key(k)) self.assert_(k in d) for k in self.other: self.failIf(d.has_key(k)) self.failIf(k in d) #cmp self.assertEqual(cmp(p,p), 0) self.assertEqual(cmp(d,d), 0) self.assertEqual(cmp(p,d), -1) self.assertEqual(cmp(d,p), 1) #__non__zero__ if p: self.fail("Empty mapping must compare to False") if not d: self.fail("Full mapping must compare to True") # keys(), items(), iterkeys() ... def check_iterandlist(iter, lst, ref): self.assert_(hasattr(iter, 'next')) self.assert_(hasattr(iter, '__iter__')) x = list(iter) self.assert_(set(x)==set(lst)==set(ref)) check_iterandlist(d.iterkeys(), d.keys(), self.reference.keys()) check_iterandlist(iter(d), d.keys(), self.reference.keys()) check_iterandlist(d.itervalues(), d.values(), self.reference.values()) check_iterandlist(d.iteritems(), d.items(), self.reference.items()) #get key, value = d.iteritems().next() knownkey, knownvalue = self.other.iteritems().next() self.assertEqual(d.get(key, knownvalue), value) self.assertEqual(d.get(knownkey, knownvalue), knownvalue) self.failIf(knownkey in d) def test_write(self): # Test for write operations on mapping p = self._empty_mapping() #Indexing for key, value in self.reference.items(): p[key] = value self.assertEqual(p[key], value) for key in self.reference.keys(): del p[key] self.failUnlessRaises(KeyError, lambda:p[key]) p = self._empty_mapping() #update p.update(self.reference) self.assertEqual(dict(p), self.reference) items = p.items() p = self._empty_mapping() p.update(items) self.assertEqual(dict(p), self.reference) d = self._full_mapping(self.reference) #setdefault key, value = d.iteritems().next() knownkey, knownvalue = self.other.iteritems().next() self.assertEqual(d.setdefault(key, knownvalue), value) self.assertEqual(d[key], value) self.assertEqual(d.setdefault(knownkey, knownvalue), knownvalue) self.assertEqual(d[knownkey], knownvalue) #pop self.assertEqual(d.pop(knownkey), knownvalue) self.failIf(knownkey in d) self.assertRaises(KeyError, d.pop, knownkey) default = 909 d[knownkey] = knownvalue self.assertEqual(d.pop(knownkey, default), knownvalue) self.failIf(knownkey in d) self.assertEqual(d.pop(knownkey, default), default) #popitem key, value = d.popitem() self.failIf(key in d) self.assertEqual(value, self.reference[key]) p=self._empty_mapping() self.assertRaises(KeyError, p.popitem) def test_constructor(self): self.assertEqual(self._empty_mapping(), self._empty_mapping()) def test_bool(self): self.assert_(not self._empty_mapping()) self.assert_(self.reference) self.assert_(bool(self._empty_mapping()) is False) self.assert_(bool(self.reference) is True) def test_keys(self): d = self._empty_mapping() self.assertEqual(d.keys(), []) d = self.reference self.assert_(self.inmapping.keys()[0] in d.keys()) self.assert_(self.other.keys()[0] not in d.keys()) self.assertRaises(TypeError, d.keys, None) def test_values(self): d = self._empty_mapping() self.assertEqual(d.values(), []) self.assertRaises(TypeError, d.values, None) def test_items(self): d = self._empty_mapping() self.assertEqual(d.items(), []) self.assertRaises(TypeError, d.items, None) def test_len(self): d = self._empty_mapping() self.assertEqual(len(d), 0) def test_getitem(self): d = self.reference self.assertEqual(d[self.inmapping.keys()[0]], self.inmapping.values()[0]) self.assertRaises(TypeError, d.__getitem__) def test_update(self): # mapping argument d = self._empty_mapping() d.update(self.other) self.assertEqual(d.items(), self.other.items()) # No argument d = self._empty_mapping() d.update() self.assertEqual(d, self._empty_mapping()) # item sequence d = self._empty_mapping() d.update(self.other.items()) self.assertEqual(d.items(), self.other.items()) # Iterator d = self._empty_mapping() d.update(self.other.iteritems()) self.assertEqual(d.items(), self.other.items()) # FIXME: Doesn't work with UserDict # self.assertRaises((TypeError, AttributeError), d.update, None) self.assertRaises((TypeError, AttributeError), d.update, 42) outerself = self class SimpleUserDict: def __init__(self): self.d = outerself.reference def keys(self): return self.d.keys() def __getitem__(self, i): return self.d[i] d.clear() d.update(SimpleUserDict()) i1 = d.items() i2 = self.reference.items() i1.sort() i2.sort() self.assertEqual(i1, i2) class Exc(Exception): pass d = self._empty_mapping() class FailingUserDict: def keys(self): raise Exc self.assertRaises(Exc, d.update, FailingUserDict()) d.clear() class FailingUserDict: def keys(self): class BogonIter: def __init__(self): self.i = 1 def __iter__(self): return self def next(self): if self.i: self.i = 0 return 'a' raise Exc return BogonIter() def __getitem__(self, key): return key self.assertRaises(Exc, d.update, FailingUserDict()) class FailingUserDict: def keys(self): class BogonIter: def __init__(self): self.i = ord('a') def __iter__(self): return self def next(self): if self.i <= ord('z'): rtn = chr(self.i) self.i += 1 return rtn raise StopIteration return BogonIter() def __getitem__(self, key): raise Exc self.assertRaises(Exc, d.update, FailingUserDict()) d = self._empty_mapping() class badseq(object): def __iter__(self): return self def next(self): raise Exc() self.assertRaises(Exc, d.update, badseq()) self.assertRaises(ValueError, d.update, [(1, 2, 3)]) # no test_fromkeys or test_copy as both os.environ and selves don't support it def test_get(self): d = self._empty_mapping() self.assert_(d.get(self.other.keys()[0]) is None) self.assertEqual(d.get(self.other.keys()[0], 3), 3) d = self.reference self.assert_(d.get(self.other.keys()[0]) is None) self.assertEqual(d.get(self.other.keys()[0], 3), 3) self.assertEqual(d.get(self.inmapping.keys()[0]), self.inmapping.values()[0]) self.assertEqual(d.get(self.inmapping.keys()[0], 3), self.inmapping.values()[0]) self.assertRaises(TypeError, d.get) self.assertRaises(TypeError, d.get, None, None, None) def test_setdefault(self): d = self._empty_mapping() self.assertRaises(TypeError, d.setdefault) def test_popitem(self): d = self._empty_mapping() self.assertRaises(KeyError, d.popitem) self.assertRaises(TypeError, d.popitem, 42) def test_pop(self): d = self._empty_mapping() k, v = self.inmapping.items()[0] d[k] = v self.assertRaises(KeyError, d.pop, self.other.keys()[0]) self.assertEqual(d.pop(k), v) self.assertEqual(len(d), 0) self.assertRaises(KeyError, d.pop, k) class TestMappingProtocol(BasicTestMappingProtocol): def test_constructor(self): BasicTestMappingProtocol.test_constructor(self) self.assert_(self._empty_mapping() is not self._empty_mapping()) self.assertEqual(self._tested_class(x=1, y=2), {"x": 1, "y": 2}) def test_bool(self): BasicTestMappingProtocol.test_bool(self) self.assert_(not self._empty_mapping()) self.assert_(self._full_mapping({"x": "y"})) self.assert_(bool(self._empty_mapping()) is False) self.assert_(bool(self._full_mapping({"x": "y"})) is True) def test_keys(self): BasicTestMappingProtocol.test_keys(self) d = self._empty_mapping() self.assertEqual(d.keys(), []) d = self._full_mapping({'a': 1, 'b': 2}) k = d.keys() self.assert_('a' in k) self.assert_('b' in k) self.assert_('c' not in k) def test_values(self): BasicTestMappingProtocol.test_values(self) d = self._full_mapping({1:2}) self.assertEqual(d.values(), [2]) def test_items(self): BasicTestMappingProtocol.test_items(self) d = self._full_mapping({1:2}) self.assertEqual(d.items(), [(1, 2)]) def test_has_key(self): d = self._empty_mapping() self.assert_(not d.has_key('a')) d = self._full_mapping({'a': 1, 'b': 2}) k = d.keys() k.sort() self.assertEqual(k, ['a', 'b']) self.assertRaises(TypeError, d.has_key) def test_contains(self): d = self._empty_mapping() self.assert_(not ('a' in d)) self.assert_('a' not in d) d = self._full_mapping({'a': 1, 'b': 2}) self.assert_('a' in d) self.assert_('b' in d) self.assert_('c' not in d) self.assertRaises(TypeError, d.__contains__) def test_len(self): BasicTestMappingProtocol.test_len(self) d = self._full_mapping({'a': 1, 'b': 2}) self.assertEqual(len(d), 2) def test_getitem(self): BasicTestMappingProtocol.test_getitem(self) d = self._full_mapping({'a': 1, 'b': 2}) self.assertEqual(d['a'], 1) self.assertEqual(d['b'], 2) d['c'] = 3 d['a'] = 4 self.assertEqual(d['c'], 3) self.assertEqual(d['a'], 4) del d['b'] self.assertEqual(d, {'a': 4, 'c': 3}) self.assertRaises(TypeError, d.__getitem__) def test_clear(self): d = self._full_mapping({1:1, 2:2, 3:3}) d.clear() self.assertEqual(d, {}) self.assertRaises(TypeError, d.clear, None) def test_update(self): BasicTestMappingProtocol.test_update(self) # mapping argument d = self._empty_mapping() d.update({1:100}) d.update({2:20}) d.update({1:1, 2:2, 3:3}) self.assertEqual(d, {1:1, 2:2, 3:3}) # no argument d.update() self.assertEqual(d, {1:1, 2:2, 3:3}) # keyword arguments d = self._empty_mapping() d.update(x=100) d.update(y=20) d.update(x=1, y=2, z=3) self.assertEqual(d, {"x":1, "y":2, "z":3}) # item sequence d = self._empty_mapping() d.update([("x", 100), ("y", 20)]) self.assertEqual(d, {"x":100, "y":20}) # Both item sequence and keyword arguments d = self._empty_mapping() d.update([("x", 100), ("y", 20)], x=1, y=2) self.assertEqual(d, {"x":1, "y":2}) # iterator d = self._full_mapping({1:3, 2:4}) d.update(self._full_mapping({1:2, 3:4, 5:6}).iteritems()) self.assertEqual(d, {1:2, 2:4, 3:4, 5:6}) class SimpleUserDict: def __init__(self): self.d = {1:1, 2:2, 3:3} def keys(self): return self.d.keys() def __getitem__(self, i): return self.d[i] d.clear() d.update(SimpleUserDict()) self.assertEqual(d, {1:1, 2:2, 3:3}) def test_fromkeys(self): self.assertEqual(self._tested_class.fromkeys('abc'), {'a':None, 'b':None, 'c':None}) d = self._empty_mapping() self.assert_(not(d.fromkeys('abc') is d)) self.assertEqual(d.fromkeys('abc'), {'a':None, 'b':None, 'c':None}) self.assertEqual(d.fromkeys((4,5),0), {4:0, 5:0}) self.assertEqual(d.fromkeys([]), {}) def g(): yield 1 self.assertEqual(d.fromkeys(g()), {1:None}) self.assertRaises(TypeError, {}.fromkeys, 3) class dictlike(self._tested_class): pass self.assertEqual(dictlike.fromkeys('a'), {'a':None}) self.assertEqual(dictlike().fromkeys('a'), {'a':None}) self.assert_(dictlike.fromkeys('a').__class__ is dictlike) self.assert_(dictlike().fromkeys('a').__class__ is dictlike) # FIXME: the following won't work with UserDict, because it's an old style class # self.assert_(type(dictlike.fromkeys('a')) is dictlike) class mydict(self._tested_class): def __new__(cls): return UserDict.UserDict() ud = mydict.fromkeys('ab') self.assertEqual(ud, {'a':None, 'b':None}) # FIXME: the following won't work with UserDict, because it's an old style class # self.assert_(isinstance(ud, UserDict.UserDict)) self.assertRaises(TypeError, dict.fromkeys) class Exc(Exception): pass class baddict1(self._tested_class): def __init__(self): raise Exc() self.assertRaises(Exc, baddict1.fromkeys, [1]) class BadSeq(object): def __iter__(self): return self def next(self): raise Exc() self.assertRaises(Exc, self._tested_class.fromkeys, BadSeq()) class baddict2(self._tested_class): def __setitem__(self, key, value): raise Exc() self.assertRaises(Exc, baddict2.fromkeys, [1]) def test_copy(self): d = self._full_mapping({1:1, 2:2, 3:3}) self.assertEqual(d.copy(), {1:1, 2:2, 3:3}) d = self._empty_mapping() self.assertEqual(d.copy(), d) self.assert_(isinstance(d.copy(), d.__class__)) self.assertRaises(TypeError, d.copy, None) def test_get(self): BasicTestMappingProtocol.test_get(self) d = self._empty_mapping() self.assert_(d.get('c') is None) self.assertEqual(d.get('c', 3), 3) d = self._full_mapping({'a' : 1, 'b' : 2}) self.assert_(d.get('c') is None) self.assertEqual(d.get('c', 3), 3) self.assertEqual(d.get('a'), 1) self.assertEqual(d.get('a', 3), 1) def test_setdefault(self): BasicTestMappingProtocol.test_setdefault(self) d = self._empty_mapping() self.assert_(d.setdefault('key0') is None) d.setdefault('key0', []) self.assert_(d.setdefault('key0') is None) d.setdefault('key', []).append(3) self.assertEqual(d['key'][0], 3) d.setdefault('key', []).append(4) self.assertEqual(len(d['key']), 2) def test_popitem(self): BasicTestMappingProtocol.test_popitem(self) for copymode in -1, +1: # -1: b has same structure as a # +1: b is a.copy() for log2size in range(12): size = 2**log2size a = self._empty_mapping() b = self._empty_mapping() for i in range(size): a[repr(i)] = i if copymode < 0: b[repr(i)] = i if copymode > 0: b = a.copy() for i in range(size): ka, va = ta = a.popitem() self.assertEqual(va, int(ka)) kb, vb = tb = b.popitem() self.assertEqual(vb, int(kb)) self.assert_(not(copymode < 0 and ta != tb)) self.assert_(not a) self.assert_(not b) def test_pop(self): BasicTestMappingProtocol.test_pop(self) # Tests for pop with specified key d = self._empty_mapping() k, v = 'abc', 'def' # verify longs/ints get same value when key > 32 bits (for 64-bit archs) # see SF bug #689659 x = 4503599627370496L y = 4503599627370496 h = self._full_mapping({x: 'anything', y: 'something else'}) self.assertEqual(h[x], h[y]) self.assertEqual(d.pop(k, v), v) d[k] = v self.assertEqual(d.pop(k, 1), v) class TestHashMappingProtocol(TestMappingProtocol): def test_getitem(self): TestMappingProtocol.test_getitem(self) class Exc(Exception): pass class BadEq(object): def __eq__(self, other): raise Exc() d = self._empty_mapping() d[BadEq()] = 42 self.assertRaises(KeyError, d.__getitem__, 23) class BadHash(object): fail = False def __hash__(self): if self.fail: raise Exc() else: return 42 d = self._empty_mapping() x = BadHash() d[x] = 42 x.fail = True self.assertRaises(Exc, d.__getitem__, x) def test_fromkeys(self): TestMappingProtocol.test_fromkeys(self) class mydict(self._tested_class): def __new__(cls): return UserDict.UserDict() ud = mydict.fromkeys('ab') self.assertEqual(ud, {'a':None, 'b':None}) self.assert_(isinstance(ud, UserDict.UserDict)) def test_pop(self): TestMappingProtocol.test_pop(self) class Exc(Exception): pass class BadHash(object): fail = False def __hash__(self): if self.fail: raise Exc() else: return 42 d = self._empty_mapping() x = BadHash() d[x] = 42 x.fail = True self.assertRaises(Exc, d.pop, x) def test_mutatingiteration(self): d = self._empty_mapping() d[1] = 1 try: for i in d: d[i+1] = 1 except RuntimeError: pass else: self.fail("changing dict size during iteration doesn't raise Error") def test_repr(self): d = self._empty_mapping() self.assertEqual(repr(d), '{}') d[1] = 2 self.assertEqual(repr(d), '{1: 2}') d = self._empty_mapping() d[1] = d self.assertEqual(repr(d), '{1: {...}}') class Exc(Exception): pass class BadRepr(object): def __repr__(self): raise Exc() d = self._full_mapping({1: BadRepr()}) self.assertRaises(Exc, repr, d) def test_le(self): self.assert_(not (self._empty_mapping() < self._empty_mapping())) self.assert_(not (self._full_mapping({1: 2}) < self._full_mapping({1L: 2L}))) class Exc(Exception): pass class BadCmp(object): def __eq__(self, other): raise Exc() d1 = self._full_mapping({BadCmp(): 1}) d2 = self._full_mapping({1: 1}) try: d1 < d2 except Exc: pass else: self.fail("< didn't raise Exc") def test_setdefault(self): TestMappingProtocol.test_setdefault(self) class Exc(Exception): pass class BadHash(object): fail = False def __hash__(self): if self.fail: raise Exc() else: return 42 d = self._empty_mapping() x = BadHash() d[x] = 42 x.fail = True self.assertRaises(Exc, d.setdefault, x, []) Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** test_os.py 18 Jan 2004 20:29:55 -0000 1.21 --- test_os.py 31 May 2004 16:29:04 -0000 1.22 *************** *** 206,212 **** pass ! from test_userdict import TestMappingProtocol ! class EnvironTests(TestMappingProtocol): """check that os.environ object conform to mapping protocol""" _tested_class = None --- 206,212 ---- pass ! from test import mapping_tests ! class EnvironTests(mapping_tests.BasicTestMappingProtocol): """check that os.environ object conform to mapping protocol""" _tested_class = None Index: test_shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shelve.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_shelve.py 10 May 2003 07:36:55 -0000 1.6 --- test_shelve.py 31 May 2004 16:29:04 -0000 1.7 *************** *** 75,86 **** ! from test_userdict import TestMappingProtocol ! class TestShelveBase(TestMappingProtocol): fn = "shelftemp.db" counter = 0 def __init__(self, *args, **kw): self._db = [] ! TestMappingProtocol.__init__(self, *args, **kw) _tested_class = shelve.Shelf def _reference(self): --- 75,86 ---- ! from test import mapping_tests ! class TestShelveBase(mapping_tests.BasicTestMappingProtocol): fn = "shelftemp.db" counter = 0 def __init__(self, *args, **kw): self._db = [] ! mapping_tests.BasicTestMappingProtocol.__init__(self, *args, **kw) _tested_class = shelve.Shelf def _reference(self): Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** test_types.py 4 Mar 2004 08:25:44 -0000 1.59 --- test_types.py 31 May 2004 16:29:04 -0000 1.60 *************** *** 11,15 **** if 0.0: raise TestFailed, '0.0 is true instead of false' if '': raise TestFailed, '\'\' is true instead of false' - if {}: raise TestFailed, '{} is true instead of false' if not 1: raise TestFailed, '1 is false instead of true' if not 1L: raise TestFailed, '1L is false instead of true' --- 11,14 ---- *************** *** 216,446 **** print '6.5.3 Lists [see test_list.py]' - print '6.6 Mappings == Dictionaries' - # calling built-in types without argument must return empty - if dict() != {}: raise TestFailed,'dict() does not return {}' - d = {} - if d.keys() != []: raise TestFailed, '{}.keys()' - if d.values() != []: raise TestFailed, '{}.values()' - if d.items() != []: raise TestFailed, '{}.items()' - 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} - if len(d) != 2: raise TestFailed, 'len(dict)' - k = d.keys() - k.sort() - if k != ['a', 'b']: raise TestFailed, 'dict keys()' - 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 - d['a'] = 4 - if d['c'] != 3 or d['a'] != 4: raise TestFailed, 'dict item assignment' - del d['b'] - if d != {'a': 4, 'c': 3}: raise TestFailed, 'dict item deletion' - # dict.clear() - d = {1:1, 2:2, 3:3} - d.clear() - if d != {}: raise TestFailed, 'dict clear' - # dict.update() - d.update({1:100}) - d.update({2:20}) - d.update({1:1, 2:2, 3:3}) - if d != {1:1, 2:2, 3:3}: raise TestFailed, 'dict update' - d.clear() - try: d.update(None) - except (TypeError, AttributeError): pass - else: raise TestFailed, 'dict.update(None), AttributeError expected' - class SimpleUserDict: - def __init__(self): - self.d = {1:1, 2:2, 3:3} - def keys(self): - return self.d.keys() - def __getitem__(self, i): - return self.d[i] - d.update(SimpleUserDict()) - if d != {1:1, 2:2, 3:3}: raise TestFailed, 'dict.update(instance)' - d.clear() - class FailingUserDict: - def keys(self): - raise ValueError - try: d.update(FailingUserDict()) - except ValueError: pass - else: raise TestFailed, 'dict.keys() expected ValueError' - class FailingUserDict: - def keys(self): - class BogonIter: - def __iter__(self): - raise ValueError - return BogonIter() - try: d.update(FailingUserDict()) - except ValueError: pass - else: raise TestFailed, 'iter(dict.keys()) expected ValueError' - class FailingUserDict: - def keys(self): - class BogonIter: - def __init__(self): - self.i = 1 - def __iter__(self): - return self - def next(self): - if self.i: - self.i = 0 - return 'a' - raise ValueError - return BogonIter() - def __getitem__(self, key): - return key - try: d.update(FailingUserDict()) - except ValueError: pass - else: raise TestFailed, 'iter(dict.keys()).next() expected ValueError' - class FailingUserDict: - def keys(self): - class BogonIter: - def __init__(self): - self.i = ord('a') - def __iter__(self): - return self - def next(self): - if self.i <= ord('z'): - rtn = chr(self.i) - self.i += 1 - return rtn - raise StopIteration - return BogonIter() - def __getitem__(self, key): - raise ValueError - try: d.update(FailingUserDict()) - except ValueError: pass - else: raise TestFailed, 'dict.update(), __getitem__ expected ValueError' - # dict.fromkeys() - if dict.fromkeys('abc') != {'a':None, 'b':None, 'c':None}: - raise TestFailed, 'dict.fromkeys did not work as a class method' - d = {} - if d.fromkeys('abc') is d: - raise TestFailed, 'dict.fromkeys did not return a new dict' - if d.fromkeys('abc') != {'a':None, 'b':None, 'c':None}: - raise TestFailed, 'dict.fromkeys failed with default value' - if d.fromkeys((4,5),0) != {4:0, 5:0}: - raise TestFailed, 'dict.fromkeys failed with specified value' - if d.fromkeys([]) != {}: - raise TestFailed, 'dict.fromkeys failed with null sequence' - def g(): - yield 1 - if d.fromkeys(g()) != {1:None}: - raise TestFailed, 'dict.fromkeys failed with a generator' - try: {}.fromkeys(3) - except TypeError: pass - else: raise TestFailed, 'dict.fromkeys failed to raise TypeError' - class dictlike(dict): pass - if dictlike.fromkeys('a') != {'a':None}: - raise TestFailed, 'dictsubclass.fromkeys did not inherit' - if dictlike().fromkeys('a') != {'a':None}: - raise TestFailed, 'dictsubclass.fromkeys did not inherit' - if type(dictlike.fromkeys('a')) is not dictlike: - raise TestFailed, 'dictsubclass.fromkeys created wrong type' - if type(dictlike().fromkeys('a')) is not dictlike: - raise TestFailed, 'dictsubclass.fromkeys created wrong type' - from UserDict import UserDict - class mydict(dict): - def __new__(cls): - return UserDict() - ud = mydict.fromkeys('ab') - if ud != {'a':None, 'b':None} or not isinstance(ud,UserDict): - raise TestFailed, 'fromkeys did not instantiate using __new__' - # dict.copy() - d = {1:1, 2:2, 3:3} - if d.copy() != {1:1, 2:2, 3:3}: raise TestFailed, 'dict copy' - if {}.copy() != {}: raise TestFailed, 'empty dict copy' - # dict.get() - d = {} - if d.get('c') is not None: raise TestFailed, 'missing {} get, no 2nd arg' - if d.get('c', 3) != 3: raise TestFailed, 'missing {} get, w/ 2nd arg' - d = {'a' : 1, 'b' : 2} - if d.get('c') is not None: raise TestFailed, 'missing dict get, no 2nd arg' - if d.get('c', 3) != 3: raise TestFailed, 'missing dict get, w/ 2nd arg' - if d.get('a') != 1: raise TestFailed, 'present dict get, no 2nd arg' - if d.get('a', 3) != 1: raise TestFailed, 'present dict get, w/ 2nd arg' - # dict.setdefault() - d = {} - if d.setdefault('key0') is not None: - raise TestFailed, 'missing {} setdefault, no 2nd arg' - if d.setdefault('key0') is not None: - raise TestFailed, 'present {} setdefault, no 2nd arg' - d.setdefault('key', []).append(3) - if d['key'][0] != 3: - raise TestFailed, 'missing {} setdefault, w/ 2nd arg' - d.setdefault('key', []).append(4) - if len(d['key']) != 2: - raise TestFailed, 'present {} setdefault, w/ 2nd arg' - # dict.popitem() - for copymode in -1, +1: - # -1: b has same structure as a - # +1: b is a.copy() - for log2size in range(12): - size = 2**log2size - a = {} - b = {} - for i in range(size): - a[repr(i)] = i - if copymode < 0: - b[repr(i)] = i - if copymode > 0: - b = a.copy() - for i in range(size): - ka, va = ta = a.popitem() - if va != int(ka): raise TestFailed, "a.popitem: %s" % str(ta) - kb, vb = tb = b.popitem() - if vb != int(kb): raise TestFailed, "b.popitem: %s" % str(tb) - if copymode < 0 and ta != tb: - raise TestFailed, "a.popitem != b.popitem: %s, %s" % ( - str(ta), str(tb)) - if a: raise TestFailed, 'a not empty after popitems: %s' % str(a) - if b: raise TestFailed, 'b not empty after popitems: %s' % str(b) - - d.clear() - try: d.popitem() - except KeyError: pass - else: raise TestFailed, "{}.popitem doesn't raise KeyError" - - # Tests for pop with specified key - d.clear() - k, v = 'abc', 'def' - d[k] = v - try: d.pop('ghi') - except KeyError: pass - else: raise TestFailed, "{}.pop(k) doesn't raise KeyError when k not in dictionary" - - if d.pop(k) != v: raise TestFailed, "{}.pop(k) doesn't find known key/value pair" - if len(d) > 0: raise TestFailed, "{}.pop(k) failed to remove the specified pair" - - try: d.pop(k) - except KeyError: pass - else: raise TestFailed, "{}.pop(k) doesn't raise KeyError when dictionary is empty" - - # verify longs/ints get same value when key > 32 bits (for 64-bit archs) - # see SF bug #689659 - x = 4503599627370496L - y = 4503599627370496 - h = {x: 'anything', y: 'something else'} - if h[x] != h[y]: - raise TestFailed, "long/int key should match" - - if d.pop(k, v) != v: raise TestFailed, "{}.pop(k, v) doesn't return default value" - d[k] = v - if d.pop(k, 1) != v: raise TestFailed, "{}.pop(k, v) doesn't find known key/value pair" - - d[1] = 1 - try: - for i in d: - d[i+1] = 1 - except RuntimeError: - pass - else: - raise TestFailed, "changing dict size during iteration doesn't raise Error" try: type(1, 2) --- 215,220 ---- print '6.5.3 Lists [see test_list.py]' + print '6.6 Mappings == Dictionaries [see test_dict.py]' try: type(1, 2) Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_userdict.py 4 Mar 2004 08:25:44 -0000 1.18 --- test_userdict.py 31 May 2004 16:29:04 -0000 1.19 *************** *** 1,125 **** # Check every path through every method of UserDict ! import test.test_support, unittest import UserDict - class TestMappingProtocol(unittest.TestCase): - # This base class can be used to check that an object conforms to the - # mapping protocol - - # Functions that can be useful to override to adapt to dictionary - # semantics - _tested_class = dict # which class is being tested - - def _reference(self): - """Return a dictionary of values which are invariant by storage - in the object under test.""" - return {1:2, "key1":"value1", "key2":(1,2,3)} - def _empty_mapping(self): - """Return an empty mapping object""" - return self._tested_class() - def _full_mapping(self, data): - """Return a mapping object with the value contained in data - dictionary""" - x = self._empty_mapping() - for key, value in data.items(): - x[key] = value - return x - - def __init__(self, *args, **kw): - unittest.TestCase.__init__(self, *args, **kw) - self.reference = self._reference().copy() - key, value = self.reference.popitem() - self.other = {key:value} - - def test_read(self): - # Test for read only operations on mapping - p = self._empty_mapping() - p1 = dict(p) #workaround for singleton objects - d = self._full_mapping(self.reference) - if d is p: - p = p1 - #Indexing - for key, value in self.reference.items(): - self.assertEqual(d[key], value) - knownkey = self.other.keys()[0] - self.failUnlessRaises(KeyError, lambda:d[knownkey]) - #len - self.assertEqual(len(p), 0) - self.assertEqual(len(d), len(self.reference)) - #has_key - for k in self.reference: - self.assert_(d.has_key(k)) - self.assert_(k in d) - for k in self.other: - self.failIf(d.has_key(k)) - self.failIf(k in d) - #cmp - self.assertEqual(cmp(p,p), 0) - self.assertEqual(cmp(d,d), 0) - self.assertEqual(cmp(p,d), -1) - self.assertEqual(cmp(d,p), 1) - #__non__zero__ - if p: self.fail("Empty mapping must compare to False") - if not d: self.fail("Full mapping must compare to True") - # keys(), items(), iterkeys() ... - def check_iterandlist(iter, lst, ref): - self.assert_(hasattr(iter, 'next')) - self.assert_(hasattr(iter, '__iter__')) - x = list(iter) - self.assert_(set(x)==set(lst)==set(ref)) - check_iterandlist(d.iterkeys(), d.keys(), self.reference.keys()) - check_iterandlist(iter(d), d.keys(), self.reference.keys()) - check_iterandlist(d.itervalues(), d.values(), self.reference.values()) - check_iterandlist(d.iteritems(), d.items(), self.reference.items()) - #get - key, value = d.iteritems().next() - knownkey, knownvalue = self.other.iteritems().next() - self.assertEqual(d.get(key, knownvalue), value) - self.assertEqual(d.get(knownkey, knownvalue), knownvalue) - self.failIf(knownkey in d) - - def test_write(self): - # Test for write operations on mapping - p = self._empty_mapping() - #Indexing - for key, value in self.reference.items(): - p[key] = value - self.assertEqual(p[key], value) - for key in self.reference.keys(): - del p[key] - self.failUnlessRaises(KeyError, lambda:p[key]) - p = self._empty_mapping() - #update - p.update(self.reference) - self.assertEqual(dict(p), self.reference) - items = p.items() - p = self._empty_mapping() - p.update(items) - self.assertEqual(dict(p), self.reference) - d = self._full_mapping(self.reference) - #setdefault - key, value = d.iteritems().next() - knownkey, knownvalue = self.other.iteritems().next() - self.assertEqual(d.setdefault(key, knownvalue), value) - self.assertEqual(d[key], value) - self.assertEqual(d.setdefault(knownkey, knownvalue), knownvalue) - self.assertEqual(d[knownkey], knownvalue) - #pop - self.assertEqual(d.pop(knownkey), knownvalue) - self.failIf(knownkey in d) - self.assertRaises(KeyError, d.pop, knownkey) - default = 909 - d[knownkey] = knownvalue - self.assertEqual(d.pop(knownkey, default), knownvalue) - self.failIf(knownkey in d) - self.assertEqual(d.pop(knownkey, default), default) - #popitem - key, value = d.popitem() - self.failIf(key in d) - self.assertEqual(value, self.reference[key]) - p=self._empty_mapping() - self.assertRaises(KeyError, p.popitem) - d0 = {} d1 = {"one": 1} --- 1,8 ---- # Check every path through every method of UserDict ! import unittest ! from test import test_support, mapping_tests import UserDict d0 = {} d1 = {"one": 1} *************** *** 129,133 **** d5 = {"one": 1, "two": 1} ! class UserDictTest(TestMappingProtocol): _tested_class = UserDict.IterableUserDict --- 12,16 ---- d5 = {"one": 1, "two": 1} ! class UserDictTest(mapping_tests.TestHashMappingProtocol): _tested_class = UserDict.IterableUserDict *************** *** 274,280 **** Used to test and demonstrate DictMixin """ ! def __init__(self): self.keylist = [] self.valuelist = [] def __getitem__(self, key): try: --- 157,168 ---- Used to test and demonstrate DictMixin """ ! def __init__(self, other=None, **kwargs): self.keylist = [] self.valuelist = [] + if other is not None: + for (key, value) in other: + self[key] = value + for (key, value) in kwargs.iteritems(): + self[key] = value def __getitem__(self, key): try: *************** *** 299,304 **** def keys(self): return list(self.keylist) ! class UserDictMixinTest(TestMappingProtocol): _tested_class = SeqDict --- 187,203 ---- def keys(self): return list(self.keylist) + def copy(self): + d = self.__class__() + for key, value in self.iteritems(): + d[key] = value + return d + def fromkeys(cls, keys, value=None): + d = cls() + for key in keys: + d[key] = value + return d + fromkeys = classmethod(fromkeys) ! class UserDictMixinTest(mapping_tests.TestMappingProtocol): _tested_class = SeqDict *************** *** 394,399 **** def test_main(): ! test.test_support.run_unittest( ! TestMappingProtocol, UserDictTest, UserDictMixinTest --- 293,297 ---- def test_main(): ! test_support.run_unittest( UserDictTest, UserDictMixinTest Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** test_weakref.py 13 Feb 2004 19:21:57 -0000 1.38 --- test_weakref.py 31 May 2004 16:29:04 -0000 1.39 *************** *** 913,919 **** self.assertEqual(count, 2) ! from test_userdict import TestMappingProtocol ! class WeakValueDictionaryTestCase(TestMappingProtocol): """Check that WeakValueDictionary conforms to the mapping protocol""" __ref = {"key1":Object(1), "key2":Object(2), "key3":Object(3)} --- 913,919 ---- self.assertEqual(count, 2) ! from test import mapping_tests ! class WeakValueDictionaryTestCase(mapping_tests.BasicTestMappingProtocol): """Check that WeakValueDictionary conforms to the mapping protocol""" __ref = {"key1":Object(1), "key2":Object(2), "key3":Object(3)} *************** *** 922,926 **** return self.__ref.copy() ! class WeakKeyDictionaryTestCase(TestMappingProtocol): """Check that WeakKeyDictionary conforms to the mapping protocol""" __ref = {Object("key1"):1, Object("key2"):2, Object("key3"):3} --- 922,926 ---- return self.__ref.copy() ! class WeakKeyDictionaryTestCase(mapping_tests.BasicTestMappingProtocol): """Check that WeakKeyDictionary conforms to the mapping protocol""" __ref = {Object("key1"):1, Object("key2"):2, Object("key3"):3} From loewis at users.sourceforge.net Mon May 31 14:22:42 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon May 31 14:22:48 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.48, 1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27715/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: Patch #963318: Add support for client-side cookie management. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** whatsnew24.tex 31 May 2004 03:15:02 -0000 1.48 --- whatsnew24.tex 31 May 2004 18:22:40 -0000 1.49 *************** *** 570,573 **** --- 570,592 ---- % whole new modules get described in \subsections here + \subsection{cookielib} + + The \module{cookielib} library supports client-side handling for HTTP + cookies, just as the \module{Cookie} provides server-side cookie + support in CGI scripts. This library manages cookies in a way similar + to web browsers. Cookies are stored in cookie jars; the library + transparently stores cookies offered by the web server in the cookie + jar, and fetches the cookie from the jar when connecting to the + server. Similar to web browsers, policy objects control whether + cookies are accepted or not. + + In order to store cookies across sessions, two implementations of + cookie jars are provided: one that stores cookies in the Netscape + format, so applications can use the Mozilla or Lynx cookie jars, and + one that stores cookies in the same format as the Perl libwww libary. + + \module{urllib2} has been changed to interact with \module{cookielib}: + \class{HTTPCookieProcessor} manages a cookie jar that is used when + accessing URLs. % ====================================================================== From loewis at users.sourceforge.net Mon May 31 14:22:42 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon May 31 14:22:53 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcookielib.tex, NONE, 1.1 lib.tex, 1.225, 1.226 libcookie.tex, 1.11, 1.12 liburllib2.tex, 1.17, 1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27715/Doc/lib Modified Files: lib.tex libcookie.tex liburllib2.tex Added Files: libcookielib.tex Log Message: Patch #963318: Add support for client-side cookie management. --- NEW FILE: libcookielib.tex --- \section{\module{cookielib} --- Cookie handling for HTTP clients} \declaremodule{standard}{cookielib} \moduleauthor{John J. Lee}{jjl@pobox.com} \sectionauthor{John J. Lee}{jjl@pobox.com} \modulesynopsis{Cookie handling for HTTP clients} The \module{cookielib} module defines classes for automatic handling of HTTP cookies. It is useful for accessing web sites that require small pieces of data -- \dfn{cookies} -- to be set on the client machine by an HTTP response from a web server, and then returned to the server in later HTTP requests. Both the regular Netscape cookie protocol and the protocol defined by \rfc{2965} are handled. RFC 2965 handling is switched off by default. \rfc{2109} cookies are parsed as Netscape cookies and subsequently treated as RFC 2965 cookies. Note that the great majority of cookies on the Internet are Netscape cookies. \module{cookielib} attempts to follow the de-facto Netscape cookie protocol (which differs substantially from that set out in the original Netscape specification), including taking note of the \code{max-age} and \code{port} cookie-attributes introduced with RFC 2109. \note{The various named parameters found in \mailheader{Set-Cookie} and \mailheader{Set-Cookie2} headers (eg. \code{domain} and \code{expires}) are conventionally referred to as \dfn{attributes}. To distinguish them from Python attributes, the documentation for this module uses the term \dfn{cookie-attribute} instead}. The module defines the following exception: \begin{excdesc}{LoadError} Instances of \class{FileCookieJar} raise this exception on failure to load cookies from a file. \end{excdesc} The following classes are provided: \begin{classdesc}{CookieJar}{policy=\constant{None}} \var{policy} is an object implementing the \class{CookiePolicy} interface. The \class{CookieJar} class stores HTTP cookies. It extracts cookies from HTTP requests, and returns them in HTTP responses. \class{CookieJar} instances automatically expire contained cookies when necessary. Subclasses are also responsible for storing and retrieving cookies from a file or database. \end{classdesc} \begin{classdesc}{FileCookieJar}{filename, delayload=\constant{None}, policy=\constant{None}} \var{policy} is an object implementing the \class{CookiePolicy} interface. For the other arguments, see the documentation for the corresponding attributes. A \class{CookieJar} which can load cookies from, and perhaps save cookies to, a file on disk. Cookies are \strong{NOT} loaded from the named file until either the \method{load()} or \method{revert()} method is called. Subclasses of this class are documented in section \ref{file-cookie-jar-classes}. \end{classdesc} \begin{classdesc}{CookiePolicy}{} This class is responsible for deciding whether each cookie should be accepted from / returned to the server. \end{classdesc} \begin{classdesc}{DefaultCookiePolicy}{ blocked_domains=\constant{None}, allowed_domains=\constant{None}, netscape=\constant{True}, rfc2965=\constant{False}, hide_cookie2=\constant{False}, strict_domain=\constant{False}, strict_rfc2965_unverifiable=\constant{True}, strict_ns_unverifiable=\constant{False}, strict_ns_domain=\constant{DefaultCookiePolicy.DomainLiberal}, strict_ns_set_initial_dollar=\constant{False}, strict_ns_set_path=\constant{False} } Constructor arguments should be passed as keyword arguments only. \var{blocked_domains} is a sequence of domain names that we never accept cookies from, nor return cookies to. \var{allowed_domains} if not \constant{None}, this is a sequence of the only domains for which we accept and return cookies. For all other arguments, see the documentation for \class{CookiePolicy} and \class{DefaultCookiePolicy} objects. \class{DefaultCookiePolicy} implements the standard accept / reject rules for Netscape and RFC 2965 cookies. RFC 2109 cookies (ie. cookies received in a \mailheader{Set-Cookie} header with a version cookie-attribute of 1) are treated according to the RFC 2965 rules. \class{DefaultCookiePolicy} also provides some parameters to allow some fine-tuning of policy. \end{classdesc} \begin{classdesc}{Cookie}{} This class represents Netscape, RFC 2109 and RFC 2965 cookies. It is not expected that users of \module{cookielib} construct their own \class{Cookie} instances. Instead, if necessary, call \method{make_cookies()} on a \class{CookieJar} instance. \end{classdesc} \begin{seealso} \seemodule{urllib2}{URL opening with automatic cookie handling.} \seemodule{Cookie}{HTTP cookie classes, principally useful for server-side code. The \module{cookielib} and \module{Cookie} modules do not depend on each other.} \seeurl{http://wwwsearch.sf.net/ClientCookie/}{Extensions to this module, including a class for reading Microsoft Internet Explorer cookies on Windows.} \seeurl{http://www.netscape.com/newsref/std/cookie_spec.html}{The specification of the original Netscape cookie protocol. Though this is still the dominant protocol, the 'Netscape cookie protocol' implemented by all the major browsers (and \module{cookielib}) only bears a passing resemblance to the one sketched out in \code{cookie_spec.html}.} \seerfc{2109}{HTTP State Management Mechanism}{Obsoleted by RFC 2965. Uses \mailheader{Set-Cookie} with version=1.} \seerfc{2965}{HTTP State Management Mechanism}{The Netscape protocol with the bugs fixed. Uses \mailheader{Set-Cookie2} in place of \mailheader{Set-Cookie}. Not widely used.} \seeurl{http://kristol.org/cookie/errata.html}{Unfinished errata to RFC 2965.} \seerfc{2964}{Use of HTTP State Management}{} \end{seealso} \subsection{CookieJar and FileCookieJar Objects \label{cookie-jar-objects}} \class{CookieJar} objects support the iterator protocol. \class{CookieJar} has the following methods: \begin{methoddesc}[CookieJar]{add_cookie_header}{request} Add correct \mailheader{Cookie} header to \var{request}. If the CookiePolicy allows (ie. the \class{CookiePolicy} instance's \member{rfc2965} and \member{hide_cookie2} attributes are true and false respectively), the \mailheader{Cookie2} header is also added when appropriate. The \var{request} object (usually a \class{urllib2.Request} instance) must support the methods \method{get_full_url()}, \method{get_host()}, \method{get_type()}, \method{unverifiable()}, \method{get_origin_req_host()}, \method{has_header()}, \method{get_header()}, \method{header_items()}, and \method{add_unredirected_header()},as documented by \module{urllib2}. \end{methoddesc} \begin{methoddesc}[CookieJar]{extract_cookies}{response, request} Extract cookies from HTTP \var{response} and store them in the \class{CookieJar}, where allowed by policy. The \class{CookieJar} will look for allowable \mailheader{Set-Cookie} and \mailheader{Set-Cookie2} headers in the \var{response} argument, and store cookies as appropriate (subject to the \method{CookiePolicy.set_ok()} method's approval). The \var{response} object (usually the result of a call to \method{urllib2.urlopen()}, or similar) should support an \method{info()} method, which returns an object with a \method{getallmatchingheaders()} method (usually a \class{mimetools.Message} instance). The \var{request} object (usually a \class{urllib2.Request} instance) must support the methods \method{get_full_url()}, \method{get_host()}, \method{unverifiable()}, and \method{get_origin_req_host()}, as documented by \module{urllib2}. The request is used to set default values for cookie-attributes as well as for checking that the cookie is allowed to be set. \end{methoddesc} \begin{methoddesc}[CookieJar]{set_policy}{policy} Set the \class{CookiePolicy} instance to be used. \end{methoddesc} \begin{methoddesc}[CookieJar]{make_cookies}{response, request} Return sequence of \class{Cookie} objects extracted from \var{response} object. See the documentation for \method{extract_cookies} for the interfaces required of the \var{response} and \var{request} arguments. \end{methoddesc} \begin{methoddesc}[CookieJar]{set_cookie_if_ok}{cookie, request} Set a \class{Cookie} if policy says it's OK to do so. \end{methoddesc} \begin{methoddesc}[CookieJar]{set_cookie}{cookie} Set a \class{Cookie}, without checking with policy to see whether or not it should be set. \end{methoddesc} \begin{methoddesc}[CookieJar]{clear}{\optional{domain\optional{, path\optional{, name}}}} Clear some cookies. If invoked without arguments, clear all cookies. If given a single argument, only cookies belonging to that \var{domain} will be removed. If given two arguments, cookies belonging to the specified \var{domain} and URL \var{path} are removed. If given three arguments, then the cookie with the specified \var{domain}, \var{path} and \var{name} is removed. Raises \exception{KeyError} if no matching cookie exists. \end{methoddesc} \begin{methoddesc}[CookieJar]{clear_session_cookies}{} Discard all session cookies. Discards all contained cookies that have a true \member{discard} attribute (usually because they had either no \code{max-age} or \code{expires} cookie-attribute, or an explicit \code{discard} cookie-attribute). For interactive browsers, the end of a session usually corresponds to closing the browser window. Note that the \method{save()} method won't save session cookies anyway, unless you ask otherwise by passing a true \var{ignore_discard} argument. \end{methoddesc} \class{FileCookieJar} implements the following additional methods: \begin{methoddesc}[FileCookieJar]{save}{filename=\constant{None}, ignore_discard=\constant{False}, ignore_expires=\constant{False}} Save cookies to a file. This base class raises \class{NotImplementedError}. Subclasses may leave this method unimplemented. \var{filename} is the name of file in which to save cookies. If \var{filename} is not specified, \member{self.filename} is used (whose default is the value passed to the constructor, if any); if \member{self.filename} is \constant{None}, \exception{ValueError} is raised. \var{ignore_discard}: save even cookies set to be discarded. \var{ignore_expires}: save even cookies that have expired The file is overwritten if it already exists, thus wiping all the cookies it contains. Saved cookies can be restored later using the \method{load()} or \method{revert()} methods. \end{methoddesc} \begin{methoddesc}[FileCookieJar]{load}{filename=\constant{None}, ignore_discard=\constant{False}, ignore_expires=\constant{False}} Load cookies from a file. Old cookies are kept unless overwritten by newly loaded ones. Arguments are as for \method{save()}. The named file must be in the format understood by the class, or \exception{LoadError} will be raised. \end{methoddesc} \begin{methoddesc}[FileCookieJar]{revert}{filename=\constant{None}, ignore_discard=\constant{False}, ignore_expires=\constant{False}} Clear all cookies and reload cookies from a saved file. Raises \exception{cookielib.LoadError} or \exception{IOError} if reversion is not successful; the object's state will not be altered if this happens. \end{methoddesc} \class{FileCookieJar} instances have the following public attributes: \begin{memberdesc}{filename} Filename of default file in which to keep cookies. \end{memberdesc} \begin{memberdesc}{delayload} If true, load cookies lazily from disk. This is only a hint, since this only affects performance, not behaviour (unless the cookies on disk are changing). A \class{CookieJar} object may ignore it. None of the \class{FileCookieJar} classes included in the standard library lazily loads cookies. \end{memberdesc} \subsection{FileCookieJar subclasses and co-operation with web browsers \label{file-cookie-jar-classes}} The following \class{CookieJar} subclasses are provided for reading and writing . Further \class{CookieJar} subclasses, including one that reads Microsoft Internet Explorer cookies, are available at \url{http://wwwsearch.sf.net/ClientCookie/}. \begin{classdesc}{MozillaCookieJar}{filename, delayload=\constant{None}, policy=\constant{None}} A \class{FileCookieJar} that can load from and save cookies to disk in the Mozilla \code{cookies.txt} file format (which is also used by the lynx and Netscape browsers). \note{This loses information about RFC 2965 cookies, and also about newer or non-standard cookie-attributes such as \code{port}.} \warning{Back up your cookies before saving if you have cookies whose loss / corruption would be inconvenient (there are some subtleties which may lead to slight changes in the file over a load / save round-trip).} Also note that cookies saved while Mozilla is running will get clobbered by Mozilla. \end{classdesc} \begin{classdesc}{LWPCookieJar}{filename, delayload=\constant{None}, policy=\constant{None}} A \class{FileCookieJar} that can load from and save cookies to disk in format compatible with the libwww-perl library's \code{Set-Cookie3} file format. This is convenient if you want to store cookies in a human-readable file. \end{classdesc} \subsection{CookiePolicy Objects \label{cookie-policy-objects}} Objects implementing the \class{CookiePolicy} interface have the following methods: \begin{methoddesc}[CookiePolicy]{set_ok}{cookie, request} Return boolean value indicating whether cookie should be accepted from server. \var{cookie} is a \class{cookielib.Cookie} instance. \var{request} is an object implementing the interface defined by the documentation for \method{CookieJar.extract_cookies()}. \end{methoddesc} \begin{methoddesc}[CookiePolicy]{return_ok}{cookie, request} Return boolean value indicating whether cookie should be returned to server. \var{cookie} is a \class{cookielib.Cookie} instance. \var{request} is an object implementing the interface defined by the documentation for \method{CookieJar.add_cookie_header()}. \end{methoddesc} \begin{methoddesc}[CookiePolicy]{domain_return_ok}{domain, request} Return false if cookies should not be returned, given cookie domain. This method is an optimization. It removes the need for checking every cookie with a particular domain (which might involve reading many files). The default implementations of \method{domain_return_ok()} and \method{path_return_ok()} (\samp{return True}) leave all the work to \method{return_ok()}. If \method{domain_return_ok()} returns true for the cookie domain, \method{path_return_ok()} is called for the cookie path. Otherwise, \method{path_return_ok()} and \method{return_ok()} are never called for that cookie domain. If \method{path_return_ok()} returns true, \method{return_ok()} is called with the \class{Cookie} object itself for a full check. Otherwise, \method{return_ok()} is never called for that cookie path. Note that \method{domain_return_ok()} is called for every \emph{cookie} domain, not just for the \emph{request} domain. For example, the function might be called with both \code{".example.com"} and \code{"www.example.com"} if the request domain is \code{"www.example.com"}. The same goes for \method{path_return_ok()}. The \var{request} argument is as documented for \method{return_ok()}. \end{methoddesc} \begin{methoddesc}[CookiePolicy]{path_return_ok}{path, request} Return false if cookies should not be returned, given cookie path. See the documentation for \method{domain_return_ok()}. \end{methoddesc} In addition to implementing the methods above, implementations of the \class{CookiePolicy} interface must also supply the following attributes, indicating which protocols should be used, and how. All of these attributes may be assigned to. \begin{memberdesc}{netscape} Implement netscape protocol. \end{memberdesc} \begin{memberdesc}{rfc2965} Implement RFC 2965 protocol. \end{memberdesc} \begin{memberdesc}{hide_cookie2} Don't add Cookie2 header to requests (the presence of this header indicates to the server that we understand RFC 2965 cookies). \end{memberdesc} The most useful way to define a \class{CookiePolicy} class is by subclassing from \class{DefaultCookiePolicy} and overriding some or all of the methods above. \class{CookiePolicy} itself may be used as a 'null policy' to allow setting and receiving any and all cookies. \subsection{DefaultCookiePolicy Objects \label{default-cookie-policy-objects}} Implements the standard rules for accepting and returning cookies. Both RFC 2965 and Netscape cookies are covered. RFC 2965 handling is switched off by default. The easiest way to provide your own policy is to override this class and call its methods in your overriden implementations before adding your own additional checks: \begin{verbatim} import cookielib class MyCookiePolicy(cookielib.DefaultCookiePolicy): def set_ok(self, cookie, request): if not cookielib.DefaultCookiePolicy.set_ok(self, cookie, request): return False if i_dont_want_to_store_this_cookie(cookie): return False return True \end{verbatim} In addition to the features required to implement the \class{CookiePolicy} interface, this class allows you to block and allow domains from setting and receiving cookies. There are also some strictness switches that allow you to tighten up the rather loose Netscape protocol rules a little bit (at the cost of blocking some benign cookies). A domain blacklist and whitelist is provided (both off by default). Only domains not in the blacklist and present in the whitelist (if the whitelist is active) participate in cookie setting and returning. Use the \var{blocked_domains} constructor argument, and \method{blocked_domains()} and \method{set_blocked_domains()} methods (and the corresponding argument and methods for \var{allowed_domains}). If you set a whitelist, you can turn it off again by setting it to \constant{None}. Domains in block or allow lists that do not start with a dot must be equal. For example, \code{"example.com"} matches a blacklist entry of \code{"example.com"}, but \code{"www.example.com"} does not. Domains that do start with a dot are matched by more specific domains too. For example, both \code{"www.example.com"} and \code{"www.coyote.example.com"} match \code{".example.com"} (but \code{"example.com"} itself does not). IP addresses are an exception, and must match exactly. For example, if blocked_domains contains \code{"192.168.1.2"} and \code{".168.1.2"}, 192.168.1.2 is blocked, but 193.168.1.2 is not. \class{DefaultCookiePolicy} implements the following additional methods: \begin{methoddesc}[DefaultCookiePolicy]{blocked_domains}{} Return the sequence of blocked domains (as a tuple). \end{methoddesc} \begin{methoddesc}[DefaultCookiePolicy]{set_blocked_domains} {blocked_domains} Set the sequence of blocked domains. \end{methoddesc} \begin{methoddesc}[DefaultCookiePolicy]{is_blocked}{domain} Return whether \var{domain} is on the blacklist for setting or receiving cookies. \end{methoddesc} \begin{methoddesc}[DefaultCookiePolicy]{allowed_domains}{} Return \constant{None}, or the sequence of allowed domains (as a tuple). \end{methoddesc} \begin{methoddesc}[DefaultCookiePolicy]{set_allowed_domains} {allowed_domains} Set the sequence of allowed domains, or \constant{None}. \end{methoddesc} \begin{methoddesc}[DefaultCookiePolicy]{is_not_allowed}{domain} Return whether \var{domain} is not on the whitelist for setting or receiving cookies. \end{methoddesc} \class{DefaultCookiePolicy} instances have the following attributes, which are all initialised from the constructor arguments of the same name, and which may all be assigned to. General strictness switches: \begin{memberdesc}{strict_domain} Don't allow sites to set two-component domains with country-code top-level domains like \code{.co.uk}, \code{.gov.uk}, \code{.co.nz}.etc. This is far from perfect and isn't guaranteed to work! \end{memberdesc} RFC 2965 protocol strictness switches: \begin{memberdesc}{strict_rfc2965_unverifiable} Follow RFC 2965 rules on unverifiable transactions (usually, an unverifiable transaction is one resulting from a redirect or a request for an image hosted on another site). If this is false, cookies are \emph{never} blocked on the basis of verifiability \end{memberdesc} Netscape protocol strictness switches: \begin{memberdesc}{strict_ns_unverifiable} apply RFC 2965 rules on unverifiable transactions even to Netscape cookies \end{memberdesc} \begin{memberdesc}{strict_ns_domain} Flags indicating how strict to be with domain-matching rules for Netscape cookies. See below for acceptable values. \end{memberdesc} \begin{memberdesc}{strict_ns_set_initial_dollar} Ignore cookies in Set-Cookie: headers that have names starting with \code{'\$'}. \end{memberdesc} \begin{memberdesc}{strict_ns_set_path} Don't allow setting cookies whose path doesn't path-match request URI. \end{memberdesc} \member{strict_ns_domain} is a collection of flags. Its value is constructed by or-ing together (for example, \code{DomainStrictNoDots|DomainStrictNonDomain} means both flags are set). \begin{memberdesc}{DomainStrictNoDots} When setting cookies, the 'host prefix' must not contain a dot (eg. \code{www.foo.bar.com} can't set a cookie for \code{.bar.com}, because \code{www.foo} contains a dot). \end{memberdesc} \begin{memberdesc}{DomainStrictNonDomain} Cookies that did not explicitly specify a \code{domain} cookie-attribute can only be returned to a domain that string-compares equal to the domain that set the cookie (eg. \code{spam.example.com} won't be returned cookies from \code{example.com} that had no \code{domain} cookie-attribute). \end{memberdesc} \begin{memberdesc}{DomainRFC2965Match} When setting cookies, require a full RFC 2965 domain-match. \end{memberdesc} The following attributes are provided for convenience, and are the most useful combinations of the above flags: \begin{memberdesc}{DomainLiberal} Equivalent to 0 (ie. all of the above Netscape domain strictness flags switched off). \end{memberdesc} \begin{memberdesc}{DomainStrict} Equivalent to \code{DomainStrictNoDots|DomainStrictNonDomain}. \end{memberdesc} \subsection{Cookie Objects \label{cookie-jar-objects}} \class{Cookie} instances have Python attributes roughly corresponding to the standard cookie-attributes specified in the various cookie standards. The correspondence is not one-to-one, because there are complicated rules for assigning default values, and because the \code{max-age} and \code{expires} cookie-attributes contain equivalent information. Assignment to these attributes should not be necessary other than in rare circumstances in a \class{CookiePolicy} method. The class does not enforce internal consistency, so you should know what you're doing if you do that. \begin{memberdesc}[Cookie]{version} Integer or \constant{None}. Netscape cookies have version 0. RFC 2965 and RFC 2109 cookies have version 1. \end{memberdesc} \begin{memberdesc}[Cookie]{name} Cookie name (a string), or \constant{None}. \end{memberdesc} \begin{memberdesc}[Cookie]{value} Cookie value (a string). \end{memberdesc} \begin{memberdesc}[Cookie]{port} String representing a port or a set of ports (eg. '80', or '80,8080'), or \constant{None}. \end{memberdesc} \begin{memberdesc}[Cookie]{path} Cookie path (a string, eg. '/acme/rocket_launchers'). \end{memberdesc} \begin{memberdesc}[Cookie]{secure} True if cookie should only be returned over a secure connection. \end{memberdesc} \begin{memberdesc}[Cookie]{expires} Integer expiry date in seconds since epoch, or \constant{None}. See also the \method{is_expired()} method. \end{memberdesc} \begin{memberdesc}[Cookie]{discard} True if this is a session cookie. \end{memberdesc} \begin{memberdesc}[Cookie]{comment} String comment from the server explaining the function of this cookie, or \constant{None}. \end{memberdesc} \begin{memberdesc}[Cookie]{comment_url} URL linking to a comment from the server explaining the function of this cookie, or \constant{None}. \end{memberdesc} \begin{memberdesc}[Cookie]{port_specified} True if a port or set of ports was explicitly specified by the server (in the \mailheader{Set-Cookie} / \mailheader{Set-Cookie2} header). \end{memberdesc} \begin{memberdesc}[Cookie]{domain_specified} True if a domain was explicitly specified by the server. \end{memberdesc} \begin{memberdesc}[Cookie]{domain_initial_dot} True if the domain explicitly specified by the server began with a dot ('.'). \end{memberdesc} Cookies may have additional non-standard cookie-attributes. These may be accessed using the following methods: \begin{methoddesc}[Cookie]{has_nonstandard_attr}{name} Return true if cookie has the named cookie-attribute. \end{methoddesc} \begin{methoddesc}[Cookie]{get_nonstandard_attr}{name, default=\constant{None}} If cookie has the named cookie-attribute, return its value. Otherwise, return \var{default}. \end{methoddesc} \begin{methoddesc}[Cookie]{set_nonstandard_attr}{name, value} Set the value of the named cookie-attribute. \end{methoddesc} The \class{Cookie} class also defines the following method: \begin{methoddesc}[Cookie]{is_expired}{\optional{now=\constant{None}}} True if cookie has passed the time at which the server requested it should expire. If \var{now} is given (in seconds since the epoch), return whether the cookie has expired at the specified time. \end{methoddesc} \subsection{Examples \label{cookielib-examples}} The first example shows the most common usage of \module{cookielib}: \begin{verbatim} import cookielib, urllib2 cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) r = opener.open("http://example.com/") \end{verbatim} This example illustrates how to open a URL using your Netscape, Mozilla, or lynx cookies (assumes \UNIX{} convention for location of the cookies file): \begin{verbatim} import os, cookielib, urllib2 cj = cookielib.MozillaCookieJar() cj.load(os.path.join(os.environ["HOME"], "/.netscape/cookies.txt")) opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) r = opener.open("http://example.com/") \end{verbatim} The next example illustrates the use of \class{DefaultCookiePolicy}. Turn on RFC 2965 cookies, be more strict about domains when setting and returning Netscape cookies, and block some domains from setting cookies or having them returned: \begin{verbatim} import urllib2 from cookielib import CookieJar, DefaultCookiePolicy as Policy policy = Policy(rfc2965=True, strict_ns_domain=Policy.DomainStrict, blocked_domains=["ads.net", ".ads.net"]) cj = CookieJar(policy) opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) r = opener.open("http://example.com/") \end{verbatim} Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.225 retrieving revision 1.226 diff -C2 -d -r1.225 -r1.226 *** lib.tex 29 Jan 2004 07:35:45 -0000 1.225 --- lib.tex 31 May 2004 18:22:39 -0000 1.226 *************** *** 234,237 **** --- 234,238 ---- \input{libsimplehttp} \input{libcgihttp} + \input{libcookielib} \input{libcookie} \input{libxmlrpclib} Index: libcookie.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcookie.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libcookie.tex 25 Aug 2003 04:28:03 -0000 1.11 --- libcookie.tex 31 May 2004 18:22:39 -0000 1.12 *************** *** 69,72 **** --- 69,76 ---- \begin{seealso} + \seemodule{cookielib}{HTTP cookie handling for for web + \emph{clients}. The \module{cookielib} and \module{Cookie} + modules do not depend on each other.} + \seerfc{2109}{HTTP State Management Mechanism}{This is the state management specification implemented by this module.} Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** liburllib2.tex 12 May 2004 03:07:27 -0000 1.17 --- liburllib2.tex 31 May 2004 18:22:39 -0000 1.18 *************** *** 11,15 **** The \module{urllib2} module defines functions and classes which help in opening URLs (mostly HTTP) in a complex world --- basic and digest ! authentication, redirections and more. The \module{urllib2} module defines the following functions: --- 11,15 ---- The \module{urllib2} module defines functions and classes which help in opening URLs (mostly HTTP) in a complex world --- basic and digest ! authentication, redirections, cookies and more. The \module{urllib2} module defines the following functions: *************** *** 17,22 **** \begin{funcdesc}{urlopen}{url\optional{, data}} Open the URL \var{url}, which can be either a string or a \class{Request} ! object (currently the code checks that it really is a \class{Request} ! instance, or an instance of a subclass of \class{Request}). \var{data} should be a string, which specifies additional data to --- 17,21 ---- \begin{funcdesc}{urlopen}{url\optional{, data}} Open the URL \var{url}, which can be either a string or a \class{Request} ! object. \var{data} should be a string, which specifies additional data to *************** *** 88,92 **** The following classes are provided: ! \begin{classdesc}{Request}{url\optional{, data\optional{, headers}}} This class is an abstraction of a URL request. --- 87,92 ---- The following classes are provided: ! \begin{classdesc}{Request}{url\optional{, data}\optional{, headers} ! \optional{, origin_req_host}\optional{, unverifiable}} This class is an abstraction of a URL request. *************** *** 95,98 **** --- 95,116 ---- \var{headers} should be a dictionary, and will be treated as if \method{add_header()} was called with each key and value as arguments. + + The final two arguments are only of interest for correct handling of + third-party HTTP cookies: + + \var{origin_req_host} should be the request-host of the origin + transaction, as defined by \rfc{2965}. It defaults to + \code{cookielib.request_host(self)}. This is the host name or IP + address of the original request that was initiated by the user. For + example, if the request is for an image in an HTML document, this + should be the request-host of the request for the page containing the + image. + + \var{unverifiable} should indicate whether the request is + unverifiable, as defined by RFC 2965. It defaults to False. An + unverifiable request is one whose URL the user did not have the option + to approve. For example, if the request is for an image in an HTML + document, and the user had no option to approve the automatic fetching + of the image, this should be true. \end{classdesc} *************** *** 117,120 **** --- 135,142 ---- \end{classdesc} + \begin{classdesc}{HTTPCookieProcessor}{\optional{cookiejar}} + A class to handle HTTP Cookies. + \end{classdesc} + \begin{classdesc}{ProxyHandler}{\optional{proxies}} Cause requests to go through a proxy. *************** *** 218,225 **** \begin{methoddesc}[Request]{add_data}{data} ! Set the \class{Request} data to \var{data}. This is ignored ! by all handlers except HTTP handlers --- and there it should be an ! \mimetype{application/x-www-form-encoded} buffer, and will change the ! request to be \code{POST} rather than \code{GET}. \end{methoddesc} --- 240,247 ---- \begin{methoddesc}[Request]{add_data}{data} ! Set the \class{Request} data to \var{data}. This is ignored by all ! handlers except HTTP handlers --- and there it should be a byte ! string, and will change the request to be \code{POST} rather than ! \code{GET}. \end{methoddesc} *************** *** 283,286 **** --- 305,319 ---- \end{methoddesc} + \begin{methoddesc}[Request]{get_origin_req_host}{} + Return the request-host of the origin transaction, as defined by + \rfc{2965}. See the documentation for the \class{Request} + constructor. + \end{methoddesc} + + \begin{methoddesc}[Request]{is_unverifiable}{} + Return whether the request is unverifiable, as defined by RFC 2965. + See the documentation for the \class{Request} constructor. + \end{methoddesc} + \subsection{OpenerDirector Objects \label{opener-director-objects}} *************** *** 290,301 **** \begin{methoddesc}[OpenerDirector]{add_handler}{handler} \var{handler} should be an instance of \class{BaseHandler}. The ! following methods are searched, and added to the possible chains. \begin{itemize} \item \method{\var{protocol}_open()} --- signal that the handler knows how to open \var{protocol} URLs. ! \item \method{\var{protocol}_error_\var{type}()} --- ! signal that the handler knows how to handle \var{type} errors from ! \var{protocol}. \item \method{\var{protocol}_request()} --- signal that the handler knows how to pre-process \var{protocol} --- 323,338 ---- \begin{methoddesc}[OpenerDirector]{add_handler}{handler} \var{handler} should be an instance of \class{BaseHandler}. The ! following methods are searched, and added to the possible chains (note ! that HTTP errors are a special case). \begin{itemize} \item \method{\var{protocol}_open()} --- signal that the handler knows how to open \var{protocol} URLs. ! \item \method{http_error_\var{type}()} --- ! signal that the handler knows how to handle HTTP errors with HTTP ! error code \var{type}. ! \item \method{\var{protocol}_error()} --- ! signal that the handler knows how to handle errors from ! (non-\code{http}) \var{protocol}. \item \method{\var{protocol}_request()} --- signal that the handler knows how to pre-process \var{protocol} *************** *** 307,319 **** \end{methoddesc} - \begin{methoddesc}[OpenerDirector]{close}{} - Explicitly break cycles, and delete all the handlers. - Because the \class{OpenerDirector} needs to know the registered handlers, - and a handler needs to know who the \class{OpenerDirector} who called - it is, there is a reference cycle. Even though recent versions of Python - have cycle-collection, it is sometimes preferable to explicitly break - the cycles. - \end{methoddesc} - \begin{methoddesc}[OpenerDirector]{open}{url\optional{, data}} Open the given \var{url} (which can be a request object or a string), --- 344,347 ---- *************** *** 321,330 **** Arguments, return values and exceptions raised are the same as those of \function{urlopen()} (which simply calls the \method{open()} method ! on the default installed \class{OpenerDirector}). \end{methoddesc} \begin{methoddesc}[OpenerDirector]{error}{proto\optional{, arg\optional{, \moreargs}}} ! Handle an error in a given protocol. This will call the registered error handlers for the given protocol with the given arguments (which are protocol specific). The HTTP protocol is a special case which --- 349,358 ---- Arguments, return values and exceptions raised are the same as those of \function{urlopen()} (which simply calls the \method{open()} method ! on the currently installed global \class{OpenerDirector}). \end{methoddesc} \begin{methoddesc}[OpenerDirector]{error}{proto\optional{, arg\optional{, \moreargs}}} ! Handle an error of the given protocol. This will call the registered error handlers for the given protocol with the given arguments (which are protocol specific). The HTTP protocol is a special case which *************** *** 336,339 **** --- 364,406 ---- \end{methoddesc} + OpenerDirector objects open URLs in three stages: + + \begin{enumerate} + \item Every handler with a method named like + \method{\var{protocol}_request()} has that method called to + pre-process the request. + + The order in which these methods are called is determined by + sorting the handler instances by the \member{.processor_order} + attribute. + + \item Handlers with a method named like + \method{\var{protocol}_open()} are called to handle the request. + This stage ends when a handler either returns a + non-\constant{None} value (ie. a response), or raises an exception + (usually URLError). Exceptions are allowed to propagate. + + In fact, the above algorithm is first tried for methods named + \method{default_open}. If all such methods return + \constant{None}, the algorithm is repeated for methods named like + \method{\var{protocol}_open()}. If all such methods return + \constant{None}, the algorithm is repeated for methods named + \method{unknown_open()}. + + Note that the implementation of these methods may involve calls of + the parent \class{OpenerDirector} instance's \method{.open()} and + \method{.error()} methods. + + The order in which these methods are called is determined by + sorting the handler instances. + + \item Every handler with a method named like + \method{\var{protocol}_response()} has that method called to + post-process the response. + + The order in which these methods are called is determined by + sorting the handler instances by the \member{.processor_order} + attribute. + \end{enumerate} \subsection{BaseHandler Objects \label{base-handler-objects}} *************** *** 352,356 **** The following members and methods should only be used by classes ! derived from \class{BaseHandler}: \begin{memberdesc}[BaseHandler]{parent} --- 419,427 ---- The following members and methods should only be used by classes ! derived from \class{BaseHandler}. \note{The convention has been ! adopted that subclasses defining \method{\var{protocol}_request()} or ! \method{\var{protocol}_response()} methods are named ! \class{*Processor}; all others are named \class{*Handler}.} ! \begin{memberdesc}[BaseHandler]{parent} *************** *** 424,427 **** --- 495,521 ---- \end{methoddesc} + \begin{methoddescni}[BaseHandler]{\var{protocol}_request}{req} + This method is \emph{not} defined in \class{BaseHandler}, but + subclasses should define it if they want to pre-process requests of + the given protocol. + + This method, if defined, will be called by the parent + \class{OpenerDirector}. \var{req} will be a \class{Request} object. + The return value should be a \class{Request} object. + \end{methoddescni} + + \begin{methoddescni}[BaseHandler]{\var{protocol}_response}{req, response} + This method is \emph{not} defined in \class{BaseHandler}, but + subclasses should define it if they want to post-process responses of + the given protocol. + + This method, if defined, will be called by the parent + \class{OpenerDirector}. \var{req} will be a \class{Request} object. + \var{response} will be an object implementing the same interface as + the return value of \function{urlopen()}. The return value should + implement the same interface as the return value of + \function{urlopen()}. + \end{methoddescni} + \subsection{HTTPRedirectHandler Objects \label{http-redirect-handler}} *************** *** 435,444 **** Return a \class{Request} or \code{None} in response to a redirect. This is called by the default implementations of the ! \method{http_error_30*()} methods when a redirection is received ! from the server. If a redirection should take place, return a new \class{Request} to allow \method{http_error_30*()} to perform the ! redirect. Otherwise, raise \exception{HTTPError} if no other ! \class{Handler} should try to handle this URL, or return \code{None} ! if you can't but another \class{Handler} might. \begin{notice} --- 529,538 ---- Return a \class{Request} or \code{None} in response to a redirect. This is called by the default implementations of the ! \method{http_error_30*()} methods when a redirection is received from ! the server. If a redirection should take place, return a new \class{Request} to allow \method{http_error_30*()} to perform the ! redirect. Otherwise, raise \exception{HTTPError} if no other handler ! should try to handle this URL, or return \code{None} if you can't but ! another handler might. \begin{notice} *************** *** 479,482 **** --- 573,585 ---- + \subsection{HTTPCookieProcessor Objects \label{http-cookie-processor}} + + \class{HTTPCookieProcessor} instances have one attribute: + + \begin{memberdesc}{cookiejar} + The \class{cookielib.CookieJar} in which cookies are stored. + \end{memberdesc} + + \subsection{ProxyHandler Objects \label{proxy-handler}} From loewis at users.sourceforge.net Mon May 31 14:22:42 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon May 31 14:22:57 2004 Subject: [Python-checkins] python/dist/src/Lib _LWPCookieJar.py, NONE, 1.1 _MozillaCookieJar.py, NONE, 1.1 cookielib.py, NONE, 1.1 urllib2.py, 1.66, 1.67 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27715/Lib Modified Files: urllib2.py Added Files: _LWPCookieJar.py _MozillaCookieJar.py cookielib.py Log Message: Patch #963318: Add support for client-side cookie management. --- NEW FILE: _LWPCookieJar.py --- """Load / save to libwww-perl (LWP) format files. Actually, the format is slightly extended from that used by LWP's (libwww-perl's) HTTP::Cookies, to avoid losing some RFC 2965 information not recorded by LWP. It uses the version string "2.0", though really there isn't an LWP Cookies 2.0 format. This indicates that there is extra information in here (domain_dot and # port_spec) while still being compatible with libwww-perl, I hope. """ import time, re, logging from cookielib import reraise_unmasked_exceptions, FileCookieJar, Cookie, \ MISSING_FILENAME_TEXT, join_header_words, split_header_words, \ iso2time, time2isoz def lwp_cookie_str(cookie): """Return string representation of Cookie in an the LWP cookie file format. Actually, the format is extended a bit -- see module docstring. """ h = [(cookie.name, cookie.value), ("path", cookie.path), ("domain", cookie.domain)] if cookie.port is not None: h.append(("port", cookie.port)) if cookie.path_specified: h.append(("path_spec", None)) if cookie.port_specified: h.append(("port_spec", None)) if cookie.domain_initial_dot: h.append(("domain_dot", None)) if cookie.secure: h.append(("secure", None)) if cookie.expires: h.append(("expires", time2isoz(float(cookie.expires)))) if cookie.discard: h.append(("discard", None)) if cookie.comment: h.append(("comment", cookie.comment)) if cookie.comment_url: h.append(("commenturl", cookie.comment_url)) keys = cookie._rest.keys() keys.sort() for k in keys: h.append((k, str(cookie._rest[k]))) h.append(("version", str(cookie.version))) return join_header_words([h]) class LWPCookieJar(FileCookieJar): """ The LWPCookieJar saves a sequence of"Set-Cookie3" lines. "Set-Cookie3" is the format used by the libwww-perl libary, not known to be compatible with any browser, but which is easy to read and doesn't lose information about RFC 2965 cookies. Additional methods as_lwp_str(ignore_discard=True, ignore_expired=True) """ def as_lwp_str(self, ignore_discard=True, ignore_expires=True): """Return cookies as a string of "\n"-separated "Set-Cookie3" headers. ignore_discard and ignore_expires: see docstring for FileCookieJar.save """ now = time.time() r = [] for cookie in self: if not ignore_discard and cookie.discard: continue if not ignore_expires and cookie.is_expired(now): continue r.append("Set-Cookie3: %s" % lwp_cookie_str(cookie)) return "\n".join(r+[""]) def save(self, filename=None, ignore_discard=False, ignore_expires=False): if filename is None: if self.filename is not None: filename = self.filename else: raise ValueError(MISSING_FILENAME_TEXT) f = open(filename, "w") try: # There really isn't an LWP Cookies 2.0 format, but this indicates # that there is extra information in here (domain_dot and # port_spec) while still being compatible with libwww-perl, I hope. f.write("#LWP-Cookies-2.0\n") f.write(self.as_lwp_str(ignore_discard, ignore_expires)) finally: f.close() def _really_load(self, f, filename, ignore_discard, ignore_expires): magic = f.readline() if not re.search(self.magic_re, magic): msg = "%s does not seem to contain cookies" % filename raise IOError(msg) now = time.time() header = "Set-Cookie3:" boolean_attrs = ("port_spec", "path_spec", "domain_dot", "secure", "discard") value_attrs = ("version", "port", "path", "domain", "expires", "comment", "commenturl") try: while 1: line = f.readline() if line == "": break if not line.startswith(header): continue line = line[len(header):].strip() for data in split_header_words([line]): name, value = data[0] # name and value are an exception here, since a plain "foo" # (with no "=", unlike "bar=foo") means a cookie with no # name and value "foo". With all other cookie-attributes, # the situation is reversed: "foo" means an attribute named # "foo" with no value! if value is None: name, value = value, name standard = {} rest = {} for k in boolean_attrs: standard[k] = False for k, v in data[1:]: if k is not None: lc = k.lower() else: lc = None # don't lose case distinction for unknown fields if (lc in value_attrs) or (lc in boolean_attrs): k = lc if k in boolean_attrs: if v is None: v = True standard[k] = v elif k in value_attrs: standard[k] = v else: rest[k] = v h = standard.get expires = h("expires") discard = h("discard") if expires is not None: expires = iso2time(expires) if expires is None: discard = True domain = h("domain") domain_specified = domain.startswith(".") c = Cookie(h("version"), name, value, h("port"), h("port_spec"), domain, domain_specified, h("domain_dot"), h("path"), h("path_spec"), h("secure"), expires, discard, h("comment"), h("commenturl"), rest) if not ignore_discard and c.discard: continue if not ignore_expires and c.is_expired(now): continue self.set_cookie(c) except: reraise_unmasked_exceptions((IOError,)) raise IOError("invalid Set-Cookie3 format file %s" % filename) --- NEW FILE: _MozillaCookieJar.py --- """Mozilla / Netscape cookie loading / saving.""" import re, time, logging from cookielib import reraise_unmasked_exceptions, FileCookieJar, Cookie, \ MISSING_FILENAME_TEXT class MozillaCookieJar(FileCookieJar): """ WARNING: you may want to backup your browser's cookies file if you use this class to save cookies. I *think* it works, but there have been bugs in the past! This class differs from CookieJar only in the format it uses to save and load cookies to and from a file. This class uses the Mozilla/Netscape `cookies.txt' format. lynx uses this file format, too. Don't expect cookies saved while the browser is running to be noticed by the browser (in fact, Mozilla on unix will overwrite your saved cookies if you change them on disk while it's running; on Windows, you probably can't save at all while the browser is running). Note that the Mozilla/Netscape format will downgrade RFC2965 cookies to Netscape cookies on saving. In particular, the cookie version and port number information is lost, together with information about whether or not Path, Port and Discard were specified by the Set-Cookie2 (or Set-Cookie) header, and whether or not the domain as set in the HTTP header started with a dot (yes, I'm aware some domains in Netscape files start with a dot and some don't -- trust me, you really don't want to know any more about this). Note that though Mozilla and Netscape use the same format, they use slightly different headers. The class saves cookies using the Netscape header by default (Mozilla can cope with that). """ magic_re = "#( Netscape)? HTTP Cookie File" header = """\ # Netscape HTTP Cookie File # http://www.netscape.com/newsref/std/cookie_spec.html # This is a generated file! Do not edit. """ def _really_load(self, f, filename, ignore_discard, ignore_expires): now = time.time() magic = f.readline() if not re.search(self.magic_re, magic): f.close() raise IOError( "%s does not look like a Netscape format cookies file" % filename) try: while 1: line = f.readline() if line == "": break # last field may be absent, so keep any trailing tab if line.endswith("\n"): line = line[:-1] # skip comments and blank lines XXX what is $ for? if (line.strip().startswith("#") or line.strip().startswith("$") or line.strip() == ""): continue domain, domain_specified, path, secure, expires, name, value = \ line.split("\t") secure = (secure == "TRUE") domain_specified = (domain_specified == "TRUE") if name == "": name = value value = None initial_dot = domain.startswith(".") assert domain_specified == initial_dot discard = False if expires == "": expires = None discard = True # assume path_specified is false c = Cookie(0, name, value, None, False, domain, domain_specified, initial_dot, path, False, secure, expires, discard, None, None, {}) if not ignore_discard and c.discard: continue if not ignore_expires and c.is_expired(now): continue self.set_cookie(c) except: reraise_unmasked_exceptions((IOError,)) raise IOError("invalid Netscape format file %s: %s" % (filename, line)) def save(self, filename=None, ignore_discard=False, ignore_expires=False): if filename is None: if self.filename is not None: filename = self.filename else: raise ValueError(MISSING_FILENAME_TEXT) f = open(filename, "w") try: f.write(self.header) now = time.time() for cookie in self: if not ignore_discard and cookie.discard: continue if not ignore_expires and cookie.is_expired(now): continue if cookie.secure: secure = "TRUE" else: secure = "FALSE" if cookie.domain.startswith("."): initial_dot = "TRUE" else: initial_dot = "FALSE" if cookie.expires is not None: expires = str(cookie.expires) else: expires = "" if cookie.value is None: # cookies.txt regards 'Set-Cookie: foo' as a cookie # with no name, whereas cookielib regards it as a # cookie with no value. name = "" value = cookie.name else: name = cookie.name value = cookie.value f.write( "\t".join([cookie.domain, initial_dot, cookie.path, secure, expires, name, value])+ "\n") finally: f.close() --- NEW FILE: cookielib.py --- """HTTP cookie handling for web clients. This module has (now fairly distant) origins in Gisle Aas' Perl module HTTP::Cookies, from the libwww-perl library. Docstrings, comments and debug strings in this code refer to the attributes of the HTTP cookie system as cookie-attributes, to distinguish them clearly from Python attributes. Class diagram (note that the classes which do not derive from FileCookieJar are not distributed with the Python standard library, but are available from http://wwwsearch.sf.net/): CookieJar____ / \ \ FileCookieJar \ \ / | \ \ \ MozillaCookieJar | LWPCookieJar \ \ | | \ [...1717 lines suppressed...] """ if filename is None: if self.filename is not None: filename = self.filename else: raise ValueError(MISSING_FILENAME_TEXT) self._cookies_lock.acquire() old_state = copy.deepcopy(self._cookies) self._cookies = {} try: self.load(filename, ignore_discard, ignore_expires) except (LoadError, IOError): self._cookies = old_state raise self._cookies_lock.release() from _LWPCookieJar import LWPCookieJar, lwp_cookie_str from _MozillaCookieJar import MozillaCookieJar Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** urllib2.py 10 May 2004 07:35:33 -0000 1.66 --- urllib2.py 31 May 2004 18:22:40 -0000 1.67 *************** *** 107,110 **** --- 107,111 ---- import urlparse import bisect + import cookielib try: *************** *** 177,181 **** class Request: ! def __init__(self, url, data=None, headers={}): # unwrap('') --> 'type://host/path' self.__original = unwrap(url) --- 178,183 ---- class Request: ! def __init__(self, url, data=None, headers={}, ! origin_req_host=None, unverifiable=False): # unwrap('') --> 'type://host/path' self.__original = unwrap(url) *************** *** 189,192 **** --- 191,198 ---- self.add_header(key, value) self.unredirected_hdrs = {} + if origin_req_host is None: + origin_req_host = cookielib.request_host(self) + self.origin_req_host = origin_req_host + self.unverifiable = unverifiable def __getattr__(self, attr): *************** *** 243,246 **** --- 249,258 ---- self.__r_host = self.__original + def get_origin_req_host(self): + return self.origin_req_host + + def is_unverifiable(self): + return self.unverifiable + def add_header(self, key, val): # useful for something like authentication *************** *** 255,258 **** --- 267,279 ---- header_name in self.unredirected_hdrs) + def get_header(self, header_name, default=None): + return self.headers.get( + header_name, + self.unredirected_hdrs.get(header_name, default)) + + def header_items(self): + hdrs = self.unredirected_hdrs.copy() + hdrs.update(self.headers) + return hdrs.items() class OpenerDirector: *************** *** 461,465 **** class HTTPRedirectHandler(BaseHandler): ! # maximum number of redirections before assuming we're in a loop max_redirections = 10 --- 482,490 ---- class HTTPRedirectHandler(BaseHandler): ! # maximum number of redirections to any single URL ! # this is needed because of the state that cookies introduce ! max_repeats = 4 ! # maximum total number of redirections (regardless of URL) before ! # assuming we're in a loop max_redirections = 10 *************** *** 482,486 **** # essentially all clients do redirect in this case, so we # do the same. ! return Request(newurl, headers=req.headers) else: raise HTTPError(req.get_full_url(), code, msg, headers, fp) --- 507,514 ---- # essentially all clients do redirect in this case, so we # do the same. ! return Request(newurl, ! headers=req.headers, ! origin_req_host=req.get_origin_req_host(), ! unverifiable=True) else: raise HTTPError(req.get_full_url(), code, msg, headers, fp) *************** *** 491,498 **** # attribute to the Request object. def http_error_302(self, req, fp, code, msg, headers): if 'location' in headers: ! newurl = headers['location'] elif 'uri' in headers: ! newurl = headers['uri'] else: return --- 519,528 ---- # attribute to the Request object. def http_error_302(self, req, fp, code, msg, headers): + # Some servers (incorrectly) return multiple Location headers + # (so probably same goes for URI). Use first header. if 'location' in headers: ! newurl = headers.getheaders('location')[0] elif 'uri' in headers: ! newurl = headers.getheaders('uri')[0] else: return *************** *** 507,524 **** # loop detection ! # .redirect_dict has a key (url, code) if url was previously ! # visited as a result of a redirection with that code. The ! # code is needed in addition to the URL because visiting a URL ! # twice isn't necessarily a loop: there is more than one way ! # to redirect (301, 302, 303, 307, refresh). ! key = (newurl, code) if hasattr(req, 'redirect_dict'): visited = new.redirect_dict = req.redirect_dict ! if key in visited or len(visited) >= self.max_redirections: raise HTTPError(req.get_full_url(), code, self.inf_msg + msg, headers, fp) else: visited = new.redirect_dict = req.redirect_dict = {} ! visited[key] = None # Don't close the fp until we are sure that we won't use it --- 537,550 ---- # loop detection ! # .redirect_dict has a key url if url was previously visited. if hasattr(req, 'redirect_dict'): visited = new.redirect_dict = req.redirect_dict ! if (visited.get(newurl, 0) >= self.max_repeats or ! len(visited) >= self.max_redirections): raise HTTPError(req.get_full_url(), code, self.inf_msg + msg, headers, fp) else: visited = new.redirect_dict = req.redirect_dict = {} ! visited[newurl] = visited.get(newurl, 0) + 1 # Don't close the fp until we are sure that we won't use it *************** *** 913,917 **** self._debuglevel = level ! def do_request(self, request): host = request.get_host() if not host: --- 939,943 ---- self._debuglevel = level ! def do_request_(self, request): host = request.get_host() if not host: *************** *** 988,992 **** return self.do_open(httplib.HTTPConnection, req) ! http_request = AbstractHTTPHandler.do_request if hasattr(httplib, 'HTTPS'): --- 1014,1018 ---- return self.do_open(httplib.HTTPConnection, req) ! http_request = AbstractHTTPHandler.do_request_ if hasattr(httplib, 'HTTPS'): *************** *** 996,1000 **** return self.do_open(httplib.HTTPSConnection, req) ! https_request = AbstractHTTPHandler.do_request class UnknownHandler(BaseHandler): --- 1022,1043 ---- return self.do_open(httplib.HTTPSConnection, req) ! https_request = AbstractHTTPHandler.do_request_ ! ! class HTTPCookieProcessor(BaseHandler): ! def __init__(self, cookiejar=None): ! if cookiejar is None: ! cookiejar = CookieJar() ! self.cookiejar = cookiejar ! ! def http_request(self, request): ! self.cookiejar.add_cookie_header(request) ! return request ! ! def http_response(self, request, response): ! self.cookiejar.extract_cookies(response, request) ! return response ! ! https_request = http_request ! https_response = http_response class UnknownHandler(BaseHandler): From loewis at users.sourceforge.net Mon May 31 14:22:43 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon May 31 14:23:02 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.977,1.978 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27715/Misc Modified Files: NEWS Log Message: Patch #963318: Add support for client-side cookie management. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.977 retrieving revision 1.978 diff -C2 -d -r1.977 -r1.978 *** NEWS 31 May 2004 03:09:23 -0000 1.977 --- NEWS 31 May 2004 18:22:40 -0000 1.978 *************** *** 312,315 **** --- 312,319 ---- ------- + - Added a new module: cookielib. Automatic cookie handling for HTTP + clients. Also, support for cookielib has been added to urllib2, so + urllib2.urlopen() can transparently handle cookies. + - stringprep.py now uses built-in set() instead of sets.Set(). From loewis at users.sourceforge.net Mon May 31 14:22:42 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon May 31 14:23:08 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_cookielib.py, NONE, 1.1 test_urllib2.py, 1.12, 1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27715/Lib/test Modified Files: test_urllib2.py Added Files: test_cookielib.py Log Message: Patch #963318: Add support for client-side cookie management. --- NEW FILE: test_cookielib.py --- # -*- coding: utf-8 -*- """Tests for cookielib.py.""" import re, os, time from unittest import TestCase from test import test_support class DateTimeTests(TestCase): def test_time2isoz(self): from cookielib import time2isoz base = 1019227000 day = 24*3600 self.assertEquals(time2isoz(base), "2002-04-19 14:36:40Z") self.assertEquals(time2isoz(base+day), "2002-04-20 14:36:40Z") self.assertEquals(time2isoz(base+2*day), "2002-04-21 14:36:40Z") self.assertEquals(time2isoz(base+3*day), "2002-04-22 14:36:40Z") [...1581 lines suppressed...] self.assert_(not ( # a permanent cookie got lost accidently counter["perm_after"] != counter["perm_before"] or # a session cookie hasn't been cleared counter["session_after"] != 0 or # we didn't have session cookies in the first place counter["session_before"] == 0)) def test_main(verbose=None): from test import test_sets test_support.run_unittest( DateTimeTests, HeaderTests, CookieTests, LWPCookieTests, ) if __name__ == "__main__": test_main(verbose=True) Index: test_urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib2.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_urllib2.py 24 Feb 2004 19:40:35 -0000 1.12 --- test_urllib2.py 31 May 2004 18:22:40 -0000 1.13 *************** *** 55,58 **** --- 55,62 ---- def close(self): pass + class MockHeaders(dict): + def getheaders(self, name): + return self.values() + class MockResponse(StringIO.StringIO): def __init__(self, code, msg, headers, data, url=None): *************** *** 64,67 **** --- 68,77 ---- return self.url + class MockCookieJar: + def add_cookie_header(self, request): + self.ach_req = request + def extract_cookies(self, response, request): + self.ec_req, self.ec_r = request, response + class FakeMethod: def __init__(self, meth_name, action, handle): *************** *** 475,479 **** req = Request("http://example.com/", data) r = MockResponse(200, "OK", {}, "") ! newreq = h.do_request(req) if data is None: # GET self.assert_("Content-length" not in req.unredirected_hdrs) --- 485,489 ---- req = Request("http://example.com/", data) r = MockResponse(200, "OK", {}, "") ! newreq = h.do_request_(req) if data is None: # GET self.assert_("Content-length" not in req.unredirected_hdrs) *************** *** 492,496 **** req.add_unredirected_header("Host", "baz") req.add_unredirected_header("Spam", "foo") ! newreq = h.do_request(req) self.assertEqual(req.unredirected_hdrs["Content-length"], "foo") self.assertEqual(req.unredirected_hdrs["Content-type"], "bar") --- 502,506 ---- req.add_unredirected_header("Host", "baz") req.add_unredirected_header("Spam", "foo") ! newreq = h.do_request_(req) self.assertEqual(req.unredirected_hdrs["Content-length"], "foo") self.assertEqual(req.unredirected_hdrs["Content-type"], "bar") *************** *** 515,518 **** --- 525,543 ---- self.assertEqual(o.args, (req, r, 201, "Created", {})) + def test_cookies(self): + cj = MockCookieJar() + h = urllib2.HTTPCookieProcessor(cj) + o = h.parent = MockOpener() + + req = Request("http://example.com/") + r = MockResponse(200, "OK", {}, "") + newreq = h.http_request(req) + self.assert_(cj.ach_req is req is newreq) + self.assertEquals(req.get_origin_req_host(), "example.com") + self.assert_(not req.is_unverifiable()) + newr = h.http_response(req, r) + self.assert_(cj.ec_req is req) + self.assert_(cj.ec_r is r is newr) + def test_redirect(self): from_url = "http://example.com/a.html" *************** *** 529,533 **** req.add_unredirected_header("Spam", "spam") try: ! method(req, MockFile(), code, "Blah", {"location": to_url}) except urllib2.HTTPError: # 307 in response to POST requires user OK --- 554,559 ---- req.add_unredirected_header("Spam", "spam") try: ! method(req, MockFile(), code, "Blah", ! MockHeaders({"location": to_url})) except urllib2.HTTPError: # 307 in response to POST requires user OK *************** *** 545,575 **** # loop detection req = Request(from_url) ! req.origin_req_host = "example.com" ! def redirect(h, req, code, url=to_url): ! method = getattr(h, "http_error_%s" % code) ! method(req, MockFile(), code, "Blah", {"location": url}) # Note that the *original* request shares the same record of # redirections with the sub-requests caused by the redirections. ! # once ! redirect(h, req, 302) ! # twice: loop detected ! self.assertRaises(urllib2.HTTPError, redirect, h, req, 302) ! # and again ! self.assertRaises(urllib2.HTTPError, redirect, h, req, 302) ! # but this is a different redirect code, so OK... ! redirect(h, req, 301) ! self.assertRaises(urllib2.HTTPError, redirect, h, req, 301) ! # order doesn't matter ! redirect(h, req, 303) ! redirect(h, req, 307) ! self.assertRaises(urllib2.HTTPError, redirect, h, req, 303) # detect endless non-repeating chain of redirects ! req = Request(from_url) ! req.origin_req_host = "example.com" count = 0 try: while 1: ! redirect(h, req, 302, "http://example.com/%d" % count) count = count + 1 except urllib2.HTTPError: --- 571,597 ---- # loop detection req = Request(from_url) ! def redirect(h, req, url=to_url): ! h.http_error_302(req, MockFile(), 302, "Blah", ! MockHeaders({"location": url})) # Note that the *original* request shares the same record of # redirections with the sub-requests caused by the redirections. ! ! # detect infinite loop redirect of a URL to itself ! req = Request(from_url, origin_req_host="example.com") ! count = 0 ! try: ! while 1: ! redirect(h, req, "http://example.com/") ! count = count + 1 ! except urllib2.HTTPError: ! # don't stop until max_repeats, because cookies may introduce state ! self.assertEqual(count, urllib2.HTTPRedirectHandler.max_repeats) # detect endless non-repeating chain of redirects ! req = Request(from_url, origin_req_host="example.com") count = 0 try: while 1: ! redirect(h, req, "http://example.com/%d" % count) count = count + 1 except urllib2.HTTPError: *************** *** 577,580 **** --- 599,633 ---- urllib2.HTTPRedirectHandler.max_redirections) + def test_cookie_redirect(self): + class MockHTTPHandler(urllib2.HTTPHandler): + def __init__(self): self._count = 0 + def http_open(self, req): + import mimetools + from StringIO import StringIO + if self._count == 0: + self._count = self._count + 1 + msg = mimetools.Message( + StringIO("Location: http://www.cracker.com/\r\n\r\n")) + return self.parent.error( + "http", req, MockFile(), 302, "Found", msg) + else: + self.req = req + msg = mimetools.Message(StringIO("\r\n\r\n")) + return MockResponse(200, "OK", msg, "", req.get_full_url()) + # cookies shouldn't leak into redirected requests + from cookielib import CookieJar + from urllib2 import build_opener, HTTPHandler, HTTPError, \ + HTTPCookieProcessor + + from test_cookielib import interact_netscape + + cj = CookieJar() + interact_netscape(cj, "http://www.example.com/", "spam=eggs") + hh = MockHTTPHandler() + cp = HTTPCookieProcessor(cj) + o = build_opener(hh, cp) + o.open("http://www.example.com/") + self.assert_(not hh.req.has_header("Cookie")) + class MiscTests(unittest.TestCase): From loewis at users.sourceforge.net Mon May 31 15:01:02 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon May 31 15:01:07 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libdoctest.tex,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2601/Doc/lib Modified Files: libdoctest.tex Log Message: Patch #932930: suggest the use of rawstrings for backslashes. Index: libdoctest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdoctest.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** libdoctest.tex 27 Nov 2003 19:48:03 -0000 1.19 --- libdoctest.tex 31 May 2004 19:00:59 -0000 1.20 *************** *** 362,376 **** tracebacks are captured via a different means). ! \item If you continue a line via backslashing in an interactive session, or ! for any other reason use a backslash, you need to double the backslash in ! the docstring version. This is simply because you're in a string, and so ! the backslash must be escaped for it to survive intact. Like: \begin{verbatim} ! >>> if "yes" == \\ ! ... "y" + \\ ! ... "es": ! ... print 'yes' ! yes \end{verbatim} --- 362,387 ---- tracebacks are captured via a different means). ! \item If you continue a line via backslashing in an interactive session, ! or for any other reason use a backslash, you should use a raw ! docstring, which will preserve your backslahses exactly as you type ! them: \begin{verbatim} ! >>> def f(x): ! ... r'''Backslashes in a raw docstring: m\n''' ! >>> print f.__doc__ ! Backslashes in a raw docstring: m\n ! \end{verbatim} ! ! Otherwise, the backslash will be interpreted as part of the string. ! E.g., the "\textbackslash" above would be interpreted as a newline ! character. Alternatively, you can double each backslash in the ! doctest version (and not use a raw string): ! ! \begin{verbatim} ! >>> def f(x): ! ... '''Backslashes in a raw docstring: m\\n''' ! >>> print f.__doc__ ! Backslashes in a raw docstring: m\n \end{verbatim} From loewis at users.sourceforge.net Mon May 31 15:01:02 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon May 31 15:01:12 2004 Subject: [Python-checkins] python/dist/src/Lib doctest.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2601/Lib Modified Files: doctest.py Log Message: Patch #932930: suggest the use of rawstrings for backslashes. Index: doctest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** doctest.py 12 Feb 2004 17:35:06 -0000 1.33 --- doctest.py 31 May 2004 19:01:00 -0000 1.34 *************** *** 5,9 **** # Provided as-is; use at your own risk; no warranty; no promises; enjoy! ! """Module doctest -- a framework for running examples in docstrings. NORMAL USAGE --- 5,9 ---- # Provided as-is; use at your own risk; no warranty; no promises; enjoy! ! r"""Module doctest -- a framework for running examples in docstrings. NORMAL USAGE *************** *** 201,215 **** tracebacks are captured via a different means). ! + If you continue a line via backslashing in an interactive session, or for ! any other reason use a backslash, you need to double the backslash in the ! docstring version. This is simply because you're in a string, and so the ! backslash must be escaped for it to survive intact. Like: ! >>> if "yes" == \\ ! ... "y" + \\ ! ... "es": # in the source code you'll see the doubled backslashes ! ... print 'yes' ! yes The starting column doesn't matter: --- 201,224 ---- tracebacks are captured via a different means). ! + If you continue a line via backslashing in an interactive session, ! or for any other reason use a backslash, you should use a raw ! docstring, which will preserve your backslahses exactly as you type ! them: ! >>> def f(x): ! ... r'''Backslashes in a raw docstring: m\n''' ! >>> print f.__doc__ ! Backslashes in a raw docstring: m\n ! ! Otherwise, the backslash will be interpreted as part of the string. ! E.g., the "\n" above would be interpreted as a newline character. ! Alternatively, you can double each backslash in the doctest version ! (and not use a raw string): + >>> def f(x): + ... '''Backslashes in a raw docstring: m\\n''' + >>> print f.__doc__ + Backslashes in a raw docstring: m\n + The starting column doesn't matter: From tim_one at users.sourceforge.net Mon May 31 15:28:04 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon May 31 15:28:08 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.978,1.979 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9423/Misc Modified Files: NEWS Log Message: SF patch 959726: sdist versus SVN The disutils sdist command now ignores .svn directories. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.978 retrieving revision 1.979 diff -C2 -d -r1.978 -r1.979 *** NEWS 31 May 2004 18:22:40 -0000 1.978 --- NEWS 31 May 2004 19:27:59 -0000 1.979 *************** *** 150,154 **** - Added a sorted() builtin function that returns a new sorted list ! from any iterable. - CObjects are now mutable (on the C level) through PyCObject_SetVoidPtr. --- 150,154 ---- - Added a sorted() builtin function that returns a new sorted list ! from any iterable. - CObjects are now mutable (on the C level) through PyCObject_SetVoidPtr. *************** *** 198,204 **** - buffer objects based on other objects no longer cache a pointer to the data and the data length. Instead, the appropriate tp_as_buffer ! method is called as necessary. ! - fixed: if a file is opened with an explicit buffer size >= 1, repeated close() calls would attempt to free() the buffer already free()ed on the first call. --- 198,204 ---- - buffer objects based on other objects no longer cache a pointer to the data and the data length. Instead, the appropriate tp_as_buffer ! method is called as necessary. ! - fixed: if a file is opened with an explicit buffer size >= 1, repeated close() calls would attempt to free() the buffer already free()ed on the first call. *************** *** 312,315 **** --- 312,319 ---- ------- + - The distutils sdist command now ignores all .svn directories, in + addition to CVS and RCS directories. .svn directories hold + administrative files for the Subversion source control system. + - Added a new module: cookielib. Automatic cookie handling for HTTP clients. Also, support for cookielib has been added to urllib2, so From tim_one at users.sourceforge.net Mon May 31 15:28:31 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon May 31 15:28:36 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9423/Doc/dist Modified Files: dist.tex Log Message: SF patch 959726: sdist versus SVN The disutils sdist command now ignores .svn directories. Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** dist.tex 31 Mar 2004 01:50:37 -0000 1.73 --- dist.tex 31 May 2004 19:27:58 -0000 1.74 *************** *** 1067,1071 **** \begin{itemize} \item all files in the Distutils ``build'' tree (default \file{build/}) ! \item all files in directories named \file{RCS} or \file{CVS} \end{itemize} Now we have our complete list of files, which is written to the manifest --- 1067,1071 ---- \begin{itemize} \item all files in the Distutils ``build'' tree (default \file{build/}) ! \item all files in directories named \file{RCS}, \file{CVS} or \file{.svn} \end{itemize} Now we have our complete list of files, which is written to the manifest *************** *** 1099,1104 **** \code{prune} command in the manifest template comes after the \code{recursive-include} command ! \item exclude the entire \file{build} tree, and any \file{RCS} or ! \file{CVS} directories \end{enumerate} Just like in the setup script, file and directory names in the manifest --- 1099,1104 ---- \code{prune} command in the manifest template comes after the \code{recursive-include} command ! \item exclude the entire \file{build} tree, and any \file{RCS}, ! \file{CVS} and \file{.svn} directories \end{enumerate} Just like in the setup script, file and directory names in the manifest From tim_one at users.sourceforge.net Mon May 31 15:28:31 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon May 31 15:28:39 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command sdist.py, 1.57, 1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9423/Lib/distutils/command Modified Files: sdist.py Log Message: SF patch 959726: sdist versus SVN The disutils sdist command now ignores .svn directories. Index: sdist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/sdist.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** sdist.py 25 Mar 2004 22:04:52 -0000 1.57 --- sdist.py 31 May 2004 19:27:59 -0000 1.58 *************** *** 348,352 **** * the release tree itself (only an issue if we ran "sdist" previously with --keep-temp, or it aborted) ! * any RCS or CVS directories """ build = self.get_finalized_command('build') --- 348,352 ---- * the release tree itself (only an issue if we ran "sdist" previously with --keep-temp, or it aborted) ! * any RCS, CVS and .svn directories """ build = self.get_finalized_command('build') *************** *** 355,359 **** self.filelist.exclude_pattern(None, prefix=build.build_base) self.filelist.exclude_pattern(None, prefix=base_dir) ! self.filelist.exclude_pattern(r'/(RCS|CVS)/.*', is_regex=1) --- 355,359 ---- self.filelist.exclude_pattern(None, prefix=build.build_base) self.filelist.exclude_pattern(None, prefix=base_dir) ! self.filelist.exclude_pattern(r'/(RCS|CVS|\.svn)/.*', is_regex=1) From loewis at users.sourceforge.net Mon May 31 15:38:10 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon May 31 15:38:14 2004 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.3.spec, 1.2.12.12, 1.2.12.13 Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11657 Modified Files: Tag: release23-maint python-2.3.spec Log Message: Including changes from Ian Holsman to build under Red Hat 7.3. Fixing some problems with the /usr/local path change. Index: python-2.3.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.3.spec,v retrieving revision 1.2.12.12 retrieving revision 1.2.12.13 diff -C2 -d -r1.2.12.12 -r1.2.12.13 *** python-2.3.spec 27 May 2004 05:56:12 -0000 1.2.12.12 --- python-2.3.spec 31 May 2004 19:38:08 -0000 1.2.12.13 *************** *** 33,37 **** %define version 2.3.4 %define libvers 2.3 ! %define release 1pydotorg %define __prefix /usr --- 33,37 ---- %define version 2.3.4 %define libvers 2.3 ! %define release 2pydotorg %define __prefix /usr *************** *** 128,131 **** --- 128,135 ---- %changelog + * Thu May 27 2004 Sean Reifschneider [2.3.4-2pydotorg] + - Including changes from Ian Holsman to build under Red Hat 7.3. + - Fixing some problems with the /usr/local path change. + * Sat Mar 27 2004 Sean Reifschneider [2.3.2-3pydotorg] - Being more agressive about finding the paths to fix for *************** *** 242,248 **** # Tools echo '#!/bin/bash' >${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix} ! echo 'exec %{_prefix}/bin/python%{binsuffix} /usr/lib/python%{libvers}/idlelib/idle.py' >>$RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix} chmod 755 $RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix} ! cp -a Tools $RPM_BUILD_ROOT%{_prefix}/lib/python%{libvers} # MAKE FILE LISTS --- 246,252 ---- # Tools echo '#!/bin/bash' >${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix} ! echo 'exec %{__prefix}/bin/python%{binsuffix} /usr/lib/python%{libvers}/idlelib/idle.py' >>$RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix} chmod 755 $RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix} ! cp -a Tools $RPM_BUILD_ROOT%{__prefix}/lib/python%{libvers} # MAKE FILE LISTS *************** *** 272,281 **** # fix the #! line in installed files ! find . -type f -print0 | xargs -0 grep -l /usr/local/bin/python | ! while read file do sed 's|^#!.*python|#!/usr/bin/env python'"%{binsuffix}"'|' \ ! "$RPM_BUILD_ROOT"/"$file" >/tmp/fix-python-path.$$ ! cat /tmp/fix-python-path.$$ >"$RPM_BUILD_ROOT"/"$file" rm -f /tmp/fix-python-path.$$ done --- 276,286 ---- # fix the #! line in installed files ! find "$RPM_BUILD_ROOT" -type f -print0 | ! xargs -0 grep -l /usr/local/bin/python | while read file do + FIXFILE="$file" sed 's|^#!.*python|#!/usr/bin/env python'"%{binsuffix}"'|' \ ! "$FIXFILE" >/tmp/fix-python-path.$$ ! cat /tmp/fix-python-path.$$ >"$FIXFILE" rm -f /tmp/fix-python-path.$$ done *************** *** 315,319 **** %doc Misc/README Misc/cheatsheet Misc/Porting %doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS ! %{__prefix}/man/man1/python%{binsuffix}.1.gz %dir %{__prefix}/include/python%{libvers} --- 320,324 ---- %doc Misc/README Misc/cheatsheet Misc/Porting %doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS ! %{__prefix}/man/man1/python%{binsuffix}.1* %dir %{__prefix}/include/python%{libvers} From loewis at users.sourceforge.net Mon May 31 15:40:59 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon May 31 15:41:04 2004 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.4.spec, NONE, 1.1 python-2.3.spec, 1.6, NONE Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12101 Added Files: python-2.4.spec Removed Files: python-2.3.spec Log Message: Copy from python-2.3.spec. Incorporate patch #961465: Including changes from Ian Holsman to build under Red Hat 7.3. Fixing some problems with the /usr/local path change. --- NEW FILE: python-2.4.spec --- ########################## # User-modifiable configs ########################## # Is the resulting package and the installed binary named "python" or # "python2"? #WARNING: Commenting out doesn't work. Last line is what's used. %define config_binsuffix none %define config_binsuffix 2.4 # Build tkinter? "auto" enables it if /usr/bin/wish exists. #WARNING: Commenting out doesn't work. Last line is what's used. %define config_tkinter no %define config_tkinter yes %define config_tkinter auto # Use pymalloc? The last line (commented or not) determines wether # pymalloc is used. #WARNING: Commenting out doesn't work. Last line is what's used. %define config_pymalloc no %define config_pymalloc yes # Enable IPV6? #WARNING: Commenting out doesn't work. Last line is what's used. %define config_ipv6 yes %define config_ipv6 no ################################# # End of user-modifiable configs ################################# %define name python %define version 2.4.0 %define libvers 2.4 %define release 1pydotorg %define __prefix /usr # kludge to get around rpm define weirdness %define ipv6 %(if [ "%{config_ipv6}" = yes ]; then echo --enable-ipv6; else echo --disable-ipv6; fi) %define pymalloc %(if [ "%{config_pymalloc}" = yes ]; then echo --with-pymalloc; else echo --without-pymalloc; fi) %define binsuffix %(if [ "%{config_binsuffix}" = none ]; then echo ; else echo "%{config_binsuffix}"; fi) %define include_tkinter %(if [ \\( "%{config_tkinter}" = auto -a -f /usr/bin/wish \\) -o "%{config_tkinter}" = yes ]; then echo 1; else echo 0; fi) # detect if documentation is available %define include_docs %(if [ -f "%{_sourcedir}/html-%{version}.tar.bz2" ]; then echo 1; else echo 0; fi) Summary: An interpreted, interactive, object-oriented programming language. Name: %{name}%{binsuffix} Version: %{version} Release: %{release} Copyright: Modified CNRI Open Source License Group: Development/Languages Source: Python-%{version}.tgz %if %{include_docs} Source1: html-%{version}.tar.bz2 %endif BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildPrereq: expat-devel BuildPrereq: db4-devel BuildPrereq: gdbm-devel Prefix: %{__prefix} Packager: Sean Reifschneider %description Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C++. It is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the Mac. %package devel Summary: The libraries and header files needed for Python extension development. Prereq: python%{binsuffix} = %{PACKAGE_VERSION} Group: Development/Libraries %description devel The Python programming language's interpreter can be extended with dynamically loaded extensions and can be embedded in other programs. This package contains the header files and libraries needed to do these types of tasks. Install python-devel if you want to develop Python extensions. The python package will also need to be installed. You'll probably also want to install the python-docs package, which contains Python documentation. %if %{include_tkinter} %package tkinter Summary: A graphical user interface for the Python scripting language. Group: Development/Languages Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release} %description tkinter The Tkinter (Tk interface) program is an graphical user interface for the Python scripting language. You should install the tkinter package if you'd like to use a graphical user interface for Python programming. %endif %package tools Summary: A collection of development tools included with Python. Group: Development/Tools Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release} %description tools The Python package includes several development tools that are used to build python programs. This package contains a selection of those tools, including the IDLE Python IDE. Install python-tools if you want to use these tools to develop Python programs. You will also need to install the python and tkinter packages. %if %{include_docs} %package docs Summary: Python-related documentation. Group: Development/Documentation %description docs Documentation relating to the Python programming language in HTML and info formats. %endif %changelog * Thu May 27 2004 Sean Reifschneider [2.3.4-2pydotorg] - Including changes from Ian Holsman to build under Red Hat 7.3. - Fixing some problems with the /usr/local path change. * Sat Mar 27 2004 Sean Reifschneider [2.3.2-3pydotorg] - Being more agressive about finding the paths to fix for #!/usr/local/bin/python. * Sat Feb 07 2004 Sean Reifschneider [2.3.3-2pydotorg] - Adding code to remove "#!/usr/local/bin/python" from particular files and causing the RPM build to terminate if there are any unexpected files which have that line in them. * Mon Oct 13 2003 Sean Reifschneider [2.3.2-1pydotorg] - Adding code to detect wether documentation is available to build. * Fri Sep 19 2003 Sean Reifschneider [2.3.1-1pydotorg] - Updating to the 2.3.1 release. * Mon Feb 24 2003 Sean Reifschneider [2.3b1-1pydotorg] - Updating to 2.3b1 release. * Mon Feb 17 2003 Sean Reifschneider [2.3a1-1] - Updating to 2.3 release. * Sun Dec 23 2001 Sean Reifschneider [Release 2.2-2] - Added -docs package. - Added "auto" config_tkinter setting which only enables tk if /usr/bin/wish exists. * Sat Dec 22 2001 Sean Reifschneider [Release 2.2-1] - Updated to 2.2. - Changed the extension to "2" from "2.2". * Tue Nov 18 2001 Sean Reifschneider [Release 2.2c1-1] - Updated to 2.2c1. * Thu Nov 1 2001 Sean Reifschneider [Release 2.2b1-3] - Changed the way the sed for fixing the #! in pydoc works. * Wed Oct 24 2001 Sean Reifschneider [Release 2.2b1-2] - Fixed missing "email" package, thanks to anonymous report on sourceforge. - Fixed missing "compiler" package. * Mon Oct 22 2001 Sean Reifschneider [Release 2.2b1-1] - Updated to 2.2b1. * Mon Oct 9 2001 Sean Reifschneider [Release 2.2a4-4] - otto@balinor.mat.unimi.it mentioned that the license file is missing. * Sun Sep 30 2001 Sean Reifschneider [Release 2.2a4-3] - Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in the spec files. Thanks. * Wed Jul 25 2001 Sean Reifschneider [Release 2.2a1-1] - Updated to 2.2a1 release. - Changed idle and pydoc to use binsuffix macro ####### # PREP ####### %prep %setup -n Python-%{version} ######## # BUILD ######## %build ./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix} make ########## # INSTALL ########## %install # set the install path echo '[install_scripts]' >setup.cfg echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{__prefix}/lib/python%{libvers}/lib-dynload make prefix=$RPM_BUILD_ROOT%{__prefix} install # REPLACE PATH IN PYDOC if [ ! -z "%{binsuffix}" ] then ( cd $RPM_BUILD_ROOT%{__prefix}/bin mv pydoc pydoc.old sed 's|#!.*|#!/usr/bin/env python'%{binsuffix}'|' \ pydoc.old >pydoc chmod 755 pydoc rm -f pydoc.old ) fi # add the binsuffix if [ ! -z "%{binsuffix}" ] then ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*; mv -f python python"%{binsuffix}" ) ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 ) ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" ) ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" ) fi ######## # Tools echo '#!/bin/bash' >${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix} echo 'exec %{__prefix}/bin/python%{binsuffix} /usr/lib/python%{libvers}/idlelib/idle.py' >>$RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix} chmod 755 $RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix} cp -a Tools $RPM_BUILD_ROOT%{__prefix}/lib/python%{libvers} # MAKE FILE LISTS rm -f mainpkg.files find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/lib-dynload -type f | sed "s|^${RPM_BUILD_ROOT}|/|" | grep -v -e '_tkinter.so$' >mainpkg.files find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f | sed "s|^${RPM_BUILD_ROOT}|/|" | grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files rm -f tools.files find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/idlelib \ "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/Tools -type f | sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files ###### # Docs %if %{include_docs} mkdir -p "$RPM_BUILD_ROOT"/var/www/html/python ( cd "$RPM_BUILD_ROOT"/var/www/html/python bunzip2 < %{SOURCE1} | tar x ) %endif # fix the #! line in installed files find "$RPM_BUILD_ROOT" -type f -print0 | xargs -0 grep -l /usr/local/bin/python | while read file do FIXFILE="$file" sed 's|^#!.*python|#!/usr/bin/env python'"%{binsuffix}"'|' \ "$FIXFILE" >/tmp/fix-python-path.$$ cat /tmp/fix-python-path.$$ >"$FIXFILE" rm -f /tmp/fix-python-path.$$ done # check to see if there are any straggling #! lines find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \ | grep ':1:#!' >/tmp/python-rpm-files.$$ || true if [ -s /tmp/python-rpm-files.$$ ] then echo '*****************************************************' cat /tmp/python-rpm-files.$$ cat <<@EOF ***************************************************** There are still files referencing /usr/local/bin/python in the install directory. They are listed above. Please fix the .spec file and try again. If you are an end-user, you probably want to report this to jafo-rpms@tummy.com as well. ***************************************************** @EOF rm -f /tmp/python-rpm-files.$$ exit 1 fi rm -f /tmp/python-rpm-files.$$ ######## # CLEAN ######## %clean [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT rm -f mainpkg.files tools.files ######## # FILES ######## %files -f mainpkg.files %defattr(-,root,root) %doc Misc/README Misc/cheatsheet Misc/Porting %doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS %{__prefix}/man/man1/python%{binsuffix}.1* %dir %{__prefix}/include/python%{libvers} %dir %{__prefix}/lib/python%{libvers}/ %{__prefix}/lib/python%{libvers}/*.txt %{__prefix}/lib/python%{libvers}/*.py* %{__prefix}/lib/python%{libvers}/pdb.doc %{__prefix}/lib/python%{libvers}/profile.doc %{__prefix}/lib/python%{libvers}/curses %{__prefix}/lib/python%{libvers}/distutils %{__prefix}/lib/python%{libvers}/encodings %{__prefix}/lib/python%{libvers}/plat-linux2 %{__prefix}/lib/python%{libvers}/site-packages %{__prefix}/lib/python%{libvers}/test %{__prefix}/lib/python%{libvers}/xml %{__prefix}/lib/python%{libvers}/email %{__prefix}/lib/python%{libvers}/compiler %{__prefix}/lib/python%{libvers}/bsddb %{__prefix}/lib/python%{libvers}/hotshot %{__prefix}/lib/python%{libvers}/logging %{__prefix}/lib/python%{libvers}/lib-old %files devel %defattr(-,root,root) %{__prefix}/include/python%{libvers}/*.h %{__prefix}/lib/python%{libvers}/config %files -f tools.files tools %defattr(-,root,root) %if %{include_tkinter} %files tkinter %defattr(-,root,root) %{__prefix}/lib/python%{libvers}/lib-tk %{__prefix}/lib/python%{libvers}/lib-dynload/_tkinter.so* %endif %if %{include_docs} %files docs %defattr(-,root,root) /var/www/html/python/* %endif --- python-2.3.spec DELETED --- From Rhea at dbzmail.com Mon May 31 17:39:03 2004 From: Rhea at dbzmail.com (Krista Mclain) Date: Mon May 31 16:45:10 2004 Subject: [Python-checkins] Do not have money, get software cds from here! tarantara Message-ID: Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/gif Size: 10721 bytes Desc: not available Url : http://mail.python.org/pipermail/python-checkins/attachments/20040601/f6530259/attachment.gif From rhettinger at users.sourceforge.net Mon May 31 18:53:27 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon May 31 18:53:31 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.231,1.232 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20371 Modified Files: tut.tex Log Message: Fixup spacing in an example. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.231 retrieving revision 1.232 diff -C2 -d -r1.231 -r1.232 *** tut.tex 26 May 2004 13:57:54 -0000 1.231 --- tut.tex 31 May 2004 22:53:25 -0000 1.232 *************** *** 4593,4598 **** >>> import urllib2 >>> for line in urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'): ! ... if 'EST' in line: # look for Eastern Standard Time ! ... print line
Nov. 25, 09:43:32 PM EST --- 4593,4598 ---- >>> import urllib2 >>> for line in urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'): ! ... if 'EST' in line: # look for Eastern Standard Time ! ... print line
Nov. 25, 09:43:32 PM EST From ZPSTMKRIBXSVHN at hotmail.com Mon May 31 22:38:47 2004 From: ZPSTMKRIBXSVHN at hotmail.com (Claudette Riggs) Date: Mon May 31 22:37:41 2004 Subject: [Python-checkins] Find out what's best for you! Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040601/2720c2a3/attachment.html