[Stackless-checkins] r55183 - in stackless/branches/release25-maint: Doc/api/concrete.tex Doc/api/init.tex Doc/commontex/copyright.tex Doc/commontex/license.tex Doc/inst/inst.tex Doc/lib/libbase64.tex Doc/lib/libfuncs.tex Doc/lib/liblogging.tex Doc/lib/libstdtypes.tex Doc/lib/libsys.tex Doc/lib/liburllib2.tex Doc/lib/libxmlrpclib.tex Doc/mac/using.tex Doc/texinputs/python.sty Doc/tut/tut.tex Include/fileobject.h LICENSE Lib/Bastion.py Lib/CGIHTTPServer.py Lib/_strptime.py Lib/cgitb.py Lib/ctypes Lib/distutils/command/build_ext.py Lib/distutils/unixccompiler.py Lib/email/__init__.py Lib/encodings/utf_8_sig.py Lib/ftplib.py Lib/lib-tk/tkSimpleDialog.py Lib/locale.py Lib/rexec.py Lib/subprocess.py Lib/tarfile.py Lib/test/README Lib/test/string_tests.py Lib/test/test_codecs.py Lib/test/test_curses.py Lib/test/test_descr.py Lib/test/test_format.py Lib/test/test_import.py Lib/test/test_index.py Lib/test/test_itertools.py Lib/test/test_locale.py Lib/test/test_mailbox.py Lib/test/test_old_mailb! ox.py Lib/test/test_pty.py Lib/test/test_re.py Lib/test/test_sax.py Lib/test/test_set.py Lib/test/test_strptime.py Lib/test/test_syntax.py Lib/test/test_tarfile.py Lib/urllib2.py Misc/NEWS Misc/build.sh Modules/_ctypes Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_ctypes/stgdict.c Modules/binascii.c Modules/cPickle.c Modules/cStringIO.c Modules/itertoolsmodule.c Modules/posixmodule.c Objects/classobject.c Objects/exceptions.c Objects/fileobject.c Objects/longobject.c PC/_winreg.c Python/dynload_win.c Python/thread_nt.h

kristjan.jonsson python-checkins at python.org
Tue May 8 11:04:13 CEST 2007


Author: kristjan.jonsson
Date: Tue May  8 11:04:01 2007
New Revision: 55183

Modified:
   stackless/branches/release25-maint/Doc/api/concrete.tex
   stackless/branches/release25-maint/Doc/api/init.tex
   stackless/branches/release25-maint/Doc/commontex/copyright.tex
   stackless/branches/release25-maint/Doc/commontex/license.tex
   stackless/branches/release25-maint/Doc/inst/inst.tex
   stackless/branches/release25-maint/Doc/lib/libbase64.tex
   stackless/branches/release25-maint/Doc/lib/libfuncs.tex
   stackless/branches/release25-maint/Doc/lib/liblogging.tex
   stackless/branches/release25-maint/Doc/lib/libstdtypes.tex
   stackless/branches/release25-maint/Doc/lib/libsys.tex
   stackless/branches/release25-maint/Doc/lib/liburllib2.tex
   stackless/branches/release25-maint/Doc/lib/libxmlrpclib.tex
   stackless/branches/release25-maint/Doc/mac/using.tex
   stackless/branches/release25-maint/Doc/texinputs/python.sty
   stackless/branches/release25-maint/Doc/tut/tut.tex
   stackless/branches/release25-maint/Include/fileobject.h
   stackless/branches/release25-maint/LICENSE
   stackless/branches/release25-maint/Lib/Bastion.py
   stackless/branches/release25-maint/Lib/CGIHTTPServer.py
   stackless/branches/release25-maint/Lib/_strptime.py
   stackless/branches/release25-maint/Lib/cgitb.py
   stackless/branches/release25-maint/Lib/ctypes/   (props changed)
   stackless/branches/release25-maint/Lib/distutils/command/build_ext.py
   stackless/branches/release25-maint/Lib/distutils/unixccompiler.py
   stackless/branches/release25-maint/Lib/email/__init__.py
   stackless/branches/release25-maint/Lib/encodings/utf_8_sig.py
   stackless/branches/release25-maint/Lib/ftplib.py
   stackless/branches/release25-maint/Lib/lib-tk/tkSimpleDialog.py
   stackless/branches/release25-maint/Lib/locale.py
   stackless/branches/release25-maint/Lib/rexec.py
   stackless/branches/release25-maint/Lib/subprocess.py
   stackless/branches/release25-maint/Lib/tarfile.py
   stackless/branches/release25-maint/Lib/test/README
   stackless/branches/release25-maint/Lib/test/string_tests.py
   stackless/branches/release25-maint/Lib/test/test_codecs.py
   stackless/branches/release25-maint/Lib/test/test_curses.py
   stackless/branches/release25-maint/Lib/test/test_descr.py
   stackless/branches/release25-maint/Lib/test/test_format.py
   stackless/branches/release25-maint/Lib/test/test_import.py
   stackless/branches/release25-maint/Lib/test/test_index.py
   stackless/branches/release25-maint/Lib/test/test_itertools.py
   stackless/branches/release25-maint/Lib/test/test_locale.py
   stackless/branches/release25-maint/Lib/test/test_mailbox.py
   stackless/branches/release25-maint/Lib/test/test_old_mailbox.py
   stackless/branches/release25-maint/Lib/test/test_pty.py
   stackless/branches/release25-maint/Lib/test/test_re.py
   stackless/branches/release25-maint/Lib/test/test_sax.py
   stackless/branches/release25-maint/Lib/test/test_set.py
   stackless/branches/release25-maint/Lib/test/test_strptime.py
   stackless/branches/release25-maint/Lib/test/test_syntax.py
   stackless/branches/release25-maint/Lib/test/test_tarfile.py
   stackless/branches/release25-maint/Lib/urllib2.py
   stackless/branches/release25-maint/Misc/NEWS
   stackless/branches/release25-maint/Misc/build.sh
   stackless/branches/release25-maint/Modules/_ctypes/   (props changed)
   stackless/branches/release25-maint/Modules/_ctypes/callproc.c
   stackless/branches/release25-maint/Modules/_ctypes/cfield.c
   stackless/branches/release25-maint/Modules/_ctypes/stgdict.c
   stackless/branches/release25-maint/Modules/binascii.c
   stackless/branches/release25-maint/Modules/cPickle.c
   stackless/branches/release25-maint/Modules/cStringIO.c
   stackless/branches/release25-maint/Modules/itertoolsmodule.c
   stackless/branches/release25-maint/Modules/posixmodule.c
   stackless/branches/release25-maint/Objects/classobject.c
   stackless/branches/release25-maint/Objects/exceptions.c
   stackless/branches/release25-maint/Objects/fileobject.c
   stackless/branches/release25-maint/Objects/longobject.c
   stackless/branches/release25-maint/PC/_winreg.c
   stackless/branches/release25-maint/Python/dynload_win.c
   stackless/branches/release25-maint/Python/thread_nt.h
Log:
Merged in up to 55182 from the python release25-maint branch.  Several bugfixes mainly for Visual Studio 2005, and x64 platform.

Modified: stackless/branches/release25-maint/Doc/api/concrete.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/api/concrete.tex	(original)
+++ stackless/branches/release25-maint/Doc/api/concrete.tex	Tue May  8 11:04:01 2007
@@ -1173,10 +1173,10 @@
    *byteorder == 1:  big endian
 \end{verbatim}
 
-  and then switches according to all byte order marks (BOM) it finds
-  in the input data.  BOMs are not copied into the resulting Unicode
-  string.  After completion, \var{*byteorder} is set to the current
-  byte order at the end of input data.
+  and then switches if the first two bytes of the input data are a byte order
+  mark (BOM) and the specified byte order is native order.  This BOM is not
+  copied into the resulting Unicode string.  After completion, \var{*byteorder}
+  is set to the current byte order at the.
 
   If \var{byteorder} is \NULL{}, the codec starts in native order mode.
 

Modified: stackless/branches/release25-maint/Doc/api/init.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/api/init.tex	(original)
+++ stackless/branches/release25-maint/Doc/api/init.tex	Tue May  8 11:04:01 2007
@@ -245,7 +245,7 @@
   program name (set by \cfunction{Py_SetProgramName()} above) and some
   environment variables.  The returned string consists of a series of
   directory names separated by a platform dependent delimiter
-  character.  The delimiter character is \character{:} on \UNIX and Mac OS X,
+  character.  The delimiter character is \character{:} on \UNIX{} and Mac OS X,
   \character{;} on Windows.  The returned string points into
   static storage; the caller should not modify its value.  The value
   is available to Python code as the list

Modified: stackless/branches/release25-maint/Doc/commontex/copyright.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/commontex/copyright.tex	(original)
+++ stackless/branches/release25-maint/Doc/commontex/copyright.tex	Tue May  8 11:04:01 2007
@@ -1,4 +1,4 @@
-Copyright \copyright{} 2001-2006 Python Software Foundation.
+Copyright \copyright{} 2001-2007 Python Software Foundation.
 All rights reserved.
 
 Copyright \copyright{} 2000 BeOpen.com.

Modified: stackless/branches/release25-maint/Doc/commontex/license.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/commontex/license.tex	(original)
+++ stackless/branches/release25-maint/Doc/commontex/license.tex	Tue May  8 11:04:01 2007
@@ -50,6 +50,7 @@
   \linev{2.4.1}{2.4}{2005}{PSF}{yes}
   \linev{2.4.2}{2.4.1}{2005}{PSF}{yes}
   \linev{2.4.3}{2.4.2}{2006}{PSF}{yes}
+  \linev{2.4.4}{2.4.3}{2006}{PSF}{yes}
   \linev{2.5}{2.4}{2006}{PSF}{yes}
   \linev{2.5.1}{2.5}{2007}{PSF}{yes}
 \end{tablev}
@@ -82,7 +83,7 @@
 prepare derivative works, distribute, and otherwise use Python
 \version{} alone or in any derivative version, provided, however, that
 PSF's License Agreement and PSF's notice of copyright, i.e.,
-``Copyright \copyright{} 2001-2006 Python Software Foundation; All
+``Copyright \copyright{} 2001-2007 Python Software Foundation; All
 Rights Reserved'' are retained in Python \version{} alone or in any
 derivative version prepared by Licensee.
 

Modified: stackless/branches/release25-maint/Doc/inst/inst.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/inst/inst.tex	(original)
+++ stackless/branches/release25-maint/Doc/inst/inst.tex	Tue May  8 11:04:01 2007
@@ -296,7 +296,7 @@
 \filevar{prefix} and \filevar{exec-prefix} stand for the directories
 that Python is installed to, and where it finds its libraries at
 run-time.  They are always the same under Windows, and very
-often the same under \UNIX and Mac OS X.  You can find out what your Python
+often the same under \UNIX{} and Mac OS X.  You can find out what your Python
 installation uses for \filevar{prefix} and \filevar{exec-prefix} by
 running Python in interactive mode and typing a few simple commands.
 Under \UNIX, just type \code{python} at the shell prompt.  Under

Modified: stackless/branches/release25-maint/Doc/lib/libbase64.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/lib/libbase64.tex	(original)
+++ stackless/branches/release25-maint/Doc/lib/libbase64.tex	Tue May  8 11:04:01 2007
@@ -85,7 +85,7 @@
 letter O (oh), and for optional mapping of the digit 1 (one) to either
 the letter I (eye) or letter L (el).  The optional argument
 \var{map01} when not \code{None}, specifies which letter the digit 1 should
-be mapped to (when map01 is not \var{None}, the digit 0 is always
+be mapped to (when \var{map01} is not \code{None}, the digit 0 is always
 mapped to the letter O).  For security purposes the default is
 \code{None}, so that 0 and 1 are not allowed in the input.
 

Modified: stackless/branches/release25-maint/Doc/lib/libfuncs.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/lib/libfuncs.tex	(original)
+++ stackless/branches/release25-maint/Doc/lib/libfuncs.tex	Tue May  8 11:04:01 2007
@@ -972,7 +972,7 @@
 
 \begin{funcdesc}{reversed}{seq}
   Return a reverse iterator.  \var{seq} must be an object which
-  supports the sequence protocol (the __len__() method and the
+  supports the sequence protocol (the \method{__len__()} method and the
   \method{__getitem__()} method with integer arguments starting at
   \code{0}).
   \versionadded{2.4}

Modified: stackless/branches/release25-maint/Doc/lib/liblogging.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/lib/liblogging.tex	(original)
+++ stackless/branches/release25-maint/Doc/lib/liblogging.tex	Tue May  8 11:04:01 2007
@@ -203,7 +203,7 @@
 \begin{verbatim}
  FORMAT = "%(asctime)-15s %(clientip)s %(user)-8s %(message)s"
  logging.basicConfig(format=FORMAT)
- dict = { 'clientip' : '192.168.0.1', 'user' : 'fbloggs' }
+ d = {'clientip': '192.168.0.1', 'user': 'fbloggs'}
  logging.warning("Protocol problem: %s", "connection reset", extra=d)
 \end{verbatim}
 
@@ -1495,7 +1495,7 @@
 \var{exc_info} is the exception tuple obtained by calling
 \function{sys.exc_info() }(or \constant{None}, if no exception information
 is available). The \var{func} is the name of the function from which the
-logging call was made. If not specified, it defaults to \var{None}.
+logging call was made. If not specified, it defaults to \code{None}.
 \versionchanged[\var{func} was added]{2.5}
 \end{classdesc}
 

Modified: stackless/branches/release25-maint/Doc/lib/libstdtypes.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/lib/libstdtypes.tex	(original)
+++ stackless/branches/release25-maint/Doc/lib/libstdtypes.tex	Tue May  8 11:04:01 2007
@@ -1489,7 +1489,7 @@
 
 \item[(5)] \function{setdefault()} is like \function{get()}, except
 that if \var{k} is missing, \var{x} is both returned and inserted into
-the dictionary as the value of \var{k}. \var{x} defaults to \var{None}.
+the dictionary as the value of \var{k}. \var{x} defaults to \code{None}.
 
 \item[(6)] \function{popitem()} is useful to destructively iterate
 over a dictionary, as often used in set algorithms.  If the dictionary
@@ -1615,14 +1615,15 @@
 iterator, typically in a \keyword{for} loop (for example,
 \code{for line in f: print line}), the \method{next()} method is
 called repeatedly.  This method returns the next input line, or raises
-\exception{StopIteration} when \EOF{} is hit.  In order to make a
-\keyword{for} loop the most efficient way of looping over the lines of
-a file (a very common operation), the \method{next()} method uses a
-hidden read-ahead buffer.  As a consequence of using a read-ahead
-buffer, combining \method{next()} with other file methods (like
-\method{readline()}) does not work right.  However, using
-\method{seek()} to reposition the file to an absolute position will
-flush the read-ahead buffer.
+\exception{StopIteration} when \EOF{} is hit when the file is open for
+reading (behavior is undefined when the file is open for writing).  In
+order to make a \keyword{for} loop the most efficient way of looping
+over the lines of a file (a very common operation), the
+\method{next()} method uses a hidden read-ahead buffer.  As a
+consequence of using a read-ahead buffer, combining \method{next()}
+with other file methods (like \method{readline()}) does not work
+right.  However, using \method{seek()} to reposition the file to an
+absolute position will flush the read-ahead buffer.
 \versionadded{2.3}
 \end{methoddesc}
 
@@ -1846,7 +1847,7 @@
   expection that occurred should be suppressed. If an exception
   occurred while executing the body of the \keyword{with} statement, the
   arguments contain the exception type, value and traceback information.
-  Otherwise, all three arguments are \var{None}.
+  Otherwise, all three arguments are \code{None}.
 
   Returning a true value from this method will cause the \keyword{with}
   statement to suppress the exception and continue execution with the

Modified: stackless/branches/release25-maint/Doc/lib/libsys.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/lib/libsys.tex	(original)
+++ stackless/branches/release25-maint/Doc/lib/libsys.tex	Tue May  8 11:04:01 2007
@@ -15,8 +15,8 @@
   whether this is a full pathname or not).  If the command was
   executed using the \programopt{-c} command line option to the
   interpreter, \code{argv[0]} is set to the string \code{'-c'}.  If no
-  script name was passed to the Python interpreter, \code{argv} has
-  zero length.
+  script name was passed to the Python interpreter, \code{argv[0]} is
+  the empty string.
 \end{datadesc}
 
 \begin{datadesc}{byteorder}

Modified: stackless/branches/release25-maint/Doc/lib/liburllib2.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/lib/liburllib2.tex	(original)
+++ stackless/branches/release25-maint/Doc/lib/liburllib2.tex	Tue May  8 11:04:01 2007
@@ -817,7 +817,10 @@
 import urllib2
 # Create an OpenerDirector with support for Basic HTTP Authentication...
 auth_handler = urllib2.HTTPBasicAuthHandler()
-auth_handler.add_password('realm', 'host', 'username', 'password')
+auth_handler.add_password(realm='PDQ Application',
+                          uri='https://mahler:8092/site-updates.py',
+                          user='klem',
+                          passwd='kadidd!ehopper')
 opener = urllib2.build_opener(auth_handler)
 # ...and install it globally so it can be used with urlopen.
 urllib2.install_opener(opener)

Modified: stackless/branches/release25-maint/Doc/lib/libxmlrpclib.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/lib/libxmlrpclib.tex	(original)
+++ stackless/branches/release25-maint/Doc/lib/libxmlrpclib.tex	Tue May  8 11:04:01 2007
@@ -280,7 +280,7 @@
 
 Create an object used to boxcar method calls. \var{server} is the
 eventual target of the call. Calls can be made to the result object,
-but they will immediately return \var{None}, and only store the
+but they will immediately return \code{None}, and only store the
 call name and parameters in the \class{MultiCall} object. Calling
 the object itself causes all stored calls to be transmitted as
 a single \code{system.multicall} request. The result of this call

Modified: stackless/branches/release25-maint/Doc/mac/using.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/mac/using.tex	(original)
+++ stackless/branches/release25-maint/Doc/mac/using.tex	Tue May  8 11:04:01 2007
@@ -2,7 +2,7 @@
 \sectionauthor{Bob Savage}{bobsavage at mac.com}
 
 Python on a Macintosh running Mac OS X is in principle very similar to
-Python on any other \UNIX platform, but there are a number of additional
+Python on any other \UNIX{} platform, but there are a number of additional
 features such as the IDE and the Package Manager that are worth pointing out.
 
 Python on Mac OS 9 or earlier can be quite different from Python on
@@ -13,206 +13,166 @@
 
 \section{Getting and Installing MacPython \label{getting-OSX}}
 
-Mac OS X 10.3 comes with Python 2.3 pre-installed by Apple.
-This installation does not come with the IDE and other additions, however,
-so to get these you need to install the \program{MacPython for Panther additions}
-from the MacPython website, \url{http://www.cwi.nl/\textasciitilde jack/macpython}.
-
-For MacPython 2.4, or for any MacPython on earlier releases of Mac OS X,
-you need to install a full distribution from the same website.
+Mac OS X 10.4 comes with Python 2.3 pre-installed by Apple. However, you are
+encouraged to install the most recent version of Python from the Python website
+(\url{http://www.python.org}). A ``universal binary'' build of Python 2.5, which
+runs natively on the Mac's new Intel and legacy PPC CPU's, is available there.
 
 What you get after installing is a number of things:
 
 \begin{itemize}
-    \item A \file{MacPython-2.3} folder in your \file{Applications}
-    folder. In here you find the PythonIDE Integrated Development Environment;
-    PythonLauncher, which handles double-clicking Python scripts from
-    the Finder; and the Package Manager.
-    
-    \item A fairly standard \UNIX{} commandline Python interpreter in
-    \file{/usr/local/bin/python}, but without the usual
-    \file{/usr/local/lib/python}.
-    
-    \item A framework \file{/Library/Frameworks/Python.framework}, where
-    all the action really is, but which you usually do not have to be aware of.
+\item A \file{MacPython 2.5} folder in your \file{Applications} folder. In here
+  you find IDLE, the development environment that is a standard part of official
+  Python distributions; PythonLauncher, which handles double-clicking Python
+  scripts from the Finder; and the ``Build Applet'' tool, which allows you to
+  package Python scripts as standalone applications on your system.
+
+\item A framework \file{/Library/Frameworks/Python.framework}, which includes
+  the Python executable and libraries. The installer adds this location to your
+  shell path. To uninstall MacPython, you can simply remove these three
+  things. A symlink to the Python executable is placed in /usr/local/bin/.
 \end{itemize}
 
-To uninstall MacPython you can simply remove these three things.
+The Apple-provided build of Python is installed in
+\file{/System/Library/Frameworks/Python.framework} and \file{/usr/bin/python},
+respectively. You should never modify or delete these, as they are
+Apple-controlled and are used by Apple- or third-party software.
+
+IDLE includes a help menu that allows you to access Python documentation. If you
+are completely new to Python you should start reading the tutorial introduction
+in that document.
 
-If you use the ``additions'' installer to install on top of an existing
-Apple-Python you will not get the framework and the commandline interpreter,
-as they have been installed by Apple already, in
-\file{/System/Library/Frameworks/Python.framework} and
-\file{/usr/bin/python}, respectively. You should in principle never modify
-or delete these, as they are Apple-controlled and may be used by Apple- or
-third-party software.
-
-PythonIDE contains an Apple Help Viewer book called "MacPython Help"
-which you can access through its help menu. If you are completely new to
-Python you should start reading the IDE introduction in that document.
+If you are familiar with Python on other \UNIX{} platforms you should read the
+section on running Python scripts from the \UNIX{} shell.
 
-If you are familiar with Python on other \UNIX{} platforms you should
-read the section on running Python scripts from the \UNIX{} shell.
 
 \subsection{How to run a Python script}
 
-Your best way to get started with Python on Mac OS X is through the PythonIDE
-integrated development environment, see section \ref{IDE} and use the Help
-menu when the IDE is running.
-
-If you want to run Python scripts from the Terminal window command line
-or from the Finder you first need an editor to create your script.
-Mac OS X comes with a number of standard \UNIX{} command line editors,
-\program{vim} and \program{emacs} among them. If you want a more Mac-like
-editor \program{BBEdit} or \program{TextWrangler} from Bare Bones Software
-(see \url{http://www.barebones.com/products/bbedit/index.shtml}) are
-good choices.  \program{AppleWorks} or any other
-word processor that can save files in ASCII is also a possibility, including
-\program{TextEdit} which is included with OS X.
+Your best way to get started with Python on Mac OS X is through the IDLE
+integrated development environment, see section \ref{IDE} and use the Help menu
+when the IDE is running.
+
+If you want to run Python scripts from the Terminal window command line or from
+the Finder you first need an editor to create your script. Mac OS X comes with a
+number of standard \UNIX{} command line editors, \program{vim} and
+\program{emacs} among them. If you want a more Mac-like editor, \program{BBEdit}
+or \program{TextWrangler} from Bare Bones Software (see
+\url{http://www.barebones.com/products/bbedit/index.shtml}) are good choices, as
+is \program{TextMate} (see \url{http://macromates.com/}). Other editors include
+\program{Gvim} (\url{http://macvim.org}) and \program{Aquamacs}
+(\url{http://aquamacs.org}).
 
 To run your script from the Terminal window you must make sure that
-\file{/usr/local/bin} is in your shell search path. 
+\file{/usr/local/bin} is in your shell search path.
 
 To run your script from the Finder you have two options:
+
 \begin{itemize}
-    \item Drag it to \program{PythonLauncher}
-    \item Select \program{PythonLauncher} as the default application
-    to open your script (or any .py script) through the finder Info window
-    and double-click it.
+\item Drag it to \program{PythonLauncher}
+\item Select \program{PythonLauncher} as the default application to open your
+  script (or any .py script) through the finder Info window and double-click it.
+  \program{PythonLauncher} has various preferences to control how your script is
+  launched. Option-dragging allows you to change these for one invocation, or
+  use its Preferences menu to change things globally.
 \end{itemize}
 
-PythonLauncher has various preferences to control how your script is launched.
-Option-dragging allows you to change these for one invocation, or use its
-Preferences menu to change things globally.
 
 \subsection{Running scripts with a GUI \label{osx-gui-scripts}}
 
-There is one Mac OS X quirk that you need to be aware of: programs
-that talk to the Aqua window manager (in other words, anything that has a GUI)
-need to be run in a special way. Use \program{pythonw} instead of \program{python}
-to start such scripts.
-
-\subsection{configuration}
-
-MacPython honours all standard \UNIX{} environment variables such as
-\envvar{PYTHONPATH}, but setting these variables for programs started
-from the Finder is non-standard
-as the Finder does not read your \file{.profile} or \file{.cshrc} at startup.
-You need to create a file \file{\textasciitilde /.MacOSX/environment.plist}.
-See Apple's Technical Document QA1067 for details.
+With older versions of Python, there is one Mac OS X quirk that you need to be
+aware of: programs that talk to the Aqua window manager (in other words,
+anything that has a GUI) need to be run in a special way. Use \program{pythonw}
+instead of \program{python} to start such scripts.
+
+With Python 2.5, you can use either \program{python} or \program{pythonw}.
+
+\subsection{Configuration}
+
+Python on OS X honors all standard \UNIX{} environment variables such as
+\envvar{PYTHONPATH}, but setting these variables for programs started from the
+Finder is non-standard as the Finder does not read your \file{.profile} or
+\file{.cshrc} at startup. You need to create a file \file{\textasciitilde
+  /.MacOSX/environment.plist}. See Apple's Technical Document QA1067 for
+details.
 
-Installing additional Python packages is most easily done through the
-Package Manager, see the MacPython Help Book for details.
+For more information on installation Python packages in MacPython, see section
+\ref{mac-package-manager}, ``Installing Additional Python Packages.''
 
 
 \section{The IDE\label{IDE}}
 
-The \program{Python IDE} (Integrated Development Environment) is a
-separate application that acts as a text editor for your Python code,
-a class browser, a graphical debugger, and more.
-
-The online Python Help contains a quick walkthrough of the IDE that
-shows the major features and how to use them.
-
-\subsection{Using the ``Python Interactive'' window}
-
-Use this window like you would use a normal \UNIX{} command line
-interpreter.
-
-\subsection{Writing a Python Script \label{IDEwrite}}
-
-In addition to using the \program{Python IDE} interactively, you can
-also type out a complete Python program, saving it incrementally, and
-execute it or smaller selections of it.
-
-You can create a new script, open a previously saved script, and save
-your currently open script by selecting the appropriate item in the
-``File'' menu. Dropping a Python script onto the
-\program{Python IDE} will open it for editing.
-
-When the \program{Python IDE} saves a script, it uses the creator code
-settings which are available by clicking on the small black triangle
-on the top right of the document window, and selecting ``save
-options''. The default is to save the file with the \program{Python
-IDE} as the creator, this means that you can open the file for editing
-by simply double-clicking on its icon. You might want to change this
-behaviour so that it will be opened by the
-\program{PythonLauncher}, and run. To do this simply choose
-``PythonLauncher'' from the ``save options''. Note that these
-options are associated with the \emph{file} not the application.
-
-
-\subsection{Executing a script from within the IDE
-            \label{IDEexecution}}
-
-You can run the script in the frontmost window of the \program{Python
-IDE} by hitting the run all button.  You should be aware, however that
-if you use the Python convention \samp{if __name__ == "__main__":} the
-script will \emph{not} be ``__main__'' by default. To get that
-behaviour you must select the ``Run as __main__'' option from the
-small black triangle on the top right of the document window.  Note
-that this option is associated with the \emph{file} not the
-application. It \emph{will} stay active after a save, however; to shut
-this feature off simply select it again.
- 
-
-\subsection{``Save as'' versus ``Save as Applet''
-            \label{IDEapplet}}
-
-When you are done writing your Python script you have the option of
-saving it as an ``applet'' (by selecting ``Save as applet'' from the
-``File'' menu). This has a significant advantage in that you can drop
-files or folders onto it, to pass them to the applet the way
-command-line users would type them onto the command-line to pass them
-as arguments to the script. However, you should make sure to save the
-applet as a separate file, do not overwrite the script you are
-writing, because you will not be able to edit it again.
-
-Accessing the items passed to the applet via ``drag-and-drop'' is done
-using the standard \member{sys.argv} mechanism. See the general
-documentation for more
-% need to link to the appropriate place in non-Mac docs
-
-Note that saving a script as an applet will not make it runnable on a
-system without a Python installation.
-
-%\subsection{Debugger}
-% **NEED INFO HERE**
- 
-%\subsection{Module Browser}
-% **NEED INFO HERE**
- 
-%\subsection{Profiler}
-% **NEED INFO HERE**
-% end IDE
-
-%\subsection{The ``Scripts'' menu}
-% **NEED INFO HERE**
-
-\section{The Package Manager}
-
-Historically MacPython came with a number of useful extension packages
-included, because most Macintosh users do not have access to a development
-environment and C compiler. For Mac OS X that bundling is no longer done,
-but a new mechanism has been made available to allow easy access to
-extension packages.
-
-The Python Package Manager helps you installing additional packages
-that enhance Python. It determines the exact MacOS version  and Python
-version you have and uses that information to download  a database that
-has packages that are tested and tried on that combination. In other
-words: if something is in your Package Manager  window but does not work
-you are free to blame the database maintainer.
-
-PackageManager then checks which of the packages you have installed  and
-which ones are not. This should also work when you have installed packages 
-outside of PackageManager.  You can select packages and install them,
-and PackageManager will work out the requirements and install these too.
-
-Often PackageManager will list a package in two flavors: binary  and
-source. Binary should always work, source will only work if  you have
-installed the Apple Developer Tools. PackageManager will warn  you about
-this, and also about other external dependencies.
+MacPython ships with the standard IDLE development environment. A good
+introduction to using IDLE can be found at
+\url{http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html}.
+
+
+\section{Installing Additional Python Packages \label{mac-package-manager}}
+
+There are several methods to install additional Python packages:
+
+\begin{itemize}
+\item \url{http://pythonmac.org/packages/} contains selected compiled packages
+  for Python 2.5, 2.4, and 2.3.
+\item Packages can be installed via the standard Python distutils mode
+  (\samp{python setup.py install}).
+\item Many packages can also be installed via the \program{setuptools}
+  extension.
+\end{itemize}
+
+
+\section{GUI Programming on the Mac}
+
+There are several options for building GUI applications on the Mac with Python.
+
+\emph{PyObjC} is a Python binding to Apple's Objective-C/Cocoa framework, which
+is the foundation of most modern Mac development. Information on PyObjC is
+available from \url{http://pybojc.sourceforge.net}.
+
+The standard Python GUI toolkit is \module{Tkinter}, based on the cross-platform
+Tk toolkit (\url{http://www.tcl.tk}). An Aqua-native version of Tk is bundled
+with OS X by Apple, and the latest version can be downloaded and installed from
+\url{http://www.activestate.com}; it can also be built from source.
+
+\emph{wxPython} is another popular cross-platform GUI toolkit that runs natively
+on Mac OS X. Packages and documentation are available from
+\url{http://www.wxpython.org}.
+
+\emph{PyQt} is another popular cross-platform GUI toolkit that runs natively on
+Mac OS X. More information can be found at
+\url{http://www.riverbankcomputing.co.uk/pyqt/}.
+
+
+\section{Distributing Python Applications on the Mac}
+
+The ``Build Applet'' tool that is placed in the MacPython 2.5 folder is fine for
+packaging small Python scripts on your own machine to run as a standard Mac
+application. This tool, however, is not robust enough to distribute Python
+applications to other users.
+
+The standard tool for deploying standalone Python applications on the Mac is
+\program{py2app}. More information on installing and using py2app can be found
+at \url{http://undefined.org/python/\#py2app}.
+
+\section{Application Scripting}
+
+Python can also be used to script other Mac applications via Apple's Open
+Scripting Architecture (OSA); see
+\url{http://appscript.sourceforge.net}. Appscript is a high-level, user-friendly
+Apple event bridge that allows you to control scriptable Mac OS X applications
+using ordinary Python scripts. Appscript makes Python a serious alternative to
+Apple's own \emph{AppleScript} language for automating your Mac. A related
+package, \emph{PyOSA}, is an OSA language component for the Python scripting
+language, allowing Python code to be executed by any OSA-enabled application
+(Script Editor, Mail, iTunes, etc.). PyOSA makes Python a full peer to
+AppleScript.
+
+\section{Other Resources}
+
+The MacPython mailing list is an excellent support resource for Python users and
+developers on the Mac:
+
+\url{http://www.python.org/community/sigs/current/pythonmac-sig/}
+
+Another useful resource is the MacPython wiki:
 
-PackageManager is available as a separate application and also  as a
-function of the IDE, through the File->Package Manager menu  entry.
+\url{http://wiki.python.org/moin/MacPython}

Modified: stackless/branches/release25-maint/Doc/texinputs/python.sty
==============================================================================
--- stackless/branches/release25-maint/Doc/texinputs/python.sty	(original)
+++ stackless/branches/release25-maint/Doc/texinputs/python.sty	Tue May  8 11:04:01 2007
@@ -612,7 +612,7 @@
 \newenvironment{cfuncdesc}[4][\py at badkey]{
   \begin{fulllineitems}
     \cfuncline{#2}{#3}{#4}
-    \ifx#1\@undefined\else%
+    \ifx\@undefined#1\relax\else%
       \emph{Return value: \textbf{#1}.}\\
     \fi
 }{\end{fulllineitems}}
@@ -629,7 +629,7 @@
 \newenvironment{ctypedesc}[2][\py at badkey]{
   \begin{fulllineitems}
     \item[\bfcode{#2}%
-    \ifx#1\@undefined%
+    \ifx\@undefined#1\relax%
       \index{#2@{\py at idxcode{#2}} (C type)}
     \else%
       \index{#2@{\py at idxcode{#1}} (C type)}
@@ -712,7 +712,7 @@
 % \begin{methoddesc}[classname]{methodname}{args}
 \newcommand{\methodline}[3][\@undefined]{
   \methodlineni{#2}{#3}
-  \ifx#1\@undefined
+  \ifx\@undefined#1\relax
     \index{#2@{\py at idxcode{#2()}} (\py at thisclass\ method)}
   \else
     \index{#2@{\py at idxcode{#2()}} (#1 method)}
@@ -720,7 +720,7 @@
 }
 \newenvironment{methoddesc}[3][\@undefined]{
   \begin{fulllineitems}
-    \ifx#1\@undefined
+    \ifx\@undefined#1\relax
       \methodline{#2}{#3}
     \else
       \def\py at thisclass{#1}
@@ -740,7 +740,7 @@
 % object data attribute --------------------------------------------------
 % \begin{memberdesc}[classname]{membername}
 \newcommand{\memberline}[2][\py at classbadkey]{%
-  \ifx#1\@undefined
+  \ifx\@undefined#1\relax
     \memberlineni{#2}
     \index{#2@{\py at idxcode{#2}} (\py at thisclass\ attribute)}
   \else
@@ -750,7 +750,7 @@
 }
 \newenvironment{memberdesc}[2][\py at classbadkey]{
   \begin{fulllineitems}
-    \ifx#1\@undefined
+    \ifx\@undefined#1\relax
       \memberline{#2}
     \else
       \def\py at thisclass{#1}
@@ -1046,14 +1046,14 @@
 %  \versionchanged[short explanation]{2.0}
 %
 \newcommand{\versionadded}[2][\py at badkey]{%
-  \ifx#1\@undefined%
+  \ifx\@undefined#1\relax%
     {  New in version #2.  }%
   \else%
     {  New in version #2:\ #1.  }%
   \fi%
 }
 \newcommand{\versionchanged}[2][\py at badkey]{%
-  \ifx#1\@undefined%
+  \ifx\@undefined#1\relax%
     {  Changed in version #2.  }%
   \else%
     {  Changed in version #2:\ #1.  }%

Modified: stackless/branches/release25-maint/Doc/tut/tut.tex
==============================================================================
--- stackless/branches/release25-maint/Doc/tut/tut.tex	(original)
+++ stackless/branches/release25-maint/Doc/tut/tut.tex	Tue May  8 11:04:01 2007
@@ -184,12 +184,12 @@
 \file{/usr/local/python} is a popular alternative location.)
 
 On Windows machines, the Python installation is usually placed in
-\file{C:\e Python24}, though you can change this when you're running
+\file{C:\e Python25}, though you can change this when you're running
 the installer.  To add this directory to your path, 
 you can type the following command into the command prompt in a DOS box:
 
 \begin{verbatim}
-set path=%path%;C:\python24
+set path=%path%;C:\python25
 \end{verbatim}
 
 
@@ -3556,7 +3556,7 @@
 ...    print 'x =', x
 ...    print 'y =', y
 ...
-<type 'instance'>
+<type 'exceptions.Exception'>
 ('spam', 'eggs')
 ('spam', 'eggs')
 x = spam
@@ -4654,7 +4654,7 @@
 >>> os.system('time 0:02')
 0
 >>> os.getcwd()      # Return the current working directory
-'C:\\Python24'
+'C:\\Python25'
 >>> os.chdir('/server/accesslogs')
 \end{verbatim}
 
@@ -5254,7 +5254,7 @@
     Traceback (most recent call last):
       File "<pyshell#108>", line 1, in -toplevel-
         d['primary']                # entry was automatically removed
-      File "C:/PY24/lib/weakref.py", line 46, in __getitem__
+      File "C:/python25/lib/weakref.py", line 46, in __getitem__
         o = self.data[key]()
     KeyError: 'primary'
 \end{verbatim}

Modified: stackless/branches/release25-maint/Include/fileobject.h
==============================================================================
--- stackless/branches/release25-maint/Include/fileobject.h	(original)
+++ stackless/branches/release25-maint/Include/fileobject.h	Tue May  8 11:04:01 2007
@@ -57,6 +57,11 @@
 char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
 size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *);
 
+/* A routine to do sanity checking on the file mode string.  returns
+   non-zero on if an exception occurred
+*/
+int _PyFile_SanitizeMode(char *mode);
+
 #ifdef __cplusplus
 }
 #endif

Modified: stackless/branches/release25-maint/LICENSE
==============================================================================
--- stackless/branches/release25-maint/LICENSE	(original)
+++ stackless/branches/release25-maint/LICENSE	Tue May  8 11:04:01 2007
@@ -52,6 +52,7 @@
     2.4.1           2.4         2005        PSF         yes
     2.4.2           2.4.1       2005        PSF         yes
     2.4.3           2.4.2       2006        PSF         yes
+    2.4.4           2.4.3       2006        PSF         yes
     2.5             2.4         2006        PSF         yes
     2.5.1           2.5         2007        PSF         yes
 

Modified: stackless/branches/release25-maint/Lib/Bastion.py
==============================================================================
--- stackless/branches/release25-maint/Lib/Bastion.py	(original)
+++ stackless/branches/release25-maint/Lib/Bastion.py	Tue May  8 11:04:01 2007
@@ -97,7 +97,7 @@
 
     """
 
-    raise RuntimeError, "This code is not secure in Python 2.2 and 2.3"
+    raise RuntimeError, "This code is not secure in Python 2.2 and later"
 
     # Note: we define *two* ad-hoc functions here, get1 and get2.
     # Both are intended to be called in the same way: get(name).

Modified: stackless/branches/release25-maint/Lib/CGIHTTPServer.py
==============================================================================
--- stackless/branches/release25-maint/Lib/CGIHTTPServer.py	(original)
+++ stackless/branches/release25-maint/Lib/CGIHTTPServer.py	Tue May  8 11:04:01 2007
@@ -107,7 +107,7 @@
         """Execute a CGI script."""
         path = self.path
         dir, rest = self.cgi_info
-        
+
         i = path.find('/', len(dir) + 1)
         while i >= 0:
             nextdir = path[:i]

Modified: stackless/branches/release25-maint/Lib/_strptime.py
==============================================================================
--- stackless/branches/release25-maint/Lib/_strptime.py	(original)
+++ stackless/branches/release25-maint/Lib/_strptime.py	Tue May  8 11:04:01 2007
@@ -299,17 +299,16 @@
     global _TimeRE_cache, _regex_cache
     _cache_lock.acquire()
     try:
-        time_re = _TimeRE_cache
-        locale_time = time_re.locale_time
-        if _getlang() != locale_time.lang:
+        if _getlang() != _TimeRE_cache.locale_time.lang:
             _TimeRE_cache = TimeRE()
-            _regex_cache = {}
+            _regex_cache.clear()
         if len(_regex_cache) > _CACHE_MAX_SIZE:
             _regex_cache.clear()
+        locale_time = _TimeRE_cache.locale_time
         format_regex = _regex_cache.get(format)
         if not format_regex:
             try:
-                format_regex = time_re.compile(format)
+                format_regex = _TimeRE_cache.compile(format)
             # KeyError raised when a bad format is found; can be specified as
             # \\, in which case it was a stray % but with a space after it
             except KeyError, err:

Modified: stackless/branches/release25-maint/Lib/cgitb.py
==============================================================================
--- stackless/branches/release25-maint/Lib/cgitb.py	(original)
+++ stackless/branches/release25-maint/Lib/cgitb.py	Tue May  8 11:04:01 2007
@@ -167,7 +167,7 @@
 
     exception = ['<p>%s: %s' % (strong(pydoc.html.escape(str(etype))),
                                 pydoc.html.escape(str(evalue)))]
-    if type(evalue) is types.InstanceType:
+    if isinstance(evalue, BaseException):
         for name in dir(evalue):
             if name[:1] == '_': continue
             value = pydoc.html.repr(getattr(evalue, name))
@@ -239,7 +239,7 @@
         frames.append('\n%s\n' % '\n'.join(rows))
 
     exception = ['%s: %s' % (str(etype), str(evalue))]
-    if type(evalue) is types.InstanceType:
+    if isinstance(evalue, BaseException):
         for name in dir(evalue):
             value = pydoc.text.repr(getattr(evalue, name))
             exception.append('\n%s%s = %s' % (" "*4, name, value))

Modified: stackless/branches/release25-maint/Lib/distutils/command/build_ext.py
==============================================================================
--- stackless/branches/release25-maint/Lib/distutils/command/build_ext.py	(original)
+++ stackless/branches/release25-maint/Lib/distutils/command/build_ext.py	Tue May  8 11:04:01 2007
@@ -533,7 +533,8 @@
         if self.swig_cpp:
             log.warn("--swig-cpp is deprecated - use --swig-opts=-c++")
 
-        if self.swig_cpp or ('-c++' in self.swig_opts):
+        if self.swig_cpp or ('-c++' in self.swig_opts) or \
+           ('-c++' in extension.swig_opts):
             target_ext = '.cpp'
         else:
             target_ext = '.c'

Modified: stackless/branches/release25-maint/Lib/distutils/unixccompiler.py
==============================================================================
--- stackless/branches/release25-maint/Lib/distutils/unixccompiler.py	(original)
+++ stackless/branches/release25-maint/Lib/distutils/unixccompiler.py	Tue May  8 11:04:01 2007
@@ -82,7 +82,7 @@
         except ValueError:
             pass
 
-    # Check if the SDK that is used during compilation actually exists, 
+    # Check if the SDK that is used during compilation actually exists,
     # the universal build requires the usage of a universal SDK and not all
     # users have that installed by default.
     sysroot = None

Modified: stackless/branches/release25-maint/Lib/email/__init__.py
==============================================================================
--- stackless/branches/release25-maint/Lib/email/__init__.py	(original)
+++ stackless/branches/release25-maint/Lib/email/__init__.py	Tue May  8 11:04:01 2007
@@ -4,7 +4,7 @@
 
 """A package for parsing, handling, and generating email messages."""
 
-__version__ = '4.0.1'
+__version__ = '4.0.2'
 
 __all__ = [
     # Old names

Modified: stackless/branches/release25-maint/Lib/encodings/utf_8_sig.py
==============================================================================
--- stackless/branches/release25-maint/Lib/encodings/utf_8_sig.py	(original)
+++ stackless/branches/release25-maint/Lib/encodings/utf_8_sig.py	Tue May  8 11:04:01 2007
@@ -44,14 +44,19 @@
         self.first = True
 
     def _buffer_decode(self, input, errors, final):
-        if self.first and codecs.BOM_UTF8.startswith(input): # might be a BOM
+        if self.first:
             if len(input) < 3:
-                # not enough data to decide if this really is a BOM
-                # => try again on the next call
-                return (u"", 0)
-            (output, consumed) = codecs.utf_8_decode(input[3:], errors, final)
-            self.first = False
-            return (output, consumed+3)
+                if codecs.BOM_UTF8.startswith(input):
+                    # not enough data to decide if this really is a BOM
+                    # => try again on the next call
+                    return (u"", 0)
+                else:
+                    self.first = None
+            else:
+                self.first = None
+                if input[:3] == codecs.BOM_UTF8:
+                    (output, consumed) = codecs.utf_8_decode(input[3:], errors, final)
+                    return (output, consumed+3)
         return codecs.utf_8_decode(input, errors, final)
 
     def reset(self):

Modified: stackless/branches/release25-maint/Lib/ftplib.py
==============================================================================
--- stackless/branches/release25-maint/Lib/ftplib.py	(original)
+++ stackless/branches/release25-maint/Lib/ftplib.py	Tue May  8 11:04:01 2007
@@ -332,7 +332,7 @@
             # 1xx or error messages for LIST), so we just discard
             # this response.
             if resp[0] == '2':
-               resp = self.getresp()
+                resp = self.getresp()
             if resp[0] != '1':
                 raise error_reply, resp
         else:
@@ -342,7 +342,7 @@
             resp = self.sendcmd(cmd)
             # See above.
             if resp[0] == '2':
-               resp = self.getresp()
+                resp = self.getresp()
             if resp[0] != '1':
                 raise error_reply, resp
             conn, sockaddr = sock.accept()

Modified: stackless/branches/release25-maint/Lib/lib-tk/tkSimpleDialog.py
==============================================================================
--- stackless/branches/release25-maint/Lib/lib-tk/tkSimpleDialog.py	(original)
+++ stackless/branches/release25-maint/Lib/lib-tk/tkSimpleDialog.py	Tue May  8 11:04:01 2007
@@ -50,9 +50,9 @@
         # If the master is not viewable, don't
         # make the child transient, or else it
         # would be opened withdrawn
-        if parent.winfo_viewable():  
+        if parent.winfo_viewable():
             self.transient(parent)
- 
+
         if title:
             self.title(title)
 

Modified: stackless/branches/release25-maint/Lib/locale.py
==============================================================================
--- stackless/branches/release25-maint/Lib/locale.py	(original)
+++ stackless/branches/release25-maint/Lib/locale.py	Tue May  8 11:04:01 2007
@@ -19,9 +19,11 @@
 
 # Yuck:  LC_MESSAGES is non-standard:  can't tell whether it exists before
 # trying the import.  So __all__ is also fiddled at the end of the file.
-__all__ = ["setlocale","Error","localeconv","strcoll","strxfrm",
-           "format","str","atof","atoi","LC_CTYPE","LC_COLLATE",
-           "LC_TIME","LC_MONETARY","LC_NUMERIC", "LC_ALL","CHAR_MAX"]
+__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
+           "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",
+           "str", "atof", "atoi", "format", "format_string", "currency",
+           "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
+           "LC_NUMERIC", "LC_ALL", "CHAR_MAX"]
 
 try:
 

Modified: stackless/branches/release25-maint/Lib/rexec.py
==============================================================================
--- stackless/branches/release25-maint/Lib/rexec.py	(original)
+++ stackless/branches/release25-maint/Lib/rexec.py	Tue May  8 11:04:01 2007
@@ -181,7 +181,7 @@
 
         """
 
-        raise RuntimeError, "This code is not secure in Python 2.2 and 2.3"
+        raise RuntimeError, "This code is not secure in Python 2.2 and later"
 
         ihooks._Verbose.__init__(self, verbose)
         # XXX There's a circular reference here:

Modified: stackless/branches/release25-maint/Lib/subprocess.py
==============================================================================
--- stackless/branches/release25-maint/Lib/subprocess.py	(original)
+++ stackless/branches/release25-maint/Lib/subprocess.py	Tue May  8 11:04:01 2007
@@ -596,7 +596,7 @@
         # either have to redirect all three or none. If the subprocess
         # user has only redirected one or two handles, we are
         # automatically creating PIPEs for the rest. We should close
-        # these after the process is started. See bug #1124861. 
+        # these after the process is started. See bug #1124861.
         if mswindows:
             if stdin is None and p2cwrite is not None:
                 os.close(p2cwrite)
@@ -628,7 +628,7 @@
         return data
 
 
-    def __del__(self):
+    def __del__(self, sys=sys):
         if not self._child_created:
             # We didn't get to successfully create a child process.
             return
@@ -1142,7 +1142,7 @@
                     # we can write up to PIPE_BUF bytes without risk
                     # blocking.  POSIX defines PIPE_BUF >= 512
                     bytes_written = os.write(self.stdin.fileno(), buffer(input, input_offset, 512))
-                    input_offset += bytes_written 
+                    input_offset += bytes_written
                     if input_offset >= len(input):
                         self.stdin.close()
                         write_set.remove(self.stdin)

Modified: stackless/branches/release25-maint/Lib/tarfile.py
==============================================================================
--- stackless/branches/release25-maint/Lib/tarfile.py	(original)
+++ stackless/branches/release25-maint/Lib/tarfile.py	Tue May  8 11:04:01 2007
@@ -963,7 +963,7 @@
             stn(prefix, 155)
         ]
 
-        buf += struct.pack("%ds" % BLOCKSIZE, "".join(parts))
+        buf += "".join(parts).ljust(BLOCKSIZE, NUL)
         chksum = calc_chksums(buf[-BLOCKSIZE:])[0]
         buf = buf[:-364] + "%06o\0" % chksum + buf[-357:]
         self.buf = buf
@@ -1044,7 +1044,9 @@
            can be determined, `mode' is overridden by `fileobj's mode.
            `fileobj' is not closed, when TarFile is closed.
         """
-        self.name = os.path.abspath(name)
+        self.name = name
+        if self.name is not None:
+            self.name = os.path.abspath(name)
 
         if len(mode) > 1 or mode not in "raw":
             raise ValueError("mode must be 'r', 'a' or 'w'")
@@ -1842,7 +1844,7 @@
             tarinfo.type = DIRTYPE
 
         # Directory names should have a '/' at the end.
-        if tarinfo.isdir():
+        if tarinfo.isdir() and not tarinfo.name.endswith("/"):
             tarinfo.name += "/"
 
         self.members.append(tarinfo)

Modified: stackless/branches/release25-maint/Lib/test/README
==============================================================================
--- stackless/branches/release25-maint/Lib/test/README	(original)
+++ stackless/branches/release25-maint/Lib/test/README	Tue May  8 11:04:01 2007
@@ -15,7 +15,7 @@
 one of these options.  Each option requires writing a test module using the
 conventions of the selected option:
 
-    - PyUnit_ based tests
+    - unittest_ based tests
     - doctest_ based tests
     - "traditional" Python test modules
 
@@ -28,27 +28,26 @@
 able to refer to the C and Python code in the CVS repository when writing
 your regression test cases.
 
-.. _PyUnit:
 .. _unittest: http://www.python.org/doc/current/lib/module-unittest.html
 .. _doctest: http://www.python.org/doc/current/lib/module-doctest.html
 
-PyUnit based tests
+unittest-based tests
 ------------------
-The PyUnit_ framework is based on the ideas of unit testing as espoused
+The unittest_ framework is based on the ideas of unit testing as espoused
 by Kent Beck and the `Extreme Programming`_ (XP) movement.  The specific
 interface provided by the framework is tightly based on the JUnit_
 Java implementation of Beck's original SmallTalk test framework.  Please
 see the documentation of the unittest_ module for detailed information on
-the interface and general guidelines on writing PyUnit based tests.
+the interface and general guidelines on writing unittest-based tests.
 
 The test_support helper module provides two functions for use by
-PyUnit based tests in the Python regression testing framework:
+unittest-based tests in the Python regression testing framework:
 
-- ``run_unittest()`` takes a ``unittest.TestCase`` derived class as a
-  parameter and runs the tests defined in that class
+- ``run_unittest()`` takes a number of ``unittest.TestCase`` derived class as
+  parameters and runs the tests defined in those classes.
    
 - ``run_suite()`` takes a populated ``TestSuite`` instance and runs the
-  tests
+  tests.
    
 ``run_suite()`` is preferred because unittest files typically grow multiple
 test classes, and you might as well be prepared.
@@ -63,7 +62,7 @@
 latter information makes it easier to find the source for the test
 than the docstring.
 
-All PyUnit-based tests in the Python test suite use boilerplate that
+All unittest-based tests in the Python test suite use boilerplate that
 looks like this (with minor variations)::
 
     import unittest
@@ -415,7 +414,7 @@
       This is rarely required with the "traditional" Python tests, and
       you shouldn't create a module global with name test_main unless
       you're specifically exploiting this gimmick.  This usage does
-      prove useful with PyUnit-based tests as well, however; defining
+      prove useful with unittest-based tests as well, however; defining
       a ``test_main()`` which is run by regrtest and a script-stub in the
       test module ("``if __name__ == '__main__': test_main()``") allows
       the test to be used like any other Python test and also work

Modified: stackless/branches/release25-maint/Lib/test/string_tests.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/string_tests.py	(original)
+++ stackless/branches/release25-maint/Lib/test/string_tests.py	Tue May  8 11:04:01 2007
@@ -2,7 +2,7 @@
 Common tests shared by test_str, test_unicode, test_userstring and test_string.
 """
 
-import unittest, string, sys
+import unittest, string, sys, struct
 from test import test_support
 from UserList import UserList
 
@@ -671,7 +671,7 @@
 
     def test_replace_overflow(self):
         # Check for overflow checking on 32 bit machines
-        if sys.maxint != 2147483647:
+        if sys.maxint != 2147483647 or struct.calcsize("P") > 4:
             return
         A2_16 = "A" * (2**16)
         self.checkraises(OverflowError, A2_16, "replace", "", A2_16)

Modified: stackless/branches/release25-maint/Lib/test/test_codecs.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_codecs.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_codecs.py	Tue May  8 11:04:01 2007
@@ -430,6 +430,11 @@
         # SF bug #1601501: check that the codec works with a buffer
         unicode("\xef\xbb\xbf", "utf-8-sig")
 
+    def test_bom(self):
+        d = codecs.getincrementaldecoder("utf-8-sig")()
+        s = u"spam"
+        self.assertEqual(d.decode(s.encode("utf-8-sig")), s)
+
 class EscapeDecodeTest(unittest.TestCase):
     def test_empty(self):
         self.assertEquals(codecs.escape_decode(""), ("", 0))
@@ -916,7 +921,7 @@
         self.assertEquals(f.readlines(), [u'\ud55c\n', u'\uae00'])
 
 class EncodedFileTest(unittest.TestCase):
-    
+
     def test_basic(self):
         f = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80')
         ef = codecs.EncodedFile(f, 'utf-16-le', 'utf-8')

Modified: stackless/branches/release25-maint/Lib/test/test_curses.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_curses.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_curses.py	Tue May  8 11:04:01 2007
@@ -245,7 +245,7 @@
     if hasattr(curses, 'resizeterm'):
         lines, cols = curses.LINES, curses.COLS
         curses.resizeterm(lines - 1, cols + 1)
-        
+
         if curses.LINES != lines - 1 or curses.COLS != cols + 1:
             raise RuntimeError, "Expected resizeterm to update LINES and COLS"
 

Modified: stackless/branches/release25-maint/Lib/test/test_descr.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_descr.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_descr.py	Tue May  8 11:04:01 2007
@@ -1216,7 +1216,7 @@
     except NameError:
         pass
     else:
-        # _unicode_to_string used to modify slots in certain circumstances 
+        # _unicode_to_string used to modify slots in certain circumstances
         slots = (unicode("foo"), unicode("bar"))
         class C(object):
             __slots__ = slots
@@ -1231,7 +1231,7 @@
         except (TypeError, UnicodeEncodeError):
             pass
         else:
-            raise TestFailed, "[unichr(128)] slots not caught" 
+            raise TestFailed, "[unichr(128)] slots not caught"
 
     # Test leaks
     class Counted(object):

Modified: stackless/branches/release25-maint/Lib/test/test_format.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_format.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_format.py	Tue May  8 11:04:01 2007
@@ -1,5 +1,7 @@
 from test.test_support import verbose, have_unicode, TestFailed
 import sys
+from test.test_support import MAX_Py_ssize_t
+maxsize = MAX_Py_ssize_t
 
 # test string formatting operator (I am not sure if this is being tested
 # elsewhere but, surely, some of the given cases are *not* tested because
@@ -238,11 +240,11 @@
 test_exc('%o', Foobar(), TypeError,
          "expected string or Unicode object, long found")
 
-if sys.maxint == 2**31-1:
+if maxsize == 2**31-1:
     # crashes 2.2.1 and earlier:
     try:
-        "%*d"%(sys.maxint, -127)
+        "%*d"%(maxsize, -127)
     except MemoryError:
         pass
     else:
-        raise TestFailed, '"%*d"%(sys.maxint, -127) should fail'
+        raise TestFailed, '"%*d"%(maxsize, -127) should fail'

Modified: stackless/branches/release25-maint/Lib/test/test_import.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_import.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_import.py	Tue May  8 11:04:01 2007
@@ -224,13 +224,13 @@
 test_import_initless_directory_warning()
 
 def test_infinite_reload():
-     # Bug #742342 reports that Python segfaults (infinite recursion in C)
-     #  when faced with self-recursive reload()ing.
+    # Bug #742342 reports that Python segfaults (infinite recursion in C)
+    #  when faced with self-recursive reload()ing.
 
-     sys.path.insert(0, os.path.dirname(__file__))
-     try:
-         import infinite_reload
-     finally:
-         sys.path.pop(0)
+    sys.path.insert(0, os.path.dirname(__file__))
+    try:
+        import infinite_reload
+    finally:
+        sys.path.pop(0)
 
 test_infinite_reload()

Modified: stackless/branches/release25-maint/Lib/test/test_index.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_index.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_index.py	Tue May  8 11:04:01 2007
@@ -1,7 +1,10 @@
 import unittest
 from test import test_support
 import operator
+import sys
 from sys import maxint
+maxsize = test_support.MAX_Py_ssize_t
+minsize = -maxsize-1
 
 class oldstyle:
     def __index__(self):
@@ -185,7 +188,7 @@
     def _getitem_helper(self, base):
         class GetItem(base):
             def __len__(self):
-                return maxint
+                return maxint #cannot return long here
             def __getitem__(self, key):
                 return key
             def __getslice__(self, i, j):
@@ -193,8 +196,8 @@
         x = GetItem()
         self.assertEqual(x[self.pos], self.pos)
         self.assertEqual(x[self.neg], self.neg)
-        self.assertEqual(x[self.neg:self.pos], (-1, maxint))
-        self.assertEqual(x[self.neg:self.pos:1].indices(maxint), (0, maxint, 1))
+        self.assertEqual(x[self.neg:self.pos], (maxint+minsize, maxsize))
+        self.assertEqual(x[self.neg:self.pos:1].indices(maxsize), (0, maxsize, 1))
 
     def test_getitem(self):
         self._getitem_helper(object)

Modified: stackless/branches/release25-maint/Lib/test/test_itertools.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_itertools.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_itertools.py	Tue May  8 11:04:01 2007
@@ -5,6 +5,8 @@
 import sys
 import operator
 import random
+maxsize = test_support.MAX_Py_ssize_t
+minsize = -maxsize-1
 
 def onearg(x):
     'Test function of one argument'
@@ -52,7 +54,7 @@
         self.assertEqual(take(2, zip('abc',count(3))), [('a', 3), ('b', 4)])
         self.assertRaises(TypeError, count, 2, 3)
         self.assertRaises(TypeError, count, 'a')
-        self.assertRaises(OverflowError, list, islice(count(sys.maxint-5), 10))
+        self.assertRaises(OverflowError, list, islice(count(maxsize-5), 10))
         c = count(3)
         self.assertEqual(repr(c), 'count(3)')
         c.next()
@@ -285,7 +287,7 @@
         self.assertRaises(ValueError, islice, xrange(10), 1, 'a')
         self.assertRaises(ValueError, islice, xrange(10), 'a', 1, 1)
         self.assertRaises(ValueError, islice, xrange(10), 1, 'a', 1)
-        self.assertEqual(len(list(islice(count(), 1, 10, sys.maxint))), 1)
+        self.assertEqual(len(list(islice(count(), 1, 10, maxsize))), 1)
 
     def test_takewhile(self):
         data = [1, 3, 5, 20, 2, 4, 6, 8]

Modified: stackless/branches/release25-maint/Lib/test/test_locale.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_locale.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_locale.py	Tue May  8 11:04:01 2007
@@ -7,7 +7,7 @@
 oldlocale = locale.setlocale(locale.LC_NUMERIC)
 
 if sys.platform.startswith("win"):
-    tlocs = ("en",)
+    tlocs = ("En", "English")
 else:
     tlocs = ("en_US.UTF-8", "en_US.US-ASCII", "en_US")
 

Modified: stackless/branches/release25-maint/Lib/test/test_mailbox.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_mailbox.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_mailbox.py	Tue May  8 11:04:01 2007
@@ -681,11 +681,11 @@
         box = self._factory(self._path, factory=dummy_factory)
         folder = box.add_folder('folder1')
         self.assert_(folder._factory is dummy_factory)
-        
+
         folder1_alias = box.get_folder('folder1')
         self.assert_(folder1_alias._factory is dummy_factory)
 
-        
+
 
 class _TestMboxMMDF(TestMailbox):
 
@@ -767,15 +767,15 @@
         key1 = self._box.add(msg)
         self._box.flush()
         self._box.close()
-        
+
         self._box = self._factory(self._path)
         self._box.lock()
         key2 = self._box.add(msg)
         self._box.flush()
         self.assert_(self._box._locked)
         self._box.close()
-        
-        
+
+
 
 class TestMbox(_TestMboxMMDF):
 
@@ -805,7 +805,7 @@
         def dummy_factory (s):
             return None
         self._box = self._factory(self._path, dummy_factory)
-        
+
         new_folder = self._box.add_folder('foo.bar')
         folder0 = self._box.get_folder('foo.bar')
         folder0.add(self._template % 'bar')
@@ -901,7 +901,7 @@
         self.assert_(self._box.get_sequences() ==
                      {'foo':[1, 2, 3, 4, 5],
                       'unseen':[1], 'bar':[3], 'replied':[3]})
-        
+
     def _get_lock_path(self):
         return os.path.join(self._path, '.mh_sequences.lock')
 

Modified: stackless/branches/release25-maint/Lib/test/test_old_mailbox.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_old_mailbox.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_old_mailbox.py	Tue May  8 11:04:01 2007
@@ -116,7 +116,7 @@
 
     def tearDown(self):
         os.unlink(self._path)
-    
+
     def test_from_regex (self):
         # Testing new regex from bug #1633678
         f = open(self._path, 'w')

Modified: stackless/branches/release25-maint/Lib/test/test_pty.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_pty.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_pty.py	Tue May  8 11:04:01 2007
@@ -115,6 +115,24 @@
     os._exit(4)
 else:
     debug("Waiting for child (%d) to finish."%pid)
+    # In verbose mode, we have to consume the debug output from the child or
+    # the child will block, causing this test to hang in the parent's
+    # waitpid() call.  The child blocks after a platform-dependent amount of
+    # data is written to its fd.  On Linux 2.6, it's 4000 bytes and the child
+    # won't block, but on OS X even the small writes in the child above will
+    # block it.  Also on Linux, the read() will throw an OSError (input/output
+    # error) when it tries to read past the end of the buffer but the child's
+    # already exited, so catch and discard those exceptions.  It's not worth
+    # checking for EIO.
+    while True:
+        try:
+            data = os.read(master_fd, 80)
+        except OSError:
+            break
+        if not data:
+            break
+        sys.stdout.write(data.replace('\r\n', '\n'))
+
     ##line = os.read(master_fd, 80)
     ##lines = line.replace('\r\n', '\n').split('\n')
     ##if False and lines != ['In child, calling os.setsid()',

Modified: stackless/branches/release25-maint/Lib/test/test_re.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_re.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_re.py	Tue May  8 11:04:01 2007
@@ -610,7 +610,7 @@
         for typecode in 'cbBuhHiIlLfd':
             a = array.array(typecode)
             self.assertEqual(re.compile("bla").match(a), None)
-            self.assertEqual(re.compile("").match(a).groups(), ())            
+            self.assertEqual(re.compile("").match(a).groups(), ())
 
 def run_re_tests():
     from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR

Modified: stackless/branches/release25-maint/Lib/test/test_sax.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_sax.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_sax.py	Tue May  8 11:04:01 2007
@@ -252,7 +252,7 @@
     gen.endDocument()
 
     return result.getvalue() == start+'<my:a xmlns:my="qux" b="c"></my:a>'
-    
+
 # ===== Xmlfilterbase
 
 def test_filter_basic():

Modified: stackless/branches/release25-maint/Lib/test/test_set.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_set.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_set.py	Tue May  8 11:04:01 2007
@@ -288,7 +288,7 @@
         self.assertEqual(sum(elem.hash_count for elem in d), n)
         if hasattr(s, 'symmetric_difference_update'):
             s.symmetric_difference_update(d)
-        self.assertEqual(sum(elem.hash_count for elem in d), n)     
+        self.assertEqual(sum(elem.hash_count for elem in d), n)
         d2 = dict.fromkeys(set(d))
         self.assertEqual(sum(elem.hash_count for elem in d), n)
         d3 = dict.fromkeys(frozenset(d))
@@ -500,7 +500,7 @@
         set.__init__(self, iterable)
 
 class TestSetSubclassWithKeywordArgs(TestSet):
-    
+
     def test_keywords_in_subclass(self):
         'SF bug #1486663 -- this used to erroneously raise a TypeError'
         SetSubclassWithKeywordArgs(newarg=1)
@@ -1487,7 +1487,7 @@
     test_classes = (
         TestSet,
         TestSetSubclass,
-        TestSetSubclassWithKeywordArgs,        
+        TestSetSubclassWithKeywordArgs,
         TestFrozenSet,
         TestFrozenSetSubclass,
         TestSetOfSets,

Modified: stackless/branches/release25-maint/Lib/test/test_strptime.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_strptime.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_strptime.py	Tue May  8 11:04:01 2007
@@ -505,6 +505,35 @@
         self.failIfEqual(locale_time_id,
                          id(_strptime._TimeRE_cache.locale_time))
 
+    def test_TimeRE_recreation(self):
+        # The TimeRE instance should be recreated upon changing the locale.
+        locale_info = locale.getlocale(locale.LC_TIME)
+        try:
+            locale.setlocale(locale.LC_TIME, ('en_US', 'UTF8'))
+        except locale.Error:
+            return
+        try:
+            _strptime.strptime('10', '%d')
+            # Get id of current cache object.
+            first_time_re_id = id(_strptime._TimeRE_cache)
+            try:
+                # Change the locale and force a recreation of the cache.
+                locale.setlocale(locale.LC_TIME, ('de_DE', 'UTF8'))
+                _strptime.strptime('10', '%d')
+                # Get the new cache object's id.
+                second_time_re_id = id(_strptime._TimeRE_cache)
+                # They should not be equal.
+                self.failIfEqual(first_time_re_id, second_time_re_id)
+            # Possible test locale is not supported while initial locale is.
+            # If this is the case just suppress the exception and fall-through
+            # to the reseting to the original locale.
+            except locale.Error:
+                pass
+        # Make sure we don't trample on the locale setting once we leave the
+        # test.
+        finally:
+            locale.setlocale(locale.LC_TIME, locale_info)
+
 
 def test_main():
     test_support.run_unittest(

Modified: stackless/branches/release25-maint/Lib/test/test_syntax.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_syntax.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_syntax.py	Tue May  8 11:04:01 2007
@@ -373,7 +373,7 @@
    ... elif 1:
    ...   pass
    Traceback (most recent call last):
-     ... 
+     ...
    SyntaxError: can't assign to function call (<doctest test.test_syntax[44]>, line 2)
 
    >>> if 1:
@@ -381,7 +381,7 @@
    ... elif 1:
    ...   x() = 1
    Traceback (most recent call last):
-     ... 
+     ...
    SyntaxError: can't assign to function call (<doctest test.test_syntax[45]>, line 4)
 
    >>> if 1:
@@ -391,7 +391,7 @@
    ... else:
    ...   pass
    Traceback (most recent call last):
-     ... 
+     ...
    SyntaxError: can't assign to function call (<doctest test.test_syntax[46]>, line 2)
 
    >>> if 1:
@@ -401,7 +401,7 @@
    ... else:
    ...   pass
    Traceback (most recent call last):
-     ... 
+     ...
    SyntaxError: can't assign to function call (<doctest test.test_syntax[47]>, line 4)
 
    >>> if 1:
@@ -411,7 +411,7 @@
    ... else:
    ...   x() = 1
    Traceback (most recent call last):
-     ... 
+     ...
    SyntaxError: can't assign to function call (<doctest test.test_syntax[48]>, line 6)
 
 """

Modified: stackless/branches/release25-maint/Lib/test/test_tarfile.py
==============================================================================
--- stackless/branches/release25-maint/Lib/test/test_tarfile.py	(original)
+++ stackless/branches/release25-maint/Lib/test/test_tarfile.py	Tue May  8 11:04:01 2007
@@ -191,6 +191,13 @@
             except:
                 pass
 
+    def test_dirtype(self):
+        for tarinfo in self.tar:
+            if tarinfo.isdir():
+                self.assert_(tarinfo.name.endswith("/"))
+                self.assert_(not tarinfo.name[:-1].endswith("/"))
+
+
 class ReadStreamTest(ReadTest):
     sep = "|"
 
@@ -626,15 +633,21 @@
         self.assertEqual(tarfile.filemode(07111), '---s--s--t')
 
 class OpenFileobjTest(BaseTest):
-    # Test for SF bug #1496501.
 
     def test_opener(self):
+        # Test for SF bug #1496501.
         fobj = StringIO.StringIO("foo\n")
         try:
-            tarfile.open("", "r", fileobj=fobj)
+            tarfile.open("", mode="r", fileobj=fobj)
         except tarfile.ReadError:
             self.assertEqual(fobj.tell(), 0, "fileobj's position has moved")
 
+    def test_fileobj(self):
+        # Test for SF bug #1695229, opening a tarfile without
+        # a name argument.
+        tarfile.open(mode="r", fileobj=open(tarname("")))
+        tarfile.TarFile(mode="r", fileobj=open(tarname("")))
+
 if bz2:
     # Bzip2 TestCases
     class ReadTestBzip2(ReadTestGzip):

Modified: stackless/branches/release25-maint/Lib/urllib2.py
==============================================================================
--- stackless/branches/release25-maint/Lib/urllib2.py	(original)
+++ stackless/branches/release25-maint/Lib/urllib2.py	Tue May  8 11:04:01 2007
@@ -55,7 +55,10 @@
 
 # set up authentication info
 authinfo = urllib2.HTTPBasicAuthHandler()
-authinfo.add_password('realm', 'host', 'username', 'password')
+authinfo.add_password(realm='PDQ Application',
+                      uri='https://mahler:8092/site-updates.py',
+                      user='klem',
+                      passwd='geheim$parole')
 
 proxy_support = urllib2.ProxyHandler({"http" : "http://ahad-haam:3128"})
 

Modified: stackless/branches/release25-maint/Misc/NEWS
==============================================================================
--- stackless/branches/release25-maint/Misc/NEWS	(original)
+++ stackless/branches/release25-maint/Misc/NEWS	Tue May  8 11:04:01 2007
@@ -4,6 +4,37 @@
 
 (editors: check NEWS.help for information about editing NEWS using ReST.)
 
+What's New in Python 2.5.2c1?
+=============================
+
+*Release date: XX-XXX-XXXX*
+
+Library
+-------
+
+- Bug #1290505: Properly clear time.strptime's locale cache when the locale
+  changes between calls.  Backport of r54646 and r54647.
+
+- Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
+  (as opposed to the command line) will now write file names ending in
+  ".cpp" too.
+
+- Patch #1695229: Fix a regression with tarfile.open() and a missing name
+  argument.
+
+- tarfile.py: Fix directory names to have only one trailing slash.
+
+- Fix test_pty.py to not hang on OS X (and theoretically other *nixes) when
+  run in verbose mode.
+
+
+Documentation
+-------------
+
+- Bug #1569057: Document that calling file.next() on a file open for writing
+  has undefined behaviour.  Backport of r54712.
+
+
 What's New in Python 2.5.1?
 =============================
 
@@ -483,6 +514,8 @@
 Documentation
 -------------
 
+- Patch #1698768: updated the "using Python on the Mac" intro.
+
 - Patch #1489771: the syntax rules in Python Reference Manual were
   updated to reflect the current Python syntax.
 
@@ -588,6 +621,8 @@
 - Fix bsddb test_basics.test06_Transactions to check the version
   number properly.
 
+- Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
+  first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
 
 Documentation
 -------------

Modified: stackless/branches/release25-maint/Misc/build.sh
==============================================================================
--- stackless/branches/release25-maint/Misc/build.sh	(original)
+++ stackless/branches/release25-maint/Misc/build.sh	Tue May  8 11:04:01 2007
@@ -47,11 +47,12 @@
 FAILURE_SUBJECT="Python Regression Test Failures"
 #FAILURE_MAILTO="YOUR_ACCOUNT at gmail.com"
 FAILURE_MAILTO="python-checkins at python.org"
+#FAILURE_CC="optional--uncomment and set to desired address"
 
 REMOTE_SYSTEM="neal at dinsdale.python.org"
-REMOTE_DIR="/data/ftp.python.org/pub/docs.python.org/dev/"
+REMOTE_DIR="/data/ftp.python.org/pub/docs.python.org/dev/2.5"
 RESULT_FILE="$DIR/build/index.html"
-INSTALL_DIR="/tmp/python-test/local"
+INSTALL_DIR="/tmp/python-test-2.5/local"
 RSYNC_OPTS="-aC -e ssh"
 
 # Always run the installed version of Python.
@@ -66,7 +67,7 @@
 # Note: test_XXX (none currently) really leak, but are disabled
 # so we don't send spam.  Any test which really leaks should only 
 # be listed here if there are also test cases under Lib/test/leakers.
-LEAKY_TESTS="test_(XXX)"  # Currently no tests should report spurious leaks.
+LEAKY_TESTS="test_(cmd_line|socket)"
 
 # Skip these tests altogether when looking for leaks.  These tests
 # do not need to be stored above in LEAKY_TESTS too.
@@ -76,7 +77,7 @@
 LEAKY_SKIPS="-x test_compiler test_logging"
 
 # Change this flag to "yes" for old releases to only update/build the docs.
-BUILD_DISABLED="no"
+BUILD_DISABLED="yes"
 
 ## utility functions
 current_time() {
@@ -91,7 +92,12 @@
 
 mail_on_failure() {
     if [ "$NUM_FAILURES" != "0" ]; then
-        mutt -s "$FAILURE_SUBJECT $1 ($NUM_FAILURES)" $FAILURE_MAILTO < $2
+        dest=$FAILURE_MAILTO
+        # FAILURE_CC is optional.
+        if [ "$FAILURE_CC" != "" ]; then
+            dest="$dest -c $FAILURE_CC"
+        fi
+        mutt -s "$FAILURE_SUBJECT $1 ($NUM_FAILURES)" $dest < $2
     fi
 }
 
@@ -208,8 +214,19 @@
 cd $DIR/Doc
 F="make-doc.out"
 start=`current_time`
-make >& ../build/$F
-err=$?
+# Doc/commontex/boilerplate.tex is expected to always have an outstanding
+# modification for the date.  When a release is cut, a conflict occurs.
+# This allows us to detect this problem and not try to build the docs
+# which will definitely fail with a conflict. 
+CONFLICTED_FILE=commontex/boilerplate.tex
+conflict_count=`grep -c "<<<" $CONFLICTED_FILE`
+if [ $conflict_count != 0 ]; then
+    echo "Conflict detected in $CONFLICTED_FILE.  Doc build skipped." > ../build/$F
+    err=1
+else
+    make >& ../build/$F
+    err=$?
+fi
 update_status "Making doc" "$F" $start
 if [ $err != 0 ]; then
     NUM_FAILURES=1

Modified: stackless/branches/release25-maint/Modules/_ctypes/callproc.c
==============================================================================
--- stackless/branches/release25-maint/Modules/_ctypes/callproc.c	(original)
+++ stackless/branches/release25-maint/Modules/_ctypes/callproc.c	Tue May  8 11:04:01 2007
@@ -64,6 +64,7 @@
 
 #ifdef MS_WIN32
 #include <windows.h>
+#include <tchar.h>
 #else
 #include "ctypes_dlfcn.h"
 #endif
@@ -97,9 +98,9 @@
 			  0,
 			  NULL);
 	if (n) {
-		while (isspace(lpMsgBuf[n-1]))
+		while (_istspace(lpMsgBuf[n-1]))
 			--n;
-		lpMsgBuf[n] = '\0'; /* rstrip() */
+		lpMsgBuf[n] = _T('\0'); /* rstrip() */
 	}
 	return lpMsgBuf;
 }
@@ -538,8 +539,10 @@
 		size += 1; /* terminating NUL */
 		size *= sizeof(wchar_t);
 		pa->value.p = PyMem_Malloc(size);
-		if (!pa->value.p)
+		if (!pa->value.p) {
+			PyErr_NoMemory();
 			return -1;
+		}
 		memset(pa->value.p, 0, size);
 		pa->keep = PyCObject_FromVoidPtr(pa->value.p, PyMem_Free);
 		if (!pa->keep) {

Modified: stackless/branches/release25-maint/Modules/_ctypes/cfield.c
==============================================================================
--- stackless/branches/release25-maint/Modules/_ctypes/cfield.c	(original)
+++ stackless/branches/release25-maint/Modules/_ctypes/cfield.c	Tue May  8 11:04:01 2007
@@ -1333,7 +1333,7 @@
 		if (IsBadStringPtrA(*(char **)ptr, -1)) {
 			PyErr_Format(PyExc_ValueError,
 				     "invalid string pointer %p",
-				     ptr);
+				     *(char **)ptr);
 			return NULL;
 		}
 #endif
@@ -1389,7 +1389,7 @@
 		size *= sizeof(wchar_t);
 		buffer = (wchar_t *)PyMem_Malloc(size);
 		if (!buffer)
-			return NULL;
+			return PyErr_NoMemory();
 		memset(buffer, 0, size);
 		keep = PyCObject_FromVoidPtr(buffer, PyMem_Free);
 		if (!keep) {
@@ -1414,9 +1414,17 @@
 {
 	wchar_t *p;
 	p = *(wchar_t **)ptr;
-	if (p)
+	if (p) {
+#if defined(MS_WIN32) && !defined(_WIN32_WCE)
+		if (IsBadStringPtrW(*(wchar_t **)ptr, -1)) {
+			PyErr_Format(PyExc_ValueError,
+				     "invalid string pointer %p",
+				     *(wchar_t **)ptr);
+			return NULL;
+		}
+#endif
 		return PyUnicode_FromWideChar(p, wcslen(p));
-	else {
+	} else {
 		Py_INCREF(Py_None);
 		return Py_None;
 	}

Modified: stackless/branches/release25-maint/Modules/_ctypes/stgdict.c
==============================================================================
--- stackless/branches/release25-maint/Modules/_ctypes/stgdict.c	(original)
+++ stackless/branches/release25-maint/Modules/_ctypes/stgdict.c	Tue May  8 11:04:01 2007
@@ -72,8 +72,10 @@
 		return 0;
 	size = sizeof(ffi_type *) * (src->length + 1);
 	dst->ffi_type_pointer.elements = PyMem_Malloc(size);
-	if (dst->ffi_type_pointer.elements == NULL)
+	if (dst->ffi_type_pointer.elements == NULL) {
+		PyErr_NoMemory();
 		return -1;
+	}
 	memcpy(dst->ffi_type_pointer.elements,
 	       src->ffi_type_pointer.elements,
 	       size);
@@ -359,6 +361,10 @@
 		total_align = align ? align : 1;
 		stgdict->ffi_type_pointer.type = FFI_TYPE_STRUCT;
 		stgdict->ffi_type_pointer.elements = PyMem_Malloc(sizeof(ffi_type *) * (basedict->length + len + 1));
+		if (stgdict->ffi_type_pointer.elements == NULL) {
+			PyErr_NoMemory();
+			return -1;
+		}
 		memset(stgdict->ffi_type_pointer.elements, 0,
 		       sizeof(ffi_type *) * (basedict->length + len + 1));
 		memcpy(stgdict->ffi_type_pointer.elements,
@@ -373,6 +379,10 @@
 		total_align = 1;
 		stgdict->ffi_type_pointer.type = FFI_TYPE_STRUCT;
 		stgdict->ffi_type_pointer.elements = PyMem_Malloc(sizeof(ffi_type *) * (len + 1));
+		if (stgdict->ffi_type_pointer.elements == NULL) {
+			PyErr_NoMemory();
+			return -1;
+		}
 		memset(stgdict->ffi_type_pointer.elements, 0,
 		       sizeof(ffi_type *) * (len + 1));
 		ffi_ofs = 0;

Modified: stackless/branches/release25-maint/Modules/binascii.c
==============================================================================
--- stackless/branches/release25-maint/Modules/binascii.c	(original)
+++ stackless/branches/release25-maint/Modules/binascii.c	Tue May  8 11:04:01 2007
@@ -1160,12 +1160,14 @@
 		if ((data[in] > 126) ||
 		    (data[in] == '=') ||
 		    (header && data[in] == '_') ||
-		    ((data[in] == '.') && (linelen == 1)) ||
+		    ((data[in] == '.') && (linelen == 0) &&
+		     (data[in+1] == '\n' || data[in+1] == '\r' || data[in+1] == 0)) ||
 		    (!istext && ((data[in] == '\r') || (data[in] == '\n'))) ||
 		    ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) ||
 		    ((data[in] < 33) &&
 		     (data[in] != '\r') && (data[in] != '\n') &&
-		     (quotetabs && ((data[in] != '\t') || (data[in] != ' ')))))
+		     (quotetabs ||
+		     	(!quotetabs && ((data[in] != '\t') && (data[in] != ' '))))))
 		{
 			if ((linelen + 3) >= MAXLINESIZE) {
 				linelen = 0;
@@ -1230,12 +1232,14 @@
 		if ((data[in] > 126) ||
 		    (data[in] == '=') ||
 		    (header && data[in] == '_') ||
-		    ((data[in] == '.') && (linelen == 1)) ||
+		    ((data[in] == '.') && (linelen == 0) &&
+		     (data[in+1] == '\n' || data[in+1] == '\r' || data[in+1] == 0)) ||
 		    (!istext && ((data[in] == '\r') || (data[in] == '\n'))) ||
 		    ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) ||
 		    ((data[in] < 33) &&
 		     (data[in] != '\r') && (data[in] != '\n') &&
-		     (quotetabs && ((data[in] != '\t') || (data[in] != ' ')))))
+		     (quotetabs ||
+		     	(!quotetabs && ((data[in] != '\t') && (data[in] != ' '))))))
 		{
 			if ((linelen + 3 )>= MAXLINESIZE) {
 				odata[out++] = '=';

Modified: stackless/branches/release25-maint/Modules/cPickle.c
==============================================================================
--- stackless/branches/release25-maint/Modules/cPickle.c	(original)
+++ stackless/branches/release25-maint/Modules/cPickle.c	Tue May  8 11:04:01 2007
@@ -538,11 +538,12 @@
 		self->buf_size = size;
 	}
 	else if (n > self->buf_size) {
-		self->buf = (char *)realloc(self->buf, n);
-		if (!self->buf)  {
+		char *newbuf = (char *)realloc(self->buf, n);
+		if (!newbuf)  {
 			PyErr_NoMemory();
 			return -1;
 		}
+		self->buf = newbuf;
 		self->buf_size = n;
 	}
 
@@ -581,6 +582,7 @@
 	i = 0;
 	while (1) {
 		int bigger;
+		char *newbuf;
 		for (; i < (self->buf_size - 1); i++) {
 			if (feof(self->fp) ||
 			    (self->buf[i] = getc(self->fp)) == '\n') {
@@ -594,11 +596,12 @@
 			PyErr_NoMemory();
 			return -1;
 		}
-		self->buf = (char *)realloc(self->buf, bigger);
-		if (!self->buf)  {
+		newbuf = (char *)realloc(self->buf, bigger);
+		if (!newbuf)  {
 			PyErr_NoMemory();
 			return -1;
 		}
+		self->buf = newbuf;
 		self->buf_size = bigger;
 	}
 }
@@ -4437,17 +4440,19 @@
 	*/
 
 	if ((self->num_marks + 1) >= self->marks_size) {
+		int *marks;
 		s=self->marks_size+20;
 		if (s <= self->num_marks) s=self->num_marks + 1;
 		if (self->marks == NULL)
-			self->marks=(int *)malloc(s * sizeof(int));
+			marks=(int *)malloc(s * sizeof(int));
 		else
-			self->marks=(int *)realloc(self->marks,
+			marks=(int *)realloc(self->marks,
 						   s * sizeof(int));
-		if (! self->marks) {
+		if (!marks) {
 			PyErr_NoMemory();
 			return -1;
 		}
+		self->marks = marks;
 		self->marks_size = s;
 	}
 

Modified: stackless/branches/release25-maint/Modules/cStringIO.c
==============================================================================
--- stackless/branches/release25-maint/Modules/cStringIO.c	(original)
+++ stackless/branches/release25-maint/Modules/cStringIO.c	Tue May  8 11:04:01 2007
@@ -339,13 +339,17 @@
         }
 
         if (position > self->buf_size) {
+                  char *newbuf;
                   self->buf_size*=2;
                   if (self->buf_size <= position) self->buf_size=position+1;
-		  self->buf = (char*) realloc(self->buf,self->buf_size);
-                  if (!self->buf) {
+		  newbuf = (char*) realloc(self->buf,self->buf_size);
+                  if (!newbuf) {
+                      free(self->buf);
+                      self->buf = 0;
                       self->buf_size=self->pos=0;
                       return PyErr_NoMemory();
                     }
+                  self->buf = newbuf;
           }
         else if (position < 0) position=0;
 
@@ -366,6 +370,7 @@
 O_cwrite(PyObject *self, const char *c, Py_ssize_t  l) {
         Py_ssize_t newl;
         Oobject *oself;
+        char *newbuf;
 
         if (!IO__opencheck(IOOOBJECT(self))) return -1;
         oself = (Oobject *)self;
@@ -377,12 +382,15 @@
 		    assert(newl + 1 < INT_MAX);
                     oself->buf_size = (int)(newl+1);
 	    }
-            oself->buf = (char*)realloc(oself->buf, oself->buf_size);
-	    if (!oself->buf) {
+            newbuf = (char*)realloc(oself->buf, oself->buf_size);
+	    if (!newbuf) {
                     PyErr_SetString(PyExc_MemoryError,"out of memory");
+                    free(oself->buf);
+                    oself->buf = 0;
                     oself->buf_size = oself->pos = 0;
                     return -1;
               }
+            oself->buf = newbuf;
           }
 
         memcpy(oself->buf+oself->pos,c,l);

Modified: stackless/branches/release25-maint/Modules/itertoolsmodule.c
==============================================================================
--- stackless/branches/release25-maint/Modules/itertoolsmodule.c	(original)
+++ stackless/branches/release25-maint/Modules/itertoolsmodule.c	Tue May  8 11:04:01 2007
@@ -2073,9 +2073,9 @@
 static PyObject *
 count_next(countobject *lz)
 {
-        if (lz->cnt == LONG_MAX) {
+        if (lz->cnt == PY_SSIZE_T_MAX) {
                 PyErr_SetString(PyExc_OverflowError,
-                        "cannot count beyond LONG_MAX");                
+                        "cannot count beyond PY_SSIZE_T_MAX");                
                 return NULL;         
         }
 	return PyInt_FromSsize_t(lz->cnt++);

Modified: stackless/branches/release25-maint/Modules/posixmodule.c
==============================================================================
--- stackless/branches/release25-maint/Modules/posixmodule.c	(original)
+++ stackless/branches/release25-maint/Modules/posixmodule.c	Tue May  8 11:04:01 2007
@@ -4788,18 +4788,19 @@
 			        (sizeof(modulepath)/sizeof(modulepath[0]))
 			               -strlen(modulepath));
 			if (stat(modulepath, &statinfo) != 0) {
+				size_t mplen = sizeof(modulepath)/sizeof(modulepath[0]);
 				/* Eeek - file-not-found - possibly an embedding
 				   situation - see if we can locate it in sys.prefix
 				*/
 				strncpy(modulepath,
 				        Py_GetExecPrefix(),
-				        sizeof(modulepath)/sizeof(modulepath[0]));
+				        mplen);
+				modulepath[mplen-1] = '\0';
 				if (modulepath[strlen(modulepath)-1] != '\\')
 					strcat(modulepath, "\\");
 				strncat(modulepath,
 				        szConsoleSpawn,
-				        (sizeof(modulepath)/sizeof(modulepath[0]))
-				               -strlen(modulepath));
+				        mplen-strlen(modulepath));
 				/* No where else to look - raise an easily identifiable
 				   error, rather than leaving Windows to report
 				   "file not found" - as the user is probably blissfully
@@ -6169,16 +6170,23 @@
 posix_fdopen(PyObject *self, PyObject *args)
 {
 	int fd;
-	char *mode = "r";
+	char *orgmode = "r";
 	int bufsize = -1;
 	FILE *fp;
 	PyObject *f;
-	if (!PyArg_ParseTuple(args, "i|si", &fd, &mode, &bufsize))
+	char *mode;
+	if (!PyArg_ParseTuple(args, "i|si", &fd, &orgmode, &bufsize))
 		return NULL;
 
-	if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') {
-		PyErr_Format(PyExc_ValueError,
-			     "invalid file mode '%s'", mode);
+	/* Sanitize mode.  See fileobject.c */
+	mode = PyMem_MALLOC(strlen(orgmode)+3);
+	if (!mode) {
+		PyErr_NoMemory();
+		return NULL;
+	}
+	strcpy(mode, orgmode);
+	if (_PyFile_SanitizeMode(mode)) {
+		PyMem_FREE(mode);
 		return NULL;
 	}
 	Py_BEGIN_ALLOW_THREADS
@@ -6199,10 +6207,11 @@
 #else
 	fp = fdopen(fd, mode);
 #endif
+	PyMem_FREE(mode);
 	Py_END_ALLOW_THREADS
 	if (fp == NULL)
 		return posix_error();
-	f = PyFile_FromFile(fp, "<fdopen>", mode, fclose);
+	f = PyFile_FromFile(fp, "<fdopen>", orgmode, fclose);
 	if (f != NULL)
 		PyFile_SetBufSize(f, bufsize);
 	return f;

Modified: stackless/branches/release25-maint/Objects/classobject.c
==============================================================================
--- stackless/branches/release25-maint/Objects/classobject.c	(original)
+++ stackless/branches/release25-maint/Objects/classobject.c	Tue May  8 11:04:01 2007
@@ -1540,6 +1540,18 @@
 	return generic_unary_op(self, o); \
 }
 
+/* unary function with a fallback */
+#define UNARY_FB(funcname, methodname, funcname_fb) \
+static PyObject *funcname(PyInstanceObject *self) { \
+	static PyObject *o; \
+	if (o == NULL) { o = PyString_InternFromString(methodname); \
+			 if (o == NULL) return NULL; } \
+	if (PyObject_HasAttr((PyObject*)self, o)) \
+		return generic_unary_op(self, o); \
+	else \
+		return funcname_fb(self); \
+}
+
 #define BINARY(f, m, n) \
 static PyObject *f(PyObject *v, PyObject *w) { \
 	return do_binop(v, w, "__" m "__", "__r" m "__", n); \
@@ -1778,7 +1790,7 @@
 
 UNARY(instance_invert, "__invert__")
 UNARY(instance_int, "__int__")
-UNARY(instance_long, "__long__")
+UNARY_FB(instance_long, "__long__", instance_int)
 UNARY(instance_float, "__float__")
 UNARY(instance_oct, "__oct__")
 UNARY(instance_hex, "__hex__")

Modified: stackless/branches/release25-maint/Objects/exceptions.c
==============================================================================
--- stackless/branches/release25-maint/Objects/exceptions.c	(original)
+++ stackless/branches/release25-maint/Objects/exceptions.c	Tue May  8 11:04:01 2007
@@ -33,6 +33,8 @@
     PyBaseExceptionObject *self;
 
     self = (PyBaseExceptionObject *)type->tp_alloc(type, 0);
+    if (!self)
+        return NULL;
     /* the dict is created on the fly in PyObject_GenericSetAttr */
     self->message = self->dict = NULL;
 

Modified: stackless/branches/release25-maint/Objects/fileobject.c
==============================================================================
--- stackless/branches/release25-maint/Objects/fileobject.c	(original)
+++ stackless/branches/release25-maint/Objects/fileobject.c	Tue May  8 11:04:01 2007
@@ -139,17 +139,16 @@
    ignore stuff they don't understand... write or append mode with
    universal newline support is expressly forbidden by PEP 278.
    Additionally, remove the 'U' from the mode string as platforms
-   won't know what it is. */
-/* zero return is kewl - one is un-kewl */
-static int
-sanitize_the_mode(char *mode)
+   won't know what it is. Non-zero return signals an exception */
+int
+_PyFile_SanitizeMode(char *mode)
 {
 	char *upos;
 	size_t len = strlen(mode);
 
 	if (!len) {
 		PyErr_SetString(PyExc_ValueError, "empty mode string");
-		return 1;
+		return -1;
 	}
 
 	upos = strchr(mode, 'U');
@@ -160,7 +159,7 @@
 			PyErr_Format(PyExc_ValueError, "universal newline "
 			             "mode can only be used with modes "
 				     "starting with 'r'");
-			return 1;
+			return -1;
 		}
 
 		if (mode[0] != 'r') {
@@ -175,7 +174,7 @@
 	} else if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') {
 		PyErr_Format(PyExc_ValueError, "mode string must begin with "
 	        	    "one of 'r', 'w', 'a' or 'U', not '%.200s'", mode);
-		return 1;
+		return -1;
 	}
 
 	return 0;
@@ -204,7 +203,7 @@
 	}
 	strcpy(newmode, mode);
 
-	if (sanitize_the_mode(newmode)) {
+	if (_PyFile_SanitizeMode(newmode)) {
 		f = NULL;
 		goto cleanup;
 	}

Modified: stackless/branches/release25-maint/Objects/longobject.c
==============================================================================
--- stackless/branches/release25-maint/Objects/longobject.c	(original)
+++ stackless/branches/release25-maint/Objects/longobject.c	Tue May  8 11:04:01 2007
@@ -893,7 +893,7 @@
 	int one = 1;
 	return _PyLong_FromByteArray(
 			(unsigned char *)&bytes,
-			SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 0);
+			SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 1);
 }
 
 /* Create a new long int object from a C size_t. */
@@ -1739,6 +1739,8 @@
 	     a->ob_digit[size_a-1] < b->ob_digit[size_b-1])) {
 		/* |a| < |b|. */
 		*pdiv = _PyLong_New(0);
+		if (*pdiv == NULL)
+			return -1;
 		Py_INCREF(a);
 		*prem = (PyLongObject *) a;
 		return 0;
@@ -1749,6 +1751,10 @@
 		if (z == NULL)
 			return -1;
 		*prem = (PyLongObject *) PyLong_FromLong((long)rem);
+		if (*prem == NULL) {
+			Py_DECREF(z);
+			return -1;
+		}
 	}
 	else {
 		z = x_divrem(a, b, prem);
@@ -3204,6 +3210,8 @@
 {
 	if (PyInt_Check(*pw)) {
 		*pw = PyLong_FromLong(PyInt_AS_LONG(*pw));
+		if (*pw == NULL)
+			return -1;
 		Py_INCREF(*pv);
 		return 0;
 	}

Modified: stackless/branches/release25-maint/PC/_winreg.c
==============================================================================
--- stackless/branches/release25-maint/PC/_winreg.c	(original)
+++ stackless/branches/release25-maint/PC/_winreg.c	Tue May  8 11:04:01 2007
@@ -699,7 +699,7 @@
 		case REG_DWORD:
 			if (value != Py_None && !PyInt_Check(value))
 				return FALSE;
-			*retDataBuf = (BYTE *)PyMem_NEW(DWORD, sizeof(DWORD));
+			*retDataBuf = (BYTE *)PyMem_NEW(DWORD, 1);
 			if (*retDataBuf==NULL){
 				PyErr_NoMemory();
 				return FALSE;

Modified: stackless/branches/release25-maint/Python/dynload_win.c
==============================================================================
--- stackless/branches/release25-maint/Python/dynload_win.c	(original)
+++ stackless/branches/release25-maint/Python/dynload_win.c	Tue May  8 11:04:01 2007
@@ -13,16 +13,8 @@
 const struct filedescr _PyImport_DynLoadFiletab[] = {
 #ifdef _DEBUG
 	{"_d.pyd", "rb", C_EXTENSION},
-	/* Temporarily disable .dll, to avoid conflicts between sqlite3.dll
-	   and the sqlite3 package. If this needs to be reverted for 2.5,
-	   some other solution for the naming conflict must be found.
-	{"_d.dll", "rb", C_EXTENSION},
-	*/
 #else
 	{".pyd", "rb", C_EXTENSION},
-	/* Likewise
-	{".dll", "rb", C_EXTENSION},
-	*/
 #endif
 	{0, 0}
 };

Modified: stackless/branches/release25-maint/Python/thread_nt.h
==============================================================================
--- stackless/branches/release25-maint/Python/thread_nt.h	(original)
+++ stackless/branches/release25-maint/Python/thread_nt.h	Tue May  8 11:04:01 2007
@@ -15,14 +15,14 @@
 	HANDLE hevent ;
 } NRMUTEX, *PNRMUTEX ;
 
-typedef PVOID WINAPI interlocked_cmp_xchg_t(PVOID *dest, PVOID exc, PVOID comperand) ;
+typedef LONG WINAPI interlocked_cmp_xchg_t(LONG volatile *dest, LONG exc, LONG comperand) ;
 
 /* Sorry mate, but we haven't got InterlockedCompareExchange in Win95! */
-static PVOID WINAPI
-interlocked_cmp_xchg(PVOID *dest, PVOID exc, PVOID comperand)
+static LONG WINAPI
+interlocked_cmp_xchg(LONG volatile *dest, LONG exc, LONG comperand)
 {
 	static LONG spinlock = 0 ;
-	PVOID result ;
+	LONG result ;
 	DWORD dwSleep = 0;
 
 	/* Acqire spinlock (yielding control to other threads if cant aquire for the moment) */
@@ -76,10 +76,12 @@
 	return mutex->hevent != NULL ;	/* TRUE if the mutex is created */
 }
 
+#ifndef MS_WIN64
 #ifdef InterlockedCompareExchange
 #undef InterlockedCompareExchange
 #endif
 #define InterlockedCompareExchange(dest,exchange,comperand) (ixchg((dest), (exchange), (comperand)))
+#endif
 
 VOID
 DeleteNonRecursiveMutex(PNRMUTEX mutex)
@@ -98,7 +100,7 @@
 	/* InterlockedIncrement(&mutex->owned) == 0 means that no thread currently owns the mutex */
 	if (!wait)
 	{
-		if (InterlockedCompareExchange((PVOID *)&mutex->owned, (PVOID)0, (PVOID)-1) != (PVOID)-1)
+		if (InterlockedCompareExchange(&mutex->owned, 0, -1) != -1)
 			return WAIT_TIMEOUT ;
 		ret = WAIT_OBJECT_0 ;
 	}
@@ -202,12 +204,12 @@
 		 * too many threads".
 		 */
 		dprintf(("%ld: PyThread_start_new_thread failed: %p errno %d\n",
-		         PyThread_get_thread_ident(), rv, errno));
+		         PyThread_get_thread_ident(), (void*)rv, errno));
 		obj.id = -1;
 	}
 	else {
 		dprintf(("%ld: PyThread_start_new_thread succeeded: %p\n",
-		         PyThread_get_thread_ident(), rv));
+		         PyThread_get_thread_ident(), (void*)rv));
 		/* wait for thread to initialize, so we can get its id */
 		WaitForSingleObject(obj.done, INFINITE);
 		assert(obj.id != -1);
@@ -333,7 +335,7 @@
 	dprintf(("%ld: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
 
 	if (!(aLock && LeaveNonRecursiveMutex((PNRMUTEX) aLock)))
-		dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n", PyThread_get_thread_ident(), aLock, GetLastError()));
+		dprintf(("%ld: Could not PyThread_release_lock(%p) error: %ld\n", PyThread_get_thread_ident(), aLock, GetLastError()));
 }
 
 /* minimum/maximum thread stack sizes supported */

_______________________________________________
Stackless-checkins mailing list
Stackless-checkins at stackless.com
http://www.stackless.com/mailman/listinfo/stackless-checkins



More information about the Stackless-checkins mailing list