From akuchling at users.sourceforge.net Wed Dec 1 01:42:44 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Dec 1 01:42:46 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.119, 1.120 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19639 Modified Files: whatsnew24.tex Log Message: [Patch #1076365] Correction of name of Template class; add contributor Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.119 retrieving revision 1.120 diff -u -d -r1.119 -r1.120 --- whatsnew24.tex 30 Nov 2004 14:42:24 -0000 1.119 +++ whatsnew24.tex 1 Dec 2004 00:42:41 -0000 1.120 @@ -227,7 +227,7 @@ method that ignores missing keys: \begin{verbatim} ->>> t = string.SafeTemplate('$page: $title') +>>> t = string.Template('$page: $title') >>> t.safe_substitute({'page':3}) u'3: $title' \end{verbatim} @@ -881,6 +881,7 @@ \item Strings also gained an \method{rsplit()} method that works like the \method{split()} method but splits from the end of the string. +(Contributed by Sean Reifschneider.) \begin{verbatim} >>> 'www.python.org'.split('.', 1) @@ -1729,6 +1730,6 @@ The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this article: Koray Can, Hye-Shik Chang, Michael Dyck, Raymond Hettinger, -Brian Hurt, Hamish Lawson, Fredrik Lundh. +Brian Hurt, Hamish Lawson, Fredrik Lundh, Sean Reifschneider. \end{document} From akuchling at users.sourceforge.net Wed Dec 1 01:45:17 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Dec 1 01:45:20 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.120, 1.121 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20197 Modified Files: whatsnew24.tex Log Message: Remove mention of Template being a subclass of unicode Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.120 retrieving revision 1.121 diff -u -d -r1.120 -r1.121 --- whatsnew24.tex 1 Dec 2004 00:42:41 -0000 1.120 +++ whatsnew24.tex 1 Dec 2004 00:45:15 -0000 1.121 @@ -209,15 +209,13 @@ difficult to provide helpful feedback to them. PEP 292 adds a \class{Template} class to the \module{string} module -that uses \samp{\$} to indicate a substitution. \class{Template} is a -subclass of the built-in Unicode type, so the result is always a -Unicode string: +that uses \samp{\$} to indicate a substitution: \begin{verbatim} >>> import string >>> t = string.Template('$page: $title') >>> t.substitute({'page':2, 'title': 'The Best of Times'}) -u'2: The Best of Times' +'2: The Best of Times' \end{verbatim} % $ Terminate $-mode for Emacs @@ -229,7 +227,7 @@ \begin{verbatim} >>> t = string.Template('$page: $title') >>> t.safe_substitute({'page':3}) -u'3: $title' +'3: $title' \end{verbatim} % $ Terminate math-mode for Emacs From akuchling at users.sourceforge.net Wed Dec 1 01:46:36 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Dec 1 01:46:40 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.121, 1.122 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20396 Modified Files: whatsnew24.tex Log Message: Bump version number Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.121 retrieving revision 1.122 diff -u -d -r1.121 -r1.122 --- whatsnew24.tex 1 Dec 2004 00:45:15 -0000 1.121 +++ whatsnew24.tex 1 Dec 2004 00:46:33 -0000 1.122 @@ -7,7 +7,7 @@ % to be covered. --amk \title{What's New in Python 2.4} -\release{1.01} +\release{1.02} \author{A.M.\ Kuchling} \authoraddress{ \strong{Python Software Foundation}\\ From akuchling at users.sourceforge.net Wed Dec 1 01:57:14 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Dec 1 01:57:17 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.122, 1.123 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22981 Modified Files: whatsnew24.tex Log Message: Mention getservbyport(). There's no patch number in the CVS log, so I assume Barry wrote the code. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.122 retrieving revision 1.123 diff -u -d -r1.122 -r1.123 --- whatsnew24.tex 1 Dec 2004 00:46:33 -0000 1.122 +++ whatsnew24.tex 1 Dec 2004 00:57:12 -0000 1.123 @@ -1422,9 +1422,10 @@ Python 2.4's regular expression engine can match this pattern without problems. -\item A new \function{socketpair()} function, returning a pair of -connected sockets, was added to the \module{socket} module. -(Contributed by Dave Cole.) +\item Two new functions were added to the \module{socket} module. +\function{socketpair()} returns a pair of connected sockets and +\function{getservbyport(\var{port})} looks up the service name for a +given port number. (Contributed by Dave Cole and Barry Warsaw.) \item The \function{sys.exitfunc()} function has been deprecated. Code should be using the existing \module{atexit} module, which correctly From rhettinger at users.sourceforge.net Wed Dec 1 05:22:41 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 1 05:22:44 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.261,1.262 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4883 Modified Files: tut.tex Log Message: Fix nit. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.261 retrieving revision 1.262 diff -u -d -r1.261 -r1.262 --- tut.tex 29 Nov 2004 13:12:44 -0000 1.261 +++ tut.tex 1 Dec 2004 04:22:38 -0000 1.262 @@ -4413,7 +4413,7 @@ Another key feature is that the local variables and execution state are automatically saved between calls. This made the function easier to write -and much more clear than an approach using class variables like +and much more clear than an approach using instance variables like \code{self.index} and \code{self.data}. In addition to automatic method creation and saving program state, when From fdrake at users.sourceforge.net Wed Dec 1 06:05:50 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Dec 1 06:05:54 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew25.tex, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14613 Added Files: whatsnew25.tex Log Message: Continue the post-release mechanics; we need a "What's New" document so the docs can be built. --- NEW FILE: whatsnew25.tex --- \documentclass{howto} \usepackage{distutils} % $Id: whatsnew25.tex,v 1.1 2004/12/01 05:05:47 fdrake Exp $ % When creating a new ``What's New'' document, copy this to % ../whatsnew/whatsnewXY.tex, where X is replaced by the major version % number and Y, by the minor version number for the release of Python % being described. % % The following replacements need to be made in the text: % % X.Y -- the version of Python this document describes % X.Y-1 -- previous minor release (not a maintenance release) % X.Y-2 -- minor release before that one (optional; search the % template to see the usage % % In this document, these map to the following replacements: % (Please complete this section when specific replacements are made.) % % X.Y -- 2.5 % X.Y-1 -- 2.4.something (not yet determined) % X.Y-2 -- 2.4.something (not yet determined) % % Once done, write and edit to your heart's content! \title{What's New in Python 2.5} \release{0.0} \author{Young Author} \authoraddress{\email{ya@example.com}} \begin{document} \maketitle \tableofcontents This article explains the new features in Python 2.5. No release date for Python 2.5 has been set; expect that this will happen next year. % Compare with previous release in 2 - 3 sentences here. This article doesn't attempt to provide a complete specification of the new features, but instead provides a convenient overview. For full details, you should refer to the documentation for Python 2.5. % add hyperlink when the documentation becomes available online. If you want to understand the complete implementation and design rationale, refer to the PEP for a particular new feature. %====================================================================== % Large, PEP-level features and changes should be described here. %====================================================================== \section{Other Language Changes} Here are all of the changes that Python 2.5 makes to the core Python language. \begin{itemize} \item TBD \end{itemize} %====================================================================== \subsection{Optimizations} \begin{itemize} \item Optimizations should be described here. \end{itemize} The net result of the 2.5 optimizations is that Python 2.5 runs the pystone benchmark around XX\% faster than Python X.Y-1.% % only use the next line if you want to do the extra work ;) : % and YY\% faster than Python X.Y-2. %====================================================================== \section{New, Improved, and Deprecated Modules} As usual, Python's standard library received a number of enhancements and bug fixes. Here's a partial list of the most notable changes, sorted alphabetically by module name. Consult the \file{Misc/NEWS} file in the source tree for a more complete list of changes, or look through the CVS logs for all the details. \begin{itemize} \item Descriptions go here. \end{itemize} %====================================================================== % whole new modules get described in \subsections here % ====================================================================== \section{Build and C API Changes} Changes to Python's build process and to the C API include: \begin{itemize} \item Detailed changes are listed here. \end{itemize} %====================================================================== \subsection{Port-Specific Changes} Platform-specific changes go here. %====================================================================== \section{Other Changes and Fixes \label{section-other}} As usual, there were a bunch of other improvements and bugfixes scattered throughout the source tree. A search through the CVS change logs finds there were XXX patches applied and YYY bugs fixed between Python X.Y-1 and 2.5. Both figures are likely to be underestimates. Some of the more notable changes are: \begin{itemize} \item Details go here. \end{itemize} %====================================================================== \section{Porting to Python 2.5} This section lists previously described changes that may require changes to your code: \begin{itemize} \item Everything is all in the details! \end{itemize} %====================================================================== \section{Acknowledgements \label{acks}} The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this article: . \end{document} From fdrake at users.sourceforge.net Wed Dec 1 06:55:50 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Dec 1 06:55:52 2004 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.279,1.280 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24684 Modified Files: Makefile Log Message: - bump version number for "What's New" document - don't create .tgz version of doc source package, since we're not generating that for the other formats either Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.279 retrieving revision 1.280 diff -u -d -r1.279 -r1.280 --- Makefile 5 Nov 2004 04:51:05 -0000 1.279 +++ Makefile 1 Dec 2004 05:55:47 -0000 1.280 @@ -122,7 +122,7 @@ # The end of this should reflect the major/minor version numbers of # the release: -WHATSNEW=whatsnew24 +WHATSNEW=whatsnew25 # what's what MANDVIFILES= paper-$(PAPER)/api.dvi paper-$(PAPER)/ext.dvi \ @@ -700,7 +700,7 @@ $(TOOLSDIR)/mkpkglist >pkglist.html distfiles: paperdist edist - $(TOOLSDIR)/mksourcepkg --all $(RELEASE) + $(TOOLSDIR)/mksourcepkg --bzip2 --zip $(RELEASE) $(TOOLSDIR)/mkpkglist >pkglist.html From fdrake at users.sourceforge.net Wed Dec 1 07:29:55 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Dec 1 07:29:59 2004 Subject: [Python-checkins] python/dist/src/Doc/texinputs python.sty, 1.110, 1.110.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30902/texinputs Modified Files: Tag: release24-maint python.sty Log Message: - fix up internal hyperlink generation in PDF formatting so that links at the beginning of a paragraph do not generate errors; this affected things like \refmodule when it came first in a paragraph - clean up the .sty file to separate out the treatment of the start of a new paragraph Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.110 retrieving revision 1.110.2.1 diff -u -d -r1.110 -r1.110.2.1 --- python.sty 21 Aug 2004 15:13:52 -0000 1.110 +++ python.sty 1 Dec 2004 06:29:51 -0000 1.110.2.1 @@ -20,6 +20,11 @@ %\RequirePackage{showkeys} %\RequirePackage{showidx} +% If we ever want to indent paragraphs, this needs to be changed. +% This is used inside the macros defined here instead of coding +% \noindent directly. +\let\py@parindent=\noindent + % for PDF output, use maximal compression & a lot of other stuff % (test for PDF recommended by Tanmoy Bhattacharya ) % @@ -56,12 +61,19 @@ \let\pdfstartlink=\pdfannotlink }{} % + % The \py@parindent here is a hack -- we're forcing pdfTeX into + % horizontal mode since \pdfstartlink requires that. + \def\py@pdfstartlink{% + \ifvmode\py@parindent\fi% + \pdfstartlink% + } + % % Macro that takes two args: the name to link to and the content of % the link. This takes care of the PDF magic, getting the colors % the same for each link, and avoids having lots of garbage all over % this style file. \newcommand{\py@linkToName}[2]{% - \pdfstartlink attr{/Border [0 0 0]} goto name{#1}% + \py@pdfstartlink attr{/Border [0 0 0]} goto name{#1}% \py@LinkColor#2\py@NormalColor% \pdfendlink% } @@ -857,8 +869,7 @@ % but only if we actually used hyperref: \ifpdf \newcommand{\url}[1]{{% - \noindent% - \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}% + \py@pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}% \py@LinkColor% color of the link text \py@smallsize\sf #1% \py@NormalColor% Turn it back off; these are declarative @@ -933,11 +944,9 @@ % \ulink{link text}{URL} \ifpdf - % The \noindent here is a hack -- we're forcing pdfTeX into - % horizontal mode since \pdfstartlink requires that. - % For PDF, we *should* only generate a link when the URL is absolute. - \newcommand{\ulink}[2]{\noindent{% - \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}% + \newcommand{\ulink}[2]{{% + % For PDF, we *should* only generate a link when the URL is absolute. + \py@pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}% \py@LinkColor% color of the link text #1% \py@NormalColor% Turn it back off; these are declarative From fdrake at users.sourceforge.net Wed Dec 1 07:30:33 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Dec 1 07:30:37 2004 Subject: [Python-checkins] python/dist/src/Doc/texinputs python.sty, 1.110, 1.111 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31049/texinputs Modified Files: python.sty Log Message: - fix up internal hyperlink generation in PDF formatting so that links at the beginning of a paragraph do not generate errors; this affected things like \refmodule when it came first in a paragraph - clean up the .sty file to separate out the treatment of the start of a new paragraph Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.110 retrieving revision 1.111 diff -u -d -r1.110 -r1.111 --- python.sty 21 Aug 2004 15:13:52 -0000 1.110 +++ python.sty 1 Dec 2004 06:30:31 -0000 1.111 @@ -20,6 +20,11 @@ %\RequirePackage{showkeys} %\RequirePackage{showidx} +% If we ever want to indent paragraphs, this needs to be changed. +% This is used inside the macros defined here instead of coding +% \noindent directly. +\let\py@parindent=\noindent + % for PDF output, use maximal compression & a lot of other stuff % (test for PDF recommended by Tanmoy Bhattacharya ) % @@ -56,12 +61,19 @@ \let\pdfstartlink=\pdfannotlink }{} % + % The \py@parindent here is a hack -- we're forcing pdfTeX into + % horizontal mode since \pdfstartlink requires that. + \def\py@pdfstartlink{% + \ifvmode\py@parindent\fi% + \pdfstartlink% + } + % % Macro that takes two args: the name to link to and the content of % the link. This takes care of the PDF magic, getting the colors % the same for each link, and avoids having lots of garbage all over % this style file. \newcommand{\py@linkToName}[2]{% - \pdfstartlink attr{/Border [0 0 0]} goto name{#1}% + \py@pdfstartlink attr{/Border [0 0 0]} goto name{#1}% \py@LinkColor#2\py@NormalColor% \pdfendlink% } @@ -857,8 +869,7 @@ % but only if we actually used hyperref: \ifpdf \newcommand{\url}[1]{{% - \noindent% - \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}% + \py@pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}% \py@LinkColor% color of the link text \py@smallsize\sf #1% \py@NormalColor% Turn it back off; these are declarative @@ -933,11 +944,9 @@ % \ulink{link text}{URL} \ifpdf - % The \noindent here is a hack -- we're forcing pdfTeX into - % horizontal mode since \pdfstartlink requires that. - % For PDF, we *should* only generate a link when the URL is absolute. - \newcommand{\ulink}[2]{\noindent{% - \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}% + \newcommand{\ulink}[2]{{% + % For PDF, we *should* only generate a link when the URL is absolute. + \py@pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}% \py@LinkColor% color of the link text #1% \py@NormalColor% Turn it back off; these are declarative From doko at users.sourceforge.net Wed Dec 1 08:37:00 2004 From: doko at users.sourceforge.net (doko@users.sourceforge.net) Date: Wed Dec 1 08:37:04 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.157, 1.831.4.158 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9830/Misc Modified Files: Tag: release23-maint NEWS Log Message: Taken from 2.4/HEAD: - Bug #875692: Improve signal handling, especially when using threads, by forcing an early re-execution of PyEval_EvalFrame() "periodic" code when things_to_do is not cleared by Py_MakePendingCalls(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.157 retrieving revision 1.831.4.158 diff -u -d -r1.831.4.157 -r1.831.4.158 --- NEWS 31 Oct 2004 00:13:05 -0000 1.831.4.157 +++ NEWS 1 Dec 2004 07:36:56 -0000 1.831.4.158 @@ -36,6 +36,10 @@ - Bug #845802: Python crashed when __init__.py is a directory. +- Bug #875692: Improve signal handling, especially when using threads, by + forcing an early re-execution of PyEval_EvalFrame() "periodic" code when + things_to_do is not cleared by Py_MakePendingCalls(). + Extension modules ----------------- From doko at users.sourceforge.net Wed Dec 1 08:37:01 2004 From: doko at users.sourceforge.net (doko@users.sourceforge.net) Date: Wed Dec 1 08:37:05 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.367,2.367.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9830/Python Modified Files: Tag: release23-maint ceval.c Log Message: Taken from 2.4/HEAD: - Bug #875692: Improve signal handling, especially when using threads, by forcing an early re-execution of PyEval_EvalFrame() "periodic" code when things_to_do is not cleared by Py_MakePendingCalls(). Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.367 retrieving revision 2.367.8.1 diff -u -d -r2.367 -r2.367.8.1 --- ceval.c 29 Jun 2003 14:48:32 -0000 2.367 +++ ceval.c 1 Dec 2004 07:36:58 -0000 2.367.8.1 @@ -785,6 +785,12 @@ why = WHY_EXCEPTION; goto on_error; } + if (things_to_do) + /* MakePendingCalls() didn't succeed. + Force early re-execution of this + "periodic" code, possibly after + a thread switch */ + _Py_Ticker = 0; } #if !defined(HAVE_SIGNAL_H) || defined(macintosh) /* If we have true signals, the signal handler From theller at users.sourceforge.net Wed Dec 1 19:18:14 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed Dec 1 19:18:17 2004 Subject: [Python-checkins] python/dist/src/PC/bdist_wininst install.c, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/PC/bdist_wininst In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19473 Modified Files: install.c Log Message: Running the pre-install or post-install script did not work when Python was installed with the 'only for me' option. The registry key had a hardcoded '2.3' in it where the python version chosen for installation should be used instead. Will backport myself. Index: install.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/bdist_wininst/install.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- install.c 19 Jul 2004 09:57:58 -0000 1.10 +++ install.c 1 Dec 2004 18:18:08 -0000 1.11 @@ -611,12 +611,15 @@ static HINSTANCE LoadPythonDll(char *fname) { char fullpath[_MAX_PATH]; + char subkey_name[80]; LONG size = sizeof(fullpath); HINSTANCE h = LoadLibrary(fname); if (h) return h; - if (ERROR_SUCCESS != RegQueryValue(HKEY_CURRENT_USER, - "SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath", + wsprintf(subkey_name, + "SOFTWARE\\Python\\PythonCore\\%s.%s\\InstallPath", + py_major, py_minor); + if (ERROR_SUCCESS != RegQueryValue(HKEY_CURRENT_USER, subkey_name, fullpath, &size)) return NULL; strcat(fullpath, "\\"); @@ -1793,7 +1796,7 @@ /* Strip the trailing backslash again */ python_dir[strlen(python_dir)-1] = '\0'; - CheckRootKey(hwnd); + CheckRootKey(hwnd); if (!OpenLogfile(python_dir)) break; From akuchling at users.sourceforge.net Wed Dec 1 19:34:13 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Dec 1 19:34:16 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsimplexmlrpc.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-serv23533 Modified Files: libsimplexmlrpc.tex Log Message: Make the example server code clearer; add the corresponding example client. [Bugfix candidate] Index: libsimplexmlrpc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsimplexmlrpc.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- libsimplexmlrpc.tex 8 Oct 2004 18:34:47 -0000 1.7 +++ libsimplexmlrpc.tex 1 Dec 2004 18:34:11 -0000 1.8 @@ -88,18 +88,49 @@ Example: \begin{verbatim} -class MyFuncs: - def div(self, x, y) : return x // y - +from SimpleXMLRPCServer import SimpleXMLRPCServer +# Create server server = SimpleXMLRPCServer(("localhost", 8000)) -server.register_function(pow) -server.register_function(lambda x,y: x+y, 'add') server.register_introspection_functions() + +# Register pow() function; this will use the value of +# pow.__name__ as the name, which is just 'pow'. +server.register_function(pow) + +# Register a function under a different name +def adder_function(x,y): + return x + y +server.register_function(adder_function, 'add') + +# Register an instance; all the methods of the instance are +# published as XML-RPC methods (in this case, just 'div'). +class MyFuncs: + def div(self, x, y): + return x // y + server.register_instance(MyFuncs()) + +# Run the server's main loop server.serve_forever() \end{verbatim} +The following client code will call the methods made available by +the preceding server: + +\begin{verbatim} +import xmlrpclib + +s = xmlrpclib.Server('http://localhost:8000') +print s.pow(2,3) # Returns 2**3 = 8 +print s.add(2,3) # Returns 5 +print s.div(5,2) # Returns 5//2 = 2 + +# Print list of available methods +print s.system.listMethods() +\end{verbatim} + + \subsection{CGIXMLRPCRequestHandler} The \class{CGIXMLRPCRequestHandler} class can be used to From theller at users.sourceforge.net Wed Dec 1 20:39:55 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed Dec 1 20:39:57 2004 Subject: [Python-checkins] python/dist/src/PC pyconfig.h,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8019 Modified Files: pyconfig.h Log Message: Update import library name on windows. Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/pyconfig.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- pyconfig.h 15 Oct 2004 04:26:18 -0000 1.31 +++ pyconfig.h 1 Dec 2004 19:39:52 -0000 1.32 @@ -225,9 +225,9 @@ their Makefile (other compilers are generally taken care of by distutils.) */ # ifdef _DEBUG -# pragma comment(lib,"python24_d.lib") +# pragma comment(lib,"python25_d.lib") # else -# pragma comment(lib,"python24.lib") +# pragma comment(lib,"python25.lib") # endif /* _DEBUG */ # endif /* _MSC_VER */ # endif /* Py_BUILD_CORE */ From theller at users.sourceforge.net Wed Dec 1 20:40:47 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed Dec 1 20:40:51 2004 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.vcproj, 1.25, 1.26 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8257 Modified Files: pythoncore.vcproj Log Message: Update the filenames in the MSVC project file for Python 2.5. Index: pythoncore.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.vcproj,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- pythoncore.vcproj 29 Nov 2004 09:57:14 -0000 1.25 +++ pythoncore.vcproj 1 Dec 2004 19:40:45 -0000 1.26 @@ -40,15 +40,15 @@ Name="VCCustomBuildTool"/> Update of /cvsroot/python/python/dist/src/PC/bdist_wininst In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8814 Modified Files: install.c Log Message: printf format code for integers is %d not %s. Will backport. Index: install.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/bdist_wininst/install.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- install.c 1 Dec 2004 18:18:08 -0000 1.11 +++ install.c 1 Dec 2004 19:43:02 -0000 1.12 @@ -617,7 +617,7 @@ if (h) return h; wsprintf(subkey_name, - "SOFTWARE\\Python\\PythonCore\\%s.%s\\InstallPath", + "SOFTWARE\\Python\\PythonCore\\%d.%d\\InstallPath", py_major, py_minor); if (ERROR_SUCCESS != RegQueryValue(HKEY_CURRENT_USER, subkey_name, fullpath, &size)) From theller at users.sourceforge.net Wed Dec 1 20:43:36 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed Dec 1 20:43:46 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command wininst-7.1.exe, 1.5, 1.6 wininst-6.exe, 1.5, 1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8951 Modified Files: wininst-7.1.exe wininst-6.exe Log Message: Recompiled binaries after source changes. Index: wininst-7.1.exe =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/wininst-7.1.exe,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 Binary files /tmp/cvsFUMMCw and /tmp/cvsAb0z6U differ Index: wininst-6.exe =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/wininst-6.exe,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 Binary files /tmp/cvskV8gRy and /tmp/cvsY0evmX differ From loewis at users.sourceforge.net Wed Dec 1 22:46:38 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Dec 1 22:46:42 2004 Subject: [Python-checkins] python/dist/src/Tools/msi msi.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/msi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7337 Modified Files: msi.py Log Message: Add all readme files in Tools. Index: msi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/msi/msi.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- msi.py 21 Nov 2004 10:16:26 -0000 1.16 +++ msi.py 1 Dec 2004 21:46:35 -0000 1.17 @@ -982,8 +982,9 @@ if f == "pynche": x = PyDirectory(db, cab, lib, "X", "X", "X|X") x.glob("*.txt") - if f == 'Scripts': + if os.path.exists(os.path.join(lib.absolute, "README")): lib.add_file("README.txt", src="README") + if f == 'Scripts': if have_tcl: lib.start_component("pydocgui.pyw", tcltk, keyfile="pydocgui.pyw") lib.add_file("pydocgui.pyw") From loewis at users.sourceforge.net Wed Dec 1 22:47:08 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Dec 1 22:47:12 2004 Subject: [Python-checkins] python/dist/src/Tools/msi msi.py,1.16,1.16.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/msi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7502 Modified Files: Tag: release24-maint msi.py Log Message: Add all readme files in Tools. Index: msi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/msi/msi.py,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -u -d -r1.16 -r1.16.2.1 --- msi.py 21 Nov 2004 10:16:26 -0000 1.16 +++ msi.py 1 Dec 2004 21:47:02 -0000 1.16.2.1 @@ -982,8 +982,9 @@ if f == "pynche": x = PyDirectory(db, cab, lib, "X", "X", "X|X") x.glob("*.txt") - if f == 'Scripts': + if os.path.exists(os.path.join(lib.absolute, "README")): lib.add_file("README.txt", src="README") + if f == 'Scripts': if have_tcl: lib.start_component("pydocgui.pyw", tcltk, keyfile="pydocgui.pyw") lib.add_file("pydocgui.pyw") From rhettinger at users.sourceforge.net Thu Dec 2 07:08:46 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 2 07:08:49 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.262,1.263 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19897 Modified Files: tut.tex Log Message: SF bug #1076955: Tutorial corrections Part I (Submitted by some anonymous person with an amazing eye for grammer nits.) Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.262 retrieving revision 1.263 diff -u -d -r1.262 -r1.263 --- tut.tex 1 Dec 2004 04:22:38 -0000 1.262 +++ tut.tex 2 Dec 2004 06:08:42 -0000 1.263 @@ -33,7 +33,7 @@ The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the -Python Web site, \url{http://www.python.org/}, and can be freely +Python Web site, \url{http://www.python.org/}, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation. @@ -84,7 +84,7 @@ Another situation: perhaps you have to work with several C libraries, and the usual C write/compile/test/re-compile cycle is too slow. You -need to develop software more quickly. Possibly perhaps you've +need to develop software more quickly. Possibly you've written a program that could use an extension language, and you don't want to design a language, write and debug an interpreter for it, then tie it into your application. @@ -103,8 +103,8 @@ Python allows you to split up your program in modules that can be reused in other Python programs. It comes with a large collection of standard modules that you can use as the basis of your programs --- or -as examples to start learning to program in Python. There are also -built-in modules that provide things like file I/O, system calls, +as examples to start learning to program in Python. Some of these +modules provide things like file I/O, system calls, sockets, and even interfaces to graphical user interface toolkits like Tk. Python is an interpreted language, which can save you considerable time @@ -145,7 +145,7 @@ Now that you are all excited about Python, you'll want to examine it in some more detail. Since the best way to learn a language is -using it, you are invited here to do so. +using it, you are invited to do so with this tutorial. In the next chapter, the mechanics of using the interpreter are explained. This is rather mundane information, but essential for @@ -603,7 +603,7 @@ print hello \end{verbatim} -Note that newlines would still need to be embedded in the string using +Note that newlines still need to be embedded in the string using \code{\e n}; the newline following the trailing backslash is discarded. This example would print the following: @@ -847,7 +847,7 @@ Starting with Python 2.0 a new data type for storing text data is available to the programmer: the Unicode object. It can be used to store and manipulate Unicode data (see \url{http://www.unicode.org/}) -and integrates well with the existing string objects providing +and integrates well with the existing string objects, providing auto-conversions where necessary. Unicode has the advantage of providing one ordinal for every character @@ -978,8 +978,8 @@ ['eggs', 100] >>> a[:2] + ['bacon', 2*2] ['spam', 'eggs', 'bacon', 4] ->>> 3*a[:3] + ['Boe!'] -['spam', 'eggs', 100, 'spam', 'eggs', 100, 'spam', 'eggs', 100, 'Boe!'] +>>> 3*a[:3] + ['Boo!'] +['spam', 'eggs', 100, 'spam', 'eggs', 100, 'spam', 'eggs', 100, 'Boo!'] \end{verbatim} Unlike strings, which are \emph{immutable}, it is possible to change @@ -1553,8 +1553,9 @@ \end{verbatim} When a final formal parameter of the form \code{**\var{name}} is -present, it receives a \ulink{dictionary}{../lib/typesmapping.html} containing all keyword arguments -whose keyword doesn't correspond to a formal parameter. This may be +present, it receives a \ulink{dictionary}{../lib/typesmapping.html} +containing all keyword arguments except for those corresponding to +a formal parameter. This may be combined with a formal parameter of the form \code{*\var{name}} (described in the next subsection) which receives a tuple containing the positional arguments beyond the formal parameter @@ -1883,8 +1884,8 @@ [0, 2, 4, 6, 8, 10, 12, 14] \end{verbatim} -\samp{reduce(\var{func}, \var{sequence})} returns a single value -constructed by calling the binary function \var{func} on the first two +\samp{reduce(\var{function}, \var{sequence})} returns a single value +constructed by calling the binary function \var{function} on the first two items of the sequence, then on the result and the next item, and so on. For example, to compute the sum of the numbers 1 through 10: @@ -2174,10 +2175,14 @@ \begin{verbatim} >>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)]) {'sape': 4139, 'jack': 4098, 'guido': 4127} ->>> dict([(x, x**2) for x in vec]) # use a list comprehension +>>> dict([(x, x**2) for x in (2, 4, 6)) # use a list comprehension {2: 4, 4: 16, 6: 36} \end{verbatim} +Later in the tutorial, we will learn about Generator Expressions +which are even better suited for the task of supplying key-values pairs to +the \function{dict()} constructor. + \section{Looping Techniques \label{loopidioms}} @@ -2635,7 +2640,7 @@ >>> import fibo, sys >>> fib = fibo.fib >>> dir() -['__name__', 'a', 'fib', 'fibo', 'sys'] +['__builtins__', '__doc__', '__file__', '__name__', 'fib', 'fib2'] \end{verbatim} Note that it lists all types of names: variables, modules, functions, etc. @@ -2647,27 +2652,29 @@ \begin{verbatim} >>> import __builtin__ >>> dir(__builtin__) -['ArithmeticError', 'AssertionError', 'AttributeError', - 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', - 'Exception', 'False', 'FloatingPointError', 'IOError', 'ImportError', +['ArithmeticError', 'AssertionError', 'AttributeError', 'DeprecationWarning', + 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', + 'FloatingPointError', 'FutureWarning', 'IOError', 'ImportError', 'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'OverflowWarning', - 'PendingDeprecationWarning', 'ReferenceError', - 'RuntimeError', 'RuntimeWarning', 'StandardError', 'StopIteration', - 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', - 'True', 'TypeError', 'UnboundLocalError', 'UnicodeError', 'UserWarning', - 'ValueError', 'Warning', 'ZeroDivisionError', '__debug__', '__doc__', - '__import__', '__name__', 'abs', 'apply', 'bool', 'buffer', - 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', 'complex', - 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', + 'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError', + 'RuntimeWarning', 'StandardError', 'StopIteration', 'SyntaxError', + 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True', + 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', + 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', + 'UserWarning', 'ValueError', 'Warning', 'WindowsError', + 'ZeroDivisionError', '_', '__debug__', '__doc__', '__import__', + '__name__', 'abs', 'apply', 'basestring', 'bool', 'buffer', + 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', + 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', - 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', - 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', + 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', + 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min', - 'object', 'oct', 'open', 'ord', 'pow', 'property', 'quit', - 'range', 'raw_input', 'reduce', 'reload', 'repr', 'round', - 'setattr', 'slice', 'staticmethod', 'str', 'string', 'sum', 'super', + 'object', 'oct', 'open', 'ord', 'pow', 'property', 'quit', 'range', + 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', + 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip'] \end{verbatim} @@ -2824,8 +2831,8 @@ If \code{__all__} is not defined, the statement \code{from Sound.Effects import *} does \emph{not} import all submodules from the package \module{Sound.Effects} into the current namespace; it only ensures that the -package \module{Sound.Effects} has been imported (possibly running its -initialization code, \file{__init__.py}) and then imports whatever names are +package \module{Sound.Effects} has been imported (possibly running any +initialization code in \file{__init__.py}) and then imports whatever names are defined in the package. This includes any names defined (and submodules explicitly loaded) by \file{__init__.py}. It also includes any submodules of the package that were explicitly loaded by previous @@ -2907,7 +2914,7 @@ simply printing space-separated values. There are two ways to format your output; the first way is to do all the string handling yourself; using string slicing and concatenation operations you can create any -lay-out you can imagine. The standard module +layout you can imagine. The standard module \module{string}\refstmodindex{string} contains some useful operations for padding strings to a given column width; these will be discussed shortly. The second way is to use the \code{\%} operator with a @@ -3322,8 +3329,8 @@ Standard exception names are built-in identifiers (not reserved keywords). -The rest of the line is a detail whose interpretation depends on the -exception type; its meaning is dependent on the exception type. +The rest of the line provides detail based on the type of exception +and what caused it. The preceding part of the error message shows the context where the exception happened, in the form of a stack backtrace. @@ -3367,9 +3374,8 @@ \item If an exception occurs during execution of the try clause, the rest of the clause is skipped. Then if its type matches the exception named -after the \keyword{except} keyword, the rest of the try clause is -skipped, the except clause is executed, and then execution continues -after the \keyword{try} statement. +after the \keyword{except} keyword, the except clause is executed, and +then execution continues after the \keyword{try} statement. \item If an exception occurs which does not match the exception named in the @@ -3480,7 +3486,7 @@ ... except ZeroDivisionError, detail: ... print 'Handling run-time error:', detail ... -Handling run-time error: integer division or modulo +Handling run-time error: integer division or modulo by zero \end{verbatim} @@ -3499,7 +3505,9 @@ The first argument to \keyword{raise} names the exception to be raised. The optional second argument specifies the exception's -argument. +argument. Alternatively, the above could be written as +\code{raise NameError('HiThere')}. Either form works fine, but there +seems to be a growing stylistic preference for the latter. If you need to determine whether an exception was raised but don't intend to handle it, a simpler form of the \keyword{raise} statement @@ -3545,10 +3553,14 @@ __main__.MyError: 'oops!' \end{verbatim} +In this example, the default \method{__init__} of \class{Exception} has +been overriden. The new behavior simply creates the \var{value} attribute. +This replaces the default behavior of creating the \var{args} attribute. + Exception classes can be defined which do anything any other class can do, but are usually kept simple, often only offering a number of attributes that allow information about the error to be extracted by -handlers for the exception. When creating a module which can raise +handlers for the exception. When creating a module that can raise several distinct errors, a common practice is to create a base class for exceptions defined by that module, and subclass that to create specific exception classes for different error conditions: @@ -3623,7 +3635,8 @@ whether or not the use of the resource was successful. A \keyword{try} statement must either have one or more except clauses -or one finally clause, but not both. +or one finally clause, but not both (because it would be unclear which +clause should be executed). \chapter{Classes \label{classes}} @@ -3825,7 +3838,7 @@ object} is created. This is basically a wrapper around the contents of the namespace created by the class definition; we'll learn more about class objects in the next section. The original local scope -(the one in effect just before the class definitions was entered) is +(the one in effect just before the class definitions were entered) is reinstated, and the class object is bound here to the class name given in the class definition header (\class{ClassName} in the example). @@ -3907,9 +3920,9 @@ Now what can we do with instance objects? The only operations understood by instance objects are attribute references. There are -two kinds of valid attribute names. +two kinds of valid attribute names, data attributes and methods. -The first I'll call \emph{data attributes}. These correspond to +\emph{data attributes} correspond to ``instance variables'' in Smalltalk, and to ``data members'' in \Cpp. Data attributes need not be declared; like local variables, they spring into existence when they are first assigned to. For @@ -3925,16 +3938,16 @@ del x.counter \end{verbatim} -The second kind of attribute references understood by instance objects -are \emph{methods}. A method is a function that ``belongs to'' an +The other kind of instance attribute references is a \emph{method}. +A method is a function that ``belongs to'' an object. (In Python, the term method is not unique to class instances: other object types can have methods as well. For example, list objects have methods called append, insert, remove, sort, and so on. However, -below, we'll use the term method exclusively to mean methods of class -instance objects, unless explicitly stated otherwise.) +in the following discussion, we'll use the term method exclusively to mean +methods of class instance objects, unless explicitly stated otherwise.) Valid method names of an instance object depend on its class. By -definition, all attributes of a class that are (user-defined) function +definition, all attributes of a class that are function objects define corresponding methods of its instances. So in our example, \code{x.f} is a valid method reference, since \code{MyClass.f} is a function, but \code{x.i} is not, since @@ -4029,12 +4042,12 @@ variables and instance variables when glancing through a method. -Conventionally, the first argument of methods is often called +Conventionally, the first argument of a method is often called \code{self}. This is nothing more than a convention: the name \code{self} has absolutely no special meaning to Python. (Note, however, that by not following the convention your code may be less -readable by other Python programmers, and it is also conceivable that -a \emph{class browser} program be written which relies upon such a +readable to other Python programmers, and it is also conceivable that +a \emph{class browser} program might be written that relies upon such a convention.) From rhettinger at users.sourceforge.net Thu Dec 2 08:29:46 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 2 08:29:49 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex, 1.263, 1.264 glossary.tex, 1.9, 1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1904 Modified Files: tut.tex glossary.tex Log Message: SF bug #1076955: Tutorial corrections Part II Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.263 retrieving revision 1.264 diff -u -d -r1.263 -r1.264 --- tut.tex 2 Dec 2004 06:08:42 -0000 1.263 +++ tut.tex 2 Dec 2004 07:29:42 -0000 1.264 @@ -2175,7 +2175,7 @@ \begin{verbatim} >>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)]) {'sape': 4139, 'jack': 4098, 'guido': 4127} ->>> dict([(x, x**2) for x in (2, 4, 6)) # use a list comprehension +>>> dict([(x, x**2) for x in (2, 4, 6)]) # use a list comprehension {2: 4, 4: 16, 6: 36} \end{verbatim} @@ -4193,6 +4193,7 @@ variables'' or data attributes used by the common base class), it is not clear that these semantics are in any way useful. +%% XXX Add rules for new-style MRO? \section{Private Variables \label{private}} @@ -4201,9 +4202,9 @@ leading underscores, at most one trailing underscore) is textually replaced with \code{_classname__spam}, where \code{classname} is the current class name with leading underscore(s) stripped. This mangling -is done without regard of the syntactic position of the identifier, so +is done without regard to the syntactic position of the identifier, so it can be used to define class-private instance and class variables, -methods, as well as globals, and even to store instance variables +methods, variables stored in globals, and even variables stored in instances. private to this class on instances of \emph{other} classes. Truncation may occur when the mangled name would be longer than 255 characters. Outside classes, or when the class name consists of only underscores, @@ -4232,7 +4233,7 @@ \section{Odds and Ends \label{odds}} Sometimes it is useful to have a data type similar to the Pascal -``record'' or C ``struct'', bundling together a couple of named data +``record'' or C ``struct'', bundling together a few named data items. An empty class definition will do nicely: \begin{verbatim} @@ -4251,7 +4252,7 @@ can often be passed a class that emulates the methods of that data type instead. For instance, if you have a function that formats some data from a file object, you can define a class with methods -\method{read()} and \method{readline()} that gets the data from a string +\method{read()} and \method{readline()} that get the data from a string buffer instead, and pass it as an argument.% (Unfortunately, this %technique has its limitations: a class can't define operations that %are accessed by special syntax such as sequence subscripting or @@ -4261,7 +4262,7 @@ Instance method objects have attributes, too: \code{m.im_self} is the -object of which the method is an instance, and \code{m.im_func} is the +instance object with the method \method{m}, and \code{m.im_func} is the function object corresponding to the method. @@ -4530,7 +4531,7 @@ \section{Command Line Arguments\label{command-line-arguments}} -Common utility scripts often invoke processing command line arguments. +Common utility scripts often need to process command line arguments. These arguments are stored in the \ulink{\module{sys}}{../lib/module-sys.html}\ module's \var{argv} attribute as a list. For instance the following output results from @@ -4557,7 +4558,7 @@ messages to make them visible even when \var{stdout} has been redirected: \begin{verbatim} ->>> sys.stderr.write('Warning, log file not found starting a new one') +>>> sys.stderr.write('Warning, log file not found starting a new one\n') Warning, log file not found starting a new one \end{verbatim} @@ -4636,7 +4637,7 @@ >>> import smtplib >>> server = smtplib.SMTP('localhost') >>> server.sendmail('soothsayer@example.org', 'jceasar@example.org', -"""To: jceasar@example.org +"""To: jcaesar@example.org From: soothsayer@example.org Beware the Ides of March. @@ -4660,8 +4661,8 @@ >>> now = date.today() >>> now datetime.date(2003, 12, 2) ->>> now.strftime("%m-%d-%y or %d%b %Y is a %A on the %d day of %B") -'12-02-03 or 02Dec 2003 is a Tuesday on the 02 day of December' +>>> now.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B.") +'12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.' # dates support calendar arithmetic >>> birthday = date(1964, 7, 31) @@ -4691,8 +4692,8 @@ 37 >>> zlib.decompress(t) 'witch which has which witches wrist watch' ->>> zlib.crc32(t) --1438085031 +>>> zlib.crc32(s) +226805979 \end{verbatim} @@ -5219,7 +5220,7 @@ \chapter{What Now? \label{whatNow}} Reading this tutorial has probably reinforced your interest in using -Python --- you should be eager to apply Python to solve your +Python --- you should be eager to apply Python to solving your real-world problems. Now what should you do? You should read, or at least page through, the @@ -5382,7 +5383,7 @@ this deletes the names it creates once they are no longer needed; this is done since the startup file is executed in the same namespace as the interactive commands, and removing the names avoids creating side -effects in the interactive environments. You may find it convenient +effects in the interactive environment. You may find it convenient to keep some of the imported modules, such as \ulink{\module{os}}{../lib/module-os.html}, which turn out to be needed in most sessions with the interpreter. @@ -5474,7 +5475,7 @@ and so on. No matter how many digits you're willing to write down, the result will never be exactly 1/3, but will be an increasingly better -approximation to 1/3. +approximation of 1/3. In the same way, no matter how many base 2 digits you're willing to use, the decimal value 0.1 cannot be represented exactly as a base 2 @@ -5520,7 +5521,7 @@ \var{x}, but rounding to 16 digits is not enough to make that true. Note that this is in the very nature of binary floating-point: this is -not a bug in Python, it is not a bug in your code either, and you'll +not a bug in Python, it is not a bug in your code either. You'll see the same kind of thing in all languages that support your hardware's floating-point arithmetic (although some languages may not \emph{display} the difference by default, or in all output modes). @@ -5634,7 +5635,7 @@ \code{< 2**53}), the best value for \var{N} is 56: \begin{verbatim} ->>> 2L**52 +>>> 2**52 4503599627370496L >>> 2L**53 9007199254740992L Index: glossary.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/glossary.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- glossary.tex 7 Jun 2004 21:52:47 -0000 1.9 +++ glossary.tex 2 Dec 2004 07:29:43 -0000 1.10 @@ -40,7 +40,7 @@ The implicit conversion of an instance of one type to another during an operation which involves two arguments of the same type. For example, -{}\code{int(3.15)} converts the floating point number to the integer, +{}\code{int(3.15)} converts the floating point number to the integer {}\code{3}, but in {}\code{3+4.5}, each argument is of a different type (one int, one float), and both must be converted to the same type before they can be added or it will raise a {}\code{TypeError}. Coercion between two @@ -169,7 +169,7 @@ An object with fixed value. Immutable objects are numbers, strings or tuples (and more). Such an object cannot be altered. A new object has to be created if a different value has to be stored. They play an -important role in places where a constant hash value is needed. For +important role in places where a constant hash value is needed, for example as a key in a dictionary. \index{integer division} @@ -189,7 +189,7 @@ \index{interactive} \item[interactive] Python has an interactive interpreter which means that you can try out -things and directly see its result. Just launch \code{python} with no +things and immediately see their results. Just launch \code{python} with no arguments (possibly by selecting it from your computer's main menu). It is a very powerful way to test out new ideas or inspect modules and packages (remember \code{help(x)}). @@ -235,7 +235,7 @@ (such as a \class{list}) produces a fresh new iterator each time you pass it to the \function{iter()} function or use it in a {}\keyword{for} loop. Attempting this with an iterator will just -return the same exhausted iterator object from the second iteration +return the same exhausted iterator object used in the previous iteration pass, making it appear like an empty container. \index{list comprehension} @@ -245,7 +245,15 @@ \% x for x in range(256) if x \% 2 == 0]} generates a list of strings containing hex numbers (0x..) that are even and in the range from 0 to 255. The \keyword{if} clause is optional. If omitted, all elements in -{}\code{range(256)} are processed in that case. +{}\code{range(256)} are processed. + + +\index{LBYL} +\item[LBYL] +Look before you leap. This coding style explicitly tests for +pre-conditions before making calls or lookups. This style contrasts +with the \emph{EAFP} approach and is characterized by the presence of +many \keyword{if} statements. \index{mapping} \item[mapping] @@ -265,13 +273,6 @@ tracking object creation, implementing singletons, and many other tasks. -\index{LBYL} -\item[LBYL] -Look before you leap. This coding style explicitly tests for -pre-conditions before making calls or lookups. This style contrasts -with the \emph{EAFP} approach and is characterized the presence of -many \keyword{if} statements. - \index{mutable} \item[mutable] Mutable objects can change their value but keep their \function{id()}. @@ -280,8 +281,8 @@ \index{namespace} \item[namespace] The place where a variable is stored. Namespaces are implemented as -dictionary. There is the local, global and builtins namespace and the -nested namespaces in objects (in methods). Namespaces support +dictionaries. There are the local, global and builtin namespaces +as well asnested namespaces in objects (in methods). Namespaces support modularity by preventing naming conflicts. For instance, the functions \function{__builtin__.open()} and \function{os.open()} are distinguished by their namespaces. Namespaces also aid readability @@ -312,7 +313,7 @@ \index{Python3000} \item[Python3000] -A mythical python release, allowed not to be backward compatible, with +A mythical python release, not required be backward compatible, with telepathic interface. \index{__slots__} @@ -321,7 +322,7 @@ pre-declaring space for instance attributes and eliminating instance dictionaries. Though popular, the technique is somewhat tricky to get right and is best reserved for rare cases where there are large -numbers of instances in a memory critical application. +numbers of instances in a memory-critical application. \index{sequence} \item[sequence] From rhettinger at users.sourceforge.net Thu Dec 2 09:31:43 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 2 09:31:46 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.170, 1.171 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14675 Modified Files: libstdtypes.tex Log Message: Fix typo. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.170 retrieving revision 1.171 diff -u -d -r1.170 -r1.171 --- libstdtypes.tex 25 Nov 2004 05:16:19 -0000 1.170 +++ libstdtypes.tex 2 Dec 2004 08:31:41 -0000 1.171 @@ -1107,7 +1107,7 @@ \var{key} specifies a function of one argument that is used to extract a comparison key from each list element: - \samp{\var{cmp}=\function{str.lower}} + \samp{\var{key}=\function{str.lower}} \var{reverse} is a boolean value. If set to \code{True}, then the list elements are sorted as if each comparison were reversed. From rhettinger at users.sourceforge.net Thu Dec 2 09:53:17 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 2 09:53:19 2004 Subject: [Python-checkins] python/dist/src/PC/VC6 pythoncore.dsp,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/PC/VC6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19577 Modified Files: pythoncore.dsp Log Message: Update the MSC6 pythoncore projects to compile for Py2.5 Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/VC6/pythoncore.dsp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- pythoncore.dsp 15 Oct 2004 04:27:51 -0000 1.15 +++ pythoncore.dsp 2 Dec 2004 08:53:14 -0000 1.16 @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python24.dll" +# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python25.dll" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" @@ -82,7 +82,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python24_d.dll" /pdbtype:sept +# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python25_d.dll" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF From rhettinger at users.sourceforge.net Thu Dec 2 09:57:22 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 2 09:57:28 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.170, 1.170.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20401/lib Modified Files: Tag: release24-maint libstdtypes.tex Log Message: Backport minor documentation fixups. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.170 retrieving revision 1.170.2.1 diff -u -d -r1.170 -r1.170.2.1 --- libstdtypes.tex 25 Nov 2004 05:16:19 -0000 1.170 +++ libstdtypes.tex 2 Dec 2004 08:57:19 -0000 1.170.2.1 @@ -1107,7 +1107,7 @@ \var{key} specifies a function of one argument that is used to extract a comparison key from each list element: - \samp{\var{cmp}=\function{str.lower}} + \samp{\var{key}=\function{str.lower}} \var{reverse} is a boolean value. If set to \code{True}, then the list elements are sorted as if each comparison were reversed. From rhettinger at users.sourceforge.net Thu Dec 2 09:59:16 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 2 09:59:19 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libheapq.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-serv20862/Doc/lib Modified Files: libheapq.tex Log Message: Add key= argument to heapq.nsmallest() and heapq.nlargest(). Index: libheapq.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libheapq.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- libheapq.tex 6 Sep 2004 07:04:09 -0000 1.10 +++ libheapq.tex 2 Dec 2004 08:59:13 -0000 1.11 @@ -90,16 +90,24 @@ The module also offers two general purpose functions based on heaps. -\begin{funcdesc}{nlargest}{n, iterable} +\begin{funcdesc}{nlargest}{n, iterable\optional{, key}} Return a list with the \var{n} largest elements from the dataset defined -by \var{iterable}. Equivalent to: \code{sorted(iterable, reverse=True)[:n]} -\versionadded{2.4} +by \var{iterable}. \var{key}, if provided, specifies a function of one +argument that is used to extract a comparison key from each element +in the iterable: \samp{\var{key}=\function{str.lower}} +Equivalent to: \samp{sorted(iterable, key=key, reverse=True)[:n]} +\versionadded{2.4} +\versionchanged[Added the optional \var{key} argument]{2.5} \end{funcdesc} -\begin{funcdesc}{nsmallest}{n, iterable} +\begin{funcdesc}{nsmallest}{n, iterable\optional{, key}} Return a list with the \var{n} smallest elements from the dataset defined -by \var{iterable}. Equivalent to: \code{sorted(iterable)[:n]} -\versionadded{2.4} +by \var{iterable}. \var{key}, if provided, specifies a function of one +argument that is used to extract a comparison key from each element +in the iterable: \samp{\var{key}=\function{str.lower}} +Equivalent to: \samp{sorted(iterable, key=key)[:n]} +\versionadded{2.4} +\versionchanged[Added the optional \var{key} argument]{2.5} \end{funcdesc} Both functions perform best for smaller values of \var{n}. For larger From rhettinger at users.sourceforge.net Thu Dec 2 09:59:16 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 2 09:59:19 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20862/Lib/test Modified Files: test_heapq.py Log Message: Add key= argument to heapq.nsmallest() and heapq.nlargest(). Index: test_heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- test_heapq.py 29 Nov 2004 05:54:48 -0000 1.16 +++ test_heapq.py 2 Dec 2004 08:59:14 -0000 1.17 @@ -105,13 +105,19 @@ def test_nsmallest(self): data = [random.randrange(2000) for i in range(1000)] + f = lambda x: x * 547 % 2000 for n in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): self.assertEqual(nsmallest(n, data), sorted(data)[:n]) + self.assertEqual(nsmallest(n, data, key=f), + sorted(data, key=f)[:n]) - def test_largest(self): + def test_nlargest(self): data = [random.randrange(2000) for i in range(1000)] + f = lambda x: x * 547 % 2000 for n in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): self.assertEqual(nlargest(n, data), sorted(data, reverse=True)[:n]) + self.assertEqual(nlargest(n, data, key=f), + sorted(data, key=f, reverse=True)[:n]) #============================================================================== From rhettinger at users.sourceforge.net Thu Dec 2 09:59:16 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 2 09:59:20 2004 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20862/Lib Modified Files: heapq.py Log Message: Add key= argument to heapq.nsmallest() and heapq.nlargest(). Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- heapq.py 29 Nov 2004 05:54:47 -0000 1.27 +++ heapq.py 2 Dec 2004 08:59:13 -0000 1.28 @@ -129,7 +129,8 @@ __all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'nlargest', 'nsmallest'] -from itertools import islice, repeat +from itertools import islice, repeat, count, imap, izip, tee +from operator import itemgetter import bisect def heappush(heap, item): @@ -307,6 +308,33 @@ except ImportError: pass +# Extend the implementations of nsmallest and nlargest to use a key= argument +_nsmallest = nsmallest +def nsmallest(n, iterable, key=None): + """Find the n smallest elements in a dataset. + + Equivalent to: sorted(iterable, key=key)[:n] + """ + if key is None: + return _nsmallest(n, iterable) + in1, in2 = tee(iterable) + it = izip(imap(key, in1), count(), in2) # decorate + result = _nsmallest(n, it) + return map(itemgetter(2), result) # undecorate + +_nlargest = nlargest +def nlargest(n, iterable, key=None): + """Find the n largest elements in a dataset. + + Equivalent to: sorted(iterable, key=key, reverse=True)[:n] + """ + if key is None: + return _nlargest(n, iterable) + in1, in2 = tee(iterable) + it = izip(imap(key, in1), count(), in2) # decorate + result = _nlargest(n, it) + return map(itemgetter(2), result) # undecorate + if __name__ == "__main__": # Simple sanity test heap = [] From rhettinger at users.sourceforge.net Thu Dec 2 09:59:17 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 2 09:59:22 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1193,1.1194 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20862/Misc Modified Files: NEWS Log Message: Add key= argument to heapq.nsmallest() and heapq.nlargest(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193 retrieving revision 1.1194 diff -u -d -r1.1193 -r1.1194 --- NEWS 30 Nov 2004 11:53:10 -0000 1.1193 +++ NEWS 2 Dec 2004 08:59:14 -0000 1.1194 @@ -4,6 +4,46 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) +What's New in Python 2.5 alpha 1? +================================= + +Core and builtins +----------------- + + +Extension Modules +----------------- + + +Library +------- + +- heapq.nsmallest() and heapq.nlargest() now support key= arguments with + the same meaning as for list.sort(). + + +Build +----- + + +C API +----- + + +Tests +----- + + +Mac +--- + + + +Tools/Demos +----------- + + + What's New in Python 2.4 final? =============================== From rhettinger at users.sourceforge.net Thu Dec 2 09:57:23 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 2 10:50:27 2004 Subject: [Python-checkins] python/dist/src/Doc/tut glossary.tex, 1.9, 1.9.4.1 tut.tex, 1.261, 1.261.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20401/tut Modified Files: Tag: release24-maint glossary.tex tut.tex Log Message: Backport minor documentation fixups. Index: glossary.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/glossary.tex,v retrieving revision 1.9 retrieving revision 1.9.4.1 diff -u -d -r1.9 -r1.9.4.1 --- glossary.tex 7 Jun 2004 21:52:47 -0000 1.9 +++ glossary.tex 2 Dec 2004 08:57:19 -0000 1.9.4.1 @@ -40,7 +40,7 @@ The implicit conversion of an instance of one type to another during an operation which involves two arguments of the same type. For example, -{}\code{int(3.15)} converts the floating point number to the integer, +{}\code{int(3.15)} converts the floating point number to the integer {}\code{3}, but in {}\code{3+4.5}, each argument is of a different type (one int, one float), and both must be converted to the same type before they can be added or it will raise a {}\code{TypeError}. Coercion between two @@ -169,7 +169,7 @@ An object with fixed value. Immutable objects are numbers, strings or tuples (and more). Such an object cannot be altered. A new object has to be created if a different value has to be stored. They play an -important role in places where a constant hash value is needed. For +important role in places where a constant hash value is needed, for example as a key in a dictionary. \index{integer division} @@ -189,7 +189,7 @@ \index{interactive} \item[interactive] Python has an interactive interpreter which means that you can try out -things and directly see its result. Just launch \code{python} with no +things and immediately see their results. Just launch \code{python} with no arguments (possibly by selecting it from your computer's main menu). It is a very powerful way to test out new ideas or inspect modules and packages (remember \code{help(x)}). @@ -235,7 +235,7 @@ (such as a \class{list}) produces a fresh new iterator each time you pass it to the \function{iter()} function or use it in a {}\keyword{for} loop. Attempting this with an iterator will just -return the same exhausted iterator object from the second iteration +return the same exhausted iterator object used in the previous iteration pass, making it appear like an empty container. \index{list comprehension} @@ -245,7 +245,15 @@ \% x for x in range(256) if x \% 2 == 0]} generates a list of strings containing hex numbers (0x..) that are even and in the range from 0 to 255. The \keyword{if} clause is optional. If omitted, all elements in -{}\code{range(256)} are processed in that case. +{}\code{range(256)} are processed. + + +\index{LBYL} +\item[LBYL] +Look before you leap. This coding style explicitly tests for +pre-conditions before making calls or lookups. This style contrasts +with the \emph{EAFP} approach and is characterized by the presence of +many \keyword{if} statements. \index{mapping} \item[mapping] @@ -265,13 +273,6 @@ tracking object creation, implementing singletons, and many other tasks. -\index{LBYL} -\item[LBYL] -Look before you leap. This coding style explicitly tests for -pre-conditions before making calls or lookups. This style contrasts -with the \emph{EAFP} approach and is characterized the presence of -many \keyword{if} statements. - \index{mutable} \item[mutable] Mutable objects can change their value but keep their \function{id()}. @@ -280,8 +281,8 @@ \index{namespace} \item[namespace] The place where a variable is stored. Namespaces are implemented as -dictionary. There is the local, global and builtins namespace and the -nested namespaces in objects (in methods). Namespaces support +dictionaries. There are the local, global and builtin namespaces +as well asnested namespaces in objects (in methods). Namespaces support modularity by preventing naming conflicts. For instance, the functions \function{__builtin__.open()} and \function{os.open()} are distinguished by their namespaces. Namespaces also aid readability @@ -312,7 +313,7 @@ \index{Python3000} \item[Python3000] -A mythical python release, allowed not to be backward compatible, with +A mythical python release, not required be backward compatible, with telepathic interface. \index{__slots__} @@ -321,7 +322,7 @@ pre-declaring space for instance attributes and eliminating instance dictionaries. Though popular, the technique is somewhat tricky to get right and is best reserved for rare cases where there are large -numbers of instances in a memory critical application. +numbers of instances in a memory-critical application. \index{sequence} \item[sequence] Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.261 retrieving revision 1.261.2.1 diff -u -d -r1.261 -r1.261.2.1 --- tut.tex 29 Nov 2004 13:12:44 -0000 1.261 +++ tut.tex 2 Dec 2004 08:57:19 -0000 1.261.2.1 @@ -33,7 +33,7 @@ The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the -Python Web site, \url{http://www.python.org/}, and can be freely +Python Web site, \url{http://www.python.org/}, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation. @@ -84,7 +84,7 @@ Another situation: perhaps you have to work with several C libraries, and the usual C write/compile/test/re-compile cycle is too slow. You -need to develop software more quickly. Possibly perhaps you've +need to develop software more quickly. Possibly you've written a program that could use an extension language, and you don't want to design a language, write and debug an interpreter for it, then tie it into your application. @@ -103,8 +103,8 @@ Python allows you to split up your program in modules that can be reused in other Python programs. It comes with a large collection of standard modules that you can use as the basis of your programs --- or -as examples to start learning to program in Python. There are also -built-in modules that provide things like file I/O, system calls, +as examples to start learning to program in Python. Some of these +modules provide things like file I/O, system calls, sockets, and even interfaces to graphical user interface toolkits like Tk. Python is an interpreted language, which can save you considerable time @@ -145,7 +145,7 @@ Now that you are all excited about Python, you'll want to examine it in some more detail. Since the best way to learn a language is -using it, you are invited here to do so. +using it, you are invited to do so with this tutorial. In the next chapter, the mechanics of using the interpreter are explained. This is rather mundane information, but essential for @@ -603,7 +603,7 @@ print hello \end{verbatim} -Note that newlines would still need to be embedded in the string using +Note that newlines still need to be embedded in the string using \code{\e n}; the newline following the trailing backslash is discarded. This example would print the following: @@ -847,7 +847,7 @@ Starting with Python 2.0 a new data type for storing text data is available to the programmer: the Unicode object. It can be used to store and manipulate Unicode data (see \url{http://www.unicode.org/}) -and integrates well with the existing string objects providing +and integrates well with the existing string objects, providing auto-conversions where necessary. Unicode has the advantage of providing one ordinal for every character @@ -978,8 +978,8 @@ ['eggs', 100] >>> a[:2] + ['bacon', 2*2] ['spam', 'eggs', 'bacon', 4] ->>> 3*a[:3] + ['Boe!'] -['spam', 'eggs', 100, 'spam', 'eggs', 100, 'spam', 'eggs', 100, 'Boe!'] +>>> 3*a[:3] + ['Boo!'] +['spam', 'eggs', 100, 'spam', 'eggs', 100, 'spam', 'eggs', 100, 'Boo!'] \end{verbatim} Unlike strings, which are \emph{immutable}, it is possible to change @@ -1553,8 +1553,9 @@ \end{verbatim} When a final formal parameter of the form \code{**\var{name}} is -present, it receives a \ulink{dictionary}{../lib/typesmapping.html} containing all keyword arguments -whose keyword doesn't correspond to a formal parameter. This may be +present, it receives a \ulink{dictionary}{../lib/typesmapping.html} +containing all keyword arguments except for those corresponding to +a formal parameter. This may be combined with a formal parameter of the form \code{*\var{name}} (described in the next subsection) which receives a tuple containing the positional arguments beyond the formal parameter @@ -1883,8 +1884,8 @@ [0, 2, 4, 6, 8, 10, 12, 14] \end{verbatim} -\samp{reduce(\var{func}, \var{sequence})} returns a single value -constructed by calling the binary function \var{func} on the first two +\samp{reduce(\var{function}, \var{sequence})} returns a single value +constructed by calling the binary function \var{function} on the first two items of the sequence, then on the result and the next item, and so on. For example, to compute the sum of the numbers 1 through 10: @@ -2174,10 +2175,14 @@ \begin{verbatim} >>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)]) {'sape': 4139, 'jack': 4098, 'guido': 4127} ->>> dict([(x, x**2) for x in vec]) # use a list comprehension +>>> dict([(x, x**2) for x in (2, 4, 6)]) # use a list comprehension {2: 4, 4: 16, 6: 36} \end{verbatim} +Later in the tutorial, we will learn about Generator Expressions +which are even better suited for the task of supplying key-values pairs to +the \function{dict()} constructor. + \section{Looping Techniques \label{loopidioms}} @@ -2635,7 +2640,7 @@ >>> import fibo, sys >>> fib = fibo.fib >>> dir() -['__name__', 'a', 'fib', 'fibo', 'sys'] +['__builtins__', '__doc__', '__file__', '__name__', 'fib', 'fib2'] \end{verbatim} Note that it lists all types of names: variables, modules, functions, etc. @@ -2647,27 +2652,29 @@ \begin{verbatim} >>> import __builtin__ >>> dir(__builtin__) -['ArithmeticError', 'AssertionError', 'AttributeError', - 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', - 'Exception', 'False', 'FloatingPointError', 'IOError', 'ImportError', +['ArithmeticError', 'AssertionError', 'AttributeError', 'DeprecationWarning', + 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', + 'FloatingPointError', 'FutureWarning', 'IOError', 'ImportError', 'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'OverflowWarning', - 'PendingDeprecationWarning', 'ReferenceError', - 'RuntimeError', 'RuntimeWarning', 'StandardError', 'StopIteration', - 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', - 'True', 'TypeError', 'UnboundLocalError', 'UnicodeError', 'UserWarning', - 'ValueError', 'Warning', 'ZeroDivisionError', '__debug__', '__doc__', - '__import__', '__name__', 'abs', 'apply', 'bool', 'buffer', - 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', 'complex', - 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', + 'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError', + 'RuntimeWarning', 'StandardError', 'StopIteration', 'SyntaxError', + 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True', + 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', + 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', + 'UserWarning', 'ValueError', 'Warning', 'WindowsError', + 'ZeroDivisionError', '_', '__debug__', '__doc__', '__import__', + '__name__', 'abs', 'apply', 'basestring', 'bool', 'buffer', + 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', + 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', - 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', - 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', + 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', + 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min', - 'object', 'oct', 'open', 'ord', 'pow', 'property', 'quit', - 'range', 'raw_input', 'reduce', 'reload', 'repr', 'round', - 'setattr', 'slice', 'staticmethod', 'str', 'string', 'sum', 'super', + 'object', 'oct', 'open', 'ord', 'pow', 'property', 'quit', 'range', + 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', + 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip'] \end{verbatim} @@ -2824,8 +2831,8 @@ If \code{__all__} is not defined, the statement \code{from Sound.Effects import *} does \emph{not} import all submodules from the package \module{Sound.Effects} into the current namespace; it only ensures that the -package \module{Sound.Effects} has been imported (possibly running its -initialization code, \file{__init__.py}) and then imports whatever names are +package \module{Sound.Effects} has been imported (possibly running any +initialization code in \file{__init__.py}) and then imports whatever names are defined in the package. This includes any names defined (and submodules explicitly loaded) by \file{__init__.py}. It also includes any submodules of the package that were explicitly loaded by previous @@ -2907,7 +2914,7 @@ simply printing space-separated values. There are two ways to format your output; the first way is to do all the string handling yourself; using string slicing and concatenation operations you can create any -lay-out you can imagine. The standard module +layout you can imagine. The standard module \module{string}\refstmodindex{string} contains some useful operations for padding strings to a given column width; these will be discussed shortly. The second way is to use the \code{\%} operator with a @@ -3322,8 +3329,8 @@ Standard exception names are built-in identifiers (not reserved keywords). -The rest of the line is a detail whose interpretation depends on the -exception type; its meaning is dependent on the exception type. +The rest of the line provides detail based on the type of exception +and what caused it. The preceding part of the error message shows the context where the exception happened, in the form of a stack backtrace. @@ -3367,9 +3374,8 @@ \item If an exception occurs during execution of the try clause, the rest of the clause is skipped. Then if its type matches the exception named -after the \keyword{except} keyword, the rest of the try clause is -skipped, the except clause is executed, and then execution continues -after the \keyword{try} statement. +after the \keyword{except} keyword, the except clause is executed, and +then execution continues after the \keyword{try} statement. \item If an exception occurs which does not match the exception named in the @@ -3480,7 +3486,7 @@ ... except ZeroDivisionError, detail: ... print 'Handling run-time error:', detail ... -Handling run-time error: integer division or modulo +Handling run-time error: integer division or modulo by zero \end{verbatim} @@ -3499,7 +3505,9 @@ The first argument to \keyword{raise} names the exception to be raised. The optional second argument specifies the exception's -argument. +argument. Alternatively, the above could be written as +\code{raise NameError('HiThere')}. Either form works fine, but there +seems to be a growing stylistic preference for the latter. If you need to determine whether an exception was raised but don't intend to handle it, a simpler form of the \keyword{raise} statement @@ -3545,10 +3553,14 @@ __main__.MyError: 'oops!' \end{verbatim} +In this example, the default \method{__init__} of \class{Exception} has +been overriden. The new behavior simply creates the \var{value} attribute. +This replaces the default behavior of creating the \var{args} attribute. + Exception classes can be defined which do anything any other class can do, but are usually kept simple, often only offering a number of attributes that allow information about the error to be extracted by -handlers for the exception. When creating a module which can raise +handlers for the exception. When creating a module that can raise several distinct errors, a common practice is to create a base class for exceptions defined by that module, and subclass that to create specific exception classes for different error conditions: @@ -3623,7 +3635,8 @@ whether or not the use of the resource was successful. A \keyword{try} statement must either have one or more except clauses -or one finally clause, but not both. +or one finally clause, but not both (because it would be unclear which +clause should be executed). \chapter{Classes \label{classes}} @@ -3825,7 +3838,7 @@ object} is created. This is basically a wrapper around the contents of the namespace created by the class definition; we'll learn more about class objects in the next section. The original local scope -(the one in effect just before the class definitions was entered) is +(the one in effect just before the class definitions were entered) is reinstated, and the class object is bound here to the class name given in the class definition header (\class{ClassName} in the example). @@ -3907,9 +3920,9 @@ Now what can we do with instance objects? The only operations understood by instance objects are attribute references. There are -two kinds of valid attribute names. +two kinds of valid attribute names, data attributes and methods. -The first I'll call \emph{data attributes}. These correspond to +\emph{data attributes} correspond to ``instance variables'' in Smalltalk, and to ``data members'' in \Cpp. Data attributes need not be declared; like local variables, they spring into existence when they are first assigned to. For @@ -3925,16 +3938,16 @@ del x.counter \end{verbatim} -The second kind of attribute references understood by instance objects -are \emph{methods}. A method is a function that ``belongs to'' an +The other kind of instance attribute references is a \emph{method}. +A method is a function that ``belongs to'' an object. (In Python, the term method is not unique to class instances: other object types can have methods as well. For example, list objects have methods called append, insert, remove, sort, and so on. However, -below, we'll use the term method exclusively to mean methods of class -instance objects, unless explicitly stated otherwise.) +in the following discussion, we'll use the term method exclusively to mean +methods of class instance objects, unless explicitly stated otherwise.) Valid method names of an instance object depend on its class. By -definition, all attributes of a class that are (user-defined) function +definition, all attributes of a class that are function objects define corresponding methods of its instances. So in our example, \code{x.f} is a valid method reference, since \code{MyClass.f} is a function, but \code{x.i} is not, since @@ -4029,12 +4042,12 @@ variables and instance variables when glancing through a method. -Conventionally, the first argument of methods is often called +Conventionally, the first argument of a method is often called \code{self}. This is nothing more than a convention: the name \code{self} has absolutely no special meaning to Python. (Note, however, that by not following the convention your code may be less -readable by other Python programmers, and it is also conceivable that -a \emph{class browser} program be written which relies upon such a +readable to other Python programmers, and it is also conceivable that +a \emph{class browser} program might be written that relies upon such a convention.) @@ -4180,6 +4193,7 @@ variables'' or data attributes used by the common base class), it is not clear that these semantics are in any way useful. +%% XXX Add rules for new-style MRO? \section{Private Variables \label{private}} @@ -4188,9 +4202,9 @@ leading underscores, at most one trailing underscore) is textually replaced with \code{_classname__spam}, where \code{classname} is the current class name with leading underscore(s) stripped. This mangling -is done without regard of the syntactic position of the identifier, so +is done without regard to the syntactic position of the identifier, so it can be used to define class-private instance and class variables, -methods, as well as globals, and even to store instance variables +methods, variables stored in globals, and even variables stored in instances. private to this class on instances of \emph{other} classes. Truncation may occur when the mangled name would be longer than 255 characters. Outside classes, or when the class name consists of only underscores, @@ -4219,7 +4233,7 @@ \section{Odds and Ends \label{odds}} Sometimes it is useful to have a data type similar to the Pascal -``record'' or C ``struct'', bundling together a couple of named data +``record'' or C ``struct'', bundling together a few named data items. An empty class definition will do nicely: \begin{verbatim} @@ -4238,7 +4252,7 @@ can often be passed a class that emulates the methods of that data type instead. For instance, if you have a function that formats some data from a file object, you can define a class with methods -\method{read()} and \method{readline()} that gets the data from a string +\method{read()} and \method{readline()} that get the data from a string buffer instead, and pass it as an argument.% (Unfortunately, this %technique has its limitations: a class can't define operations that %are accessed by special syntax such as sequence subscripting or @@ -4248,7 +4262,7 @@ Instance method objects have attributes, too: \code{m.im_self} is the -object of which the method is an instance, and \code{m.im_func} is the +instance object with the method \method{m}, and \code{m.im_func} is the function object corresponding to the method. @@ -4413,7 +4427,7 @@ Another key feature is that the local variables and execution state are automatically saved between calls. This made the function easier to write -and much more clear than an approach using class variables like +and much more clear than an approach using instance variables like \code{self.index} and \code{self.data}. In addition to automatic method creation and saving program state, when @@ -4517,7 +4531,7 @@ \section{Command Line Arguments\label{command-line-arguments}} -Common utility scripts often invoke processing command line arguments. +Common utility scripts often need to process command line arguments. These arguments are stored in the \ulink{\module{sys}}{../lib/module-sys.html}\ module's \var{argv} attribute as a list. For instance the following output results from @@ -4544,7 +4558,7 @@ messages to make them visible even when \var{stdout} has been redirected: \begin{verbatim} ->>> sys.stderr.write('Warning, log file not found starting a new one') +>>> sys.stderr.write('Warning, log file not found starting a new one\n') Warning, log file not found starting a new one \end{verbatim} @@ -4623,7 +4637,7 @@ >>> import smtplib >>> server = smtplib.SMTP('localhost') >>> server.sendmail('soothsayer@example.org', 'jceasar@example.org', -"""To: jceasar@example.org +"""To: jcaesar@example.org From: soothsayer@example.org Beware the Ides of March. @@ -4647,8 +4661,8 @@ >>> now = date.today() >>> now datetime.date(2003, 12, 2) ->>> now.strftime("%m-%d-%y or %d%b %Y is a %A on the %d day of %B") -'12-02-03 or 02Dec 2003 is a Tuesday on the 02 day of December' +>>> now.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B.") +'12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.' # dates support calendar arithmetic >>> birthday = date(1964, 7, 31) @@ -4678,8 +4692,8 @@ 37 >>> zlib.decompress(t) 'witch which has which witches wrist watch' ->>> zlib.crc32(t) --1438085031 +>>> zlib.crc32(s) +226805979 \end{verbatim} @@ -5206,7 +5220,7 @@ \chapter{What Now? \label{whatNow}} Reading this tutorial has probably reinforced your interest in using -Python --- you should be eager to apply Python to solve your +Python --- you should be eager to apply Python to solving your real-world problems. Now what should you do? You should read, or at least page through, the @@ -5369,7 +5383,7 @@ this deletes the names it creates once they are no longer needed; this is done since the startup file is executed in the same namespace as the interactive commands, and removing the names avoids creating side -effects in the interactive environments. You may find it convenient +effects in the interactive environment. You may find it convenient to keep some of the imported modules, such as \ulink{\module{os}}{../lib/module-os.html}, which turn out to be needed in most sessions with the interpreter. @@ -5461,7 +5475,7 @@ and so on. No matter how many digits you're willing to write down, the result will never be exactly 1/3, but will be an increasingly better -approximation to 1/3. +approximation of 1/3. In the same way, no matter how many base 2 digits you're willing to use, the decimal value 0.1 cannot be represented exactly as a base 2 @@ -5507,7 +5521,7 @@ \var{x}, but rounding to 16 digits is not enough to make that true. Note that this is in the very nature of binary floating-point: this is -not a bug in Python, it is not a bug in your code either, and you'll +not a bug in Python, it is not a bug in your code either. You'll see the same kind of thing in all languages that support your hardware's floating-point arithmetic (although some languages may not \emph{display} the difference by default, or in all output modes). @@ -5621,7 +5635,7 @@ \code{< 2**53}), the best value for \var{N} is 56: \begin{verbatim} ->>> 2L**52 +>>> 2**52 4503599627370496L >>> 2L**53 9007199254740992L From niemeyer at users.sourceforge.net Thu Dec 2 17:15:52 2004 From: niemeyer at users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Thu Dec 2 17:15:55 2004 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.109,2.110 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23630/Modules Modified Files: _sre.c Log Message: Fixing bug #1072259 in SRE. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.109 retrieving revision 2.110 diff -u -d -r2.109 -r2.110 --- _sre.c 24 Sep 2004 04:31:19 -0000 2.109 +++ _sre.c 2 Dec 2004 16:15:39 -0000 2.110 @@ -1024,9 +1024,10 @@ state->ptr = ctx->ptr; - ctx->count = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2]); - RETURN_ON_ERROR(ctx->count); - + ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2]); + RETURN_ON_ERROR(ret); + DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos); + ctx->count = ret; ctx->ptr += ctx->count; /* when we arrive here, count contains the number of @@ -1110,13 +1111,14 @@ ctx->count = 0; else { /* count using pattern min as the maximum */ - ctx->count = SRE_COUNT(state, ctx->pattern+3, - ctx->pattern[1]); - RETURN_ON_ERROR(ctx->count); - if (ctx->count < (int) ctx->pattern[1]) + ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[1]); + RETURN_ON_ERROR(ret); + DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos); + if (ret < (int) ctx->pattern[1]) /* didn't match minimum number of times */ RETURN_FAILURE; /* advance past minimum matches of repeat */ + ctx->count = ret; ctx->ptr += ctx->count; } @@ -1140,6 +1142,7 @@ state->ptr = ctx->ptr; ret = SRE_COUNT(state, ctx->pattern+3, 1); RETURN_ON_ERROR(ret); + DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos); if (ret == 0) break; assert(ret == 1); From niemeyer at users.sourceforge.net Thu Dec 2 17:36:33 2004 From: niemeyer at users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Thu Dec 2 17:36:37 2004 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.109,2.109.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28554 Modified Files: Tag: release24-maint _sre.c Log Message: Fixing bug #1072259 of SRE into release24-maint. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.109 retrieving revision 2.109.2.1 diff -u -d -r2.109 -r2.109.2.1 --- _sre.c 24 Sep 2004 04:31:19 -0000 2.109 +++ _sre.c 2 Dec 2004 16:36:29 -0000 2.109.2.1 @@ -1024,9 +1024,10 @@ state->ptr = ctx->ptr; - ctx->count = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2]); - RETURN_ON_ERROR(ctx->count); - + ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2]); + RETURN_ON_ERROR(ret); + DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos); + ctx->count = ret; ctx->ptr += ctx->count; /* when we arrive here, count contains the number of @@ -1110,13 +1111,14 @@ ctx->count = 0; else { /* count using pattern min as the maximum */ - ctx->count = SRE_COUNT(state, ctx->pattern+3, - ctx->pattern[1]); - RETURN_ON_ERROR(ctx->count); - if (ctx->count < (int) ctx->pattern[1]) + ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[1]); + RETURN_ON_ERROR(ret); + DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos); + if (ret < (int) ctx->pattern[1]) /* didn't match minimum number of times */ RETURN_FAILURE; /* advance past minimum matches of repeat */ + ctx->count = ret; ctx->ptr += ctx->count; } @@ -1140,6 +1142,7 @@ state->ptr = ctx->ptr; ret = SRE_COUNT(state, ctx->pattern+3, 1); RETURN_ON_ERROR(ret); + DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos); if (ret == 0) break; assert(ret == 1); From lemburg at users.sourceforge.net Thu Dec 2 21:14:19 2004 From: lemburg at users.sourceforge.net (lemburg@users.sourceforge.net) Date: Thu Dec 2 21:14:22 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command install_lib.py, 1.44, 1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20925/Lib/distutils/command Modified Files: install_lib.py Log Message: Restore Python 2.1 compatibility (os.extsep was introduced in Python 2.2). Index: install_lib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_lib.py,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- install_lib.py 10 Nov 2004 22:23:15 -0000 1.44 +++ install_lib.py 2 Dec 2004 20:14:16 -0000 1.45 @@ -9,8 +9,10 @@ # Extension for Python source files. -PYTHON_SOURCE_EXTENSION = os.extsep + "py" - +if hasattr(os, 'extsep'): + PYTHON_SOURCE_EXTENSION = os.extsep + "py" +else: + PYTHON_SOURCE_EXTENSION = ".py" class install_lib (Command): From vsajip at users.sourceforge.net Thu Dec 2 22:27:45 2004 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Thu Dec 2 22:27:49 2004 Subject: [Python-checkins] python/dist/src/Doc/lib liblogging.tex,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7616 Modified Files: liblogging.tex Log Message: Fixed errors reported in SF bug #1074693 Index: liblogging.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblogging.tex,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- liblogging.tex 11 Nov 2004 13:54:48 -0000 1.33 +++ liblogging.tex 2 Dec 2004 21:27:42 -0000 1.34 @@ -35,6 +35,21 @@ more general \class{Logger} method, \method{log()}, which takes an explicit level argument. +The numeric values of logging levels are given in the following table. These +are primarily of interest if you want to define your own levels, and need +them to have specific values relative to the predefined levels. If you +define a level with the same numeric value, it overwrites the predefined +value; the predefined name is lost. + +\begin{tableii}{l|l}{code}{Level}{Numeric value} + \lineii{CRITICAL}{50} + \lineii{ERROR}{40} + \lineii{WARNING}{30} + \lineii{INFO}{20} + \lineii{DEBUG}{10} + \lineii{NOTSET}{0} +\end{tableii} + Levels can also be associated with loggers, being set either by the developer or through loading a saved logging configuration. When a logging method is called on a logger, the logger compares its own @@ -297,8 +312,9 @@ Sets the threshold for this logger to \var{lvl}. Logging messages which are less severe than \var{lvl} will be ignored. When a logger is created, the level is set to \constant{NOTSET} (which causes all messages -to be processed in the root logger, or delegation to the parent in non-root -loggers). +to be processed when the logger is the root logger, or delegation to the +parent when the logger is a non-root logger). Note that the root logger +is created with level \constant{WARNING}. \end{methoddesc} \begin{methoddesc}{isEnabledFor}{lvl} @@ -1324,10 +1340,6 @@ source line where the logging call was made, and any exception information to be logged. -\class{LogRecord} has no methods; it's just a repository for -information about the logging event. The only reason it's a class -rather than a dictionary is to facilitate extension. - \begin{classdesc}{LogRecord}{name, lvl, pathname, lineno, msg, args, exc_info} Returns an instance of \class{LogRecord} initialized with interesting @@ -1342,6 +1354,11 @@ is available). \end{classdesc} +\begin{methoddesc}{getMessage}{} +Returns the message for this \class{LogRecord} instance after merging any +user-supplied arguments with the message. +\end{methoddesc} + \subsection{Thread Safety} The logging module is intended to be thread-safe without any special work From vsajip at users.sourceforge.net Fri Dec 3 09:23:39 2004 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Fri Dec 3 09:23:42 2004 Subject: [Python-checkins] python/dist/src/Doc/lib liblogging.tex, 1.33, 1.33.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13257/dist/src/Doc/lib Modified Files: Tag: release24-maint liblogging.tex Log Message: Fixed errors reported in SF bug #1074693 Index: liblogging.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblogging.tex,v retrieving revision 1.33 retrieving revision 1.33.2.1 diff -u -d -r1.33 -r1.33.2.1 --- liblogging.tex 11 Nov 2004 13:54:48 -0000 1.33 +++ liblogging.tex 3 Dec 2004 08:23:36 -0000 1.33.2.1 @@ -35,6 +35,21 @@ more general \class{Logger} method, \method{log()}, which takes an explicit level argument. +The numeric values of logging levels are given in the following table. These +are primarily of interest if you want to define your own levels, and need +them to have specific values relative to the predefined levels. If you +define a level with the same numeric value, it overwrites the predefined +value; the predefined name is lost. + +\begin{tableii}{l|l}{code}{Level}{Numeric value} + \lineii{CRITICAL}{50} + \lineii{ERROR}{40} + \lineii{WARNING}{30} + \lineii{INFO}{20} + \lineii{DEBUG}{10} + \lineii{NOTSET}{0} +\end{tableii} + Levels can also be associated with loggers, being set either by the developer or through loading a saved logging configuration. When a logging method is called on a logger, the logger compares its own @@ -297,8 +312,9 @@ Sets the threshold for this logger to \var{lvl}. Logging messages which are less severe than \var{lvl} will be ignored. When a logger is created, the level is set to \constant{NOTSET} (which causes all messages -to be processed in the root logger, or delegation to the parent in non-root -loggers). +to be processed when the logger is the root logger, or delegation to the +parent when the logger is a non-root logger). Note that the root logger +is created with level \constant{WARNING}. \end{methoddesc} \begin{methoddesc}{isEnabledFor}{lvl} @@ -1324,10 +1340,6 @@ source line where the logging call was made, and any exception information to be logged. -\class{LogRecord} has no methods; it's just a repository for -information about the logging event. The only reason it's a class -rather than a dictionary is to facilitate extension. - \begin{classdesc}{LogRecord}{name, lvl, pathname, lineno, msg, args, exc_info} Returns an instance of \class{LogRecord} initialized with interesting @@ -1342,6 +1354,11 @@ is available). \end{classdesc} +\begin{methoddesc}{getMessage}{} +Returns the message for this \class{LogRecord} instance after merging any +user-supplied arguments with the message. +\end{methoddesc} + \subsection{Thread Safety} The logging module is intended to be thread-safe without any special work From rhettinger at users.sourceforge.net Fri Dec 3 09:30:41 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 3 09:30:44 2004 Subject: [Python-checkins] python/dist/src/Misc ACKS, 1.289, 1.290 NEWS, 1.1194, 1.1195 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14724/Misc Modified Files: ACKS NEWS Log Message: SF patch #1077353: add key= argument to min and max (First draft of patch contributed by Steven Bethard.) Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.289 retrieving revision 1.290 diff -u -d -r1.289 -r1.290 --- ACKS 10 Nov 2004 13:13:05 -0000 1.289 +++ ACKS 3 Dec 2004 08:30:35 -0000 1.290 @@ -52,6 +52,7 @@ Andy Bensky Michel Van den Bergh Eric Beser +Steven Bethard Stephen Bevan Ron Bickers Dominic Binks Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1194 retrieving revision 1.1195 diff -u -d -r1.1194 -r1.1195 --- NEWS 2 Dec 2004 08:59:14 -0000 1.1194 +++ NEWS 3 Dec 2004 08:30:36 -0000 1.1195 @@ -10,6 +10,9 @@ Core and builtins ----------------- +- min() and max() now support key= arguments with the same meaning as in + list.sort(). + Extension Modules ----------------- @@ -19,7 +22,7 @@ ------- - heapq.nsmallest() and heapq.nlargest() now support key= arguments with - the same meaning as for list.sort(). + the same meaning as in list.sort(). Build From rhettinger at users.sourceforge.net Fri Dec 3 09:30:42 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 3 09:30:45 2004 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.318,2.319 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14724/Python Modified Files: bltinmodule.c Log Message: SF patch #1077353: add key= argument to min and max (First draft of patch contributed by Steven Bethard.) Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.318 retrieving revision 2.319 diff -u -d -r2.318 -r2.319 --- bltinmodule.c 25 Aug 2004 10:42:41 -0000 2.318 +++ bltinmodule.c 3 Dec 2004 08:30:39 -0000 2.319 @@ -1114,82 +1114,114 @@ static PyObject * -min_max(PyObject *args, int op) +min_max(PyObject *args, PyObject *kwds, int op) { + PyObject *v, *it, *item, *val, *maxitem, *maxval, *keyfunc=NULL; const char *name = op == Py_LT ? "min" : "max"; - PyObject *v, *w, *x, *it; if (PyTuple_Size(args) > 1) v = args; else if (!PyArg_UnpackTuple(args, (char *)name, 1, 1, &v)) return NULL; + if (kwds != NULL && PyDict_Check(kwds) && PyDict_Size(kwds)) { + keyfunc = PyDict_GetItemString(kwds, "key"); + if (PyDict_Size(kwds)!=1 || keyfunc == NULL) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument", name); + return NULL; + } + } + it = PyObject_GetIter(v); if (it == NULL) return NULL; - w = NULL; /* the result */ - for (;;) { - x = PyIter_Next(it); - if (x == NULL) { - if (PyErr_Occurred()) { - Py_XDECREF(w); - Py_DECREF(it); - return NULL; - } - break; + maxitem = NULL; /* the result */ + maxval = NULL; /* the value associated with the result */ + while (item = PyIter_Next(it)) { + /* get the value from the key function */ + if (keyfunc != NULL) { + val = PyObject_CallFunctionObjArgs(keyfunc, item, NULL); + if (val == NULL) + goto Fail_it_item; + } + /* no key function; the value is the item */ + else { + val = item; + Py_INCREF(val); } - if (w == NULL) - w = x; + /* maximum value and item are unset; set them */ + if (maxval == NULL) { + maxitem = item; + maxval = val; + } + /* maximum value and item are set; update them as necessary */ else { - int cmp = PyObject_RichCompareBool(x, w, op); - if (cmp > 0) { - Py_DECREF(w); - w = x; + int cmp = PyObject_RichCompareBool(val, maxval, op); + if (cmp < 0) + goto Fail_it_item_and_val; + else if (cmp > 0) { + Py_DECREF(maxval); + Py_DECREF(maxitem); + maxval = val; + maxitem = item; } - else if (cmp < 0) { - Py_DECREF(x); - Py_DECREF(w); - Py_DECREF(it); - return NULL; + else { + Py_DECREF(item); + Py_DECREF(val); } - else - Py_DECREF(x); } } - if (w == NULL) + if (PyErr_Occurred()) + goto Fail_it; + if (maxval == NULL) { PyErr_Format(PyExc_ValueError, "%s() arg is an empty sequence", name); + assert(maxitem == NULL); + } + else + Py_DECREF(maxval); Py_DECREF(it); - return w; + return maxitem; + +Fail_it_item_and_val: + Py_DECREF(val); +Fail_it_item: + Py_DECREF(item); +Fail_it: + Py_XDECREF(maxval); + Py_XDECREF(maxitem); + Py_DECREF(it); + return NULL; } static PyObject * -builtin_min(PyObject *self, PyObject *v) +builtin_min(PyObject *self, PyObject *args, PyObject *kwds) { - return min_max(v, Py_LT); + return min_max(args, kwds, Py_LT); } PyDoc_STRVAR(min_doc, -"min(sequence) -> value\n\ -min(a, b, c, ...) -> value\n\ +"min(iterable[, key=func]) -> value\n\ +min(a, b, c, ...[, key=func]) -> value\n\ \n\ -With a single sequence argument, return its smallest item.\n\ +With a single iterable argument, return its smallest item.\n\ With two or more arguments, return the smallest argument."); static PyObject * -builtin_max(PyObject *self, PyObject *v) +builtin_max(PyObject *self, PyObject *args, PyObject *kwds) { - return min_max(v, Py_GT); + return min_max(args, kwds, Py_GT); } PyDoc_STRVAR(max_doc, -"max(sequence) -> value\n\ -max(a, b, c, ...) -> value\n\ +"max(iterable[, key=func]) -> value\n\ +max(a, b, c, ...[, key=func]) -> value\n\ \n\ -With a single sequence argument, return its largest item.\n\ +With a single iterable argument, return its largest item.\n\ With two or more arguments, return the largest argument."); @@ -2119,8 +2151,8 @@ {"len", builtin_len, METH_O, len_doc}, {"locals", (PyCFunction)builtin_locals, METH_NOARGS, locals_doc}, {"map", builtin_map, METH_VARARGS, map_doc}, - {"max", builtin_max, METH_VARARGS, max_doc}, - {"min", builtin_min, METH_VARARGS, min_doc}, + {"max", (PyCFunction)builtin_max, METH_VARARGS | METH_KEYWORDS, max_doc}, + {"min", (PyCFunction)builtin_min, METH_VARARGS | METH_KEYWORDS, min_doc}, {"oct", builtin_oct, METH_O, oct_doc}, {"ord", builtin_ord, METH_O, ord_doc}, {"pow", builtin_pow, METH_VARARGS, pow_doc}, From rhettinger at users.sourceforge.net Fri Dec 3 09:31:08 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 3 09:31:11 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_builtin.py, 1.36, 1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14724/Lib/test Modified Files: test_builtin.py Log Message: SF patch #1077353: add key= argument to min and max (First draft of patch contributed by Steven Bethard.) Index: test_builtin.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- test_builtin.py 30 Sep 2004 07:47:20 -0000 1.36 +++ test_builtin.py 3 Dec 2004 08:30:35 -0000 1.37 @@ -1,7 +1,8 @@ # Python test set -- built-in functions import test.test_support, unittest -from test.test_support import fcmp, have_unicode, TESTFN, unlink +from test.test_support import fcmp, have_unicode, TESTFN, unlink, run_unittest +from operator import neg import sys, warnings, cStringIO, random, UserDict warnings.filterwarnings("ignore", "hex../oct.. of negative int", @@ -9,6 +10,10 @@ warnings.filterwarnings("ignore", "integer argument expected", DeprecationWarning, "unittest") +# count the number of test runs. +# used to skip running test_execfile() multiple times +numruns = 0 + class Squares: def __init__(self, max): @@ -343,6 +348,11 @@ execfile(TESTFN) def test_execfile(self): + global numruns + if numruns: + return + numruns += 1 + globals = {'a': 1, 'b': 2} locals = {'b': 200, 'c': 300} @@ -845,6 +855,30 @@ self.assertEqual(max(1L, 2.0, 3), 3) self.assertEqual(max(1.0, 2, 3L), 3L) + for stmt in ( + "max(key=int)", # no args + "max(1, key=int)", # single arg not iterable + "max(1, 2, keystone=int)", # wrong keyword + "max(1, 2, key=int, abc=int)", # two many keywords + "max(1, 2, key=1)", # keyfunc is not callable + ): + try: + exec(stmt) in globals() + except TypeError: + pass + else: + self.fail(stmt) + + self.assertEqual(max((1,), key=neg), 1) # one elem iterable + self.assertEqual(max((1,2), key=neg), 1) # two elem iterable + self.assertEqual(max(1, 2, key=neg), 1) # two elems + + data = [random.randrange(200) for i in range(100)] + keys = dict((elem, random.randrange(50)) for elem in data) + f = keys.__getitem__ + self.assertEqual(max(data, key=f), + sorted(reversed(data), key=f)[-1]) + def test_min(self): self.assertEqual(min('123123'), '1') self.assertEqual(min(1, 2, 3), 1) @@ -867,6 +901,30 @@ raise ValueError self.assertRaises(ValueError, min, (42, BadNumber())) + for stmt in ( + "min(key=int)", # no args + "min(1, key=int)", # single arg not iterable + "min(1, 2, keystone=int)", # wrong keyword + "min(1, 2, key=int, abc=int)", # two many keywords + "min(1, 2, key=1)", # keyfunc is not callable + ): + try: + exec(stmt) in globals() + except TypeError: + pass + else: + self.fail(stmt) + + self.assertEqual(min((1,), key=neg), 1) # one elem iterable + self.assertEqual(min((1,2), key=neg), 2) # two elem iterable + self.assertEqual(min(1, 2, key=neg), 2) # two elems + + data = [random.randrange(200) for i in range(100)] + keys = dict((elem, random.randrange(50)) for elem in data) + f = keys.__getitem__ + self.assertEqual(min(data, key=f), + sorted(data, key=f)[0]) + def test_oct(self): self.assertEqual(oct(100), '0144') self.assertEqual(oct(100L), '0144L') @@ -1313,8 +1371,21 @@ data = 'The quick Brown fox Jumped over The lazy Dog'.split() self.assertRaises(TypeError, sorted, data, None, lambda x,y: 0) -def test_main(): - test.test_support.run_unittest(BuiltinTest, TestSorted) +def test_main(verbose=None): + test_classes = (BuiltinTest, TestSorted) + + run_unittest(*test_classes) + + # verify reference counting + if verbose and hasattr(sys, "gettotalrefcount"): + import gc + counts = [None] * 5 + for i in xrange(len(counts)): + run_unittest(*test_classes) + gc.collect() + counts[i] = sys.gettotalrefcount() + print counts + if __name__ == "__main__": - test_main() + test_main(verbose=True) From rhettinger at users.sourceforge.net Fri Dec 3 09:31:08 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 3 09:31:12 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.175,1.176 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14724/Doc/lib Modified Files: libfuncs.tex Log Message: SF patch #1077353: add key= argument to min and max (First draft of patch contributed by Steven Bethard.) Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.175 retrieving revision 1.176 diff -u -d -r1.175 -r1.176 --- libfuncs.tex 30 Sep 2004 00:59:08 -0000 1.175 +++ libfuncs.tex 3 Dec 2004 08:30:35 -0000 1.176 @@ -642,16 +642,28 @@ of sequence; the result is always a list. \end{funcdesc} -\begin{funcdesc}{max}{s\optional{, args...}} +\begin{funcdesc}{max}{s\optional{, args...}\optional{key}} With a single argument \var{s}, return the largest item of a non-empty sequence (such as a string, tuple or list). With more than one argument, return the largest of the arguments. + + The optional \var{key} argument specifies a one argument ordering + function like that used for \method{list.sort()}. The \var{key} + argument, if supplied, must be in keyword form (for example, + \samp{max(a,b,c,key=func)}). + \versionchanged[Added support for the optional \var{key} argument]{2.5} \end{funcdesc} \begin{funcdesc}{min}{s\optional{, args...}} With a single argument \var{s}, return the smallest item of a non-empty sequence (such as a string, tuple or list). With more than one argument, return the smallest of the arguments. + + The optional \var{key} argument specifies a one argument ordering + function like that used for \method{list.sort()}. The \var{key} + argument, if supplied, must be in keyword form (for example, + \samp{min(a,b,c,key=func)}). + \versionchanged[Added support for the optional \var{key} argument]{2.5} \end{funcdesc} \begin{funcdesc}{object}{} From rhettinger at users.sourceforge.net Fri Dec 3 09:33:34 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 3 09:33:37 2004 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.290,1.291 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15405 Modified Files: ACKS Log Message: Acknowledge contribution of a thorough tutorial review. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.290 retrieving revision 1.291 diff -u -d -r1.290 -r1.291 --- ACKS 3 Dec 2004 08:30:35 -0000 1.290 +++ ACKS 3 Dec 2004 08:33:32 -0000 1.291 @@ -38,6 +38,7 @@ Ulf Bartelt Nick Bastin Jeff Bauer +Michael R Bax Anthony Baxter Samuel L. Bayer Donald Beaudry From rhettinger at users.sourceforge.net Fri Dec 3 12:45:15 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 3 12:45:18 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1195,1.1196 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23290/Misc Modified Files: NEWS Log Message: Remove PyRange_New(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1195 retrieving revision 1.1196 diff -u -d -r1.1195 -r1.1196 --- NEWS 3 Dec 2004 08:30:36 -0000 1.1195 +++ NEWS 3 Dec 2004 11:45:09 -0000 1.1196 @@ -32,6 +32,8 @@ C API ----- +- Removed PyRange_New(). + Tests ----- From rhettinger at users.sourceforge.net Fri Dec 3 12:45:15 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 3 12:45:20 2004 Subject: [Python-checkins] python/dist/src/Objects rangeobject.c,2.53,2.54 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23290/Objects Modified Files: rangeobject.c Log Message: Remove PyRange_New(). Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.53 retrieving revision 2.54 diff -u -d -r2.53 -r2.54 --- rangeobject.c 8 Aug 2004 07:17:39 -0000 2.53 +++ rangeobject.c 3 Dec 2004 11:45:13 -0000 2.54 @@ -9,51 +9,6 @@ long len; } rangeobject; -/* XXX PyRange_New should be deprecated. It's not documented. It's not - * used in the core. Its error-checking is akin to Swiss cheese: accepts - * step == 0; accepts len < 0; ignores that (len - 1) * step may overflow; - * raises a baffling "integer addition" exception if it thinks the last - * item is "too big"; and doesn't compute whether "last item is too big" - * correctly even if the multiplication doesn't overflow. - */ -PyObject * -PyRange_New(long start, long len, long step, int reps) -{ - rangeobject *obj; - - if (reps != 1) { - PyErr_SetString(PyExc_ValueError, - "PyRange_New's 'repetitions' argument must be 1"); - return NULL; - } - - obj = PyObject_New(rangeobject, &PyRange_Type); - if (obj == NULL) - return NULL; - - if (len == 0) { - start = 0; - len = 0; - step = 1; - } - else { - long last = start + (len - 1) * step; - if ((step > 0) ? - (last > (PyInt_GetMax() - step)) : - (last < (-1 - PyInt_GetMax() - step))) { - PyErr_SetString(PyExc_OverflowError, - "integer addition"); - Py_DECREF(obj); - return NULL; - } - } - obj->start = start; - obj->len = len; - obj->step = step; - - return (PyObject *) obj; -} - /* Return number of items in range/xrange (lo, hi, step). step > 0 * required. Return a value < 0 if & only if the true value is too * large to fit in a signed long. From rhettinger at users.sourceforge.net Fri Dec 3 12:45:43 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 3 12:45:45 2004 Subject: [Python-checkins] python/dist/src/Include rangeobject.h,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23290/Include Modified Files: rangeobject.h Log Message: Remove PyRange_New(). Index: rangeobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/rangeobject.h,v retrieving revision 2.20 retrieving revision 2.21 diff -u -d -r2.20 -r2.21 --- rangeobject.h 28 Oct 2004 16:31:58 -0000 2.20 +++ rangeobject.h 3 Dec 2004 11:45:09 -0000 2.21 @@ -22,8 +22,6 @@ #define PyRange_Check(op) ((op)->ob_type == &PyRange_Type) -PyAPI_FUNC(PyObject *) PyRange_New(long, long, long, int); - #ifdef __cplusplus } #endif From akuchling at users.sourceforge.net Fri Dec 3 14:54:11 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri Dec 3 14:54:14 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew25.tex, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18646/Doc/whatsnew Modified Files: whatsnew25.tex Log Message: Fill in various bits of the template Index: whatsnew25.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew25.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- whatsnew25.tex 1 Dec 2004 05:05:47 -0000 1.1 +++ whatsnew25.tex 3 Dec 2004 13:54:09 -0000 1.2 @@ -2,38 +2,18 @@ \usepackage{distutils} % $Id$ -% When creating a new ``What's New'' document, copy this to -% ../whatsnew/whatsnewXY.tex, where X is replaced by the major version -% number and Y, by the minor version number for the release of Python -% being described. -% -% The following replacements need to be made in the text: -% -% X.Y -- the version of Python this document describes -% X.Y-1 -- previous minor release (not a maintenance release) -% X.Y-2 -- minor release before that one (optional; search the -% template to see the usage -% -% In this document, these map to the following replacements: -% (Please complete this section when specific replacements are made.) -% -% X.Y -- 2.5 -% X.Y-1 -- 2.4.something (not yet determined) -% X.Y-2 -- 2.4.something (not yet determined) -% -% Once done, write and edit to your heart's content! \title{What's New in Python 2.5} \release{0.0} -\author{Young Author} -\authoraddress{\email{ya@example.com}} +\author{A.M. Kuchling} +\authoraddress{\email{amk@amk.ca}} \begin{document} \maketitle \tableofcontents This article explains the new features in Python 2.5. No release date -for Python 2.5 has been set; expect that this will happen next year. +for Python 2.5 has been set; it will probably be released in late 2005. % Compare with previous release in 2 - 3 sentences here. @@ -72,9 +52,7 @@ \end{itemize} The net result of the 2.5 optimizations is that Python 2.5 runs the -pystone benchmark around XX\% faster than Python X.Y-1.% -% only use the next line if you want to do the extra work ;) : -% and YY\% faster than Python X.Y-2. +pystone benchmark around XX\% faster than Python 2.4. %====================================================================== @@ -122,7 +100,7 @@ As usual, there were a bunch of other improvements and bugfixes scattered throughout the source tree. A search through the CVS change logs finds there were XXX patches applied and YYY bugs fixed between -Python X.Y-1 and 2.5. Both figures are likely to be underestimates. +Python 2.4 and 2.5. Both figures are likely to be underestimates. Some of the more notable changes are: From akuchling at users.sourceforge.net Fri Dec 3 15:57:24 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri Dec 3 15:57:28 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew25.tex, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv315 Modified Files: whatsnew25.tex Log Message: AAdd item. (And so it beegins again.) Index: whatsnew25.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew25.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- whatsnew25.tex 3 Dec 2004 13:54:09 -0000 1.2 +++ whatsnew25.tex 3 Dec 2004 14:57:21 -0000 1.3 @@ -37,7 +37,24 @@ language. \begin{itemize} -\item TBD + +\item The \function{min()} and \function{max()} built-in functions +gained a \code{key} keyword argument analogous to the \code{key} +argument for \function{sort()}. This argument supplies a function +that takes a single argument and is called for every value in the list; +\function{min()}/\function{max()} will return the element with the +smallest/largest return value from this function. +For example, to find the longest string in a list, you can do: + +\begin{verbatim} +L = ['medium', 'longest', 'short'] +# Prints 'longest' +print max(L, key=len) +# Prints 'short', because lexicographically 'short' has the largest value +print max(L) +\end{verbatim} + +(Contributed by Steven Bethard and Raymond Hettinger.) \end{itemize} From akuchling at users.sourceforge.net Fri Dec 3 15:59:11 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri Dec 3 15:59:14 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.176,1.177 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv875 Modified Files: libfuncs.tex Log Message: Hyphenate 'one-argument' Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.176 retrieving revision 1.177 diff -u -d -r1.176 -r1.177 --- libfuncs.tex 3 Dec 2004 08:30:35 -0000 1.176 +++ libfuncs.tex 3 Dec 2004 14:59:09 -0000 1.177 @@ -647,7 +647,7 @@ non-empty sequence (such as a string, tuple or list). With more than one argument, return the largest of the arguments. - The optional \var{key} argument specifies a one argument ordering + The optional \var{key} argument specifies a one-argument ordering function like that used for \method{list.sort()}. The \var{key} argument, if supplied, must be in keyword form (for example, \samp{max(a,b,c,key=func)}). @@ -659,7 +659,7 @@ non-empty sequence (such as a string, tuple or list). With more than one argument, return the smallest of the arguments. - The optional \var{key} argument specifies a one argument ordering + The optional \var{key} argument specifies a one-argument ordering function like that used for \method{list.sort()}. The \var{key} argument, if supplied, must be in keyword form (for example, \samp{min(a,b,c,key=func)}). From akuchling at users.sourceforge.net Fri Dec 3 16:16:43 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri Dec 3 16:16:47 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew25.tex, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6141 Modified Files: whatsnew25.tex Log Message: Add item Index: whatsnew25.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew25.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- whatsnew25.tex 3 Dec 2004 14:57:21 -0000 1.3 +++ whatsnew25.tex 3 Dec 2004 15:16:40 -0000 1.4 @@ -100,7 +100,8 @@ \begin{itemize} -\item Detailed changes are listed here. +\item The \cfunction{PyRange_New()} function was removed. It was never documented, +never used in the core code, and had dangerously lax error checking. \end{itemize} From rhettinger at users.sourceforge.net Fri Dec 3 17:23:48 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 3 17:23:52 2004 Subject: [Python-checkins] python/nondist/peps pep-0290.txt,1.15,1.16 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21908 Modified Files: pep-0290.txt Log Message: Fix argument order in an example Index: pep-0290.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0290.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- pep-0290.txt 16 Aug 2004 03:14:53 -0000 1.15 +++ pep-0290.txt 3 Dec 2004 16:23:45 -0000 1.16 @@ -167,7 +167,7 @@ Typical contexts:: sort(studentrecords, key=attrgetter('gpa')) # set a sort field - map(studentrecords, attrgetter('lastname')) # extract a field + map(attrgetter('lastname'), studentrecords) # extract a field Locating: ``grep lambda *.py`` From rhettinger at users.sourceforge.net Sat Dec 4 11:50:53 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 4 11:50:57 2004 Subject: [Python-checkins] python/dist/src/Doc/lib lib.tex, 1.231, 1.232 librand.tex, 1.11, NONE libwhrandom.tex, 1.15, NONE Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18843/Doc/lib Modified Files: lib.tex Removed Files: librand.tex libwhrandom.tex Log Message: Remove the deprecated whrandom module. Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.231 retrieving revision 1.232 diff -u -d -r1.231 -r1.232 --- lib.tex 17 Oct 2004 16:29:48 -0000 1.231 +++ lib.tex 4 Dec 2004 10:50:50 -0000 1.232 @@ -124,7 +124,6 @@ \input{libmath} \input{libcmath} \input{librandom} -\input{libwhrandom} \input{libbisect} \input{libcollections} \input{libheapq} @@ -354,7 +353,6 @@ %\input{libcmpcache} %\input{libcmp} %\input{libni} -%\input{librand} %\input{libregex} %\input{libregsub} --- librand.tex DELETED --- --- libwhrandom.tex DELETED --- From rhettinger at users.sourceforge.net Sat Dec 4 11:50:53 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 4 11:50:57 2004 Subject: [Python-checkins] python/dist/src/Lib whrandom.py,1.21,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18843/Lib Removed Files: whrandom.py Log Message: Remove the deprecated whrandom module. --- whrandom.py DELETED --- From rhettinger at users.sourceforge.net Sat Dec 4 11:50:53 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 4 11:50:58 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.264,1.265 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18843/Doc/tut Modified Files: tut.tex Log Message: Remove the deprecated whrandom module. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.264 retrieving revision 1.265 diff -u -d -r1.264 -r1.265 --- tut.tex 2 Dec 2004 07:29:42 -0000 1.264 +++ tut.tex 4 Dec 2004 10:50:50 -0000 1.265 @@ -4653,7 +4653,7 @@ and complex ways. While date and time arithmetic is supported, the focus of the implementation is on efficient member extraction for output formatting and manipulation. The module also supports objects -that are time zone aware. +that are timezone aware. \begin{verbatim} # dates are easily constructed and formatted @@ -4777,7 +4777,7 @@ \item The \ulink{\module{xmlrpclib}}{../lib/module-xmlrpclib.html} and \ulink{\module{SimpleXMLRPCServer}}{../lib/module-SimpleXMLRPCServer.html} modules make implementing remote procedure calls into an almost trivial task. - Despite the names, no direct knowledge or handling of XML is needed. + Despite the modules names, no direct knowledge or handling of XML is needed. \item The \ulink{\module{email}}{../lib/module-email.html} package is a library for managing email messages, including MIME and other RFC 2822-based message documents. Unlike \module{smptlib} and \module{poplib} which actually send @@ -4805,9 +4805,9 @@ \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: +The \ulink{\module{repr}}{../lib/module-repr.html} module provides a +version of \function{repr()} customized for abbreviated displays of large +or deeply nested containers: \begin{verbatim} >>> import repr @@ -5097,7 +5097,7 @@ 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 +data and 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: From rhettinger at users.sourceforge.net Sat Dec 4 11:50:55 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 4 11:50:59 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1196,1.1197 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18843/Misc Modified Files: NEWS Log Message: Remove the deprecated whrandom module. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1196 retrieving revision 1.1197 diff -u -d -r1.1196 -r1.1197 --- NEWS 3 Dec 2004 11:45:09 -0000 1.1196 +++ NEWS 4 Dec 2004 10:50:51 -0000 1.1197 @@ -21,6 +21,8 @@ Library ------- +- the deprecated whrandom module was removed. Use the random module instead. + - heapq.nsmallest() and heapq.nlargest() now support key= arguments with the same meaning as in list.sort(). From rhettinger at users.sourceforge.net Sat Dec 4 21:07:33 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 4 21:07:35 2004 Subject: [Python-checkins] python/dist/src/Lib/lib-old whrandom.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-old In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2440 Added Files: whrandom.py Log Message: For the benefit of historians . . . --- NEW FILE: whrandom.py --- """Wichman-Hill random number generator. Wichmann, B. A. & Hill, I. D. (1982) Algorithm AS 183: An efficient and portable pseudo-random number generator Applied Statistics 31 (1982) 188-190 see also: Correction to Algorithm AS 183 Applied Statistics 33 (1984) 123 McLeod, A. I. (1985) A remark on Algorithm AS 183 Applied Statistics 34 (1985),198-200 USE: whrandom.random() yields double precision random numbers uniformly distributed between 0 and 1. whrandom.seed(x, y, z) must be called before whrandom.random() to seed the generator There is also an interface to create multiple independent random generators, and to choose from other ranges. Multi-threading note: the random number generator used here is not thread-safe; it is possible that nearly simultaneous calls in different theads return the same random value. To avoid this, you have to use a lock around all calls. (I didn't want to slow this down in the serial case by using a lock here.) """ import warnings warnings.warn("the whrandom module is deprecated; please use the random module", DeprecationWarning) # Translated by Guido van Rossum from C source provided by # Adrian Baddeley. class whrandom: def __init__(self, x = 0, y = 0, z = 0): """Initialize an instance. Without arguments, initialize from current time. With arguments (x, y, z), initialize from them.""" self.seed(x, y, z) def seed(self, x = 0, y = 0, z = 0): """Set the seed from (x, y, z). These must be integers in the range [0, 256).""" if not type(x) == type(y) == type(z) == type(0): raise TypeError, 'seeds must be integers' if not (0 <= x < 256 and 0 <= y < 256 and 0 <= z < 256): raise ValueError, 'seeds must be in range(0, 256)' if 0 == x == y == z: # Initialize from current time import time t = long(time.time() * 256) t = int((t&0xffffff) ^ (t>>24)) t, x = divmod(t, 256) t, y = divmod(t, 256) t, z = divmod(t, 256) # Zero is a poor seed, so substitute 1 self._seed = (x or 1, y or 1, z or 1) def random(self): """Get the next random number in the range [0.0, 1.0).""" # This part is thread-unsafe: # BEGIN CRITICAL SECTION x, y, z = self._seed # x = (171 * x) % 30269 y = (172 * y) % 30307 z = (170 * z) % 30323 # self._seed = x, y, z # END CRITICAL SECTION # return (x/30269.0 + y/30307.0 + z/30323.0) % 1.0 def uniform(self, a, b): """Get a random number in the range [a, b).""" return a + (b-a) * self.random() def randint(self, a, b): """Get a random integer in the range [a, b] including both end points. (Deprecated; use randrange below.)""" return self.randrange(a, b+1) def choice(self, seq): """Choose a random element from a non-empty sequence.""" return seq[int(self.random() * len(seq))] def randrange(self, start, stop=None, step=1, int=int, default=None): """Choose a random item from range(start, stop[, step]). This fixes the problem with randint() which includes the endpoint; in Python this is usually not what you want. Do not supply the 'int' and 'default' arguments.""" # This code is a bit messy to make it fast for the # common case while still doing adequate error checking istart = int(start) if istart != start: raise ValueError, "non-integer arg 1 for randrange()" if stop is default: if istart > 0: return int(self.random() * istart) raise ValueError, "empty range for randrange()" istop = int(stop) if istop != stop: raise ValueError, "non-integer stop for randrange()" if step == 1: if istart < istop: return istart + int(self.random() * (istop - istart)) raise ValueError, "empty range for randrange()" istep = int(step) if istep != step: raise ValueError, "non-integer step for randrange()" if istep > 0: n = (istop - istart + istep - 1) / istep elif istep < 0: n = (istop - istart + istep + 1) / istep else: raise ValueError, "zero step for randrange()" if n <= 0: raise ValueError, "empty range for randrange()" return istart + istep*int(self.random() * n) # Initialize from the current time _inst = whrandom() seed = _inst.seed random = _inst.random uniform = _inst.uniform randint = _inst.randint choice = _inst.choice randrange = _inst.randrange From rhettinger at users.sourceforge.net Sat Dec 4 22:21:56 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 4 22:21:59 2004 Subject: [Python-checkins] python/dist/src/Lib unittest.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18262/lib Modified Files: unittest.py Log Message: SF bug #1078905: Docs for unittest run() methods are misleading Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- unittest.py 7 Nov 2004 15:46:25 -0000 1.36 +++ unittest.py 4 Dec 2004 21:21:53 -0000 1.37 @@ -277,7 +277,8 @@ finally: result.stopTest(self) - __call__ = run + def __call__(self, *args, **kwds): + return self.run(*args, **kwds) def debug(self): """Run the test without collecting errors in a TestResult""" @@ -417,15 +418,15 @@ self.addTest(test) def run(self, result): - return self(result) - - def __call__(self, result): for test in self._tests: if result.shouldStop: break test(result) return result + def __call__(self, *args, **kwds): + return self.run(*args, **kwds) + def debug(self): """Run the tests without collecting errors in a TestResult""" for test in self._tests: test.debug() From rhettinger at users.sourceforge.net Sat Dec 4 22:21:56 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 4 22:22:00 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1197,1.1198 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18262/misc Modified Files: NEWS Log Message: SF bug #1078905: Docs for unittest run() methods are misleading Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1197 retrieving revision 1.1198 diff -u -d -r1.1197 -r1.1198 --- NEWS 4 Dec 2004 10:50:51 -0000 1.1197 +++ NEWS 4 Dec 2004 21:21:53 -0000 1.1198 @@ -21,6 +21,10 @@ Library ------- +- unittest.TestCase.run() and unittest.TestSuite.run() can now be successfully + extended or overridden by subclasses. Formerly, the subclassed method would + be ignored by the rest of the module. (Bug #1078905). + - the deprecated whrandom module was removed. Use the random module instead. - heapq.nsmallest() and heapq.nlargest() now support key= arguments with From rhettinger at users.sourceforge.net Sat Dec 4 22:24:33 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 4 22:24:36 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1193.2.1,1.1193.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18784/Misc Modified Files: Tag: release24-maint NEWS Log Message: SF bug #1078905: Docs for unittest run() methods are misleading Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.1 retrieving revision 1.1193.2.2 diff -u -d -r1.1193.2.1 -r1.1193.2.2 --- NEWS 30 Nov 2004 22:18:39 -0000 1.1193.2.1 +++ NEWS 4 Dec 2004 21:24:19 -0000 1.1193.2.2 @@ -15,6 +15,11 @@ Library ------- +- unittest.TestCase.run() and unittest.TestSuite.run() can now be successfully + extended or overridden by subclasses. Formerly, the subclassed method would + be ignored by the rest of the module. (Bug #1078905). + + Build ----- From rhettinger at users.sourceforge.net Sat Dec 4 22:24:33 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 4 22:24:37 2004 Subject: [Python-checkins] python/dist/src/Lib unittest.py,1.36,1.36.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18784/Lib Modified Files: Tag: release24-maint unittest.py Log Message: SF bug #1078905: Docs for unittest run() methods are misleading Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.36 retrieving revision 1.36.2.1 diff -u -d -r1.36 -r1.36.2.1 --- unittest.py 7 Nov 2004 15:46:25 -0000 1.36 +++ unittest.py 4 Dec 2004 21:24:19 -0000 1.36.2.1 @@ -277,7 +277,8 @@ finally: result.stopTest(self) - __call__ = run + def __call__(self, *args, **kwds): + return self.run(*args, **kwds) def debug(self): """Run the test without collecting errors in a TestResult""" @@ -417,15 +418,15 @@ self.addTest(test) def run(self, result): - return self(result) - - def __call__(self, result): for test in self._tests: if result.shouldStop: break test(result) return result + def __call__(self, *args, **kwds): + return self.run(*args, **kwds) + def debug(self): """Run the tests without collecting errors in a TestResult""" for test in self._tests: test.debug() From rhettinger at users.sourceforge.net Sun Dec 5 02:58:14 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 02:58:18 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1198,1.1199 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10193/Misc Modified Files: NEWS Log Message: Removed deprecated use_statcache argument. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1198 retrieving revision 1.1199 diff -u -d -r1.1198 -r1.1199 --- NEWS 4 Dec 2004 21:21:53 -0000 1.1198 +++ NEWS 5 Dec 2004 01:58:09 -0000 1.1199 @@ -21,6 +21,8 @@ Library ------- +- the filecmp module no longer uses the deprecated use_statcache argument. + - unittest.TestCase.run() and unittest.TestSuite.run() can now be successfully extended or overridden by subclasses. Formerly, the subclassed method would be ignored by the rest of the module. (Bug #1078905). From rhettinger at users.sourceforge.net Sun Dec 5 02:58:41 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 02:58:43 2004 Subject: [Python-checkins] python/dist/src/Lib filecmp.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10193/Lib Modified Files: filecmp.py Log Message: Removed deprecated use_statcache argument. Index: filecmp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/filecmp.py,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- filecmp.py 2 Sep 2003 05:42:00 -0000 1.17 +++ filecmp.py 5 Dec 2004 01:58:08 -0000 1.18 @@ -19,7 +19,7 @@ _cache = {} BUFSIZE=8*1024 -def cmp(f1, f2, shallow=1, use_statcache=None): +def cmp(f1, f2, shallow=1): """Compare two files. Arguments: @@ -31,8 +31,6 @@ shallow -- Just check stat signature (do not read the files). defaults to 1. - use_statcache -- obsolete argument. - Return value: True if the files are the same, False otherwise. @@ -41,9 +39,6 @@ with a cache invalidation mechanism relying on stale signatures. """ - if use_statcache is not None: - warnings.warn("use_statcache argument is deprecated", - DeprecationWarning) s1 = _sig(os.stat(f1)) s2 = _sig(os.stat(f2)) @@ -244,13 +239,12 @@ self.methodmap[attr](self) return getattr(self, attr) -def cmpfiles(a, b, common, shallow=1, use_statcache=None): +def cmpfiles(a, b, common, shallow=1): """Compare common files in two directories. a, b -- directory names common -- list of file names found in both directories shallow -- if true, do comparison based solely on stat() information - use_statcache -- obsolete argument Returns a tuple of three lists: files that compare equal @@ -258,9 +252,6 @@ filenames that aren't regular files. """ - if use_statcache is not None: - warnings.warn("use_statcache argument is deprecated", - DeprecationWarning) res = ([], [], []) for x in common: ax = os.path.join(a, x) From rhettinger at users.sourceforge.net Sun Dec 5 02:58:41 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 02:58:44 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libfilecmp.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-serv10193/Doc/lib Modified Files: libfilecmp.tex Log Message: Removed deprecated use_statcache argument. Index: libfilecmp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfilecmp.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- libfilecmp.tex 6 Feb 2003 21:17:17 -0000 1.8 +++ libfilecmp.tex 5 Dec 2004 01:58:08 -0000 1.9 @@ -11,13 +11,12 @@ The \module{filecmp} module defines the following functions: -\begin{funcdesc}{cmp}{f1, f2\optional{, shallow\optional{, use_statcache}}} +\begin{funcdesc}{cmp}{f1, f2\optional{, shallow}} Compare the files named \var{f1} and \var{f2}, returning \code{True} if they seem equal, \code{False} otherwise. Unless \var{shallow} is given and is false, files with identical \function{os.stat()} signatures are taken to be equal. -\versionchanged[\var{use_statcache} is obsolete and ignored.]{2.3} Files that were compared using this function will not be compared again unless their \function{os.stat()} signature changes. @@ -27,7 +26,7 @@ \end{funcdesc} \begin{funcdesc}{cmpfiles}{dir1, dir2, common\optional{, - shallow\optional{, use_statcache}}} + shallow}} Returns three lists of file names: \var{match}, \var{mismatch}, \var{errors}. \var{match} contains the list of files match in both directories, \var{mismatch} includes the names of those that don't, @@ -37,8 +36,8 @@ the comparison could not be done for some reason. The \var{common} parameter is a list of file names found in both directories. -The \var{shallow} and \var{use_statcache} parameters have the same -meanings and default values as for \function{filecmp.cmp()}. +The \var{shallow} parameter has the same +meaning and default value as for \function{filecmp.cmp()}. \end{funcdesc} Example: From rhettinger at users.sourceforge.net Sun Dec 5 04:28:01 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 04:28:04 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libprofile.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-serv27001/Doc/lib Modified Files: libprofile.tex Log Message: Removed deprecated method from pstats. Index: libprofile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libprofile.tex,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- libprofile.tex 7 Nov 2004 06:18:37 -0000 1.48 +++ libprofile.tex 5 Dec 2004 03:27:59 -0000 1.49 @@ -525,14 +525,6 @@ ordering are identical to the \method{print_callers()} method. \end{methoddesc} -\begin{methoddesc}[Stats]{ignore}{} -\deprecated{1.5.1}{This is not needed in modern versions of -Python.\footnote{ - This was once necessary, when Python would print any unused expression - result that was not \code{None}. The method is still defined for - backward compatibility.}} -\end{methoddesc} - \section{Limitations \label{profile-limits}} From rhettinger at users.sourceforge.net Sun Dec 5 04:28:02 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 04:28:04 2004 Subject: [Python-checkins] python/dist/src/Lib pstats.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27001/Lib Modified Files: pstats.py Log Message: Removed deprecated method from pstats. Index: pstats.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pstats.py,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- pstats.py 12 Feb 2004 17:35:07 -0000 1.30 +++ pstats.py 5 Dec 2004 03:27:59 -0000 1.31 @@ -416,10 +416,6 @@ print f8(ct/cc), print func_std_string(func) - def ignore(self): - # Deprecated since 1.5.1 -- see the docs. - pass # has no return value, so use at end of line :-) - class TupleComp: """This class provides a generic function for comparing any two tuples. Each instance records a list of tuple-indices (from most significant From rhettinger at users.sourceforge.net Sun Dec 5 04:28:03 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 04:28:07 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1199,1.1200 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27001/Misc Modified Files: NEWS Log Message: Removed deprecated method from pstats. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1199 retrieving revision 1.1200 diff -u -d -r1.1199 -r1.1200 --- NEWS 5 Dec 2004 01:58:09 -0000 1.1199 +++ NEWS 5 Dec 2004 03:28:00 -0000 1.1200 @@ -21,6 +21,8 @@ Library ------- +- the pstats module no longer uses the deprecated ignore() method. + - the filecmp module no longer uses the deprecated use_statcache argument. - unittest.TestCase.run() and unittest.TestSuite.run() can now be successfully From bwarsaw at users.sourceforge.net Sun Dec 5 04:34:17 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun Dec 5 04:34:20 2004 Subject: [Python-checkins] python/dist/src/Lib/email FeedParser.py, 1.13, 1.13.2.1 __init__.py, 1.35, 1.35.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28099/Lib/email Modified Files: Tag: release24-maint FeedParser.py __init__.py Log Message: Fixes for SF #1076485, which I'll apply to the CVS head too. The problem was caused by a self._input.readline() call that wasn't checking for the NeedsMoreData marker. msg_43.txt contains a message that illustrates the problem, when email.message_from_*() is called. That interface uses the Parser API, which splits reads into 8192 byte chunks. It so happens that for the test message, the 8192 chunk falls inside a message/delivery-status, which is where in the FeedParser the readline() call was that didn't check for NeedsMoreData. I also added an assert to unreadline() so it'll be more evident if an attempt to push back NeedsMoreData ever happens again. Bump the email package version number. Index: FeedParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -u -d -r1.13 -r1.13.2.1 --- FeedParser.py 29 Nov 2004 03:46:54 -0000 1.13 +++ FeedParser.py 5 Dec 2004 03:34:14 -0000 1.13.2.1 @@ -87,6 +87,7 @@ def unreadline(self, line): # Let the consumer push a line back into the buffer. + assert line is not NeedMoreData self._lines.append(line) def push(self, data): @@ -242,8 +243,18 @@ # 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() + while True: + line = self._input.readline() + if line is NeedMoreData: + yield NeedMoreData + continue + break + while True: + line = self._input.readline() + if line is NeedMoreData: + yield NeedMoreData + continue + break if line == '': break # Not at EOF so this is a line we're going to need. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.35 retrieving revision 1.35.2.1 diff -u -d -r1.35 -r1.35.2.1 --- __init__.py 29 Nov 2004 01:10:14 -0000 1.35 +++ __init__.py 5 Dec 2004 03:34:14 -0000 1.35.2.1 @@ -4,7 +4,7 @@ """A package for parsing, handling, and generating email messages.""" -__version__ = '3.0' +__version__ = '3.0+' __all__ = [ 'base64MIME', From bwarsaw at users.sourceforge.net Sun Dec 5 04:34:17 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun Dec 5 04:34:20 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.67, 1.67.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28099/Lib/email/test Modified Files: Tag: release24-maint test_email.py Log Message: Fixes for SF #1076485, which I'll apply to the CVS head too. The problem was caused by a self._input.readline() call that wasn't checking for the NeedsMoreData marker. msg_43.txt contains a message that illustrates the problem, when email.message_from_*() is called. That interface uses the Parser API, which splits reads into 8192 byte chunks. It so happens that for the test message, the 8192 chunk falls inside a message/delivery-status, which is where in the FeedParser the readline() call was that didn't check for NeedsMoreData. I also added an assert to unreadline() so it'll be more evident if an attempt to push back NeedsMoreData ever happens again. Bump the email package version number. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.67 retrieving revision 1.67.2.1 diff -u -d -r1.67 -r1.67.2.1 --- test_email.py 29 Nov 2004 03:46:54 -0000 1.67 +++ test_email.py 5 Dec 2004 03:34:14 -0000 1.67.2.1 @@ -1973,7 +1973,7 @@ # Test various other bits of the package's functionality -class TestMiscellaneous(unittest.TestCase): +class TestMiscellaneous(TestEmailBase): def test_message_from_string(self): fp = openfile('msg_01.txt') try: @@ -2222,6 +2222,48 @@ uc = Charset('US-ASCII') self.assertEqual(lc.get_body_encoding(), uc.get_body_encoding()) + def test_partial_falls_inside_message_delivery_status(self): + eq = self.ndiffAssertEqual + # The Parser interface provides chunks of data to FeedParser in 8192 + # byte gulps. SF bug #1076485 found one of those chunks inside + # message/delivery-status header block, which triggered an + # unreadline() of NeedMoreData. + msg = self._msgobj('msg_43.txt') + sfp = StringIO() + Iterators._structure(msg, sfp) + eq(sfp.getvalue(), """\ +multipart/report + text/plain + message/delivery-status + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/rfc822-headers +""") + # Test the iterator/generators From bwarsaw at users.sourceforge.net Sun Dec 5 04:34:17 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun Dec 5 04:34:21 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_43.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-serv28099/Lib/email/test/data Added Files: Tag: release24-maint msg_43.txt Log Message: Fixes for SF #1076485, which I'll apply to the CVS head too. The problem was caused by a self._input.readline() call that wasn't checking for the NeedsMoreData marker. msg_43.txt contains a message that illustrates the problem, when email.message_from_*() is called. That interface uses the Parser API, which splits reads into 8192 byte chunks. It so happens that for the test message, the 8192 chunk falls inside a message/delivery-status, which is where in the FeedParser the readline() call was that didn't check for NeedsMoreData. I also added an assert to unreadline() so it'll be more evident if an attempt to push back NeedsMoreData ever happens again. Bump the email package version number. --- NEW FILE: msg_43.txt --- >From SRS0=aO/p=ON=bag.python.org=None@bounce2.pobox.com Fri Nov 26 21:40:36 2004 X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil] [nil nil nil nil nil nil nil "MAILER DAEMON <>" "MAILER DAEMON <>" nil nil "Banned file: auto__mail.python.bat in mail from you" "^From:" nil nil nil nil "Banned file: auto__mail.python.bat in mail from you" nil nil nil nil nil nil nil] nil) MIME-Version: 1.0 Message-Id: Content-Type: multipart/report; report-type=delivery-status; charset=utf-8; boundary="----------=_1101526904-1956-5" X-Virus-Scanned: by XS4ALL Virus Scanner X-UIDL: 4\G!!! To: Subject: Banned file: auto__mail.python.bat in mail from you Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) This is a multi-part message in MIME format... ------------=_1101526904-1956-5 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 7bit BANNED FILENAME ALERT Your message to: xxxxxxx@dot.ca.gov, xxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxx@dot.ca.gov, xxxxxx@dot.ca.gov, xxxxxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxx@dot.ca.gov, xxxxxxx@dot.ca.gov, xxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxx@dot.ca.gov, xxx@dot.ca.gov, xxxxxxx@dot.ca.gov, xxxxxxx@dot.ca.gov, xxxxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxx@dot.ca.gov, xxx@dot.ca.gov, xxxxxxxx@dot.ca.gov, xxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxxx@dot.ca.gov, xxxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxx@dot.ca.gov, xxxxxxx@dot.ca.gov, xxxxxxxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxxx@dot.ca.gov, xxxx@dot.ca.gov, xxxxxxxx@dot.ca.gov, xxxxxxxxxx@dot.ca.gov, xxxxxxxxxxxxxxxxxx@dot.ca.gov was blocked by our Spam Firewall. The email you sent with the following subject has NOT BEEN DELIVERED: Subject: Delivery_failure_notice An attachment in that mail was of a file type that the Spam Firewall is set to block. ------------=_1101526904-1956-5 Content-Type: message/delivery-status Content-Disposition: inline Content-Transfer-Encoding: 7bit Content-Description: Delivery error report Reporting-MTA: dns; sacspam01.dot.ca.gov Received-From-MTA: smtp; sacspam01.dot.ca.gov ([127.0.0.1]) Arrival-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) Final-Recipient: rfc822; xxxxxxx@dot.ca.gov Action: failed Status: 5.7.1 Diagnostic-Code: smtp; 550 5.7.1 Message content rejected, id=01956-02-2 - BANNED: auto__mail.python.bat Last-Attempt-Date: Fri, 26 Nov 2004 19:41:44 -0800 (PST) ------------=_1101526904-1956-5 Content-Type: text/rfc822-headers Content-Disposition: inline Content-Transfer-Encoding: 7bit Content-Description: Undelivered-message headers Received: from kgsav.org (ppp-70-242-162-63.dsl.spfdmo.swbell.net [70.242.162.63]) by sacspam01.dot.ca.gov (Spam Firewall) with SMTP id A232AD03DE3A; Fri, 26 Nov 2004 19:41:35 -0800 (PST) From: webmaster@python.org To: xxxxx@dot.ca.gov Date: Sat, 27 Nov 2004 03:35:30 UTC Subject: Delivery_failure_notice Importance: Normal X-Priority: 3 (Normal) X-MSMail-Priority: Normal Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="====67bd2b7a5.f99f7" Content-Transfer-Encoding: 7bit ------------=_1101526904-1956-5-- From bwarsaw at users.sourceforge.net Sun Dec 5 04:45:45 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun Dec 5 04:45:48 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_43.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-serv29909/Lib/email/test/data Added Files: msg_43.txt Log Message: Fixes for SF #1076485, which I'll apply to the CVS head too. The problem was caused by a self._input.readline() call that wasn't checking for the NeedsMoreData marker. msg_43.txt contains a message that illustrates the problem, when email.message_from_*() is called. That interface uses the Parser API, which splits reads into 8192 byte chunks. It so happens that for the test message, the 8192 chunk falls inside a message/delivery-status, which is where in the FeedParser the readline() call was that didn't check for NeedsMoreData. I also added an assert to unreadline() so it'll be more evident if an attempt to push back NeedsMoreData ever happens again. Bump the email package version number. From bwarsaw at users.sourceforge.net Sun Dec 5 04:45:44 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun Dec 5 04:45:49 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.67, 1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29909/Lib/email/test Modified Files: test_email.py Log Message: Fixes for SF #1076485, which I'll apply to the CVS head too. The problem was caused by a self._input.readline() call that wasn't checking for the NeedsMoreData marker. msg_43.txt contains a message that illustrates the problem, when email.message_from_*() is called. That interface uses the Parser API, which splits reads into 8192 byte chunks. It so happens that for the test message, the 8192 chunk falls inside a message/delivery-status, which is where in the FeedParser the readline() call was that didn't check for NeedsMoreData. I also added an assert to unreadline() so it'll be more evident if an attempt to push back NeedsMoreData ever happens again. Bump the email package version number. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.67 retrieving revision 1.68 diff -u -d -r1.67 -r1.68 --- test_email.py 29 Nov 2004 03:46:54 -0000 1.67 +++ test_email.py 5 Dec 2004 03:45:42 -0000 1.68 @@ -1973,7 +1973,7 @@ # Test various other bits of the package's functionality -class TestMiscellaneous(unittest.TestCase): +class TestMiscellaneous(TestEmailBase): def test_message_from_string(self): fp = openfile('msg_01.txt') try: @@ -2222,6 +2222,48 @@ uc = Charset('US-ASCII') self.assertEqual(lc.get_body_encoding(), uc.get_body_encoding()) + def test_partial_falls_inside_message_delivery_status(self): + eq = self.ndiffAssertEqual + # The Parser interface provides chunks of data to FeedParser in 8192 + # byte gulps. SF bug #1076485 found one of those chunks inside + # message/delivery-status header block, which triggered an + # unreadline() of NeedMoreData. + msg = self._msgobj('msg_43.txt') + sfp = StringIO() + Iterators._structure(msg, sfp) + eq(sfp.getvalue(), """\ +multipart/report + text/plain + message/delivery-status + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/plain + text/rfc822-headers +""") + # Test the iterator/generators From bwarsaw at users.sourceforge.net Sun Dec 5 04:45:44 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun Dec 5 04:45:49 2004 Subject: [Python-checkins] python/dist/src/Lib/email FeedParser.py, 1.13, 1.14 __init__.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-serv29909/Lib/email Modified Files: FeedParser.py __init__.py Log Message: Fixes for SF #1076485, which I'll apply to the CVS head too. The problem was caused by a self._input.readline() call that wasn't checking for the NeedsMoreData marker. msg_43.txt contains a message that illustrates the problem, when email.message_from_*() is called. That interface uses the Parser API, which splits reads into 8192 byte chunks. It so happens that for the test message, the 8192 chunk falls inside a message/delivery-status, which is where in the FeedParser the readline() call was that didn't check for NeedsMoreData. I also added an assert to unreadline() so it'll be more evident if an attempt to push back NeedsMoreData ever happens again. Bump the email package version number. Index: FeedParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- FeedParser.py 29 Nov 2004 03:46:54 -0000 1.13 +++ FeedParser.py 5 Dec 2004 03:45:41 -0000 1.14 @@ -87,6 +87,7 @@ def unreadline(self, line): # Let the consumer push a line back into the buffer. + assert line is not NeedMoreData self._lines.append(line) def push(self, data): @@ -242,8 +243,18 @@ # 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() + while True: + line = self._input.readline() + if line is NeedMoreData: + yield NeedMoreData + continue + break + while True: + line = self._input.readline() + if line is NeedMoreData: + yield NeedMoreData + continue + break if line == '': break # Not at EOF so this is a line we're going to need. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- __init__.py 29 Nov 2004 01:10:14 -0000 1.35 +++ __init__.py 5 Dec 2004 03:45:42 -0000 1.36 @@ -4,7 +4,7 @@ """A package for parsing, handling, and generating email messages.""" -__version__ = '3.0' +__version__ = '3.0+' __all__ = [ 'base64MIME', From rhettinger at users.sourceforge.net Sun Dec 5 04:58:20 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 04:58:23 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_shelve.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-serv31910/Lib/test Modified Files: test_shelve.py Log Message: Removed deprecated method arguments from the shelve module. Index: test_shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shelve.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- test_shelve.py 2 Jun 2004 18:42:25 -0000 1.8 +++ test_shelve.py 5 Dec 2004 03:58:17 -0000 1.9 @@ -10,7 +10,7 @@ def test_ascii_file_shelf(self): try: - s = shelve.open(self.fn, binary=False) + s = shelve.open(self.fn, protocol=0) s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) s.close() @@ -20,7 +20,7 @@ def test_binary_file_shelf(self): try: - s = shelve.open(self.fn, binary=True) + s = shelve.open(self.fn, protocol=1) s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) s.close() @@ -40,12 +40,12 @@ def test_in_memory_shelf(self): d1 = {} - s = shelve.Shelf(d1, binary=False) + s = shelve.Shelf(d1, protocol=0) s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) s.close() d2 = {} - s = shelve.Shelf(d2, binary=True) + s = shelve.Shelf(d2, protocol=1) s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) s.close() @@ -102,19 +102,19 @@ os.unlink(f) class TestAsciiFileShelve(TestShelveBase): - _args={'binary':False} + _args={'protocol':0} _in_mem = False class TestBinaryFileShelve(TestShelveBase): - _args={'binary':True} + _args={'protocol':1} _in_mem = False class TestProto2FileShelve(TestShelveBase): _args={'protocol':2} _in_mem = False class TestAsciiMemShelve(TestShelveBase): - _args={'binary':False} + _args={'protocol':0} _in_mem = True class TestBinaryMemShelve(TestShelveBase): - _args={'binary':True} + _args={'protocol':1} _in_mem = True class TestProto2MemShelve(TestShelveBase): _args={'protocol':2} From rhettinger at users.sourceforge.net Sun Dec 5 04:58:20 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 04:58:24 2004 Subject: [Python-checkins] python/dist/src/Lib shelve.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31910/Lib Modified Files: shelve.py Log Message: Removed deprecated method arguments from the shelve module. Index: shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shelve.py,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- shelve.py 27 May 2003 06:30:52 -0000 1.24 +++ shelve.py 5 Dec 2004 03:58:17 -0000 1.25 @@ -80,14 +80,8 @@ See the module's __doc__ string for an overview of the interface. """ - def __init__(self, dict, protocol=None, writeback=False, binary=None): + def __init__(self, dict, protocol=None, writeback=False): self.dict = dict - if protocol is not None and binary is not None: - raise ValueError, "can't specify both 'protocol' and 'binary'" - if binary is not None: - warnings.warn("The 'binary' argument to Shelf() is deprecated", - PendingDeprecationWarning) - protocol = int(binary) if protocol is None: protocol = 0 self._protocol = protocol @@ -171,8 +165,8 @@ See the module's __doc__ string for an overview of the interface. """ - def __init__(self, dict, protocol=None, writeback=False, binary=None): - Shelf.__init__(self, dict, protocol, writeback, binary) + def __init__(self, dict, protocol=None, writeback=False): + Shelf.__init__(self, dict, protocol, writeback) def set_location(self, key): (key, value) = self.dict.set_location(key) @@ -207,12 +201,12 @@ See the module's __doc__ string for an overview of the interface. """ - def __init__(self, filename, flag='c', protocol=None, writeback=False, binary=None): + def __init__(self, filename, flag='c', protocol=None, writeback=False): import anydbm - Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback, binary) + Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback) -def open(filename, flag='c', protocol=None, writeback=False, binary=None): +def open(filename, flag='c', protocol=None, writeback=False): """Open a persistent dictionary for reading and writing. The filename parameter is the base filename for the underlying @@ -222,10 +216,7 @@ anydbm.open(). The optional protocol parameter specifies the version of the pickle protocol (0, 1, or 2). - The optional binary parameter is deprecated and may be set to True - to force the use of binary pickles for serializing data values. - See the module's __doc__ string for an overview of the interface. """ - return DbfilenameShelf(filename, flag, protocol, writeback, binary) + return DbfilenameShelf(filename, flag, protocol, writeback) From rhettinger at users.sourceforge.net Sun Dec 5 04:58:22 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 04:58:25 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1200,1.1201 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31910/Misc Modified Files: NEWS Log Message: Removed deprecated method arguments from the shelve module. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1200 retrieving revision 1.1201 diff -u -d -r1.1200 -r1.1201 --- NEWS 5 Dec 2004 03:28:00 -0000 1.1200 +++ NEWS 5 Dec 2004 03:58:17 -0000 1.1201 @@ -21,6 +21,8 @@ Library ------- +- the shelve module no longer uses the deprecated binary parameter. + - the pstats module no longer uses the deprecated ignore() method. - the filecmp module no longer uses the deprecated use_statcache argument. From rhettinger at users.sourceforge.net Sun Dec 5 04:58:51 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 04:58:54 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libshelve.tex,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31910/Doc/lib Modified Files: libshelve.tex Log Message: Removed deprecated method arguments from the shelve module. Index: libshelve.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshelve.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- libshelve.tex 19 Apr 2003 20:59:02 -0000 1.20 +++ libshelve.tex 5 Dec 2004 03:58:17 -0000 1.21 @@ -13,7 +13,7 @@ sub-objects. The keys are ordinary strings. \refstmodindex{pickle} -\begin{funcdesc}{open}{filename\optional{,flag='c'\optional{,protocol=\code{None}\optional{,writeback=\code{False}\optional{,binary=\code{None}}}}}} +\begin{funcdesc}{open}{filename\optional{,flag='c'\optional{,protocol=\code{None}\optional{,writeback=\code{False}}}}} Open a persistent dictionary. The filename specified is the base filename for the underlying database. As a side-effect, an extension may be added to the filename and more than one file may be created. By default, the @@ -24,8 +24,7 @@ By default, version 0 pickles are used to serialize values. The version of the pickle protocol can be specified with the \var{protocol} parameter. \versionchanged[The \var{protocol} -parameter was added. The \var{binary} parameter is deprecated -and provided for backwards compatibility only]{2.3} +parameter was added]{2.3} By default, mutations to persistent-dictionary mutable entries are not automatically written back. If the optional \var{writeback} parameter @@ -76,7 +75,7 @@ \end{itemize} -\begin{classdesc}{Shelf}{dict\optional{, protocol=None\optional{, writeback=False\optional{, binary=None}}}} +\begin{classdesc}{Shelf}{dict\optional{, protocol=None\optional{, writeback=False}}} A subclass of \class{UserDict.DictMixin} which stores pickled values in the \var{dict} object. @@ -84,8 +83,7 @@ version of the pickle protocol can be specified with the \var{protocol} parameter. See the \module{pickle} documentation for a discussion of the pickle protocols. \versionchanged[The \var{protocol} -parameter was added. The \var{binary} parameter is deprecated and -provided for backwards compatibility only]{2.3} +parameter was added]{2.3} If the \var{writeback} parameter is \code{True}, the object will hold a cache of all entries accessed and write them back to the \var{dict} at @@ -93,7 +91,7 @@ but can consume much more memory and make sync and close take a long time. \end{classdesc} -\begin{classdesc}{BsdDbShelf}{dict\optional{, protocol=None\optional{, writeback=False\optional{, binary=None}}}} +\begin{classdesc}{BsdDbShelf}{dict\optional{, protocol=None\optional{, writeback=False}}} A subclass of \class{Shelf} which exposes \method{first}, \method{next}, \method{previous}, \method{last} and @@ -102,19 +100,19 @@ the constructor must support those methods. This is generally accomplished by calling one of \function{bsddb.hashopen}, \function{bsddb.btopen} or \function{bsddb.rnopen}. The optional -\var{protocol}, \var{writeback}, and \var{binary} parameters have the +\var{protocol} and \var{writeback} parameters have the same interpretation as for the \class{Shelf} class. \end{classdesc} -\begin{classdesc}{DbfilenameShelf}{filename\optional{, flag='c'\optional{, protocol=None\optional{, writeback=False\optional{, binary=None}}}}} +\begin{classdesc}{DbfilenameShelf}{filename\optional{, flag='c'\optional{, protocol=None\optional{, writeback=False}}}} A subclass of \class{Shelf} which accepts a \var{filename} instead of a dict-like object. The underlying file will be opened using {}\function{anydbm.open}. By default, the file will be created and opened for both read and write. The optional \var{flag} parameter has the same interpretation as for the \function{open} function. The -optional \var{protocol}, \var{writeback}, and \var{binary} parameters +optional \var{protocol} and \var{writeback} parameters have the same interpretation as for the \class{Shelf} class. \end{classdesc} From rhettinger at users.sourceforge.net Sun Dec 5 05:55:16 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 05:55:28 2004 Subject: [Python-checkins] python/dist/src/Lib/lib-old statcache.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-old In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10587/Lib/lib-old Added Files: statcache.py Log Message: Remove the deprecated statcache module. --- NEW FILE: statcache.py --- """Maintain a cache of stat() information on files. There are functions to reset the cache or to selectively remove items. """ import warnings warnings.warn("The statcache module is obsolete. Use os.stat() instead.", DeprecationWarning) del warnings import os as _os from stat import * __all__ = ["stat","reset","forget","forget_prefix","forget_dir", "forget_except_prefix","isdir"] # The cache. Keys are pathnames, values are os.stat outcomes. # Remember that multiple threads may be calling this! So, e.g., that # path in cache returns 1 doesn't mean the cache will still contain # path on the next line. Code defensively. cache = {} def stat(path): """Stat a file, possibly out of the cache.""" ret = cache.get(path, None) if ret is None: cache[path] = ret = _os.stat(path) return ret def reset(): """Clear the cache.""" cache.clear() # For thread saftey, always use forget() internally too. def forget(path): """Remove a given item from the cache, if it exists.""" try: del cache[path] except KeyError: pass def forget_prefix(prefix): """Remove all pathnames with a given prefix.""" for path in cache.keys(): if path.startswith(prefix): forget(path) def forget_dir(prefix): """Forget a directory and all entries except for entries in subdirs.""" # Remove trailing separator, if any. This is tricky to do in a # x-platform way. For example, Windows accepts both / and \ as # separators, and if there's nothing *but* a separator we want to # preserve that this is the root. Only os.path has the platform # knowledge we need. from os.path import split, join prefix = split(join(prefix, "xxx"))[0] forget(prefix) for path in cache.keys(): # First check that the path at least starts with the prefix, so # that when it doesn't we can avoid paying for split(). if path.startswith(prefix) and split(path)[0] == prefix: forget(path) def forget_except_prefix(prefix): """Remove all pathnames except with a given prefix. Normally used with prefix = '/' after a chdir(). """ for path in cache.keys(): if not path.startswith(prefix): forget(path) def isdir(path): """Return True if directory, else False.""" try: st = stat(path) except _os.error: return False return S_ISDIR(st.st_mode) From rhettinger at users.sourceforge.net Sun Dec 5 05:55:29 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 05:55:31 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1201,1.1202 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10587/Misc Modified Files: NEWS Log Message: Remove the deprecated statcache module. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1201 retrieving revision 1.1202 diff -u -d -r1.1201 -r1.1202 --- NEWS 5 Dec 2004 03:58:17 -0000 1.1201 +++ NEWS 5 Dec 2004 04:55:14 -0000 1.1202 @@ -21,6 +21,8 @@ Library ------- +- the depecated statcache module was removed. + - the shelve module no longer uses the deprecated binary parameter. - the pstats module no longer uses the deprecated ignore() method. From rhettinger at users.sourceforge.net Sun Dec 5 05:55:44 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 05:55:48 2004 Subject: [Python-checkins] python/dist/src/Lib posixfile.py, 1.26, 1.27 statcache.py, 1.16, NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10587/Lib Modified Files: posixfile.py Removed Files: statcache.py Log Message: Remove the deprecated statcache module. Index: posixfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixfile.py,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- posixfile.py 18 Aug 2004 15:13:40 -0000 1.26 +++ posixfile.py 5 Dec 2004 04:55:09 -0000 1.27 @@ -53,12 +53,6 @@ query only """ -import warnings -warnings.warn( - "The posixfile module is obsolete and will disappear in the future", - DeprecationWarning) -del warnings - class _posixfile_: """File wrapper class that provides extra POSIX file routines.""" --- statcache.py DELETED --- From rhettinger at users.sourceforge.net Sun Dec 5 05:55:49 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 05:55:53 2004 Subject: [Python-checkins] python/dist/src/Lib/test test___all__.py, 1.41, 1.42 test_sundry.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-serv10587/Lib/test Modified Files: test___all__.py test_sundry.py Log Message: Remove the deprecated statcache module. Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- test___all__.py 6 Nov 2004 23:45:48 -0000 1.41 +++ test___all__.py 5 Dec 2004 04:55:13 -0000 1.42 @@ -9,8 +9,6 @@ r'pre$') warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning, r'^regsub$') -warnings.filterwarnings("ignore", ".* statcache .*", DeprecationWarning, - r'statcache$') class AllTest(unittest.TestCase): @@ -148,7 +146,6 @@ self.check_all("socket") self.check_all("sre") self.check_all("_strptime") - self.check_all("statcache") self.check_all("symtable") self.check_all("tabnanny") self.check_all("tarfile") Index: test_sundry.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sundry.py,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- test_sundry.py 2 Jun 2004 17:40:14 -0000 1.14 +++ test_sundry.py 5 Dec 2004 04:55:14 -0000 1.15 @@ -3,8 +3,6 @@ import warnings warnings.filterwarnings('ignore', r".*posixfile module", DeprecationWarning, 'posixfile$') -warnings.filterwarnings('ignore', r".*statcache module", - DeprecationWarning, 'statcache$') from test.test_support import verbose @@ -80,7 +78,6 @@ import shutil import smtplib import sndhdr -import statcache import statvfs import stringold import sunau From rhettinger at users.sourceforge.net Sun Dec 5 06:20:44 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 06:20:46 2004 Subject: [Python-checkins] python/dist/src/Lib pickle.py,1.158,1.159 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15207/Lib Modified Files: pickle.py Log Message: Removed the deprecated bin parameter from the pickle module. Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.158 retrieving revision 1.159 diff -u -d -r1.158 -r1.159 --- pickle.py 7 Aug 2004 16:27:24 -0000 1.158 +++ pickle.py 5 Dec 2004 05:20:42 -0000 1.159 @@ -171,7 +171,7 @@ class Pickler: - def __init__(self, file, protocol=None, bin=None): + def __init__(self, file, protocol=None): """This takes a file-like object for writing a pickle data stream. The optional protocol argument tells the pickler to use the @@ -195,12 +195,6 @@ object, or any other custom object that meets this interface. """ - if protocol is not None and bin is not None: - raise ValueError, "can't specify both 'protocol' and 'bin'" - if bin is not None: - warnings.warn("The 'bin' argument to Pickler() is deprecated", - DeprecationWarning) - protocol = bin if protocol is None: protocol = 0 if protocol < 0: @@ -1378,12 +1372,12 @@ except ImportError: from StringIO import StringIO -def dump(obj, file, protocol=None, bin=None): - Pickler(file, protocol, bin).dump(obj) +def dump(obj, file, protocol=None): + Pickler(file, protocol).dump(obj) -def dumps(obj, protocol=None, bin=None): +def dumps(obj, protocol=None): file = StringIO() - Pickler(file, protocol, bin).dump(obj) + Pickler(file, protocol).dump(obj) return file.getvalue() def load(file): From rhettinger at users.sourceforge.net Sun Dec 5 06:20:44 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 06:20:47 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libpickle.tex,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15207/Doc/lib Modified Files: libpickle.tex Log Message: Removed the deprecated bin parameter from the pickle module. Index: libpickle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- libpickle.tex 7 Aug 2004 20:25:55 -0000 1.52 +++ libpickle.tex 5 Dec 2004 05:20:41 -0000 1.53 @@ -144,14 +144,10 @@ or \constant{HIGHEST_PROTOCOL}, the highest protocol version available will be used. -\versionchanged[The \var{bin} parameter is deprecated and only provided -for backwards compatibility. You should use the \var{protocol} -parameter instead]{2.3} +\versionchanged[Introduced the \var{protocol} parameter]{2.3} A binary format, which is slightly more efficient, can be chosen by -specifying a true value for the \var{bin} argument to the -\class{Pickler} constructor or the \function{dump()} and \function{dumps()} -functions. A \var{protocol} version >= 1 implies use of a binary format. +specifying a \var{protocol} version >= 1. \subsection{Usage} @@ -170,24 +166,17 @@ The \module{pickle} module provides the following functions to make this process more convenient: -\begin{funcdesc}{dump}{obj, file\optional{, protocol\optional{, bin}}} +\begin{funcdesc}{dump}{obj, file\optional{, protocol}} Write a pickled representation of \var{obj} to the open file object \var{file}. This is equivalent to -\code{Pickler(\var{file}, \var{protocol}, \var{bin}).dump(\var{obj})}. +\code{Pickler(\var{file}, \var{protocol}).dump(\var{obj})}. If the \var{protocol} parameter is omitted, protocol 0 is used. If \var{protocol} is specified as a negative value or \constant{HIGHEST_PROTOCOL}, the highest protocol version will be used. -\versionchanged[The \var{protocol} parameter was added. -The \var{bin} parameter is deprecated and only provided -for backwards compatibility. You should use the \var{protocol} -parameter instead]{2.3} - -If the optional \var{bin} argument is true, the binary pickle format -is used; otherwise the (less efficient) text pickle format is used -(for backwards compatibility, this is the default). +\versionchanged[Introduced the \var{protocol} parameter]{2.3} \var{file} must have a \method{write()} method that accepts a single string argument. It can thus be a file object opened for writing, a @@ -211,7 +200,7 @@ written in binary mode or not. \end{funcdesc} -\begin{funcdesc}{dumps}{obj\optional{, protocol\optional{, bin}}} +\begin{funcdesc}{dumps}{obj\optional{, protocol}} Return the pickled representation of the object as a string, instead of writing it to a file. @@ -220,14 +209,8 @@ or \constant{HIGHEST_PROTOCOL}, the highest protocol version will be used. -\versionchanged[The \var{protocol} parameter was added. -The \var{bin} parameter is deprecated and only provided -for backwards compatibility. You should use the \var{protocol} -parameter instead]{2.3} +\versionchanged[The \var{protocol} parameter was added]{2.3} -If the optional \var{bin} argument is -true, the binary pickle format is used; otherwise the (less efficient) -text pickle format is used (this is the default). \end{funcdesc} \begin{funcdesc}{loads}{string} @@ -262,7 +245,7 @@ objects can actually be unpickled. See section~\ref{pickle-sub} for more details.}, \class{Pickler} and \class{Unpickler}: -\begin{classdesc}{Pickler}{file\optional{, protocol\optional{, bin}}} +\begin{classdesc}{Pickler}{file\optional{, protocol}} This takes a file-like object to which it will write a pickle data stream. @@ -270,13 +253,7 @@ If \var{protocol} is specified as a negative value, the highest protocol version will be used. -\versionchanged[The \var{bin} parameter is deprecated and only provided -for backwards compatibility. You should use the \var{protocol} -parameter instead]{2.3} - -Optional \var{bin} if true, tells the pickler to use the more -efficient binary pickle format, otherwise the \ASCII{} format is used -(this is the default). +\versionchanged[Introduced the \var{protocol} parameter]{2.3} \var{file} must have a \method{write()} method that accepts a single string argument. It can thus be an open file object, a @@ -289,7 +266,7 @@ \begin{methoddesc}[Pickler]{dump}{obj} Write a pickled representation of \var{obj} to the open file object given in the constructor. Either the binary or \ASCII{} format will -be used, depending on the value of the \var{bin} flag passed to the +be used, depending on the value of the \var{protocol} argument passed to the constructor. \end{methoddesc} @@ -451,7 +428,7 @@ \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 +constructor (\method{__init__()} for example). The \method{__getinitargs__()} method is called at pickle time; the tuple it returns is incorporated in the pickle for the instance. From rhettinger at users.sourceforge.net Sun Dec 5 06:20:45 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 06:20:49 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1202,1.1203 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15207/Misc Modified Files: NEWS Log Message: Removed the deprecated bin parameter from the pickle module. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1202 retrieving revision 1.1203 diff -u -d -r1.1202 -r1.1203 --- NEWS 5 Dec 2004 04:55:14 -0000 1.1202 +++ NEWS 5 Dec 2004 05:20:42 -0000 1.1203 @@ -21,6 +21,8 @@ Library ------- +- the pickle module no longer uses the deprecated bin parameter. + - the depecated statcache module was removed. - the shelve module no longer uses the deprecated binary parameter. From rhettinger at users.sourceforge.net Sun Dec 5 06:29:53 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 06:29:56 2004 Subject: [Python-checkins] python/dist/src/Doc/lib lib.tex, 1.232, 1.233 libstatcache.tex, 1.4, NONE Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16825 Modified Files: lib.tex Removed Files: libstatcache.tex Log Message: Remove the deprecated statcache module. Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.232 retrieving revision 1.233 diff -u -d -r1.232 -r1.233 --- lib.tex 4 Dec 2004 10:50:50 -0000 1.232 +++ lib.tex 5 Dec 2004 05:29:50 -0000 1.233 @@ -141,7 +141,6 @@ \input{libposixpath} % os.path \input{libdircache} \input{libstat} -\input{libstatcache} \input{libstatvfs} \input{libfilecmp} \input{libsubprocess} --- libstatcache.tex DELETED --- From fdrake at users.sourceforge.net Sun Dec 5 08:00:33 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun Dec 5 08:00:36 2004 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.119,1.120 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31041 Modified Files: Makefile.deps Log Message: remove dependencies that are no longer used for the library reference Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.119 retrieving revision 1.120 diff -u -d -r1.119 -r1.120 --- Makefile.deps 24 Nov 2004 14:57:04 -0000 1.119 +++ Makefile.deps 5 Dec 2004 07:00:30 -0000 1.120 @@ -139,8 +139,6 @@ lib/libstruct.tex \ lib/libmisc.tex \ lib/libmath.tex \ - lib/librand.tex \ - lib/libwhrandom.tex \ lib/libdecimal.tex \ lib/libarray.tex \ lib/liballos.tex \ @@ -321,7 +319,6 @@ lib/libnew.tex \ lib/libdircache.tex \ lib/libfilecmp.tex \ - lib/libstatcache.tex \ lib/libsunau.tex \ lib/libwave.tex \ lib/libchunk.tex \ From fdrake at users.sourceforge.net Sun Dec 5 08:45:22 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun Dec 5 08:45:32 2004 Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.83.2.1, 2.83.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5765 Modified Files: Tag: release24-maint patchlevel.h Log Message: once we're post-release, we really need to bump the version number; the documentation build gets the version number from here as well, and the script that updates www.python.org/dev/doc/ needs to get an updated version number Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.83.2.1 retrieving revision 2.83.2.2 diff -u -d -r2.83.2.1 -r2.83.2.2 --- patchlevel.h 30 Nov 2004 13:16:58 -0000 2.83.2.1 +++ patchlevel.h 5 Dec 2004 07:45:17 -0000 2.83.2.2 @@ -21,12 +21,12 @@ /* Version parsed out into numeric values */ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 4 -#define PY_MICRO_VERSION 0 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_MICRO_VERSION 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA #define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "2.4+" +#define PY_VERSION "2.4.1a0" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ From fdrake at users.sourceforge.net Sun Dec 5 08:49:08 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun Dec 5 08:49:11 2004 Subject: [Python-checkins] python/dist/src/Doc/tools push-docs.sh, 1.22, 1.22.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6287 Modified Files: Tag: release24-maint push-docs.sh Log Message: more version cruft Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -u -d -r1.22 -r1.22.2.1 --- push-docs.sh 13 Nov 2004 17:45:39 -0000 1.22 +++ push-docs.sh 5 Dec 2004 07:49:00 -0000 1.22.2.1 @@ -85,6 +85,11 @@ shift fi +if [ "$DOCTYPE" = 'maint' ] ; then + # 'maint' is a symlink + DOCTYPE='maint24' +fi + START="`pwd`" MYDIR="`dirname $0`" cd "$MYDIR" From fdrake at users.sourceforge.net Sun Dec 5 08:50:17 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun Dec 5 08:50:19 2004 Subject: [Python-checkins] python/dist/src/Doc/tools push-docs.sh, 1.15.18.4, 1.15.18.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6541 Modified Files: Tag: release23-maint push-docs.sh Log Message: remove comment that's about to become obsolete Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.15.18.4 retrieving revision 1.15.18.5 diff -u -d -r1.15.18.4 -r1.15.18.5 --- push-docs.sh 5 Dec 2003 18:02:23 -0000 1.15.18.4 +++ push-docs.sh 5 Dec 2004 07:50:14 -0000 1.15.18.5 @@ -64,7 +64,6 @@ fi if [ "$DOCTYPE" = 'maint' ] ; then - # 'maint' is a symlink DOCTYPE='maint23' fi From rhettinger at users.sourceforge.net Sun Dec 5 10:25:51 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 10:25:55 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libitertools.tex, 1.32, 1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22629/Doc/lib Modified Files: libitertools.tex Log Message: Added optional None arguments to itertools.islice(). Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- libitertools.tex 23 Sep 2004 07:27:39 -0000 1.32 +++ libitertools.tex 5 Dec 2004 09:25:48 -0000 1.33 @@ -261,6 +261,11 @@ yield element next += step \end{verbatim} + + If \var{start} is \code{None}, then iteration starts at zero. + If \var{step} is \code{None}, then the step defaults to one. + \versionchanged[accept \code{None} values for default \var{start} and + \var{step}]{2.5} \end{funcdesc} \begin{funcdesc}{izip}{*iterables} From rhettinger at users.sourceforge.net Sun Dec 5 10:25:51 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 10:25:55 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py, 1.36, 1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22629/Lib/test Modified Files: test_itertools.py Log Message: Added optional None arguments to itertools.islice(). Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- test_itertools.py 17 Oct 2004 16:40:14 -0000 1.36 +++ test_itertools.py 5 Dec 2004 09:25:49 -0000 1.37 @@ -260,6 +260,8 @@ # Test stop=None self.assertEqual(list(islice(xrange(10), None)), range(10)) + self.assertEqual(list(islice(xrange(10), None, None)), range(10)) + self.assertEqual(list(islice(xrange(10), None, None, None)), range(10)) self.assertEqual(list(islice(xrange(10), 2, None)), range(2, 10)) self.assertEqual(list(islice(xrange(10), 1, None, 2)), range(1, 10, 2)) From rhettinger at users.sourceforge.net Sun Dec 5 10:25:53 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 10:25:57 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1203,1.1204 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22629/Misc Modified Files: NEWS Log Message: Added optional None arguments to itertools.islice(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1203 retrieving revision 1.1204 diff -u -d -r1.1203 -r1.1204 --- NEWS 5 Dec 2004 05:20:42 -0000 1.1203 +++ NEWS 5 Dec 2004 09:25:49 -0000 1.1204 @@ -17,6 +17,10 @@ Extension Modules ----------------- +- itertools.islice() now accepts None for the start and step arguments. + This allows islice() to work more readily with slices: + islice(s.start, s.stop, s.step) + Library ------- From rhettinger at users.sourceforge.net Sun Dec 5 10:25:53 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 10:25:57 2004 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c, 1.39, 1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22629/Modules Modified Files: itertoolsmodule.c Log Message: Added optional None arguments to itertools.islice(). Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- itertoolsmodule.c 17 Oct 2004 19:36:57 -0000 1.39 +++ itertoolsmodule.c 5 Dec 2004 09:25:51 -0000 1.40 @@ -1044,14 +1044,14 @@ { PyObject *seq; long start=0, stop=-1, step=1; - PyObject *it, *a1=NULL, *a2=NULL; + PyObject *it, *a1=NULL, *a2=NULL, *a3=NULL; int numargs; isliceobject *lz; - numargs = PyTuple_Size(args); - if (!PyArg_ParseTuple(args, "OO|Ol:islice", &seq, &a1, &a2, &step)) + if (!PyArg_UnpackTuple(args, "islice", 2, 4, &seq, &a1, &a2, &a3)) return NULL; + numargs = PyTuple_Size(args); if (numargs == 2) { if (a1 != Py_None) { stop = PyInt_AsLong(a1); @@ -1059,39 +1059,41 @@ if (PyErr_Occurred()) PyErr_Clear(); PyErr_SetString(PyExc_ValueError, - "Stop argument must be a non-negative integer or None."); + "Stop argument for islice() must be a non-negative integer or None."); return NULL; } } } else { - start = PyInt_AsLong(a1); - if (start == -1 && PyErr_Occurred()) { + if (a1 != Py_None) + start = PyInt_AsLong(a1); + if (start == -1 && PyErr_Occurred()) PyErr_Clear(); - PyErr_SetString(PyExc_ValueError, - "Start argument must be a non-negative integer."); - return NULL; - } if (a2 != Py_None) { stop = PyInt_AsLong(a2); if (stop == -1) { if (PyErr_Occurred()) PyErr_Clear(); PyErr_SetString(PyExc_ValueError, - "Stop argument must be a non-negative integer or None."); + "Stop argument for islice() must be a non-negative integer or None."); return NULL; } } } - if (start<0 || stop<-1) { PyErr_SetString(PyExc_ValueError, - "Indices for islice() must be non-negative integers."); + "Indices for islice() must be non-negative integers or None."); return NULL; } + if (a3 != NULL) { + if (a3 != Py_None) + step = PyInt_AsLong(a3); + if (step == -1 && PyErr_Occurred()) + PyErr_Clear(); + } if (step<1) { PyErr_SetString(PyExc_ValueError, - "Step must be one or larger for islice()."); + "Step for islice() must be a positive integer or None."); return NULL; } From rhettinger at users.sourceforge.net Sun Dec 5 12:38:20 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 12:38:23 2004 Subject: [Python-checkins] python/dist/src/Lib tzparse.py,1.10,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14563/Lib Removed Files: tzparse.py Log Message: Removed deprecated tzparse module. --- tzparse.py DELETED --- From rhettinger at users.sourceforge.net Sun Dec 5 12:38:20 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 12:38:24 2004 Subject: [Python-checkins] python/dist/src/Lib/lib-old tzparse.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-old In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14563/Lib/lib-old Added Files: tzparse.py Log Message: Removed deprecated tzparse module. --- NEW FILE: tzparse.py --- """Parse a timezone specification.""" # XXX Unfinished. # XXX Only the typical form "XXXhhYYY;ddd/hh,ddd/hh" is currently supported. import warnings warnings.warn( "The tzparse module is obsolete and will disappear in the future", DeprecationWarning) tzpat = ('^([A-Z][A-Z][A-Z])([-+]?[0-9]+)([A-Z][A-Z][A-Z]);' '([0-9]+)/([0-9]+),([0-9]+)/([0-9]+)$') tzprog = None def tzparse(tzstr): """Given a timezone spec, return a tuple of information (tzname, delta, dstname, daystart, hourstart, dayend, hourend), where 'tzname' is the name of the timezone, 'delta' is the offset in hours from GMT, 'dstname' is the name of the daylight-saving timezone, and 'daystart'/'hourstart' and 'dayend'/'hourend' specify the starting and ending points for daylight saving time.""" global tzprog if tzprog is None: import re tzprog = re.compile(tzpat) match = tzprog.match(tzstr) if not match: raise ValueError, 'not the TZ syntax I understand' subs = [] for i in range(1, 8): subs.append(match.group(i)) for i in (1, 3, 4, 5, 6): subs[i] = eval(subs[i]) [tzname, delta, dstname, daystart, hourstart, dayend, hourend] = subs return (tzname, delta, dstname, daystart, hourstart, dayend, hourend) def tzlocaltime(secs, params): """Given a Unix time in seconds and a tuple of information about a timezone as returned by tzparse(), return the local time in the form (year, month, day, hour, min, sec, yday, wday, tzname).""" import time (tzname, delta, dstname, daystart, hourstart, dayend, hourend) = params year, month, days, hours, mins, secs, yday, wday, isdst = \ time.gmtime(secs - delta*3600) if (daystart, hourstart) <= (yday+1, hours) < (dayend, hourend): tzname = dstname hours = hours + 1 return year, month, days, hours, mins, secs, yday, wday, tzname def tzset(): """Determine the current timezone from the "TZ" environment variable.""" global tzparams, timezone, altzone, daylight, tzname import os tzstr = os.environ['TZ'] tzparams = tzparse(tzstr) timezone = tzparams[1] * 3600 altzone = timezone - 3600 daylight = 1 tzname = tzparams[0], tzparams[2] def isdst(secs): """Return true if daylight-saving time is in effect for the given Unix time in the current timezone.""" import time (tzname, delta, dstname, daystart, hourstart, dayend, hourend) = \ tzparams year, month, days, hours, mins, secs, yday, wday, isdst = \ time.gmtime(secs - delta*3600) return (daystart, hourstart) <= (yday+1, hours) < (dayend, hourend) tzset() def localtime(secs): """Get the local time in the current timezone.""" return tzlocaltime(secs, tzparams) def test(): from time import asctime, gmtime import time, sys now = time.time() x = localtime(now) tm = x[:-1] + (0,) print 'now =', now, '=', asctime(tm), x[-1] now = now - now % (24*3600) if sys.argv[1:]: now = now + eval(sys.argv[1]) x = gmtime(now) tm = x[:-1] + (0,) print 'gmtime =', now, '=', asctime(tm), 'yday =', x[-2] jan1 = now - x[-2]*24*3600 x = localtime(jan1) tm = x[:-1] + (0,) print 'jan1 =', jan1, '=', asctime(tm), x[-1] for d in range(85, 95) + range(265, 275): t = jan1 + d*24*3600 x = localtime(t) tm = x[:-1] + (0,) print 'd =', d, 't =', t, '=', asctime(tm), x[-1] From rhettinger at users.sourceforge.net Sun Dec 5 12:38:21 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 12:38:24 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_sundry.py, 1.15, 1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14563/Lib/test Modified Files: test_sundry.py Log Message: Removed deprecated tzparse module. Index: test_sundry.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sundry.py,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- test_sundry.py 5 Dec 2004 04:55:14 -0000 1.15 +++ test_sundry.py 5 Dec 2004 11:38:18 -0000 1.16 @@ -87,7 +87,6 @@ import telnetlib import test import toaiff -#import tzparse import urllib2 # Can't test the "user" module -- if the user has a ~/.pythonrc.py, it # can screw up all sorts of things (esp. if it prints!). From rhettinger at users.sourceforge.net Sun Dec 5 12:38:21 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 5 12:38:26 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1204,1.1205 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14563/Misc Modified Files: NEWS Log Message: Removed deprecated tzparse module. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1204 retrieving revision 1.1205 diff -u -d -r1.1204 -r1.1205 --- NEWS 5 Dec 2004 09:25:49 -0000 1.1204 +++ NEWS 5 Dec 2004 11:38:18 -0000 1.1205 @@ -25,6 +25,8 @@ Library ------- +- the deprecated tzparse module was removed. + - the pickle module no longer uses the deprecated bin parameter. - the depecated statcache module was removed. From astrand at users.sourceforge.net Sun Dec 5 21:05:06 2004 From: astrand at users.sourceforge.net (astrand@users.sourceforge.net) Date: Sun Dec 5 21:05:10 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_subprocess.py, 1.15, 1.15.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27214/test Modified Files: Tag: release24-maint test_subprocess.py Log Message: Raise TypeError if bufsize argument is not an integer. Patch 1071755, slightly modified. Index: test_subprocess.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_subprocess.py,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -d -r1.15 -r1.15.2.1 --- test_subprocess.py 17 Nov 2004 20:06:35 -0000 1.15 +++ test_subprocess.py 5 Dec 2004 20:05:04 -0000 1.15.2.1 @@ -394,6 +394,17 @@ # Subsequent invocations should just return the returncode self.assertEqual(p.wait(), 0) + + def test_invalid_bufsize(self): + # an invalid type of the bufsize argument should raise + # TypeError. + try: + subprocess.Popen([sys.executable, "-c", "pass"], "orange") + except TypeError: + pass + else: + self.fail("Expected TypeError") + # # POSIX tests # From astrand at users.sourceforge.net Sun Dec 5 21:05:07 2004 From: astrand at users.sourceforge.net (astrand@users.sourceforge.net) Date: Sun Dec 5 21:05:11 2004 Subject: [Python-checkins] python/dist/src/Lib subprocess.py, 1.8.2.1, 1.8.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27214 Modified Files: Tag: release24-maint subprocess.py Log Message: Raise TypeError if bufsize argument is not an integer. Patch 1071755, slightly modified. Index: subprocess.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/subprocess.py,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -u -d -r1.8.2.1 -r1.8.2.2 --- subprocess.py 30 Nov 2004 18:11:37 -0000 1.8.2.1 +++ subprocess.py 5 Dec 2004 20:04:56 -0000 1.8.2.2 @@ -504,6 +504,9 @@ """Create new Popen instance.""" _cleanup() + if not isinstance(bufsize, (int, long)): + raise TypeError("bufsize must be an integer") + if mswindows: if preexec_fn is not None: raise ValueError("preexec_fn is not supported on Windows " From astrand at users.sourceforge.net Sun Dec 5 21:15:39 2004 From: astrand at users.sourceforge.net (astrand@users.sourceforge.net) Date: Sun Dec 5 21:15:42 2004 Subject: [Python-checkins] python/dist/src/Lib subprocess.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29723/Lib Modified Files: subprocess.py Log Message: Changed signature of call function to avoid confusion: this 'args' is not the same as the one to the Popen constructor Index: subprocess.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/subprocess.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- subprocess.py 30 Nov 2004 21:04:44 -0000 1.10 +++ subprocess.py 5 Dec 2004 20:15:36 -0000 1.11 @@ -125,7 +125,7 @@ This module also defines two shortcut functions: -call(*args, **kwargs): +call(*popenargs, **kwargs): Run command with arguments. Wait for command to complete, then return the returncode attribute. @@ -417,7 +417,7 @@ STDOUT = -2 -def call(*args, **kwargs): +def call(*popenargs, **kwargs): """Run command with arguments. Wait for command to complete, then return the returncode attribute. @@ -425,7 +425,7 @@ retcode = call(["ls", "-l"]) """ - return Popen(*args, **kwargs).wait() + return Popen(*popenargs, **kwargs).wait() def list2cmdline(seq): From astrand at users.sourceforge.net Sun Dec 5 21:15:39 2004 From: astrand at users.sourceforge.net (astrand@users.sourceforge.net) Date: Sun Dec 5 21:15:42 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsubprocess.tex, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29723/Doc/lib Modified Files: libsubprocess.tex Log Message: Changed signature of call function to avoid confusion: this 'args' is not the same as the one to the Popen constructor Index: libsubprocess.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsubprocess.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- libsubprocess.tex 30 Nov 2004 18:06:41 -0000 1.3 +++ libsubprocess.tex 5 Dec 2004 20:15:36 -0000 1.4 @@ -122,7 +122,7 @@ This module also defines one shortcut function: -\begin{funcdesc}{call}{*args, **kwargs} +\begin{funcdesc}{call}{*popenargs, **kwargs} Run command with arguments. Wait for command to complete, then return the \member{returncode} attribute. From bcannon at users.sourceforge.net Mon Dec 6 07:01:15 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Dec 6 07:01:18 2004 Subject: [Python-checkins] python/dist/src/Mac/OSX README,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22367/Mac/OSX Modified Files: README Log Message: Very minor grammatical fix and removal of a tab. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/README,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- README 15 Jul 2004 21:30:40 -0000 1.12 +++ README 6 Dec 2004 06:01:13 -0000 1.13 @@ -4,7 +4,7 @@ This document provides a quick introduction to framework-based Python, its advantages, and how to build it. -1. Why would I want a framework Python in stead of a normal static Python? +1. Why would I want a framework Python instead of a normal static Python? -------------------------------------------------------------------------- The main reason is because you want to create GUI programs in Python. With the @@ -160,4 +160,4 @@ ".rsrc.df.rsrc" files on the fly that are normal datafork-based resource files. - Jack Jansen, Jack.Jansen@cwi.nl, 15-Jul-2004. \ No newline at end of file + Jack Jansen, Jack.Jansen@cwi.nl, 15-Jul-2004. From bcannon at users.sourceforge.net Mon Dec 6 07:09:03 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Dec 6 07:09:06 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_macostools.py, 1.5, 1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23400/Lib/test Modified Files: test_macostools.py Log Message: Have test_mkalias_relative check that sys.prefix already exists; otherwise test is pointless. Also add a note to the docs for the 'test' package that test cases should check first that any conditions needed in the operating system are met before having a test run. Closes bug #1077302. THanks, Ian Holsman. Index: test_macostools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_macostools.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- test_macostools.py 27 Feb 2003 23:17:26 -0000 1.5 +++ test_macostools.py 6 Dec 2004 06:08:58 -0000 1.6 @@ -75,6 +75,12 @@ os.unlink(TESTFN2) except: pass + # If the directory doesn't exist, then chances are this is a new + # install of Python so don't create it since the user might end up + # running ``sudo make install`` and creating the directory here won't + # leave it with the proper permissions. + if not os.path.exists(sys.prefix): + return macostools.mkalias(test_support.TESTFN, TESTFN2, sys.prefix) fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0) self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN)) From bcannon at users.sourceforge.net Mon Dec 6 07:09:03 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Dec 6 07:09:06 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libtest.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-serv23400/Doc/lib Modified Files: libtest.tex Log Message: Have test_mkalias_relative check that sys.prefix already exists; otherwise test is pointless. Also add a note to the docs for the 'test' package that test cases should check first that any conditions needed in the operating system are met before having a test run. Closes bug #1077302. THanks, Ian Holsman. Index: libtest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtest.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- libtest.tex 18 Mar 2004 07:37:15 -0000 1.5 +++ libtest.tex 6 Dec 2004 06:08:59 -0000 1.6 @@ -31,8 +31,10 @@ It is preferred that tests for the \module{test} package use the \refmodule{unittest} module and follow a few guidelines. -One is to have the name of all the test methods start with \samp{test_} as -well as the module's name. +One is to name the test module by starting it with \samp{test_} and end it with +the name of the module being tested. +The test methods in the test module should start with \samp{test_} and end with +a description of what the method is testing. This is needed so that the methods are recognized by the test driver as test methods. Also, no documentation string for the method should be included. @@ -109,6 +111,8 @@ changed in the future. \item Make sure to clean up after your tests (such as close and remove all temporary files). +\item If a test is dependent on a specific condition of the operating system + then verify the condition already exists before attempting the test. \item Import as few modules as possible and do it as soon as possible. This minimizes external dependencies of tests and also minimizes possible anomalous behavior from side-effects of importing a module. From bcannon at users.sourceforge.net Mon Dec 6 07:14:02 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Dec 6 07:14:05 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_macostools.py, 1.5, 1.5.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24337/Lib/test Modified Files: Tag: release24-maint test_macostools.py Log Message: Don't have test_mkalias_relative run if sys.prefix does not exist. Backport of fix for bug #1077302. Index: test_macostools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_macostools.py,v retrieving revision 1.5 retrieving revision 1.5.18.1 diff -u -d -r1.5 -r1.5.18.1 --- test_macostools.py 27 Feb 2003 23:17:26 -0000 1.5 +++ test_macostools.py 6 Dec 2004 06:13:59 -0000 1.5.18.1 @@ -71,6 +71,8 @@ self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN)) def test_mkalias_relative(self): + if not os.path.exists(sys.prefix): + return try: os.unlink(TESTFN2) except: From bcannon at users.sourceforge.net Mon Dec 6 07:19:26 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Dec 6 07:19:28 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_macostools.py, 1.5, 1.5.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25229/Lib/test Modified Files: Tag: release23-maint test_macostools.py Log Message: Don't have test_mkalias_relative exexute if sys.prefix does not exist. Backport of fix for bug #1077302. Index: test_macostools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_macostools.py,v retrieving revision 1.5 retrieving revision 1.5.14.1 diff -u -d -r1.5 -r1.5.14.1 --- test_macostools.py 27 Feb 2003 23:17:26 -0000 1.5 +++ test_macostools.py 6 Dec 2004 06:19:24 -0000 1.5.14.1 @@ -71,6 +71,8 @@ self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN)) def test_mkalias_relative(self): + if not os.path.exists(sys.prefix): + return try: os.unlink(TESTFN2) except: From doerwalter at users.sourceforge.net Mon Dec 6 08:58:17 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon Dec 6 08:58:20 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcalendar.tex, 1.18, 1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9600/Doc/lib Modified Files: libcalendar.tex Log Message: Fix for SF bug #947894: calendar.weekheader() undocumented Index: libcalendar.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcalendar.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- libcalendar.tex 31 Dec 2003 04:51:56 -0000 1.18 +++ libcalendar.tex 6 Dec 2004 07:58:14 -0000 1.19 @@ -59,6 +59,11 @@ (\code{1}--\code{31}). \end{funcdesc} +\begin{funcdesc}{weekheader}{n} +Return a header containing abbreviated weekday names. \var{n} specifies +the width in characters for one weekday. +\end{funcdesc} + \begin{funcdesc}{monthrange}{year, month} Returns weekday of first day of the month and number of days in month, for the specified \var{year} and \var{month}. From doerwalter at users.sourceforge.net Mon Dec 6 09:14:11 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon Dec 6 09:14:14 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcalendar.tex, 1.18, 1.18.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12313/Doc/lib Modified Files: Tag: release24-maint libcalendar.tex Log Message: Backport: Fix for SF bug #947894: calendar.weekheader() undocumented Index: libcalendar.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcalendar.tex,v retrieving revision 1.18 retrieving revision 1.18.4.1 diff -u -d -r1.18 -r1.18.4.1 --- libcalendar.tex 31 Dec 2003 04:51:56 -0000 1.18 +++ libcalendar.tex 6 Dec 2004 08:14:08 -0000 1.18.4.1 @@ -59,6 +59,11 @@ (\code{1}--\code{31}). \end{funcdesc} +\begin{funcdesc}{weekheader}{n} +Return a header containing abbreviated weekday names. \var{n} specifies +the width in characters for one weekday. +\end{funcdesc} + \begin{funcdesc}{monthrange}{year, month} Returns weekday of first day of the month and number of days in month, for the specified \var{year} and \var{month}. From rhettinger at users.sourceforge.net Mon Dec 6 13:29:58 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 6 13:30:01 2004 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.120,1.121 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32409 Modified Files: Makefile.deps Log Message: Remove deprecated xmllib from inclusion in the docs. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.120 retrieving revision 1.121 diff -u -d -r1.120 -r1.121 --- Makefile.deps 5 Dec 2004 07:00:30 -0000 1.120 +++ Makefile.deps 6 Dec 2004 12:29:55 -0000 1.121 @@ -252,7 +252,6 @@ lib/libre.tex \ lib/libuserdict.tex \ lib/libdis.tex \ - lib/libxmllib.tex \ lib/libxmlrpclib.tex \ lib/libsimplexmlrpc.tex \ lib/libdocxmlrpc.tex \ From rhettinger at users.sourceforge.net Mon Dec 6 13:29:58 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 6 13:30:02 2004 Subject: [Python-checkins] python/dist/src/Doc/lib lib.tex,1.233,1.234 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32409/lib Modified Files: lib.tex Log Message: Remove deprecated xmllib from inclusion in the docs. Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.233 retrieving revision 1.234 diff -u -d -r1.233 -r1.234 --- lib.tex 5 Dec 2004 05:29:50 -0000 1.233 +++ lib.tex 6 Dec 2004 12:29:56 -0000 1.234 @@ -281,7 +281,7 @@ \input{xmlsaxhandler} \input{xmlsaxutils} \input{xmlsaxreader} -\input{libxmllib} +% \input{libxmllib} \input{libmm} % Multimedia Services \input{libaudioop} From jlgijsbers at users.sourceforge.net Mon Dec 6 21:50:17 2004 From: jlgijsbers at users.sourceforge.net (jlgijsbers@users.sourceforge.net) Date: Mon Dec 6 21:50:20 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_shutil.py, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20531 Modified Files: test_shutil.py Log Message: SF bug #1076467: don't run test_on_error as root, as the permission errors don't get provoked that way. Also add a bunch of cross-references to bugs. Index: test_shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shutil.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- test_shutil.py 23 Nov 2004 09:27:27 -0000 1.10 +++ test_shutil.py 6 Dec 2004 20:50:15 -0000 1.11 @@ -16,7 +16,10 @@ filename = tempfile.mktemp() self.assertRaises(OSError, shutil.rmtree, filename) - if hasattr(os, 'chmod') and sys.platform[:6] != 'cygwin': + # See bug #1071513 for why we don't run this on cygwin + # and bug #1076467 for why we don't run this as root. + if (hasattr(os, 'chmod') and sys.platform[:6] != 'cygwin' + and os.getenv('USER') != 'root'): def test_on_error(self): self.errorState = 0 os.mkdir(TESTFN) @@ -31,7 +34,8 @@ shutil.rmtree(TESTFN, onerror=self.check_args_to_onerror) # Test whether onerror has actually been called. - self.assertEqual(self.errorState, 2) + self.assertEqual(self.errorState, 2, + "Expected call to onerror function did not happen.") # Make writable again. os.chmod(TESTFN, old_dir_mode) From jlgijsbers at users.sourceforge.net Mon Dec 6 22:22:21 2004 From: jlgijsbers at users.sourceforge.net (jlgijsbers@users.sourceforge.net) Date: Mon Dec 6 22:22:24 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_shutil.py, 1.10, 1.10.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27633 Modified Files: Tag: release24-maint test_shutil.py Log Message: Backport of fix for SF bug #1076467: don't run test_on_error as root, as the permission errors don't get provoked that way. Index: test_shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shutil.py,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -u -d -r1.10 -r1.10.2.1 --- test_shutil.py 23 Nov 2004 09:27:27 -0000 1.10 +++ test_shutil.py 6 Dec 2004 21:22:17 -0000 1.10.2.1 @@ -16,7 +16,8 @@ filename = tempfile.mktemp() self.assertRaises(OSError, shutil.rmtree, filename) - if hasattr(os, 'chmod') and sys.platform[:6] != 'cygwin': + if (hasattr(os, 'chmod') and sys.platform[:6] != 'cygwin' + and os.getenv('USER') != 'root'): def test_on_error(self): self.errorState = 0 os.mkdir(TESTFN) From jlgijsbers at users.sourceforge.net Mon Dec 6 22:25:29 2004 From: jlgijsbers at users.sourceforge.net (jlgijsbers@users.sourceforge.net) Date: Mon Dec 6 22:25:32 2004 Subject: [Python-checkins] python/dist/src/Lib smtplib.py,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28150 Modified Files: smtplib.py Log Message: Patch #1075928: AUTH PLAIN in smtplib. smtplib can not log in to some server using command AUTH PLAIN, it sends ``user\0user\0pass'' to the server, but ``\0user\0pass'' has better compatibility. Index: smtplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- smtplib.py 10 Jul 2004 23:14:29 -0000 1.65 +++ smtplib.py 6 Dec 2004 21:25:26 -0000 1.66 @@ -530,7 +530,7 @@ return encode_base64(response, eol="") def encode_plain(user, password): - return encode_base64("%s\0%s\0%s" % (user, user, password), eol="") + return encode_base64("\0%s\0%s" % (user, password), eol="") AUTH_PLAIN = "PLAIN" From montanaro at users.sourceforge.net Mon Dec 6 22:27:33 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon Dec 6 22:27:35 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcalendar.tex, 1.17, 1.17.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28555 Modified Files: Tag: release23-maint libcalendar.tex Log Message: backport weekheader() doc fix to 2.3 Index: libcalendar.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcalendar.tex,v retrieving revision 1.17 retrieving revision 1.17.16.1 diff -u -d -r1.17 -r1.17.16.1 --- libcalendar.tex 25 Dec 2002 16:37:19 -0000 1.17 +++ libcalendar.tex 6 Dec 2004 21:27:29 -0000 1.17.16.1 @@ -58,6 +58,11 @@ (\code{1}--\code{31}). \end{funcdesc} +\begin{funcdesc}{weekheader}{n} +Return a header containing abbreviated weekday names. \var{n} specifies +the width in characters for one weekday. +\end{funcdesc} + \begin{funcdesc}{monthrange}{year, month} Returns weekday of first day of the month and number of days in month, for the specified \var{year} and \var{month}. From bcannon at users.sourceforge.net Tue Dec 7 01:25:39 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Dec 7 01:25:42 2004 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.319,2.320 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3424/Python Modified Files: bltinmodule.c Log Message: Put parentheses around the assignment in the 'while' loop conditional expression in min_max() to shut gcc up. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.319 retrieving revision 2.320 diff -u -d -r2.319 -r2.320 --- bltinmodule.c 3 Dec 2004 08:30:39 -0000 2.319 +++ bltinmodule.c 7 Dec 2004 00:25:35 -0000 2.320 @@ -1139,7 +1139,7 @@ maxitem = NULL; /* the result */ maxval = NULL; /* the value associated with the result */ - while (item = PyIter_Next(it)) { + while (( item = PyIter_Next(it) )) { /* get the value from the key function */ if (keyfunc != NULL) { val = PyObject_CallFunctionObjArgs(keyfunc, item, NULL); From bcannon at users.sourceforge.net Tue Dec 7 01:43:02 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Dec 7 01:43:06 2004 Subject: [Python-checkins] python/dist/src Makefile.pre.in, 1.148, 1.149 setup.py, 1.204, 1.205 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5745 Modified Files: Makefile.pre.in setup.py Log Message: setup.py now uses the library directories specified in LDFLAGS (``-L`` directories) and the include directories specified in CPPFLAGS (``-I`` directories) for compiling the extension modules. This has led to the core being compiled with the values in the shell's CPPFLAGS. It has also removed the need for special casing to use Fink and DarwinPorts under darwin since the needed directories can now be specified in LDFLAGS and CPPFLAGS (e.g., DarwinPorts users can now do ``LDFLAGS=-L/opt/local/lib; CPPFLAGS=-I/opt/local/include; ./configure`` for everything to work properly). Parsing the values in the environment variables is done with getopt. While optparse would have been a nicer solution it cannot be used because of dependency issues at execution time; optparse uses gettext which uses struct which will not have been compiled when the code is imported. If optparse ever makes its importation of gettext optional by catching ImportError and setting _() to an identity function then it can be used. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.148 retrieving revision 1.149 diff -u -d -r1.148 -r1.149 --- Makefile.pre.in 26 Sep 2004 17:26:55 -0000 1.148 +++ Makefile.pre.in 7 Dec 2004 00:42:58 -0000 1.149 @@ -56,7 +56,10 @@ OPT= @OPT@ BASECFLAGS= @BASECFLAGS@ CFLAGS= $(BASECFLAGS) $(OPT) -CPPFLAGS= -I. -I$(srcdir)/Include +# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to +# be able to build extension modules using the directories specified in the +# environment variables +CPPFLAGS= -I. -I$(srcdir)/Include @CPPFLAGS@ LDFLAGS= @LDFLAGS@ LDLAST= @LDLAST@ SGI_ABI= @SGI_ABI@ Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.204 retrieving revision 1.205 diff -u -d -r1.204 -r1.205 --- setup.py 13 Nov 2004 11:13:34 -0000 1.204 +++ setup.py 7 Dec 2004 00:42:58 -0000 1.205 @@ -3,7 +3,7 @@ __version__ = "$Revision$" -import sys, os, getopt, imp, re +import sys, os, imp, re, getopt from distutils import log from distutils import sysconfig @@ -242,14 +242,23 @@ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') - # Add paths to popular package managers on OS X/darwin - if sys.platform == "darwin": - # Fink installs into /sw by default - add_dir_to_list(self.compiler.library_dirs, '/sw/lib') - add_dir_to_list(self.compiler.include_dirs, '/sw/include') - # DarwinPorts installs into /opt/local by default - add_dir_to_list(self.compiler.library_dirs, '/opt/local/lib') - add_dir_to_list(self.compiler.include_dirs, '/opt/local/include') + # Add paths specified in the environment variables LDFLAGS and + # CPPFLAGS. + # Since this file tends to be executed by ``make install`` its + # environment variables are those that the Makefile sets and not what + # the shell has. The Makefile must keep the shell's values somewhere + # in order to be able to reach them at execution time. + for env_var, arg_name, dir_list in ( + ('LDFLAGS', '-L', self.compiler.library_dirs), + ('CPPFLAGS', '-I', self.compiler.include_dirs)): + env_val = os.getenv(env_var) + if env_val: + # getopt is used instead of optparse because the latter imports + # gettext which imports struct which has not been built yet + # when this method is needed + options = getopt.getopt(env_val.split(), arg_name[1] + ':')[0] + for arg_option, directory in options: + add_dir_to_list(dir_list, directory) if os.path.normpath(sys.prefix) != '/usr': add_dir_to_list(self.compiler.library_dirs, From bcannon at users.sourceforge.net Tue Dec 7 01:43:04 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Dec 7 01:43:08 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1205,1.1206 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5745/Misc Modified Files: NEWS Log Message: setup.py now uses the library directories specified in LDFLAGS (``-L`` directories) and the include directories specified in CPPFLAGS (``-I`` directories) for compiling the extension modules. This has led to the core being compiled with the values in the shell's CPPFLAGS. It has also removed the need for special casing to use Fink and DarwinPorts under darwin since the needed directories can now be specified in LDFLAGS and CPPFLAGS (e.g., DarwinPorts users can now do ``LDFLAGS=-L/opt/local/lib; CPPFLAGS=-I/opt/local/include; ./configure`` for everything to work properly). Parsing the values in the environment variables is done with getopt. While optparse would have been a nicer solution it cannot be used because of dependency issues at execution time; optparse uses gettext which uses struct which will not have been compiled when the code is imported. If optparse ever makes its importation of gettext optional by catching ImportError and setting _() to an identity function then it can be used. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1205 retrieving revision 1.1206 diff -u -d -r1.1205 -r1.1206 --- NEWS 5 Dec 2004 11:38:18 -0000 1.1205 +++ NEWS 7 Dec 2004 00:42:59 -0000 1.1206 @@ -50,6 +50,15 @@ Build ----- +- setup.py now uses the directories specified in LDFLAGS using the -L option + and in CPPFLAGS using the -I option for adding library and include + directories, respectively, for compiling extension modules against. This has + led to the core being compiled using the values in CPPFLAGS. It also removes + the need for the special-casing of both DarwinPorts and Fink for darwin since + the proper directories can be specified in LDFLAGS (``-L/sw/lib`` for Fink, + ``-L/opt/local/lib`` for DarwinPorts) and CPPFLAGS (``-I/sw/include`` for + Fink, ``-I/opt/local/include`` for DarwinPorts). + C API ----- From bcannon at users.sourceforge.net Tue Dec 7 04:25:21 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Dec 7 04:25:23 2004 Subject: [Python-checkins] python/dist/src/Lib optparse.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7014/Lib Modified Files: optparse.py Log Message: Change code in setup.py for parsing LDFLAGS and CPPFLAGS to use optparse instead of getopt. Required making use of gettext._ as optional (optparse changed OK'ed by Greg Ward in private email). Index: optparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/optparse.py,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- optparse.py 27 Oct 2004 02:20:04 -0000 1.11 +++ optparse.py 7 Dec 2004 03:25:18 -0000 1.12 @@ -69,7 +69,10 @@ import sys, os import types import textwrap -from gettext import gettext as _ +try: + from gettext import gettext as _ +except ImportError: + _ = lambda arg: arg def _repr(self): return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self) From bcannon at users.sourceforge.net Tue Dec 7 04:25:23 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Dec 7 04:25:25 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1206,1.1207 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7014/Misc Modified Files: NEWS Log Message: Change code in setup.py for parsing LDFLAGS and CPPFLAGS to use optparse instead of getopt. Required making use of gettext._ as optional (optparse changed OK'ed by Greg Ward in private email). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1206 retrieving revision 1.1207 diff -u -d -r1.1206 -r1.1207 --- NEWS 7 Dec 2004 00:42:59 -0000 1.1206 +++ NEWS 7 Dec 2004 03:25:18 -0000 1.1207 @@ -25,6 +25,8 @@ Library ------- +- optparse now optionally imports gettext. This allows its use in setup.py. + - the deprecated tzparse module was removed. - the pickle module no longer uses the deprecated bin parameter. From bcannon at users.sourceforge.net Tue Dec 7 04:25:50 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Dec 7 04:25:53 2004 Subject: [Python-checkins] python/dist/src setup.py,1.205,1.206 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7014 Modified Files: setup.py Log Message: Change code in setup.py for parsing LDFLAGS and CPPFLAGS to use optparse instead of getopt. Required making use of gettext._ as optional (optparse changed OK'ed by Greg Ward in private email). Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.205 retrieving revision 1.206 diff -u -d -r1.205 -r1.206 --- setup.py 7 Dec 2004 00:42:58 -0000 1.205 +++ setup.py 7 Dec 2004 03:25:18 -0000 1.206 @@ -3,7 +3,7 @@ __version__ = "$Revision$" -import sys, os, imp, re, getopt +import sys, os, imp, re, optparse from distutils import log from distutils import sysconfig @@ -253,11 +253,10 @@ ('CPPFLAGS', '-I', self.compiler.include_dirs)): env_val = os.getenv(env_var) if env_val: - # getopt is used instead of optparse because the latter imports - # gettext which imports struct which has not been built yet - # when this method is needed - options = getopt.getopt(env_val.split(), arg_name[1] + ':')[0] - for arg_option, directory in options: + parser = optparse.OptionParser() + parser.add_option(arg_name, dest="dirs", action="append") + options = parser.parse_args(env_val.split())[0] + for directory in options.dirs: add_dir_to_list(dir_list, directory) if os.path.normpath(sys.prefix) != '/usr': From rhettinger at users.sourceforge.net Tue Dec 7 08:06:00 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 7 08:06:04 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1207,1.1208 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19035/Misc Modified Files: NEWS Log Message: Eliminate the deprecated option to return None instead of a tuple of arguments in __reduce__(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1207 retrieving revision 1.1208 diff -u -d -r1.1207 -r1.1208 --- NEWS 7 Dec 2004 03:25:18 -0000 1.1207 +++ NEWS 7 Dec 2004 07:05:53 -0000 1.1208 @@ -17,6 +17,9 @@ Extension Modules ----------------- +- the cPickle module no longer accepts the deprecated None option in the + args tuple returned by __reduce__(). + - itertools.islice() now accepts None for the start and step arguments. This allows islice() to work more readily with slices: islice(s.start, s.stop, s.step) @@ -25,6 +28,9 @@ Library ------- +- the pickle module no longer accepts the deprecated None option in the + args tuple returned by __reduce__(). + - optparse now optionally imports gettext. This allows its use in setup.py. - the deprecated tzparse module was removed. From rhettinger at users.sourceforge.net Tue Dec 7 08:06:01 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 7 08:06:04 2004 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.151,2.152 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19035/Modules Modified Files: cPickle.c Log Message: Eliminate the deprecated option to return None instead of a tuple of arguments in __reduce__(). Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.151 retrieving revision 2.152 diff -u -d -r2.151 -r2.152 --- cPickle.c 27 Jul 2004 05:22:33 -0000 2.151 +++ cPickle.c 7 Dec 2004 07:05:57 -0000 2.152 @@ -2143,6 +2143,12 @@ &dictitems)) return -1; + if (!PyTuple_Check(argtup)) { + PyErr_SetString(PicklingError, + "args from reduce() should be a tuple"); + return -1; + } + if (state == Py_None) state = NULL; if (listitems == Py_None) @@ -3616,17 +3622,6 @@ else goto err; } - if (args==Py_None) { - /* Special case, call cls.__basicnew__() */ - PyObject *basicnew; - - basicnew = PyObject_GetAttr(cls, __basicnew___str); - if (!basicnew) return NULL; - r=PyObject_CallObject(basicnew, NULL); - Py_DECREF(basicnew); - if (r) return r; - } - if ((r=PyObject_CallObject(cls, args))) return r; err: From rhettinger at users.sourceforge.net Tue Dec 7 08:06:25 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 7 08:06:27 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libpickle.tex,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19035/Doc/lib Modified Files: libpickle.tex Log Message: Eliminate the deprecated option to return None instead of a tuple of arguments in __reduce__(). Index: libpickle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- libpickle.tex 5 Dec 2004 05:20:41 -0000 1.53 +++ libpickle.tex 7 Dec 2004 07:05:51 -0000 1.54 @@ -515,12 +515,8 @@ unpickling environment. Note that as usual, the callable itself is pickled by name. -\item A tuple of arguments for the callable object, or \code{None}. -\deprecated{2.3}{If this item is \code{None}, then instead of calling -the callable directly, its \method{__basicnew__()} method is called -without arguments; this method should also return the unpickled -object. Providing \code{None} is deprecated, however; return a -tuple of arguments instead.} +\item A tuple of arguments for the callable object. +\versionchanged[Formerly, this argument could also be \code{None}]{2.5} \item Optionally, the object's state, which will be passed to the object's \method{__setstate__()} method as described in From rhettinger at users.sourceforge.net Tue Dec 7 08:06:27 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 7 08:06:30 2004 Subject: [Python-checkins] python/dist/src/Lib pickle.py,1.159,1.160 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19035/Lib Modified Files: pickle.py Log Message: Eliminate the deprecated option to return None instead of a tuple of arguments in __reduce__(). Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.159 retrieving revision 1.160 diff -u -d -r1.159 -r1.160 --- pickle.py 5 Dec 2004 05:20:42 -0000 1.159 +++ pickle.py 7 Dec 2004 07:05:52 -0000 1.160 @@ -33,7 +33,6 @@ import sys import struct import re -import warnings __all__ = ["PickleError", "PicklingError", "UnpicklingError", "Pickler", "Unpickler", "dump", "dumps", "load", "loads"] @@ -349,14 +348,7 @@ # Assert that args is a tuple or None if not isinstance(args, TupleType): - if args is None: - # A hack for Jim Fulton's ExtensionClass, now deprecated. - # See load_reduce() - warnings.warn("__basicnew__ special case is deprecated", - DeprecationWarning) - else: - raise PicklingError( - "args from reduce() should be a tuple") + raise PicklingError("args from reduce() should be a tuple") # Assert that func is callable if not callable(func): @@ -1138,13 +1130,7 @@ stack = self.stack args = stack.pop() func = stack[-1] - if args is None: - # A hack for Jim Fulton's ExtensionClass, now deprecated - warnings.warn("__basicnew__ special case is deprecated", - DeprecationWarning) - value = func.__basicnew__() - else: - value = func(*args) + value = func(*args) stack[-1] = value dispatch[REDUCE] = load_reduce From rhettinger at users.sourceforge.net Tue Dec 7 08:55:27 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 7 08:55:32 2004 Subject: [Python-checkins] python/dist/src/Lib formatter.py, 1.24, 1.25 string.py, 1.87, 1.88 stringold.py, 1.48, 1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28318 Modified Files: formatter.py string.py stringold.py Log Message: Remove outdated references to the regsub module. Index: formatter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/formatter.py,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- formatter.py 12 Feb 2004 17:35:06 -0000 1.24 +++ formatter.py 7 Dec 2004 07:55:06 -0000 1.25 @@ -177,7 +177,6 @@ def add_flowing_data(self, data): if not data: return # The following looks a bit convoluted but is a great improvement over - # data = regsub.gsub('[' + string.whitespace + ']+', ' ', data) prespace = data[:1].isspace() postspace = data[-1:].isspace() data = " ".join(data.split()) Index: string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v retrieving revision 1.87 retrieving revision 1.88 diff -u -d -r1.87 -r1.88 --- string.py 1 Nov 2004 03:52:43 -0000 1.87 +++ string.py 7 Dec 2004 07:55:06 -0000 1.88 @@ -43,7 +43,6 @@ # Functions which aren't available as string methods. # Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def". -# See also regsub.capwords(). def capwords(s, sep=None): """capwords(s, [sep]) -> string @@ -78,7 +77,7 @@ return ''.join(L) - + #################################################################### import re as _re @@ -205,7 +204,7 @@ return self.pattern.sub(convert, self.template) - + #################################################################### # NOTE: Everything below here is deprecated. Use string methods instead. # This stuff will go away in Python 3.0. Index: stringold.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/stringold.py,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- stringold.py 12 Feb 2004 17:35:07 -0000 1.48 +++ stringold.py 7 Dec 2004 07:55:07 -0000 1.49 @@ -363,7 +363,6 @@ return s.capitalize() # Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def". -# See also regsub.capwords(). def capwords(s, sep=None): """capwords(s, [sep]) -> string From rhettinger at users.sourceforge.net Tue Dec 7 09:26:14 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 7 09:26:17 2004 Subject: [Python-checkins] python/dist/src/Lib pickletools.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1523 Modified Files: pickletools.py Log Message: Remove reference to old pickle feature. Index: pickletools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickletools.py,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- pickletools.py 6 Nov 2004 23:45:48 -0000 1.28 +++ pickletools.py 7 Dec 2004 08:26:10 -0000 1.29 @@ -1526,11 +1526,6 @@ opcode is followed by code to create setstate's argument, and then a BUILD opcode to apply __setstate__ to that argument. - There are lots of special cases here. The argtuple can be None, in - which case callable.__basicnew__() is called instead to produce the - object to be pushed on the stack. This appears to be a trick unique - to ExtensionClasses, and is deprecated regardless. - If type(callable) is not ClassType, REDUCE complains unless the callable has been registered with the copy_reg module's safe_constructors dict, or the callable has a magic From rhettinger at users.sourceforge.net Tue Dec 7 13:02:08 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 7 13:02:11 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1208,1.1209 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13021 Modified Files: NEWS Log Message: Combined several entries. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1208 retrieving revision 1.1209 diff -u -d -r1.1208 -r1.1209 --- NEWS 7 Dec 2004 07:05:53 -0000 1.1208 +++ NEWS 7 Dec 2004 12:02:02 -0000 1.1209 @@ -28,17 +28,15 @@ Library ------- +- moved deprecated modules to Lib/lib-old: whrandom, tzparse, statcache. + - the pickle module no longer accepts the deprecated None option in the args tuple returned by __reduce__(). - optparse now optionally imports gettext. This allows its use in setup.py. -- the deprecated tzparse module was removed. - - the pickle module no longer uses the deprecated bin parameter. -- the depecated statcache module was removed. - - the shelve module no longer uses the deprecated binary parameter. - the pstats module no longer uses the deprecated ignore() method. @@ -49,8 +47,6 @@ extended or overridden by subclasses. Formerly, the subclassed method would be ignored by the rest of the module. (Bug #1078905). -- the deprecated whrandom module was removed. Use the random module instead. - - heapq.nsmallest() and heapq.nlargest() now support key= arguments with the same meaning as in list.sort(). From fdrake at users.sourceforge.net Tue Dec 7 15:08:38 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 7 15:08:41 2004 Subject: [Python-checkins] python/dist/src/Lib formatter.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7375/Lib Modified Files: formatter.py Log Message: remove the other half of one of the regsub-related comments; the other half was removed in revision 1.25 Index: formatter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/formatter.py,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- formatter.py 7 Dec 2004 07:55:06 -0000 1.25 +++ formatter.py 7 Dec 2004 14:08:24 -0000 1.26 @@ -176,7 +176,6 @@ def add_flowing_data(self, data): if not data: return - # The following looks a bit convoluted but is a great improvement over prespace = data[:1].isspace() postspace = data[-1:].isspace() data = " ".join(data.split()) From tim_one at users.sourceforge.net Tue Dec 7 22:17:50 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue Dec 7 22:17:53 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_builtin.py, 1.37, 1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10641/test Modified Files: test_builtin.py Log Message: Whitespace normalization. Index: test_builtin.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- test_builtin.py 3 Dec 2004 08:30:35 -0000 1.37 +++ test_builtin.py 7 Dec 2004 21:17:46 -0000 1.38 @@ -352,7 +352,7 @@ if numruns: return numruns += 1 - + globals = {'a': 1, 'b': 2} locals = {'b': 200, 'c': 300} @@ -862,12 +862,12 @@ "max(1, 2, key=int, abc=int)", # two many keywords "max(1, 2, key=1)", # keyfunc is not callable ): - try: - exec(stmt) in globals() - except TypeError: - pass - else: - self.fail(stmt) + try: + exec(stmt) in globals() + except TypeError: + pass + else: + self.fail(stmt) self.assertEqual(max((1,), key=neg), 1) # one elem iterable self.assertEqual(max((1,2), key=neg), 1) # two elem iterable @@ -908,12 +908,12 @@ "min(1, 2, key=int, abc=int)", # two many keywords "min(1, 2, key=1)", # keyfunc is not callable ): - try: - exec(stmt) in globals() - except TypeError: - pass - else: - self.fail(stmt) + try: + exec(stmt) in globals() + except TypeError: + pass + else: + self.fail(stmt) self.assertEqual(min((1,), key=neg), 1) # one elem iterable self.assertEqual(min((1,2), key=neg), 2) # two elem iterable From office at omtel.de Wed Dec 8 19:17:36 2004 From: office at omtel.de (office@omtel.de) Date: Thu Dec 9 01:02:14 2004 Subject: [Python-checkins] E nderuara Kompani! Message-ID: A non-text attachment was scrubbed... Name: not available Type: text Size: 1571 bytes Desc: not available Url : http://mail.python.org/pipermail/python-checkins/attachments/20041208/288f4423/attachment.ksh From office at omtel.de Wed Dec 8 19:17:33 2004 From: office at omtel.de (office@omtel.de) Date: Thu Dec 9 01:17:49 2004 Subject: [Python-checkins] E nderuara Kompani! Message-ID: A non-text attachment was scrubbed... Name: not available Type: text Size: 1571 bytes Desc: not available Url : http://mail.python.org/pipermail/python-checkins/attachments/20041208/625a52e7/attachment.ksh From rhettinger at users.sourceforge.net Fri Dec 10 18:12:36 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 10 18:12:43 2004 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21804 Modified Files: concrete.tex Log Message: SF bug #1082944: Incorrect docs for PyUnicode_TailMatch * Note correct return type is int. * Note that -1 returned on failure. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- concrete.tex 22 Nov 2004 13:02:31 -0000 1.58 +++ concrete.tex 10 Dec 2004 17:12:32 -0000 1.59 @@ -1449,7 +1449,7 @@ resulting Unicode string. \end{cfuncdesc} -\begin{cfuncdesc}{PyObject*}{PyUnicode_Tailmatch}{PyObject *str, +\begin{cfuncdesc}{int}{PyUnicode_Tailmatch}{PyObject *str, PyObject *substr, int start, int end, @@ -1457,6 +1457,7 @@ Return 1 if \var{substr} matches \var{str}[\var{start}:\var{end}] at the given tail end (\var{direction} == -1 means to do a prefix match, \var{direction} == 1 a suffix match), 0 otherwise. + Returns \code{-1} if an error occurred. \end{cfuncdesc} \begin{cfuncdesc}{int}{PyUnicode_Find}{PyObject *str, From rhettinger at users.sourceforge.net Fri Dec 10 18:13:53 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 10 18:13:56 2004 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex, 1.58, 1.58.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22319 Modified Files: Tag: release24-maint concrete.tex Log Message: SF bug #1082944: Incorrect docs for PyUnicode_TailMatch * Note correct return type is int. * Note that -1 returned on failure. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.58 retrieving revision 1.58.2.1 diff -u -d -r1.58 -r1.58.2.1 --- concrete.tex 22 Nov 2004 13:02:31 -0000 1.58 +++ concrete.tex 10 Dec 2004 17:13:51 -0000 1.58.2.1 @@ -1449,7 +1449,7 @@ resulting Unicode string. \end{cfuncdesc} -\begin{cfuncdesc}{PyObject*}{PyUnicode_Tailmatch}{PyObject *str, +\begin{cfuncdesc}{int}{PyUnicode_Tailmatch}{PyObject *str, PyObject *substr, int start, int end, @@ -1457,6 +1457,7 @@ Return 1 if \var{substr} matches \var{str}[\var{start}:\var{end}] at the given tail end (\var{direction} == -1 means to do a prefix match, \var{direction} == 1 a suffix match), 0 otherwise. + Returns \code{-1} if an error occurred. \end{cfuncdesc} \begin{cfuncdesc}{int}{PyUnicode_Find}{PyObject *str, From rhettinger at users.sourceforge.net Fri Dec 10 18:23:35 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 10 18:23:37 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libwhrandom.tex, 1.15, 1.15.30.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24276 Modified Files: Tag: release24-maint libwhrandom.tex Log Message: SF bug #1081370: Bad reference in whrandom docs Index: libwhrandom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/Attic/libwhrandom.tex,v retrieving revision 1.15 retrieving revision 1.15.30.1 diff -u -d -r1.15 -r1.15.30.1 --- libwhrandom.tex 20 Oct 2001 04:24:09 -0000 1.15 +++ libwhrandom.tex 10 Dec 2004 17:23:32 -0000 1.15.30.1 @@ -14,7 +14,8 @@ This module implements a Wichmann-Hill pseudo-random number generator class that is also named \class{whrandom}. Instances of the \class{whrandom} class conform to the Random Number Generator -interface described in section \ref{rng-objects}. They also offer the +interface described in the docs for the \refmodule{random} module. +They also offer the following method, specific to the Wichmann-Hill algorithm: \begin{methoddesc}[whrandom]{seed}{\optional{x, y, z}} @@ -29,6 +30,8 @@ series produced by the generator. \end{methoddesc} +Other supported methods include: + \begin{funcdesc}{choice}{seq} Chooses a random element from the non-empty sequence \var{seq} and returns it. \end{funcdesc} From lemburg at users.sourceforge.net Fri Dec 10 22:54:38 2004 From: lemburg at users.sourceforge.net (lemburg@users.sourceforge.net) Date: Fri Dec 10 22:54:43 2004 Subject: [Python-checkins] python/dist/src/Lib/encodings aliases.py, 1.27, 1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20753/Lib/encodings Modified Files: aliases.py Log Message: Rearranged mappings to value sorting order. Index: aliases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/aliases.py,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- aliases.py 5 Aug 2004 12:43:30 -0000 1.27 +++ aliases.py 10 Dec 2004 21:54:35 -0000 1.28 @@ -122,7 +122,7 @@ 'ibm500' : 'cp500', # cp775 codec - '775' : 'cp775', + '775' : 'cp775', 'cspc775baltic' : 'cp775', 'ibm775' : 'cp775', @@ -294,6 +294,11 @@ 'l6' : 'iso8859_10', 'latin6' : 'iso8859_10', + # iso8859_11 codec + 'thai' : 'iso8859_11', + 'iso_8859_11' : 'iso8859_11', + 'iso_8859_11_2001' : 'iso8859_11', + # iso8859_13 codec 'iso_8859_13' : 'iso8859_13', @@ -308,6 +313,13 @@ # iso8859_15 codec 'iso_8859_15' : 'iso8859_15', + # iso8859_16 codec + 'iso_8859_16' : 'iso8859_16', + 'iso_8859_16_2001' : 'iso8859_16', + 'iso_ir_226' : 'iso8859_16', + 'l10' : 'iso8859_16', + 'latin10' : 'iso8859_16', + # iso8859_2 codec 'csisolatin2' : 'iso8859_2', 'iso_8859_2' : 'iso8859_2', @@ -373,18 +385,6 @@ 'l5' : 'iso8859_9', 'latin5' : 'iso8859_9', - # iso8859_11 codec - 'thai' : 'iso8859_11', - 'iso_8859_11' : 'iso8859_11', - 'iso_8859_11_2001' : 'iso8859_11', - - # iso8859_16 codec - 'iso_8859_16' : 'iso8859_16', - 'iso_8859_16_2001' : 'iso8859_16', - 'iso_ir_226' : 'iso8859_16', - 'l10' : 'iso8859_16', - 'latin10' : 'iso8859_16', - # johab codec 'cp1361' : 'johab', 'ms1361' : 'johab', From lemburg at users.sourceforge.net Fri Dec 10 22:58:17 2004 From: lemburg at users.sourceforge.net (lemburg@users.sourceforge.net) Date: Fri Dec 10 22:58:21 2004 Subject: [Python-checkins] python/dist/src/Tools/i18n makelocalealias.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/i18n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21415/Tools/i18n Added Files: makelocalealias.py Log Message: locale.py now uses an updated locale alias table (built using Tools/i18n/makelocalealias.py, a tool to parse the X11 locale alias file); the encoding lookup was enhanced to use Python's encoding alias table As sige-effect, this fixes SF bug [ 1080864 ] locale.py doesn't recognize valid locale setting. --- NEW FILE: makelocalealias.py --- #!/usr/bin/env python """ Convert the X11 locale.alias file into a mapping dictionary suitable for locale.py. Written by Marc-Andre Lemburg , 2004-12-10. """ import locale # Location of the alias file LOCALE_ALIAS = '/usr/lib/X11/locale/locale.alias' def parse(filename): f = open(filename) lines = f.read().splitlines() data = {} for line in lines: line = line.strip() if not line: continue if line[:1] == '#': continue locale, alias = line.split() # Strip ':' if locale[-1] == ':': locale = locale[:-1] # Lower-case locale locale = locale.lower() # Ignore one letter locale mappings (except for 'c') if len(locale) == 1 and locale != 'c': continue # Normalize encoding, if given if '.' in locale: lang, encoding = locale.split('.')[:2] encoding = encoding.replace('-', '') encoding = encoding.replace('_', '') locale = lang + '.' + encoding data[locale] = alias return data def pprint(data): items = data.items() items.sort() for k,v in items: print ' %-40s%r,' % ('%r:' % k, v) def print_differences(data, olddata): items = olddata.items() items.sort() for k, v in items: if not data.has_key(k): print '# removed %r' % k elif olddata[k] != data[k]: print '# updated %r -> %r to %r' % \ (k, olddata[k], data[k]) # Additions are not mentioned if __name__ == '__main__': data = locale.locale_alias.copy() data.update(parse(LOCALE_ALIAS)) print_differences(data, locale.locale_alias) print print 'locale_alias = {' pprint(data) print '}' From lemburg at users.sourceforge.net Fri Dec 10 22:58:17 2004 From: lemburg at users.sourceforge.net (lemburg@users.sourceforge.net) Date: Fri Dec 10 22:58:23 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1209,1.1210 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21415/Misc Modified Files: NEWS Log Message: locale.py now uses an updated locale alias table (built using Tools/i18n/makelocalealias.py, a tool to parse the X11 locale alias file); the encoding lookup was enhanced to use Python's encoding alias table As sige-effect, this fixes SF bug [ 1080864 ] locale.py doesn't recognize valid locale setting. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1209 retrieving revision 1.1210 diff -u -d -r1.1209 -r1.1210 --- NEWS 7 Dec 2004 12:02:02 -0000 1.1209 +++ NEWS 10 Dec 2004 21:58:04 -0000 1.1210 @@ -28,6 +28,11 @@ Library ------- +- locale.py now uses an updated locale alias table (built using + Tools/i18n/makelocalealias.py, a tool to parse the X11 locale + alias file); the encoding lookup was enhanced to use Python's + encoding alias table + - moved deprecated modules to Lib/lib-old: whrandom, tzparse, statcache. - the pickle module no longer accepts the deprecated None option in the From lemburg at users.sourceforge.net Fri Dec 10 22:58:37 2004 From: lemburg at users.sourceforge.net (lemburg@users.sourceforge.net) Date: Fri Dec 10 22:58:40 2004 Subject: [Python-checkins] python/dist/src/Lib locale.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21415/Lib Modified Files: locale.py Log Message: locale.py now uses an updated locale alias table (built using Tools/i18n/makelocalealias.py, a tool to parse the X11 locale alias file); the encoding lookup was enhanced to use Python's encoding alias table As sige-effect, this fixes SF bug [ 1080864 ] locale.py doesn't recognize valid locale setting. Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- locale.py 26 Jul 2004 12:45:18 -0000 1.28 +++ locale.py 10 Dec 2004 21:58:04 -0000 1.29 @@ -11,7 +11,7 @@ """ -import sys +import sys, encodings, encodings.aliases # Try importing the _locale module. # @@ -223,22 +223,35 @@ encoding = '' [...1102 lines suppressed...] + 'zh': 'zh_CN.eucCN', + 'zh_cn': 'zh_CN.gb2312', + 'zh_cn.big5': 'zh_TW.big5', + 'zh_cn.euc': 'zh_CN.eucCN', + 'zh_cn.gb18030': 'zh_CN.gb18030', + 'zh_cn.gb2312': 'zh_CN.gb2312', + 'zh_cn.gbk': 'zh_CN.gbk', + 'zh_cn.utf8': 'zh_CN.UTF-8', + 'zh_hk': 'zh_HK.big5hkscs', + 'zh_hk.big5': 'zh_HK.big5', + 'zh_hk.big5hkscs': 'zh_HK.big5hkscs', + 'zh_hk.utf8': 'zh_HK.UTF-8', + 'zh_sg.utf8': 'zh_SG.UTF-8', + 'zh_tw': 'zh_TW.big5', + 'zh_tw.big5': 'zh_TW.big5', + 'zh_tw.euc': 'zh_TW.eucTW', + 'zh_tw.utf8': 'zh_TW.UTF-8', } # From rhettinger at users.sourceforge.net Sat Dec 11 03:49:43 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 11 03:49:47 2004 Subject: [Python-checkins] python/dist/src/Lib atexit.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16028 Modified Files: atexit.py Log Message: SF bug #1083202L UnboundLocalError raised by atexit module The sys module could be called before being imported. Index: atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/atexit.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- atexit.py 4 Nov 2004 04:31:30 -0000 1.8 +++ atexit.py 11 Dec 2004 02:49:40 -0000 1.9 @@ -7,6 +7,8 @@ __all__ = ["register"] +import sys + _exithandlers = [] def _run_exitfuncs(): """run any registered exit functions @@ -23,7 +25,7 @@ except SystemExit: exc_info = sys.exc_info() except: - import sys, traceback + import traceback print >> sys.stderr, "Error in atexit._run_exitfuncs:" traceback.print_exc() exc_info = sys.exc_info() @@ -41,12 +43,10 @@ """ _exithandlers.append((func, targs, kargs)) -import sys if hasattr(sys, "exitfunc"): # Assume it's another registered exit function - append it to our list register(sys.exitfunc) sys.exitfunc = _run_exitfuncs -del sys if __name__ == "__main__": def x1(): From rhettinger at users.sourceforge.net Sat Dec 11 03:53:29 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 11 03:53:32 2004 Subject: [Python-checkins] python/dist/src/Lib atexit.py,1.8,1.8.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16868/Lib Modified Files: Tag: release24-maint atexit.py Log Message: SF bug #1083202: UnboundLocalError raised by atexit module The sys module could be called before being imported. Index: atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/atexit.py,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -d -r1.8 -r1.8.2.1 --- atexit.py 4 Nov 2004 04:31:30 -0000 1.8 +++ atexit.py 11 Dec 2004 02:53:27 -0000 1.8.2.1 @@ -7,6 +7,8 @@ __all__ = ["register"] +import sys + _exithandlers = [] def _run_exitfuncs(): """run any registered exit functions @@ -23,7 +25,7 @@ except SystemExit: exc_info = sys.exc_info() except: - import sys, traceback + import traceback print >> sys.stderr, "Error in atexit._run_exitfuncs:" traceback.print_exc() exc_info = sys.exc_info() @@ -41,12 +43,10 @@ """ _exithandlers.append((func, targs, kargs)) -import sys if hasattr(sys, "exitfunc"): # Assume it's another registered exit function - append it to our list register(sys.exitfunc) sys.exitfunc = _run_exitfuncs -del sys if __name__ == "__main__": def x1(): From rhettinger at users.sourceforge.net Sat Dec 11 03:53:29 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 11 03:53:32 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1193.2.2,1.1193.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16868/Misc Modified Files: Tag: release24-maint NEWS Log Message: SF bug #1083202: UnboundLocalError raised by atexit module The sys module could be called before being imported. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1193.2.2 retrieving revision 1.1193.2.3 diff -u -d -r1.1193.2.2 -r1.1193.2.3 --- NEWS 4 Dec 2004 21:24:19 -0000 1.1193.2.2 +++ NEWS 11 Dec 2004 02:53:25 -0000 1.1193.2.3 @@ -15,6 +15,9 @@ Library ------- +- atexit.register no longer references the sys module before importing it. + (Bug #1083202). + - unittest.TestCase.run() and unittest.TestSuite.run() can now be successfully extended or overridden by subclasses. Formerly, the subclassed method would be ignored by the rest of the module. (Bug #1078905). From bcannon at users.sourceforge.net Sat Dec 11 08:54:28 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Dec 11 08:54:31 2004 Subject: [Python-checkins] python/nondist/peps pep-3000.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv496 Modified Files: pep-3000.txt Log Message: Add reference to python-dev thread discussing comparing heterogeneous types. Also fix ref for removal of '<>'; syntactically missing trailing underscore. Index: pep-3000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-3000.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- pep-3000.txt 2 Sep 2004 19:10:13 -0000 1.7 +++ pep-3000.txt 11 Dec 2004 07:54:17 -0000 1.8 @@ -70,14 +70,14 @@ equivalent generator expression to ``list()``; as a consequence the loop variable will no longer be exposed. * Comparisons other than ``==`` and ``!=`` between disparate types - will raise an exception unless explicitly supported by the type + will raise an exception unless explicitly supported by the type []_ To be removed: * The ``lambda`` statement [1]_ * String exceptions [2]_ * ```x```: use ``repr(x)`` [2]_ -* The ``<>`` operator (use ``!=`` instead) [3] +* The ``<>`` operator (use ``!=`` instead) [3]_ Built-ins @@ -132,9 +132,12 @@ .. [4] python-dev email ("Constancy of None") http://mail.python.org/pipermail/python-dev/2004-July/046294.html -.. [5] python-dev email (" "as" to be a keyword?") +.. [5] python-dev email (' "as" to be a keyword?') http://mail.python.org/pipermail/python-dev/2004-July/046316.html +.. [6] python-dev email ("Comparing heterogeneous types") + http://mail.python.org/pipermail/python-dev/2004-June/045111.html + Copyright ========= From bcannon at users.sourceforge.net Sat Dec 11 10:53:55 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Dec 11 10:53:59 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libtextwrap.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-serv20943/Doc/lib Modified Files: libtextwrap.tex Log Message: Setting textwrap.TextWrapper().expand_tabs to True calls expandtabs, not expand_tabs, on the object being wrapped. Index: libtextwrap.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtextwrap.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- libtextwrap.tex 8 Feb 2004 18:09:32 -0000 1.7 +++ libtextwrap.tex 11 Dec 2004 09:53:52 -0000 1.8 @@ -97,7 +97,7 @@ \begin{memberdesc}{expand_tabs} (default: \code{True}) If true, then all tab characters in \var{text} -will be expanded to spaces using the \method{expand_tabs()} method of +will be expanded to spaces using the \method{expandtabs()} method of \var{text}. \end{memberdesc} From bcannon at users.sourceforge.net Sat Dec 11 10:54:56 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Dec 11 10:54:58 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libtextwrap.tex, 1.7, 1.7.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21167/Doc/lib Modified Files: Tag: release24-maint libtextwrap.tex Log Message: Fix typo for what method is called when expand_tabs is true. Index: libtextwrap.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtextwrap.tex,v retrieving revision 1.7 retrieving revision 1.7.4.1 diff -u -d -r1.7 -r1.7.4.1 --- libtextwrap.tex 8 Feb 2004 18:09:32 -0000 1.7 +++ libtextwrap.tex 11 Dec 2004 09:54:53 -0000 1.7.4.1 @@ -97,7 +97,7 @@ \begin{memberdesc}{expand_tabs} (default: \code{True}) If true, then all tab characters in \var{text} -will be expanded to spaces using the \method{expand_tabs()} method of +will be expanded to spaces using the \method{expandtabs()} method of \var{text}. \end{memberdesc} From bcannon at users.sourceforge.net Sat Dec 11 10:56:11 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Dec 11 10:56:14 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libtextwrap.tex, 1.6.10.1, 1.6.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21358/Doc/lib Modified Files: Tag: release23-maint libtextwrap.tex Log Message: Fix typo about what method to call when expand_tabs is true. Index: libtextwrap.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtextwrap.tex,v retrieving revision 1.6.10.1 retrieving revision 1.6.10.2 diff -u -d -r1.6.10.1 -r1.6.10.2 --- libtextwrap.tex 8 Feb 2004 18:12:20 -0000 1.6.10.1 +++ libtextwrap.tex 11 Dec 2004 09:56:08 -0000 1.6.10.2 @@ -97,7 +97,7 @@ \begin{memberdesc}{expand_tabs} (default: \code{True}) If true, then all tab characters in \var{text} -will be expanded to spaces using the \method{expand_tabs()} method of +will be expanded to spaces using the \method{expandtabs()} method of \var{text}. \end{memberdesc} From goodger at users.sourceforge.net Sat Dec 11 19:06:30 2004 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat Dec 11 19:06:33 2004 Subject: [Python-checkins] python/nondist/peps pep-3000.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21118 Modified Files: pep-3000.txt Log Message: filled in the footnote number Index: pep-3000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-3000.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- pep-3000.txt 11 Dec 2004 07:54:17 -0000 1.8 +++ pep-3000.txt 11 Dec 2004 18:06:27 -0000 1.9 @@ -70,7 +70,7 @@ equivalent generator expression to ``list()``; as a consequence the loop variable will no longer be exposed. * Comparisons other than ``==`` and ``!=`` between disparate types - will raise an exception unless explicitly supported by the type []_ + will raise an exception unless explicitly supported by the type [6]_ To be removed: From goodger at users.sourceforge.net Sat Dec 11 19:34:28 2004 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat Dec 11 19:34:31 2004 Subject: [Python-checkins] python/nondist/peps pep-0754.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26765 Modified Files: pep-0754.txt Log Message: updated link Index: pep-0754.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0754.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pep-0754.txt 23 Apr 2004 23:42:47 -0000 1.4 +++ pep-0754.txt 11 Dec 2004 18:34:25 -0000 1.5 @@ -171,7 +171,7 @@ reference material on the IEEE 754 floating point standard. .. [1] Further information on the reference package is available at - http://www.analytics.washington.edu/statcomp/projects/rzope/fpconst/ + http://research.warnes.net/projects/rzope/fpconst/ Copyright From goodger at users.sourceforge.net Sat Dec 11 21:01:11 2004 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat Dec 11 21:01:15 2004 Subject: [Python-checkins] python/nondist/peps pep-0337.txt, NONE, 1.1 pep-0000.txt, 1.295, 1.296 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12330 Modified Files: pep-0000.txt Added Files: pep-0337.txt Log Message: added PEP 337, Logging Usage in the Standard Library, by Michael P. Dubner --- NEW FILE: pep-0337.txt --- PEP: 337 Title: Logging Usage in the Standard Library Version: $Revision: 1.1 $ Last-Modified: $Date: 2004/12/11 20:01:07 $ Author: Michael P. Dubner Status: Draft Type: Standards Track Content-Type: text/plain Created: 02-Oct-2004 Python-Version: 2.5 Post-History: 10-Nov-2004 Abstract This PEP defines a standard for using the logging system (PEP 282 [1]) in the standard library. Implementing this PEP will simplify development of daemon applications. As a downside this PEP requires slight modifications (however in a back-portable way) to a large number of standard modules. After implementing this PEP one can use following filtering scheme: logging.getLogger('py.BaseHTTPServer').setLevel(logging.FATAL) Rationale There are a couple of situations when output to stdout or stderr is impractical: - Daemon applications where the framework doesn't allow the redirection of standard output to some file, but assumes use of some other form of logging. Examples are syslog under *nix'es and EventLog under WinNT+. - GUI applications which want to output every new log entry in separate pop-up window (i.e. fading OSD). Also sometimes applications want to filter output entries based on their source or severity. This requirement can't be implemented using simple redirection. Finally sometimes output needs to be marked with event timestamps, which can be accomplished with ease using the logging system. Proposal Every module usable for daemon and GUI applications should be rewritten to use the logging system instead of 'print' or 'sys.stdout.write'. There should be code like this included in the beginning of every modified module: import logging _log = logging.getLogger('py.') A prefix of 'py.' [2] must be used by all modules included in the standard library distributed along with Python, and only by such modules (unverifiable). The use of "_log" is intentional as we don't want to auto-export it. For modules that use log only in one class a logger can be created inside the class definition as follows: class XXX: __log = logging.getLogger('py.') Then this class can create access methods to log to this private logger. So "print" and "sys.std{out|err}.write" statements should be replaced with "_log.{debug|info}", and "traceback.print_exception" with "_log.exception" or sometimes "_log.debug('...', exc_info=1)". Module List Here is a (possibly incomplete) list of modules to be reworked: - asyncore (dispatcher.log, dispatcher.log_info) - BaseHTTPServer (BaseHTTPRequestHandler.log_request, BaseHTTPRequestHandler.log_error, BaseHTTPRequestHandler.log_message) - cgi (possibly - is cgi.log used by somebody?) - ftplib (if FTP.debugging) - gopherlib (get_directory) - httplib (HTTPResponse, HTTPConnection) - ihooks (_Verbose) - imaplib (IMAP4._mesg) - mhlib (MH.error) - nntplib (NNTP) - pipes (Template.makepipeline) - pkgutil (extend_path) - platform (_syscmd_ver) - poplib (if POP3._debugging) - profile (if Profile.verbose) - robotparser (_debug) - smtplib (if SGMLParser.verbose) - shlex (if shlex.debug) - smtpd (SMTPChannel/PureProxy where print >> DEBUGSTREAM) - smtplib (if SMTP.debuglevel) - SocketServer (BaseServer.handle_error) - telnetlib (if Telnet.debuglevel) - threading? (_Verbose._note, Thread.__bootstrap) - timeit (Timer.print_exc) - trace - uu (decode) Additionally there are a couple of modules with commented debug output or modules where debug output should be added. For example: - urllib Finally possibly some modules should be extended to provide more debug information. Doubtful Modules Listed here are modules that the community will propose for addition to the module list and modules that the community say should be removed from the module list. - tabnanny (check) Guidelines for Logging Usage Also we can provide some recommendation to authors of library modules so they all follow the same format of naming loggers. I propose that non-standard library modules should use loggers named after their full names, so a module "spam" in sub-package "junk" of package "dummy" will be named "dummy.junk.spam" and, of course, the "__init__" module of the same sub-package will have the logger name "dummy.junk". References [1] PEP 282, A Logging System, Vinay Sajip, Trent Mick http://www.python.org/peps/pep-0282.html [2] http://mail.python.org/pipermail/python-dev/2004-October/049282.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.295 retrieving revision 1.296 diff -u -d -r1.295 -r1.296 --- pep-0000.txt 30 Nov 2004 13:44:08 -0000 1.295 +++ pep-0000.txt 11 Dec 2004 20:01:08 -0000 1.296 @@ -123,6 +123,7 @@ S 334 Simple Coroutines via SuspendIteration Evans S 335 Overloadable Boolean Operators Ewing S 336 Make None Callable McClelland + S 337 Logging Usage in the Standard Library Dubner S 754 IEEE 754 Floating Point Special Values Warnes Finished PEPs (done, implemented in CVS) @@ -368,6 +369,7 @@ S 334 Simple Coroutines via SuspendIteration Evans S 335 Overloadable Boolean Operators Ewing S 336 Make None Callable McClelland + S 337 Logging Usage in the Standard Library Dubner SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes I 3000 Python 3.0 Plans Kuchling, Cannon @@ -405,6 +407,7 @@ Creighton, Laura lac@strakt.com Dörwald, Walter Drake, Fred fdrake@acm.org + Dubner, Michael P. dubnerm@mindless.com Dubois, Paul F. paul@pfdubois.com Eby, Phillip J. pje@telecommunity.com Epler, Jeff jepler@unpythonic.net From goodger at users.sourceforge.net Sat Dec 11 21:24:22 2004 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat Dec 11 21:24:26 2004 Subject: [Python-checkins] python/nondist/peps pep-0338.txt, NONE, 1.1 pep-0000.txt, 1.296, 1.297 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17393 Modified Files: pep-0000.txt Added Files: pep-0338.txt Log Message: added PEP 338, , by --- NEW FILE: pep-0338.txt --- PEP: 338 Title: Executing modules inside packages with '-m' Version: $Revision: 1.1 $ Last-Modified: $Date: 2004/12/11 20:24:10 $ Author: Nick Coghlan Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 16-Oct-2004 Python-Version: 2.5 Post-History: 8-Nov-2004 Abstract ======== This PEP defines semantics for executing modules inside packages as scripts with the ``-m`` command line switch. The proposed semantics are that the containing package be imported prior to execution of the script. Rationale ========= Python 2.4 adds the command line switch ``-m`` to allow modules to be located using the Python module namespace for execution as scripts. The motivating examples were standard library modules such as ``pdb`` and ``profile``. A number of users and developers have requested extension of the feature to also support running modules located inside packages. One example provided is pychecker's ``pychecker.checker`` module. This capability was left out of the Python 2.4 implementation because the appropriate semantics were not entirely clear. The opinion on python-dev was that it was better to postpone the extension to Python 2.5, and go through the PEP process to help make sure we got it right. Scope of this proposal ========================== In Python 2.4, a module located using ``-m`` is executed just as if its filename had been provided on the command line. The goal of this PEP is to get as close as possible to making that statement also hold true for modules inside packages. Prior discussions suggest it should be noted that this PEP is **not** about any of the following: - changing the idiom for making Python modules also useful as scripts (see PEP 299 [1]_). - lifting the restriction of ``-m`` to modules of type PY_SOURCE or PY_COMPILED (i.e. ``.py``, ``.pyc``, ``.pyo``,``.pyw``). - addressing the problem of ``-m`` not understanding zip imports or Python's sys.metapath. The issues listed above are considered orthogonal to the specific feature addressed by this PEP. Current Behaviour ================= Before describing the new semantics, it's worth covering the existing semantics for Python 2.4 (as they are currently defined only by the source code). When ``-m`` is used on the command line, it immediately terminates the option list (like ``-c``). The argument is interpreted as the name of a top-level Python module (i.e. one which can be found on ``sys.path``). If the module is found, and is of type ``PY_SOURCE`` or ``PY_COMPILED``, then the command line is effectively reinterpreted from ``python -m `` to ``python ``. This includes setting ``sys.argv[0]`` correctly (some scripts rely on this - Python's own ``regrtest.py`` is one example). If the module is not found, or is not of the correct type, an error is printed. Proposed Semantics ================== The semantics proposed are fairly simple: if ``-m`` is used to execute a module inside a package as a script, then the containing package is imported before executing the module in accordance with the semantics for a top-level module. This is necessary due to the way Python's import machinery locates modules inside packages. A package may modify its own __path__ variable during initialisation. In addition, paths may affected by ``*.pth`` files. Accordingly, the only way for Python to reliably locate the module is by importing the containing package and inspecting its __path__ variable. Note that the package is *not* imported into the ``__main__`` module's namespace. The effects of these semantics that will be visible to the executed module are: - the containing package will be in sys.modules - any external effects of the package initialisation (e.g. installed import hooks, loggers, atexit handlers, etc.) Reference Implementation ======================== A reference implementation is available on SourceForge [2]_. In this implementation, if the ``-m`` switch fails to locate the requested module at the top level, it effectively reinterprets the command from ``python -m