[Python-checkins] r73266 - in python/branches/tk_and_idle_maintenance: Doc/c-api/list.rst Doc/howto/sockets.rst Doc/includes/email-unpack.py Doc/includes/mp_pool.py Doc/includes/mp_synchronize.py Doc/library/crypt.rst Doc/library/fcntl.rst Doc/library/imputil.rst Doc/library/logging.rst Doc/library/platform.rst Doc/library/rexec.rst Doc/library/shutil.rst Doc/library/signal.rst Doc/library/socket.rst Doc/library/tkinter.rst Doc/reference/simple_stmts.rst Doc/tools/roman.py Doc/tools/sphinxext/suspicious.py Doc/tutorial/controlflow.rst Doc/whatsnew/2.6.rst Lib/asyncore.py Lib/distutils/command/bdist_msi.py Lib/distutils/command/install.py Lib/distutils/extension.py Lib/distutils/tests/Setup.sample Lib/distutils/tests/test_extension.py Lib/distutils/tests/test_install.py Lib/imputil.py Lib/shutil.py Lib/test/formatfloat_testcases.txt Lib/test/test__locale.py Lib/test/test_pep352.py Lib/test/test_traceback.py Lib/test/test_unittest.py Lib/test/test_with.py Lib/traceback.py Lib/xmlrpclib.py Misc/NEWS Objects/dictobject.c Objects/unicodeobject.c

guilherme.polo python-checkins at python.org
Sun Jun 7 00:03:16 CEST 2009


Author: guilherme.polo
Date: Sun Jun  7 00:03:15 2009
New Revision: 73266

Log:
Merged revisions 73163,73166,73170,73174,73182,73184,73186,73190,73196-73197,73201,73206,73212-73213,73215,73217,73224,73232,73238,73240,73243,73247,73250,73252,73257-73258,73260 via svnmerge from 
svn+ssh://pythondev/python/trunk

........
  r73163 | georg.brandl | 2009-06-03 04:25:35 -0300 (Wed, 03 Jun 2009) | 1 line
  
  Use the preferred form of raise statements in the docs.
........
  r73166 | tarek.ziade | 2009-06-03 07:26:26 -0300 (Wed, 03 Jun 2009) | 1 line
  
  added some tests for distutils.extension + code cleanup
........
  r73170 | tarek.ziade | 2009-06-03 08:12:08 -0300 (Wed, 03 Jun 2009) | 1 line
  
  more cleanup and test coverage for distutils.extension
........
  r73174 | tarek.ziade | 2009-06-03 08:20:44 -0300 (Wed, 03 Jun 2009) | 1 line
  
  assertion message was dropped
........
  r73182 | josiah.carlson | 2009-06-03 16:46:21 -0300 (Wed, 03 Jun 2009) | 4 lines
  
  This fixes bug 5798 on OS X.
  This should also fix disconnect behavior cross-platform.
........
  r73184 | josiah.carlson | 2009-06-03 16:51:52 -0300 (Wed, 03 Jun 2009) | 2 lines
  
  Fix for line wrap ugly.
........
  r73186 | georg.brandl | 2009-06-03 18:21:09 -0300 (Wed, 03 Jun 2009) | 1 line
  
  #6174: fix indentation in code example.
........
  r73190 | georg.brandl | 2009-06-03 20:23:45 -0300 (Wed, 03 Jun 2009) | 2 lines
  
  Avoid PendingDeprecationWarnings emitted by deprecated unittest methods.
........
  r73196 | benjamin.peterson | 2009-06-03 22:40:29 -0300 (Wed, 03 Jun 2009) | 1 line
  
  use the offical api
........
  r73197 | tarek.ziade | 2009-06-04 04:31:52 -0300 (Thu, 04 Jun 2009) | 1 line
  
  improved test coverage for distutils.command.install and cleaned it up
........
  r73201 | georg.brandl | 2009-06-04 05:58:32 -0300 (Thu, 04 Jun 2009) | 1 line
  
  #5767: remove sgmlop support from xmlrpclib; the sgmlop parser does not do much validation and is no longer much faster than e.g. the cElementTree XMLParser.
........
  r73206 | georg.brandl | 2009-06-04 06:15:12 -0300 (Thu, 04 Jun 2009) | 1 line
  
  #3584: ignore trailing newlines when placing the caret for a SyntaxError location.
........
  r73212 | georg.brandl | 2009-06-04 07:10:41 -0300 (Thu, 04 Jun 2009) | 1 line
  
  Better name for "Ctor".
........
  r73213 | georg.brandl | 2009-06-04 07:15:57 -0300 (Thu, 04 Jun 2009) | 1 line
  
  #5967: note that the C slicing APIs do not support negative indices.
........
  r73215 | georg.brandl | 2009-06-04 07:22:31 -0300 (Thu, 04 Jun 2009) | 1 line
  
  #6176: fix man page section for flock(2).
........
  r73217 | georg.brandl | 2009-06-04 07:27:21 -0300 (Thu, 04 Jun 2009) | 1 line
  
  #6175: document that inet_aton supports alternate input formats with less than three dots.
........
  r73224 | eric.smith | 2009-06-04 14:58:15 -0300 (Thu, 04 Jun 2009) | 1 line
  
  Minor documentation fixes for logging.
........
  r73232 | georg.brandl | 2009-06-04 15:59:58 -0300 (Thu, 04 Jun 2009) | 1 line
  
  Add test for #3684.
........
  r73238 | hirokazu.yamamoto | 2009-06-05 02:15:58 -0300 (Fri, 05 Jun 2009) | 1 line
  
  Fix test__locale on windows (Backport of r72365)
........
  r73240 | eric.smith | 2009-06-05 09:33:26 -0300 (Fri, 05 Jun 2009) | 1 line
  
  Removed tests so that test_float pass on Windows. See issue 6198.
........
  r73243 | tarek.ziade | 2009-06-05 10:37:29 -0300 (Fri, 05 Jun 2009) | 1 line
  
  reverting r72823 : Python trunk has to use latin-1 encoding
........
  r73247 | michael.foord | 2009-06-05 11:14:34 -0300 (Fri, 05 Jun 2009) | 1 line
  
  Fix unittest discovery tests for Windows. Issue 6199
........
  r73250 | benjamin.peterson | 2009-06-05 16:09:28 -0300 (Fri, 05 Jun 2009) | 1 line
  
  only test for named pipe when os.stat doesn't raise #6209
........
  r73252 | georg.brandl | 2009-06-06 02:54:34 -0300 (Sat, 06 Jun 2009) | 1 line
  
  #6206: fix test__locale.
........
  r73257 | georg.brandl | 2009-06-06 14:50:05 -0300 (Sat, 06 Jun 2009) | 1 line
  
  #6211: elaborate a bit on ways to call the function.
........
  r73258 | georg.brandl | 2009-06-06 14:51:31 -0300 (Sat, 06 Jun 2009) | 1 line
  
  #6204: use a real reference instead of "see later".
........
  r73260 | georg.brandl | 2009-06-06 15:21:58 -0300 (Sat, 06 Jun 2009) | 1 line
  
  #6224: s/JPython/Jython/, and remove one link to a module nine years old.
........


Added:
   python/branches/tk_and_idle_maintenance/Lib/distutils/tests/Setup.sample
      - copied unchanged from r73260, /python/trunk/Lib/distutils/tests/Setup.sample
   python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_extension.py
      - copied unchanged from r73260, /python/trunk/Lib/distutils/tests/test_extension.py
Modified:
   python/branches/tk_and_idle_maintenance/   (props changed)
   python/branches/tk_and_idle_maintenance/Doc/c-api/list.rst
   python/branches/tk_and_idle_maintenance/Doc/howto/sockets.rst
   python/branches/tk_and_idle_maintenance/Doc/includes/email-unpack.py
   python/branches/tk_and_idle_maintenance/Doc/includes/mp_pool.py
   python/branches/tk_and_idle_maintenance/Doc/includes/mp_synchronize.py
   python/branches/tk_and_idle_maintenance/Doc/library/crypt.rst
   python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst
   python/branches/tk_and_idle_maintenance/Doc/library/imputil.rst
   python/branches/tk_and_idle_maintenance/Doc/library/logging.rst
   python/branches/tk_and_idle_maintenance/Doc/library/platform.rst
   python/branches/tk_and_idle_maintenance/Doc/library/rexec.rst
   python/branches/tk_and_idle_maintenance/Doc/library/shutil.rst
   python/branches/tk_and_idle_maintenance/Doc/library/signal.rst
   python/branches/tk_and_idle_maintenance/Doc/library/socket.rst
   python/branches/tk_and_idle_maintenance/Doc/library/tkinter.rst
   python/branches/tk_and_idle_maintenance/Doc/reference/simple_stmts.rst
   python/branches/tk_and_idle_maintenance/Doc/tools/roman.py
   python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/suspicious.py
   python/branches/tk_and_idle_maintenance/Doc/tutorial/controlflow.rst
   python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.6.rst
   python/branches/tk_and_idle_maintenance/Lib/asyncore.py
   python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py
   python/branches/tk_and_idle_maintenance/Lib/distutils/command/install.py
   python/branches/tk_and_idle_maintenance/Lib/distutils/extension.py
   python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_install.py
   python/branches/tk_and_idle_maintenance/Lib/imputil.py
   python/branches/tk_and_idle_maintenance/Lib/shutil.py
   python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt
   python/branches/tk_and_idle_maintenance/Lib/test/test__locale.py
   python/branches/tk_and_idle_maintenance/Lib/test/test_pep352.py
   python/branches/tk_and_idle_maintenance/Lib/test/test_traceback.py
   python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py
   python/branches/tk_and_idle_maintenance/Lib/test/test_with.py
   python/branches/tk_and_idle_maintenance/Lib/traceback.py
   python/branches/tk_and_idle_maintenance/Lib/xmlrpclib.py
   python/branches/tk_and_idle_maintenance/Misc/NEWS
   python/branches/tk_and_idle_maintenance/Objects/dictobject.c
   python/branches/tk_and_idle_maintenance/Objects/unicodeobject.c

Modified: python/branches/tk_and_idle_maintenance/Doc/c-api/list.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/c-api/list.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/c-api/list.rst	Sun Jun  7 00:03:15 2009
@@ -149,9 +149,10 @@
 
 .. cfunction:: PyObject* PyList_GetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high)
 
-   Return a list of the objects in *list* containing the objects *between*
-   *low* and *high*.  Return *NULL* and set an exception if unsuccessful.
-   Analogous to ``list[low:high]``.
+   Return a list of the objects in *list* containing the objects *between* *low*
+   and *high*.  Return *NULL* and set an exception if unsuccessful.  Analogous
+   to ``list[low:high]``.  Negative indices, as when slicing from Python, are not
+   supported.
 
    .. versionchanged:: 2.5
       This function used an :ctype:`int` for *low* and *high*. This might
@@ -163,7 +164,8 @@
    Set the slice of *list* between *low* and *high* to the contents of
    *itemlist*.  Analogous to ``list[low:high] = itemlist``. The *itemlist* may
    be *NULL*, indicating the assignment of an empty list (slice deletion).
-   Return ``0`` on success, ``-1`` on failure.
+   Return ``0`` on success, ``-1`` on failure.  Negative indices, as when
+   slicing from Python, are not supported.
 
    .. versionchanged:: 2.5
       This function used an :ctype:`int` for *low* and *high*. This might

Modified: python/branches/tk_and_idle_maintenance/Doc/howto/sockets.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/howto/sockets.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/howto/sockets.rst	Sun Jun  7 00:03:15 2009
@@ -204,8 +204,7 @@
            while totalsent < MSGLEN:
                sent = self.sock.send(msg[totalsent:])
                if sent == 0:
-                   raise RuntimeError, \
-                       "socket connection broken"
+                   raise RuntimeError("socket connection broken")
                totalsent = totalsent + sent
 
        def myreceive(self):
@@ -213,8 +212,7 @@
            while len(msg) < MSGLEN:
                chunk = self.sock.recv(MSGLEN-len(msg))
                if chunk == '':
-                   raise RuntimeError, \
-                       "socket connection broken"
+                   raise RuntimeError("socket connection broken")
                msg = msg + chunk
            return msg
 

Modified: python/branches/tk_and_idle_maintenance/Doc/includes/email-unpack.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/includes/email-unpack.py	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/includes/email-unpack.py	Sun Jun  7 00:03:15 2009
@@ -37,7 +37,7 @@
         os.mkdir(opts.directory)
     except OSError, e:
         # Ignore directory exists error
-        if e.errno <> errno.EEXIST:
+        if e.errno != errno.EEXIST:
             raise
 
     fp = open(msgfile)

Modified: python/branches/tk_and_idle_maintenance/Doc/includes/mp_pool.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/includes/mp_pool.py	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/includes/mp_pool.py	Sun Jun  7 00:03:15 2009
@@ -149,21 +149,21 @@
     except ZeroDivisionError:
         print '\tGot ZeroDivisionError as expected from pool.apply()'
     else:
-        raise AssertionError, 'expected ZeroDivisionError'
+        raise AssertionError('expected ZeroDivisionError')
 
     try:
         print pool.map(f, range(10))
     except ZeroDivisionError:
         print '\tGot ZeroDivisionError as expected from pool.map()'
     else:
-        raise AssertionError, 'expected ZeroDivisionError'
+        raise AssertionError('expected ZeroDivisionError')
 
     try:
         print list(pool.imap(f, range(10)))
     except ZeroDivisionError:
         print '\tGot ZeroDivisionError as expected from list(pool.imap())'
     else:
-        raise AssertionError, 'expected ZeroDivisionError'
+        raise AssertionError('expected ZeroDivisionError')
 
     it = pool.imap(f, range(10))
     for i in range(10):
@@ -176,7 +176,7 @@
             break
         else:
             if i == 5:
-                raise AssertionError, 'expected ZeroDivisionError'
+                raise AssertionError('expected ZeroDivisionError')
 
     assert i == 9
     print '\tGot ZeroDivisionError as expected from IMapIterator.next()'

Modified: python/branches/tk_and_idle_maintenance/Doc/includes/mp_synchronize.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/includes/mp_synchronize.py	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/includes/mp_synchronize.py	Sun Jun  7 00:03:15 2009
@@ -249,7 +249,7 @@
         info = multiprocessing._debug_info()
         if info:
             print info
-            raise ValueError, 'there should be no positive refcounts left'
+            raise ValueError('there should be no positive refcounts left')
 
 
 if __name__ == '__main__':
@@ -271,6 +271,6 @@
         import multiprocessing.dummy as namespace
     else:
         print 'Usage:\n\t%s [processes | manager | threads]' % sys.argv[0]
-        raise SystemExit, 2
+        raise SystemExit(2)
 
     test(namespace)

Modified: python/branches/tk_and_idle_maintenance/Doc/library/crypt.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/library/crypt.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/library/crypt.rst	Sun Jun  7 00:03:15 2009
@@ -52,7 +52,8 @@
        cryptedpasswd = pwd.getpwnam(username)[1]
        if cryptedpasswd:
            if cryptedpasswd == 'x' or cryptedpasswd == '*':
-               raise "Sorry, currently no support for shadow passwords"
+               raise NotImplementedError(
+                   "Sorry, currently no support for shadow passwords")
            cleartext = getpass.getpass()
            return crypt.crypt(cleartext, cryptedpasswd) == cryptedpasswd
        else:

Modified: python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst	Sun Jun  7 00:03:15 2009
@@ -96,7 +96,7 @@
 
    Perform the lock operation *op* on file descriptor *fd* (file objects providing
    a :meth:`fileno` method are accepted as well). See the Unix manual
-   :manpage:`flock(3)` for details.  (On some systems, this function is emulated
+   :manpage:`flock(2)` for details.  (On some systems, this function is emulated
    using :cfunc:`fcntl`.)
 
 

Modified: python/branches/tk_and_idle_maintenance/Doc/library/imputil.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/library/imputil.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/library/imputil.rst	Sun Jun  7 00:03:15 2009
@@ -160,7 +160,7 @@
            parent = None
            q = import_module(head, qname, parent)
            if q: return q, tail
-       raise ImportError, "No module named " + qname
+       raise ImportError("No module named " + qname)
 
    def load_tail(q, tail):
        m = q
@@ -171,7 +171,7 @@
            mname = "%s.%s" % (m.__name__, head)
            m = import_module(head, mname, m)
            if not m:
-               raise ImportError, "No module named " + mname
+               raise ImportError("No module named " + mname)
        return m
 
    def ensure_fromlist(m, fromlist, recursive=0):
@@ -189,7 +189,7 @@
                subname = "%s.%s" % (m.__name__, sub)
                submod = import_module(sub, subname, m)
                if not submod:
-                   raise ImportError, "No module named " + subname
+                   raise ImportError("No module named " + subname)
 
    def import_module(partname, fqname, parent):
        try:

Modified: python/branches/tk_and_idle_maintenance/Doc/library/logging.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/library/logging.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/library/logging.rst	Sun Jun  7 00:03:15 2009
@@ -69,7 +69,7 @@
    DEBUG:root:This message should go to the log file
 
 If you run the script repeatedly, the additional log messages are appended to
-the file.  To create a new file each time, you can pass a filemode argument to
+the file.  To create a new file each time, you can pass a *filemode* argument to
 :func:`basicConfig` with a value of ``'w'``.  Rather than managing the file size
 yourself, though, it is simpler to use a :class:`RotatingFileHandler`::
 
@@ -112,7 +112,7 @@
 The most current file is always :file:`/tmp/logging_rotatingfile_example.out`,
 and each time it reaches the size limit it is renamed with the suffix
 ``.1``. Each of the existing backup files is renamed to increment the suffix
-(``.1`` becomes ``.2``, etc.)  and the ``.5`` file is erased.
+(``.1`` becomes ``.2``, etc.)  and the ``.6`` file is erased.
 
 Obviously this example sets the log length much much too small as an extreme
 example.  You would want to set *maxBytes* to an appropriate value.

Modified: python/branches/tk_and_idle_maintenance/Doc/library/platform.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/library/platform.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/library/platform.rst	Sun Jun  7 00:03:15 2009
@@ -169,7 +169,7 @@
 
 .. function:: java_ver(release='', vendor='', vminfo=('','',''), osinfo=('','',''))
 
-   Version interface for JPython.
+   Version interface for Jython.
 
    Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a
    tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple

Modified: python/branches/tk_and_idle_maintenance/Doc/library/rexec.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/library/rexec.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/library/rexec.rst	Sun Jun  7 00:03:15 2009
@@ -272,11 +272,11 @@
            elif mode in ('w', 'wb', 'a', 'ab'):
                # check filename : must begin with /tmp/
                if file[:5]!='/tmp/':
-                   raise IOError, "can't write outside /tmp"
+                   raise IOError("can't write outside /tmp")
                elif (string.find(file, '/../') >= 0 or
                     file[:3] == '../' or file[-3:] == '/..'):
-                   raise IOError, "'..' in filename forbidden"
-           else: raise IOError, "Illegal open() mode"
+                   raise IOError("'..' in filename forbidden")
+           else: raise IOError("Illegal open() mode")
            return open(file, mode, buf)
 
 Notice that the above code will occasionally forbid a perfectly valid filename;

Modified: python/branches/tk_and_idle_maintenance/Doc/library/shutil.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/library/shutil.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/library/shutil.rst	Sun Jun  7 00:03:15 2009
@@ -216,7 +216,7 @@
        except OSError, why:
            errors.extend((src, dst, str(why)))
        if errors:
-           raise Error, errors
+           raise Error(errors)
 
 Another example that uses the :func:`ignore_patterns` helper::
 

Modified: python/branches/tk_and_idle_maintenance/Doc/library/signal.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/library/signal.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/library/signal.rst	Sun Jun  7 00:03:15 2009
@@ -232,7 +232,7 @@
 
    def handler(signum, frame):
        print 'Signal handler called with signal', signum
-       raise IOError, "Couldn't open device!"
+       raise IOError("Couldn't open device!")
 
    # Set the signal handler and a 5-second alarm
    signal.signal(signal.SIGALRM, handler)

Modified: python/branches/tk_and_idle_maintenance/Doc/library/socket.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/library/socket.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/library/socket.rst	Sun Jun  7 00:03:15 2009
@@ -401,6 +401,9 @@
    library and needs objects of type :ctype:`struct in_addr`, which is the C type
    for the 32-bit packed binary this function returns.
 
+   :func:`inet_aton` also accepts strings with less than three dots; see the
+   Unix manual page :manpage:`inet(3)` for details.
+
    If the IPv4 address string passed to this function is invalid,
    :exc:`socket.error` will be raised. Note that exactly what is valid depends on
    the underlying C implementation of :cfunc:`inet_aton`.

Modified: python/branches/tk_and_idle_maintenance/Doc/library/tkinter.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/library/tkinter.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/library/tkinter.rst	Sun Jun  7 00:03:15 2009
@@ -29,9 +29,6 @@
    `Tkinter reference: a GUI for Python <http://infohost.nmt.edu/tcc/help/pubs/lang.html>`_
       On-line reference material.
 
-   `Tkinter for JPython <http://jtkinter.sourceforge.net>`_
-      The Jython interface to Tkinter.
-
    `Python and Tkinter Programming <http://www.amazon.com/exec/obidos/ASIN/1884777813>`_
       The book by John Grayson (ISBN 1-884777-81-3).
 

Modified: python/branches/tk_and_idle_maintenance/Doc/reference/simple_stmts.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/reference/simple_stmts.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/reference/simple_stmts.rst	Sun Jun  7 00:03:15 2009
@@ -288,7 +288,7 @@
 The extended form, ``assert expression1, expression2``, is equivalent to ::
 
    if __debug__:
-      if not expression1: raise AssertionError, expression2
+      if not expression1: raise AssertionError(expression2)
 
 .. index::
    single: __debug__

Modified: python/branches/tk_and_idle_maintenance/Doc/tools/roman.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/tools/roman.py	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/tools/roman.py	Sun Jun  7 00:03:15 2009
@@ -40,9 +40,9 @@
 def toRoman(n):
     """convert integer to Roman numeral"""
     if not (0 < n < 5000):
-        raise OutOfRangeError, "number out of range (must be 1..4999)"
-    if int(n) <> n:
-        raise NotIntegerError, "decimals can not be converted"
+        raise OutOfRangeError("number out of range (must be 1..4999)")
+    if int(n) != n:
+        raise NotIntegerError("decimals can not be converted")
 
     result = ""
     for numeral, integer in romanNumeralMap:
@@ -67,9 +67,9 @@
 def fromRoman(s):
     """convert Roman numeral to integer"""
     if not s:
-        raise InvalidRomanNumeralError, 'Input can not be blank'
+        raise InvalidRomanNumeralError('Input can not be blank')
     if not romanNumeralPattern.search(s):
-        raise InvalidRomanNumeralError, 'Invalid Roman numeral: %s' % s
+        raise InvalidRomanNumeralError('Invalid Roman numeral: %s' % s)
 
     result = 0
     index = 0

Modified: python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/suspicious.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/suspicious.py	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/suspicious.py	Sun Jun  7 00:03:15 2009
@@ -159,7 +159,7 @@
         except IOError: return
         for i, row in enumerate(csv.reader(f)):
             if len(row) != 4:
-                raise ValueError, "wrong format in %s, line %d: %s" % (filename, i+1, row)
+                raise ValueError("wrong format in %s, line %d: %s" % (filename, i+1, row))
             docname, lineno, issue, text = row
             docname = docname.decode('utf-8')
             if lineno: lineno = int(lineno)

Modified: python/branches/tk_and_idle_maintenance/Doc/tutorial/controlflow.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/tutorial/controlflow.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/tutorial/controlflow.rst	Sun Jun  7 00:03:15 2009
@@ -285,7 +285,7 @@
   and ``methodname`` is the name of a method that is defined by the object's type.
   Different types define different methods.  Methods of different types may have
   the same name without causing ambiguity.  (It is possible to define your own
-  object types and methods, using *classes*, as discussed later in this tutorial.)
+  object types and methods, using *classes*, see :ref:`tut-classes`)
   The method :meth:`append` shown in the example is defined for list objects; it
   adds a new element at the end of the list.  In this example it is equivalent to
   ``result = result + [b]``, but more efficient.
@@ -312,14 +312,23 @@
    def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
        while True:
            ok = raw_input(prompt)
-           if ok in ('y', 'ye', 'yes'): return True
-           if ok in ('n', 'no', 'nop', 'nope'): return False
+           if ok in ('y', 'ye', 'yes'):
+               return True
+           if ok in ('n', 'no', 'nop', 'nope'):
+               return False
            retries = retries - 1
-           if retries < 0: raise IOError('refusenik user')
+           if retries < 0:
+               raise IOError('refusenik user')
            print complaint
 
-This function can be called either like this: ``ask_ok('Do you really want to
-quit?')`` or like this: ``ask_ok('OK to overwrite the file?', 2)``.
+This function can be called in several ways:
+
+* giving only the mandatory argument:
+  ``ask_ok('Do you really want to quit?')``
+* giving one of the optional arguments:
+  ``ask_ok('OK to overwrite the file?', 2)``
+* or even giving all arguments:
+  ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!')``
 
 This example also introduces the :keyword:`in` keyword. This tests whether or
 not a sequence contains a certain value.

Modified: python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.6.rst
==============================================================================
--- python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.6.rst	(original)
+++ python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.6.rst	Sun Jun  7 00:03:15 2009
@@ -678,15 +678,15 @@
         for N in range(1, 1000, 10):
             p.apply_async(factorial, (N, d))
 
-    # Mark pool as closed -- no more tasks can be added.
-    p.close()
+        # Mark pool as closed -- no more tasks can be added.
+        p.close()
 
-    # Wait for tasks to exit
-    p.join()
+        # Wait for tasks to exit
+        p.join()
 
-    # Output results
-    for k, v in sorted(d.items()):
-        print k, v
+        # Output results
+        for k, v in sorted(d.items()):
+            print k, v
 
 This will produce the output::
 

Modified: python/branches/tk_and_idle_maintenance/Lib/asyncore.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/asyncore.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/asyncore.py	Sun Jun  7 00:03:15 2009
@@ -101,10 +101,15 @@
             obj.handle_read_event()
         if flags & select.POLLOUT:
             obj.handle_write_event()
-        if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
-            obj.handle_close()
         if flags & select.POLLPRI:
             obj.handle_expt_event()
+        if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
+            obj.handle_close()
+    except socket.error, e:
+        if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED):
+            obj.handle_error()
+        else:
+            obj.handle_close()
     except _reraised_exceptions:
         raise
     except:

Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py	Sun Jun  7 00:03:15 2009
@@ -1,5 +1,5 @@
-# -*- coding: utf-8 -*-
-# Copyright (C) 2005, 2006 Martin von Löwis
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2005, 2006 Martin von Löwis
 # Licensed to PSF under a Contributor Agreement.
 # The bdist_wininst command proper
 # based on bdist_wininst

Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/command/install.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/distutils/command/install.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/distutils/command/install.py	Sun Jun  7 00:03:15 2009
@@ -2,12 +2,12 @@
 
 Implements the Distutils 'install' command."""
 
-from distutils import log
-
 __revision__ = "$Id$"
 
-import sys, os, string
-from types import *
+import sys
+import os
+
+from distutils import log
 from distutils.core import Command
 from distutils.debug import DEBUG
 from distutils.sysconfig import get_config_vars
@@ -117,7 +117,7 @@
 SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')
 
 
-class install (Command):
+class install(Command):
 
     description = "install everything from build directory"
 
@@ -190,8 +190,8 @@
     negative_opt = {'no-compile' : 'compile'}
 
 
-    def initialize_options (self):
-
+    def initialize_options(self):
+        """Initializes options."""
         # High-level options: these select both an installation base
         # and scheme.
         self.prefix = None
@@ -267,8 +267,8 @@
     # party Python modules on various platforms given a wide
     # array of user input is decided.  Yes, it's quite complex!)
 
-    def finalize_options (self):
-
+    def finalize_options(self):
+        """Finalizes options."""
         # This method (and its pliant slaves, like 'finalize_unix()',
         # 'finalize_other()', and 'select_scheme()') is where the default
         # installation directories for modules, extension modules, and
@@ -326,7 +326,7 @@
         # $platbase in the other installation directories and not worry
         # about needing recursive variable expansion (shudder).
 
-        py_version = (string.split(sys.version))[0]
+        py_version = sys.version.split()[0]
         (prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')
         self.config_vars = {'dist_name': self.distribution.get_name(),
                             'dist_version': self.distribution.get_version(),
@@ -409,29 +409,27 @@
         # Punt on doc directories for now -- after all, we're punting on
         # documentation completely!
 
-    # finalize_options ()
-
-
-    def dump_dirs (self, msg):
-        if DEBUG:
-            from distutils.fancy_getopt import longopt_xlate
-            print msg + ":"
-            for opt in self.user_options:
-                opt_name = opt[0]
-                if opt_name[-1] == "=":
-                    opt_name = opt_name[0:-1]
-                if opt_name in self.negative_opt:
-                    opt_name = string.translate(self.negative_opt[opt_name],
-                                                longopt_xlate)
-                    val = not getattr(self, opt_name)
-                else:
-                    opt_name = string.translate(opt_name, longopt_xlate)
-                    val = getattr(self, opt_name)
-                print "  %s: %s" % (opt_name, val)
-
-
-    def finalize_unix (self):
+    def dump_dirs(self, msg):
+        """Dumps the list of user options."""
+        if not DEBUG:
+            return
+        from distutils.fancy_getopt import longopt_xlate
+        log.debug(msg + ":")
+        for opt in self.user_options:
+            opt_name = opt[0]
+            if opt_name[-1] == "=":
+                opt_name = opt_name[0:-1]
+            if opt_name in self.negative_opt:
+                opt_name = self.negative_opt[opt_name]
+                opt_name = opt_name.translate(longopt_xlate)
+                val = not getattr(self, opt_name)
+            else:
+                opt_name = opt_name.translate(longopt_xlate)
+                val = getattr(self, opt_name)
+            log.debug("  %s: %s" % (opt_name, val))
 
+    def finalize_unix(self):
+        """Finalizes options for posix platforms."""
         if self.install_base is not None or self.install_platbase is not None:
             if ((self.install_lib is None and
                  self.install_purelib is None and
@@ -470,11 +468,8 @@
             self.install_platbase = self.exec_prefix
             self.select_scheme("unix_prefix")
 
-    # finalize_unix ()
-
-
-    def finalize_other (self):          # Windows and Mac OS for now
-
+    def finalize_other(self):
+        """Finalizes options for non-posix platforms"""
         if self.user:
             if self.install_userbase is None:
                 raise DistutilsPlatformError(
@@ -495,10 +490,8 @@
                 raise DistutilsPlatformError, \
                       "I don't know how to install stuff on '%s'" % os.name
 
-    # finalize_other ()
-
-
-    def select_scheme (self, name):
+    def select_scheme(self, name):
+        """Sets the install directories by applying the install schemes."""
         # it's the caller's problem if they supply a bad name!
         scheme = INSTALL_SCHEMES[name]
         for key in SCHEME_KEYS:
@@ -506,8 +499,7 @@
             if getattr(self, attrname) is None:
                 setattr(self, attrname, scheme[key])
 
-
-    def _expand_attrs (self, attrs):
+    def _expand_attrs(self, attrs):
         for attr in attrs:
             val = getattr(self, attr)
             if val is not None:
@@ -516,40 +508,36 @@
                 val = subst_vars(val, self.config_vars)
                 setattr(self, attr, val)
 
+    def expand_basedirs(self):
+        """Calls `os.path.expanduser` on install_base, install_platbase and
+        root."""
+        self._expand_attrs(['install_base', 'install_platbase', 'root'])
+
+    def expand_dirs(self):
+        """Calls `os.path.expanduser` on install dirs."""
+        self._expand_attrs(['install_purelib', 'install_platlib',
+                            'install_lib', 'install_headers',
+                            'install_scripts', 'install_data',])
 
-    def expand_basedirs (self):
-        self._expand_attrs(['install_base',
-                            'install_platbase',
-                            'root'])
-
-    def expand_dirs (self):
-        self._expand_attrs(['install_purelib',
-                            'install_platlib',
-                            'install_lib',
-                            'install_headers',
-                            'install_scripts',
-                            'install_data',])
-
-
-    def convert_paths (self, *names):
+    def convert_paths(self, *names):
+        """Call `convert_path` over `names`."""
         for name in names:
             attr = "install_" + name
             setattr(self, attr, convert_path(getattr(self, attr)))
 
-
-    def handle_extra_path (self):
-
+    def handle_extra_path(self):
+        """Set `path_file` and `extra_dirs` using `extra_path`."""
         if self.extra_path is None:
             self.extra_path = self.distribution.extra_path
 
         if self.extra_path is not None:
-            if type(self.extra_path) is StringType:
-                self.extra_path = string.split(self.extra_path, ',')
+            if isinstance(self.extra_path, str):
+                self.extra_path = self.extra_path.split(',')
 
             if len(self.extra_path) == 1:
                 path_file = extra_dirs = self.extra_path[0]
             elif len(self.extra_path) == 2:
-                (path_file, extra_dirs) = self.extra_path
+                path_file, extra_dirs = self.extra_path
             else:
                 raise DistutilsOptionError, \
                       ("'extra_path' option must be a list, tuple, or "
@@ -558,7 +546,6 @@
             # convert to local form in case Unix notation used (as it
             # should be in setup scripts)
             extra_dirs = convert_path(extra_dirs)
-
         else:
             path_file = None
             extra_dirs = ''
@@ -568,17 +555,14 @@
         self.path_file = path_file
         self.extra_dirs = extra_dirs
 
-    # handle_extra_path ()
-
-
-    def change_roots (self, *names):
+    def change_roots(self, *names):
+        """Change the install direcories pointed by name using root."""
         for name in names:
             attr = "install_" + name
             setattr(self, attr, change_root(self.root, getattr(self, attr)))
 
     def create_home_path(self):
-        """Create directories under ~
-        """
+        """Create directories under ~."""
         if not self.user:
             return
         home = convert_path(os.path.expanduser("~"))
@@ -589,8 +573,8 @@
 
     # -- Command execution methods -------------------------------------
 
-    def run (self):
-
+    def run(self):
+        """Runs the command."""
         # Obviously have to build before we can install
         if not self.skip_build:
             self.run_command('build')
@@ -633,9 +617,8 @@
                        "you'll have to change the search path yourself"),
                        self.install_lib)
 
-    # run ()
-
-    def create_path_file (self):
+    def create_path_file(self):
+        """Creates the .pth file"""
         filename = os.path.join(self.install_libbase,
                                 self.path_file + ".pth")
         if self.install_path_file:
@@ -648,8 +631,8 @@
 
     # -- Reporting methods ---------------------------------------------
 
-    def get_outputs (self):
-        # Assemble the outputs of all the sub-commands.
+    def get_outputs(self):
+        """Assembles the outputs of all the sub-commands."""
         outputs = []
         for cmd_name in self.get_sub_commands():
             cmd = self.get_finalized_command(cmd_name)
@@ -665,7 +648,8 @@
 
         return outputs
 
-    def get_inputs (self):
+    def get_inputs(self):
+        """Returns the inputs of all the sub-commands"""
         # XXX gee, this looks familiar ;-(
         inputs = []
         for cmd_name in self.get_sub_commands():
@@ -674,25 +658,29 @@
 
         return inputs
 
-
     # -- Predicates for sub-command list -------------------------------
 
-    def has_lib (self):
-        """Return true if the current distribution has any Python
+    def has_lib(self):
+        """Returns true if the current distribution has any Python
         modules to install."""
         return (self.distribution.has_pure_modules() or
                 self.distribution.has_ext_modules())
 
-    def has_headers (self):
+    def has_headers(self):
+        """Returns true if the current distribution has any headers to
+        install."""
         return self.distribution.has_headers()
 
-    def has_scripts (self):
+    def has_scripts(self):
+        """Returns true if the current distribution has any scripts to.
+        install."""
         return self.distribution.has_scripts()
 
-    def has_data (self):
+    def has_data(self):
+        """Returns true if the current distribution has any data to.
+        install."""
         return self.distribution.has_data_files()
 
-
     # 'sub_commands': a list of commands this command might have to run to
     # get its work done.  See cmd.py for more info.
     sub_commands = [('install_lib',     has_lib),
@@ -701,5 +689,3 @@
                     ('install_data',    has_data),
                     ('install_egg_info', lambda self:True),
                    ]
-
-# class install

Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/extension.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/distutils/extension.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/distutils/extension.py	Sun Jun  7 00:03:15 2009
@@ -5,13 +5,9 @@
 
 __revision__ = "$Id$"
 
-import os, string, sys
-from types import *
-
-try:
-    import warnings
-except ImportError:
-    warnings = None
+import os
+import sys
+import warnings
 
 # This class is really only used by the "build_ext" command, so it might
 # make sense to put it in distutils.command.build_ext.  However, that
@@ -107,9 +103,9 @@
                   optional=None,
                   **kw                      # To catch unknown keywords
                  ):
-        assert type(name) is StringType, "'name' must be a string"
-        assert (type(sources) is ListType and
-                map(type, sources) == [StringType]*len(sources)), \
+        assert isinstance(name, str), "'name' must be a string"
+        assert (isinstance(sources, list) and
+                all(isinstance(v, str) for v in sources)), \
                 "'sources' must be a list of strings"
 
         self.name = name
@@ -130,20 +126,17 @@
         self.optional = optional
 
         # If there are unknown keyword options, warn about them
-        if len(kw):
-            L = kw.keys() ; L.sort()
-            L = map(repr, L)
-            msg = "Unknown Extension options: " + string.join(L, ', ')
-            if warnings is not None:
-                warnings.warn(msg)
-            else:
-                sys.stderr.write(msg + '\n')
-# class Extension
-
+        if len(kw) > 0:
+            options = [repr(option) for option in kw]
+            options = ', '.join(sorted(options))
+            msg = "Unknown Extension options: %s" % options
+            warnings.warn(msg)
+
+def read_setup_file(filename):
+    """Reads a Setup file and returns Extension instances."""
+    from distutils.sysconfig import (parse_makefile, expand_makefile_vars,
+                                     _variable_rx)
 
-def read_setup_file (filename):
-    from distutils.sysconfig import \
-         parse_makefile, expand_makefile_vars, _variable_rx
     from distutils.text_file import TextFile
     from distutils.util import split_quoted
 
@@ -168,10 +161,8 @@
             file.warn("'%s' lines not handled yet" % line)
             continue
 
-        #print "original line: " + line
         line = expand_makefile_vars(line, vars)
         words = split_quoted(line)
-        #print "expanded line: " + line
 
         # NB. this parses a slightly different syntax than the old
         # makesetup script: here, there must be exactly one extension per
@@ -200,7 +191,7 @@
             elif switch == "-I":
                 ext.include_dirs.append(value)
             elif switch == "-D":
-                equals = string.find(value, "=")
+                equals = value.find("=")
                 if equals == -1:        # bare "-DFOO" -- no value
                     ext.define_macros.append((value, None))
                 else:                   # "-DFOO=blah"
@@ -237,15 +228,4 @@
 
         extensions.append(ext)
 
-        #print "module:", module
-        #print "source files:", source_files
-        #print "cpp args:", cpp_args
-        #print "lib args:", library_args
-
-        #extensions[module] = { 'sources': source_files,
-        #                       'cpp_args': cpp_args,
-        #                       'lib_args': library_args }
-
     return extensions
-
-# read_setup_file ()

Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_install.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_install.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_install.py	Sun Jun  7 00:03:15 2009
@@ -10,11 +10,14 @@
 from distutils.command import install as install_module
 from distutils.command.install import INSTALL_SCHEMES
 from distutils.core import Distribution
+from distutils.errors import DistutilsOptionError
 
 from distutils.tests import support
 
 
-class InstallTestCase(support.TempdirManager, unittest.TestCase):
+class InstallTestCase(support.TempdirManager,
+                      support.LoggingSilencer,
+                      unittest.TestCase):
 
     def test_home_installation_scheme(self):
         # This ensure two things:
@@ -112,6 +115,74 @@
         self.assert_('userbase' in cmd.config_vars)
         self.assert_('usersite' in cmd.config_vars)
 
+    def test_handle_extra_path(self):
+        dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'})
+        cmd = install(dist)
+
+        # two elements
+        cmd.handle_extra_path()
+        self.assertEquals(cmd.extra_path, ['path', 'dirs'])
+        self.assertEquals(cmd.extra_dirs, 'dirs')
+        self.assertEquals(cmd.path_file, 'path')
+
+        # one element
+        cmd.extra_path = ['path']
+        cmd.handle_extra_path()
+        self.assertEquals(cmd.extra_path, ['path'])
+        self.assertEquals(cmd.extra_dirs, 'path')
+        self.assertEquals(cmd.path_file, 'path')
+
+        # none
+        dist.extra_path = cmd.extra_path = None
+        cmd.handle_extra_path()
+        self.assertEquals(cmd.extra_path, None)
+        self.assertEquals(cmd.extra_dirs, '')
+        self.assertEquals(cmd.path_file, None)
+
+        # three elements (no way !)
+        cmd.extra_path = 'path,dirs,again'
+        self.assertRaises(DistutilsOptionError, cmd.handle_extra_path)
+
+    def test_finalize_options(self):
+        dist = Distribution({'name': 'xx'})
+        cmd = install(dist)
+
+        # must supply either prefix/exec-prefix/home or
+        # install-base/install-platbase -- not both
+        cmd.prefix = 'prefix'
+        cmd.install_base = 'base'
+        self.assertRaises(DistutilsOptionError, cmd.finalize_options)
+
+        # must supply either home or prefix/exec-prefix -- not both
+        cmd.install_base = None
+        cmd.home = 'home'
+        self.assertRaises(DistutilsOptionError, cmd.finalize_options)
+
+        # can't combine user with with prefix/exec_prefix/home or
+        # install_(plat)base
+        cmd.prefix = None
+        cmd.user = 'user'
+        self.assertRaises(DistutilsOptionError, cmd.finalize_options)
+
+    def test_record(self):
+
+        install_dir = self.mkdtemp()
+        pkgdir, dist = self.create_dist()
+
+        dist = Distribution()
+        cmd = install(dist)
+        dist.command_obj['install'] = cmd
+        cmd.root = install_dir
+        cmd.record = os.path.join(pkgdir, 'RECORD')
+        cmd.ensure_finalized()
+
+        cmd.run()
+
+        # let's check the RECORD file was created with one
+        # line (the egg info file)
+        with open(cmd.record) as f:
+            self.assertEquals(len(f.readlines()), 1)
+
 def test_suite():
     return unittest.makeSuite(InstallTestCase)
 

Modified: python/branches/tk_and_idle_maintenance/Lib/imputil.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/imputil.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/imputil.py	Sun Jun  7 00:03:15 2009
@@ -14,7 +14,7 @@
 del warnpy3k
 
 # note: avoid importing non-builtin modules
-import imp                      ### not available in JPython?
+import imp                      ### not available in Jython?
 import sys
 import __builtin__
 
@@ -25,7 +25,7 @@
 __all__ = ["ImportManager","Importer","BuiltinImporter"]
 
 _StringType = type('')
-_ModuleType = type(sys)         ### doesn't work in JPython...
+_ModuleType = type(sys)         ### doesn't work in Jython...
 
 class ImportManager:
     "Manage the import process."
@@ -639,8 +639,8 @@
 # TODO
 #
 # from Finn Bock:
-#   type(sys) is not a module in JPython. what to use instead?
-#   imp.C_EXTENSION is not in JPython. same for get_suffixes and new_module
+#   type(sys) is not a module in Jython. what to use instead?
+#   imp.C_EXTENSION is not in Jython. same for get_suffixes and new_module
 #
 #   given foo.py of:
 #      import sys

Modified: python/branches/tk_and_idle_maintenance/Lib/shutil.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/shutil.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/shutil.py	Sun Jun  7 00:03:15 2009
@@ -58,9 +58,10 @@
         except OSError:
             # File most likely does not exist
             pass
-        # XXX What about other special files? (sockets, devices...)
-        if stat.S_ISFIFO(st.st_mode):
-            raise SpecialFileError("`%s` is a named pipe" % fn)
+        else:
+            # XXX What about other special files? (sockets, devices...)
+            if stat.S_ISFIFO(st.st_mode):
+                raise SpecialFileError("`%s` is a named pipe" % fn)
     try:
         fsrc = open(src, 'rb')
         fdst = open(dst, 'wb')

Modified: python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt	Sun Jun  7 00:03:15 2009
@@ -11,7 +11,7 @@
 
 -- precision 0;  result should never include a .
 %.0f 1.5 -> 2
-%.0f 2.5 -> 2
+--%.0f 2.5 -> 2  fails on Windows in 2.7, works in 3.1+. See issue 6198.
 %.0f 3.5 -> 4
 %.0f 0.0 -> 0
 %.0f 0.1 -> 0
@@ -21,9 +21,9 @@
 %.0f 10.01 -> 10
 %.0f 123.456 -> 123
 %.0f 1234.56 -> 1235
-%.0f 1e49 -> 9999999999999999464902769475481793196872414789632
+--%.0f 1e49 -> 9999999999999999464902769475481793196872414789632   See issue 6198.
 -- %.0f 1e50 -> 100000000000000007629769841091887003294964970946560
-%.0f 9.9999999999999987e+49 -> 99999999999999986860582406952576489172979654066176
+-- %.0f 9.9999999999999987e+49 -> 99999999999999986860582406952576489172979654066176   See issue 6198.
 
 -- precision 1
 %.1f 0.0001 -> 0.0
@@ -31,7 +31,7 @@
 %.1f 0.01 -> 0.0
 %.1f 0.04 -> 0.0
 %.1f 0.06 -> 0.1
-%.1f 0.25 -> 0.2
+-- %.1f 0.25 -> 0.2   See issue 6198.
 %.1f 0.75 -> 0.8
 %.1f 1.4 -> 1.4
 %.1f 1.5 -> 1.5
@@ -47,7 +47,7 @@
 %.2f 0.004999 -> 0.00
 %.2f 0.005001 -> 0.01
 %.2f 0.01 -> 0.01
-%.2f 0.125 -> 0.12
+-- %.2f 0.125 -> 0.12   See issue 6198.
 %.2f 0.375 -> 0.38
 %.2f 1234500 -> 1234500.00
 %.2f 1234560 -> 1234560.00
@@ -61,8 +61,8 @@
 -- makes a difference when the precision is 0.
 %#.0f 0 -> 0.
 %#.1f 0 -> 0.0
-%#.0f 1.5 -> 2.
-%#.0f 2.5 -> 2.
+--%#.0f 1.5 -> 2.   See issue 6198.
+-- %#.0f 2.5 -> 2.    See issue 6198.
 %#.0f 10.1 -> 10.
 %#.0f 1234.56 -> 1235.
 %#.1f 1.4 -> 1.4
@@ -108,18 +108,18 @@
 %.0e 123456000 -> 1e+08
 %.0e 0.5 -> 5e-01
 %.0e 1.4 -> 1e+00
-%.0e 1.5 -> 2e+00
+--%.0e 1.5 -> 2e+00   See issue 6198.
 %.0e 1.6 -> 2e+00
 %.0e 2.4999999 -> 2e+00
-%.0e 2.5 -> 2e+00
+--%.0e 2.5 -> 2e+00   See issue 6198.
 %.0e 2.5000001 -> 3e+00
 %.0e 3.499999999999 -> 3e+00
 %.0e 3.5 -> 4e+00
-%.0e 4.5 -> 4e+00
+--%.0e 4.5 -> 4e+00   See issue 6198.
 %.0e 5.5 -> 6e+00
-%.0e 6.5 -> 6e+00
+--%.0e 6.5 -> 6e+00   See issue 6198.
 %.0e 7.5 -> 8e+00
-%.0e 8.5 -> 8e+00
+--%.0e 8.5 -> 8e+00   See issue 6198.
 %.0e 9.4999 -> 9e+00
 %.0e 9.5 -> 1e+01
 %.0e 10.5 -> 1e+01
@@ -185,15 +185,15 @@
 %#.0e 1.5 -> 2.e+00
 %#.0e 1.6 -> 2.e+00
 %#.0e 2.4999999 -> 2.e+00
-%#.0e 2.5 -> 2.e+00
+--%#.0e 2.5 -> 2.e+00   See issue 6198.
 %#.0e 2.5000001 -> 3.e+00
 %#.0e 3.499999999999 -> 3.e+00
 %#.0e 3.5 -> 4.e+00
-%#.0e 4.5 -> 4.e+00
+--%#.0e 4.5 -> 4.e+00   See issue 6198.
 %#.0e 5.5 -> 6.e+00
-%#.0e 6.5 -> 6.e+00
+--%#.0e 6.5 -> 6.e+00   See issue 6198.
 %#.0e 7.5 -> 8.e+00
-%#.0e 8.5 -> 8.e+00
+--%#.0e 8.5 -> 8.e+00   See issue 6198.
 %#.0e 9.4999 -> 9.e+00
 %#.0e 9.5 -> 1.e+01
 %#.0e 10.5 -> 1.e+01
@@ -281,11 +281,11 @@
 
 -- alternate g formatting:  always include decimal point and
 -- exactly <precision> significant digits.
-%#.0g 0 -> 0.
-%#.1g 0 -> 0.
-%#.2g 0 -> 0.0
-%#.3g 0 -> 0.00
-%#.4g 0 -> 0.000
+--%#.0g 0 -> 0.   See issue 6198.
+--%#.1g 0 -> 0.   See issue 6198.
+--%#.2g 0 -> 0.0   See issue 6198.
+--%#.3g 0 -> 0.00   See issue 6198.
+--%#.4g 0 -> 0.000   See issue 6198.
 
 %#.0g 0.2 -> 0.2
 %#.1g 0.2 -> 0.2

Modified: python/branches/tk_and_idle_maintenance/Lib/test/test__locale.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/test/test__locale.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/test/test__locale.py	Sun Jun  7 00:03:15 2009
@@ -1,7 +1,12 @@
 from test.test_support import verbose, run_unittest
-from _locale import (setlocale, LC_NUMERIC, RADIXCHAR, THOUSEP, nl_langinfo,
-                    localeconv, Error)
+from _locale import (setlocale, LC_NUMERIC, localeconv, Error)
+try:
+    from _locale import (RADIXCHAR, THOUSEP, nl_langinfo)
+except ImportError:
+    nl_langinfo = None
+
 import unittest
+import sys
 from platform import uname
 
 if uname()[0] == "Darwin":
@@ -20,6 +25,13 @@
     'eu_ES', 'vi_VN', 'af_ZA', 'nb_NO', 'en_DK', 'tg_TJ', 'en_US',
     'es_ES.ISO8859-1', 'fr_FR.ISO8859-15', 'ru_RU.KOI8-R', 'ko_KR.eucKR']
 
+# Workaround for MSVC6(debug) crash bug
+if "MSC v.1200" in sys.version:
+    def accept(loc):
+        a = loc.split(".")
+        return not(len(a) == 2 and len(a[-1]) >= 9)
+    candidate_locales = [loc for loc in candidate_locales if accept(loc)]
+
 # List known locale values to test against when available.
 # Dict formatted as ``<locale> : (<decimal_point>, <thousands_sep>)``.  If a
 # value is not known, use '' .
@@ -53,6 +65,7 @@
                                     calc_type, data_type, set_locale,
                                     used_locale))
 
+    @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available")
     def test_lc_numeric_nl_langinfo(self):
         # Test nl_langinfo against known values
         for loc in candidate_locales:
@@ -71,10 +84,10 @@
                 setlocale(LC_NUMERIC, loc)
             except Error:
                 continue
-            for li, lc in ((RADIXCHAR, "decimal_point"),
-                            (THOUSEP, "thousands_sep")):
+            for lc in ("decimal_point", "thousands_sep"):
                 self.numeric_tester('localeconv', localeconv()[lc], lc, loc)
 
+    @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available")
     def test_lc_numeric_basic(self):
         # Test nl_langinfo against localeconv
         for loc in candidate_locales:

Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_pep352.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/test/test_pep352.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/test/test_pep352.py	Sun Jun  7 00:03:15 2009
@@ -26,7 +26,7 @@
             ignore_message_warning()
             for attr in ("args", "message", "__str__", "__repr__",
                             "__getitem__"):
-                self.failUnless(hasattr(ins, attr),
+                self.assertTrue(hasattr(ins, attr),
                         "%s missing %s attribute" %
                             (ins.__class__.__name__, attr))
 
@@ -88,7 +88,7 @@
 
     def interface_test_driver(self, results):
         for test_name, (given, expected) in zip(self.interface_tests, results):
-            self.failUnlessEqual(given, expected, "%s: %s != %s" % (test_name,
+            self.assertEqual(given, expected, "%s: %s != %s" % (test_name,
                 given, expected))
 
     def test_interface_single_arg(self):

Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_traceback.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/test/test_traceback.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/test/test_traceback.py	Sun Jun  7 00:03:15 2009
@@ -24,6 +24,9 @@
     def syntax_error_with_caret(self):
         compile("def fact(x):\n\treturn x!\n", "?", "exec")
 
+    def syntax_error_with_caret_2(self):
+        compile("1 +\n", "?", "exec")
+
     def syntax_error_without_caret(self):
         # XXX why doesn't compile raise the same traceback?
         import test.badsyntax_nocaret
@@ -39,6 +42,12 @@
         self.assert_("^" in err[2]) # third line has caret
         self.assert_(err[1].find("!") == err[2].find("^")) # in the right place
 
+        err = self.get_exception_format(self.syntax_error_with_caret_2,
+                                        SyntaxError)
+        self.assert_("^" in err[2]) # third line has caret
+        self.assert_(err[2].count('\n') == 1) # and no additional newline
+        self.assert_(err[1].find("+") == err[2].find("^")) # in the right place
+
     def test_nocaret(self):
         if is_jython:
             # jython adds a caret in this case (why shouldn't it?)

Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py	Sun Jun  7 00:03:15 2009
@@ -3537,7 +3537,9 @@
 
         # We should have loaded tests from the test_directory package by calling load_tests
         # and directly from the test_directory2 package
-        self.assertEqual(suite, ['load_tests', '/foo/test_directory2 module tests'])
+        self.assertEqual(suite,
+                         ['load_tests',
+                          os.path.join('/foo', 'test_directory2') + ' module tests'])
         self.assertEqual(Module.paths, [os.path.join('/foo', 'test_directory'),
                                         os.path.join('/foo', 'test_directory2')])
 

Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_with.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/test/test_with.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/test/test_with.py	Sun Jun  7 00:03:15 2009
@@ -675,7 +675,7 @@
             if self.gobble:
                 return True
 
-    class CtorRaises(object):
+    class InitRaises(object):
         def __init__(self): raise RuntimeError()
 
     class EnterRaises(object):
@@ -695,7 +695,7 @@
 
     def testExceptionInExprList(self):
         try:
-            with self.Dummy() as a, self.CtorRaises():
+            with self.Dummy() as a, self.InitRaises():
                 pass
         except:
             pass

Modified: python/branches/tk_and_idle_maintenance/Lib/traceback.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/traceback.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/traceback.py	Sun Jun  7 00:03:15 2009
@@ -189,7 +189,7 @@
         if badline is not None:
             lines.append('    %s\n' % badline.strip())
             if offset is not None:
-                caretspace = badline[:offset].lstrip()
+                caretspace = badline.rstrip('\n')[:offset].lstrip()
                 # non-space whitespace (likes tabs) must be kept for alignment
                 caretspace = ((c.isspace() and c or ' ') for c in caretspace)
                 # only three spaces to account for offset1 == pos 0

Modified: python/branches/tk_and_idle_maintenance/Lib/xmlrpclib.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/xmlrpclib.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/xmlrpclib.py	Sun Jun  7 00:03:15 2009
@@ -526,56 +526,6 @@
 except (AttributeError, ImportError):
     FastMarshaller = None
 
-#
-# the SGMLOP parser is about 15x faster than Python's builtin
-# XML parser.  SGMLOP sources can be downloaded from:
-#
-#     http://www.pythonware.com/products/xml/sgmlop.htm
-#
-
-try:
-    import sgmlop
-    if not hasattr(sgmlop, "XMLParser"):
-        raise ImportError
-except ImportError:
-    SgmlopParser = None # sgmlop accelerator not available
-else:
-    class SgmlopParser:
-        def __init__(self, target):
-
-            # setup callbacks
-            self.finish_starttag = target.start
-            self.finish_endtag = target.end
-            self.handle_data = target.data
-            self.handle_xml = target.xml
-
-            # activate parser
-            self.parser = sgmlop.XMLParser()
-            self.parser.register(self)
-            self.feed = self.parser.feed
-            self.entity = {
-                "amp": "&", "gt": ">", "lt": "<",
-                "apos": "'", "quot": '"'
-                }
-
-        def close(self):
-            try:
-                self.parser.close()
-            finally:
-                self.parser = self.feed = None # nuke circular reference
-
-        def handle_proc(self, tag, attr):
-            m = re.search("encoding\s*=\s*['\"]([^\"']+)[\"']", attr)
-            if m:
-                self.handle_xml(m.group(1), 1)
-
-        def handle_entityref(self, entity):
-            # <string> entity
-            try:
-                self.handle_data(self.entity[entity])
-            except KeyError:
-                self.handle_data("&%s;" % entity)
-
 try:
     from xml.parsers import expat
     if not hasattr(expat, "ParserCreate"):
@@ -584,8 +534,7 @@
     ExpatParser = None # expat not available
 else:
     class ExpatParser:
-        # fast expat parser for Python 2.0 and later.  this is about
-        # 50% slower than sgmlop, on roundtrip testing
+        # fast expat parser for Python 2.0 and later.
         def __init__(self, target):
             self._parser = parser = expat.ParserCreate(None, None)
             self._target = target
@@ -606,8 +555,7 @@
 
 class SlowParser:
     """Default XML parser (based on xmllib.XMLParser)."""
-    # this is about 10 times slower than sgmlop, on roundtrip
-    # testing.
+    # this is the slowest parser.
     def __init__(self, target):
         import xmllib # lazy subclassing (!)
         if xmllib.XMLParser not in SlowParser.__bases__:
@@ -1069,8 +1017,6 @@
         target = Unmarshaller(use_datetime=use_datetime)
         if FastParser:
             parser = FastParser(target)
-        elif SgmlopParser:
-            parser = SgmlopParser(target)
         elif ExpatParser:
             parser = ExpatParser(target)
         else:

Modified: python/branches/tk_and_idle_maintenance/Misc/NEWS
==============================================================================
--- python/branches/tk_and_idle_maintenance/Misc/NEWS	(original)
+++ python/branches/tk_and_idle_maintenance/Misc/NEWS	Sun Jun  7 00:03:15 2009
@@ -317,6 +317,8 @@
 Library
 -------
 
+- Issue #5767: Removed sgmlop support from xmlrpclib.
+
 - Issue #6131: test_modulefinder leaked when run after test_distutils.
   Patch by Hirokazu Yamamoto.
 

Modified: python/branches/tk_and_idle_maintenance/Objects/dictobject.c
==============================================================================
--- python/branches/tk_and_idle_maintenance/Objects/dictobject.c	(original)
+++ python/branches/tk_and_idle_maintenance/Objects/dictobject.c	Sun Jun  7 00:03:15 2009
@@ -715,7 +715,7 @@
 	/* We can arrive here with a NULL tstate during initialization:
 	   try running "python -Wi" for an example related to string
 	   interning.  Let's just hope that no exception occurs then... */
-	tstate = _PyThreadState_Current;
+	tstate = PyThreadState_GET();
 	if (tstate != NULL && tstate->curexc_type != NULL) {
 		/* preserve the existing exception */
 		PyObject *err_type, *err_value, *err_tb;

Modified: python/branches/tk_and_idle_maintenance/Objects/unicodeobject.c
==============================================================================
--- python/branches/tk_and_idle_maintenance/Objects/unicodeobject.c	(original)
+++ python/branches/tk_and_idle_maintenance/Objects/unicodeobject.c	Sun Jun  7 00:03:15 2009
@@ -6308,7 +6308,7 @@
 
 /* This code should go into some future Unicode collation support
    module. The basic comparison should compare ordinals on a naive
-   basis (this is what Java does and thus JPython too). */
+   basis (this is what Java does and thus Jython too). */
 
 /* speedy UTF-16 code point order comparison */
 /* gleaned from: */


More information about the Python-checkins mailing list