]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 69754,69794 via svnmerge from
authorBenjamin Peterson <benjamin@python.org>
Fri, 20 Feb 2009 03:32:23 +0000 (03:32 +0000)
committerBenjamin Peterson <benjamin@python.org>
Fri, 20 Feb 2009 03:32:23 +0000 (03:32 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r69754 | benjamin.peterson | 2009-02-18 22:22:03 -0600 (Wed, 18 Feb 2009) | 54 lines

  Merged revisions 69576,69579-69580,69589,69619-69620,69633,69703-69704,69728-69730 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r69576 | georg.brandl | 2009-02-13 04:56:50 -0600 (Fri, 13 Feb 2009) | 1 line

    #1661108: note that urlsafe encoded string can contain "=".
  ........
    r69579 | georg.brandl | 2009-02-13 05:06:59 -0600 (Fri, 13 Feb 2009) | 2 lines

    Fix warnings GCC emits where the argument of PyErr_Format is a single variable.
  ........
    r69580 | georg.brandl | 2009-02-13 05:10:04 -0600 (Fri, 13 Feb 2009) | 2 lines

    Fix warnings GCC emits where the argument of PyErr_Format is a single variable.
  ........
    r69589 | martin.v.loewis | 2009-02-13 14:11:34 -0600 (Fri, 13 Feb 2009) | 2 lines

    Move amd64 properties further to the top, so that they override
    the linker options correctly.
  ........
    r69619 | benjamin.peterson | 2009-02-14 11:00:51 -0600 (Sat, 14 Feb 2009) | 1 line

    this needn't be a shebang line
  ........
    r69620 | georg.brandl | 2009-02-14 11:01:36 -0600 (Sat, 14 Feb 2009) | 1 line

    #5179: don't leak PIPE fds when child execution fails.
  ........
    r69633 | hirokazu.yamamoto | 2009-02-15 03:19:48 -0600 (Sun, 15 Feb 2009) | 1 line

    Fixed typo.
  ........
    r69703 | raymond.hettinger | 2009-02-16 16:42:54 -0600 (Mon, 16 Feb 2009) | 3 lines

    Issue 5229: Documentation for super() neglects to say what super() actually does
  ........
    r69704 | raymond.hettinger | 2009-02-16 17:00:25 -0600 (Mon, 16 Feb 2009) | 1 line

    Add explanation for super(type1, type2).
  ........
    r69728 | georg.brandl | 2009-02-17 18:22:55 -0600 (Tue, 17 Feb 2009) | 2 lines

    #5297: fix example.
  ........
    r69729 | georg.brandl | 2009-02-17 18:25:13 -0600 (Tue, 17 Feb 2009) | 2 lines

    #5296: sequence -> iterable.
  ........
    r69730 | georg.brandl | 2009-02-17 18:31:36 -0600 (Tue, 17 Feb 2009) | 2 lines

    #5268: mention VMSError.
  ........
................
  r69794 | benjamin.peterson | 2009-02-19 21:19:25 -0600 (Thu, 19 Feb 2009) | 1 line

  fix None errno #5312
................

12 files changed:
Doc/library/base64.rst
Doc/library/exceptions.rst
Doc/library/functions.rst
Doc/library/socketserver.rst
Doc/reference/simple_stmts.rst
Lib/os.py
Lib/subprocess.py
Lib/test/test_pep263.py
Lib/test/test_subprocess.py
Modules/_ctypes/_ctypes.c
Objects/unicodeobject.c
PCbuild/sqlite3.vcproj

index 35b61aeab4ea2d34d553762a8601c1e4f0f89d55..9818ea08bba9d5f524fcd96b8161a1f1a17dbc9d 100644 (file)
@@ -62,7 +62,8 @@ The modern interface provides:
 .. function:: urlsafe_b64encode(s)
 
    Encode string *s* using a URL-safe alphabet, which substitutes ``-`` instead of
-   ``+`` and ``_`` instead of ``/`` in the standard Base64 alphabet.
+   ``+`` and ``_`` instead of ``/`` in the standard Base64 alphabet.  The result
+   can still contain ``=``.
 
 
 .. function:: urlsafe_b64decode(s)
index 7129df50d68720a0151d86b3f623ff2ee221c53c..b1626f26bafdb8d22151517046e2a8dc94f08579 100644 (file)
@@ -348,6 +348,11 @@ The following exceptions are the exceptions that are actually raised.
    more precise exception such as :exc:`IndexError`.
 
 
+.. exception:: VMSError
+
+   Only available on VMS.  Raised when a VMS-specific error occurs.
+
+
 .. exception:: WindowsError
 
    Raised when a Windows-specific error occurs or when the error number does not
index 0cd1ce14e4ec0babec68bfff3bd15991e466568e..79fd4f4ecc31d09086ac093e5455a8fc11d5e804 100644 (file)
@@ -1039,16 +1039,19 @@ are always available.  They are listed here in alphabetical order.
 
 .. function:: super([type[, object-or-type]])
 
-   Return a *super* object that acts as a proxy to superclasses of *type*.
+   Return a proxy object that delegates method calls to a parent class of
+   *type*.  This is useful for accessing inherited methods that have been
+   overriden in a child class.  The search order for parent classes is
+   determined by the ``__mro__`` attribute of the *type* and can change
+   whenever the parent classes are updated.
 
    If the second argument is omitted the super object returned is unbound.  If
    the second argument is an object, ``isinstance(obj, type)`` must be true.  If
-   the second argument is a type, ``issubclass(type2, type)`` must be true.
-   Calling :func:`super` without arguments is equivalent to ``super(this_class,
-   first_arg)``.
+   the second argument is a type, ``issubclass(type2, type)`` must be true (this
+   is useful for classmethods).
 
-   There are two typical use cases for :func:`super`.  In a class hierarchy with
-   single inheritance, :func:`super` can be used to refer to parent classes without
+   There are two typical use cases for "super".  In a class hierarchy with
+   single inheritance, "super" can be used to refer to parent classes without
    naming them explicitly, thus making the code more maintainable.  This use
    closely parallels the use of "super" in other programming languages.
 
index d827b9e713ffddbf8d3b5fe1230a2628ae04da9f..f82f538816738683cec2a34da550682eba800931 100644 (file)
@@ -508,7 +508,7 @@ An example for the :class:`ThreadingMixIn` class::
        # Exit the server thread when the main thread terminates
        server_thread.setDaemon(True)
        server_thread.start()
-       print("Server loop running in thread:", server_thread.getName())
+       print("Server loop running in thread:", server_thread.name)
 
        client(ip, port, b"Hello World 1")
        client(ip, port, b"Hello World 2")
index d54499081666d0193dc625d8e2ff848866e76515..f12daf9e7274c3905200a1e9b222b813e2d7a01f 100644 (file)
@@ -116,7 +116,12 @@ square brackets, is recursively defined as follows.
 
 * If the target list is a single target: The object is assigned to that target.
 
-* If the target list is a comma-separated list of targets:
+* If the target list is a comma-separated list of targets: The object must be an
+  iterable with the same number of items as there are targets in the target list,
+  and the items are assigned, from left to right, to the corresponding targets.
+  (This rule is relaxed as of Python 1.5; in earlier versions, the object had to
+  be a tuple.  Since strings are sequences, an assignment like ``a, b = "xy"`` is
+  now legal as long as the string has the right length.)
 
   * If the target list contains one target prefixed with an asterisk, called a
     "starred" target: The object must be a sequence with at least as many items
@@ -152,9 +157,9 @@ Assignment of an object to a single target is recursively defined as follows.
   be deallocated and its destructor (if it has one) to be called.
 
 * If the target is a target list enclosed in parentheses or in square brackets:
-  The object must be a sequence with the same number of items as there are targets
-  in the target list, and its items are assigned, from left to right, to the
-  corresponding targets.
+  The object must be an iterable with the same number of items as there are
+  targets in the target list, and its items are assigned, from left to right,
+  to the corresponding targets.
 
   .. index:: pair: attribute; assignment
 
index 5a020d322791b3c1651c7f16f4862b265cc23778..65f88ba1892b2142f920bcdefaff462b7ee52c5a 100644 (file)
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -372,8 +372,8 @@ def _execvpe(file, args, env=None):
                 saved_exc = e
                 saved_tb = tb
     if saved_exc:
-        raise error(saved_exc).with_traceback(saved_tb)
-    raise error(last_exc).with_traceback(tb)
+        raise saved_exc.with_traceback(saved_tb)
+    raise last_exc.with_traceback(tb)
 
 
 # Change environ to automatically call putenv(), unsetenv if they exist.
index ac92185b6f5d770af547d9e86f54b871da4539ee..ad91bec606901341714b8ae9fd0823a234d66d03 100644 (file)
@@ -1094,6 +1094,9 @@ class Popen(object):
             if data:
                 os.waitpid(self.pid, 0)
                 child_exception = pickle.loads(data)
+                for fd in (p2cwrite, c2pread, errread):
+                    if fd is not None:
+                        os.close(fd)
                 raise child_exception
 
 
index 17abbd807a01cd3a0a7c6bef8cff54b269aadab3..a594cc4c6c293aa29a932a68c6f27289c64b9484 100644 (file)
@@ -1,4 +1,4 @@
-#! -*- coding: koi8-r -*-\r
+# -*- coding: koi8-r -*-\r
 # This file is marked as binary in the CVS, to prevent MacCVS from recoding it.\r
 \r
 import unittest\r
index f4f1cd5a86d095efdcc149fe2bdc5f9ef980dc87..916ffb2215a6c3aa98d0820b5194150a3a584901 100644 (file)
@@ -487,6 +487,22 @@ class ProcessTestCase(unittest.TestCase):
         p = subprocess.Popen([sys.executable, "-c", "pass"], bufsize=None)
         self.assertEqual(p.wait(), 0)
 
+    def test_leaking_fds_on_error(self):
+        # see bug #5179: Popen leaks file descriptors to PIPEs if
+        # the child fails to execute; this will eventually exhaust
+        # the maximum number of open fds. 1024 seems a very common
+        # value for that limit, but Windows has 2048, so we loop
+        # 1024 times (each call leaked two fds).
+        for i in range(1024):
+            try:
+                subprocess.Popen(['nonexisting_i_hope'],
+                                 stdout=subprocess.PIPE,
+                                 stderr=subprocess.PIPE)
+            # Windows raises IOError
+            except (IOError, OSError) as err:
+                if err.errno != 2:  # ignore "no such file"
+                    raise
+
     #
     # POSIX tests
     #
index 9eb497538e3e45c84ff8f5250409fca5abfbf9cf..61d34ab1c3ced1a72669a874bbfbdfea3a5bfa9a 100644 (file)
@@ -566,13 +566,14 @@ CDataType_in_dll(PyObject *type, PyObject *args)
 #else
        address = (void *)ctypes_dlsym(handle, name);
        if (!address) {
-               PyErr_Format(PyExc_ValueError,
 #ifdef __CYGWIN__
 /* dlerror() isn't very helpful on cygwin */
+               PyErr_Format(PyExc_ValueError,
                             "symbol '%s' not found (%s) ",
-                            name,
+                            name);
+#else
+               PyErr_SetString(PyExc_ValueError, ctypes_dlerror());
 #endif
-                            ctypes_dlerror());
                return NULL;
        }
 #endif
@@ -3208,13 +3209,14 @@ CFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
 #else
        address = (PPROC)ctypes_dlsym(handle, name);
        if (!address) {
-               PyErr_Format(PyExc_AttributeError,
 #ifdef __CYGWIN__
 /* dlerror() isn't very helpful on cygwin */
+               PyErr_Format(PyExc_AttributeError,
                             "function '%s' not found (%s) ",
-                            name,
+                            name);
+#else
+               PyErr_SetString(PyExc_AttributeError, ctypes_dlerror());
 #endif
-                            ctypes_dlerror());
                return NULL;
        }
 #endif
index f099bd1904db4f16de7f03fb6c05485def682dfd..21917f2a6ed3c3402305f917dd7e56b5234180bb 100644 (file)
@@ -1591,7 +1591,7 @@ int unicode_decode_call_errorhandler(const char *errors, PyObject **errorHandler
     if (restuple == NULL)
         goto onError;
     if (!PyTuple_Check(restuple)) {
-        PyErr_Format(PyExc_TypeError, &argparse[4]);
+        PyErr_SetString(PyExc_TypeError, &argparse[4]);
         goto onError;
     }
     if (!PyArg_ParseTuple(restuple, argparse, &PyUnicode_Type, &repunicode, &newpos))
@@ -3665,7 +3665,7 @@ static PyObject *unicode_encode_call_errorhandler(const char *errors,
     if (restuple == NULL)
         return NULL;
     if (!PyTuple_Check(restuple)) {
-        PyErr_Format(PyExc_TypeError, &argparse[4]);
+        PyErr_SetString(PyExc_TypeError, &argparse[4]);
         Py_DECREF(restuple);
         return NULL;
     }
@@ -4929,7 +4929,7 @@ static PyObject *unicode_translate_call_errorhandler(const char *errors,
     if (restuple == NULL)
         return NULL;
     if (!PyTuple_Check(restuple)) {
-        PyErr_Format(PyExc_TypeError, &argparse[4]);
+        PyErr_SetString(PyExc_TypeError, &argparse[4]);
         Py_DECREF(restuple);
         return NULL;
     }
index 0af1cdc07b72830daddc7d5fae2d0154e2147a6b..70badf5fe2dc99983316805d60a6001b6319dc49 100644 (file)
@@ -82,7 +82,7 @@
                <Configuration
                        Name="Debug|x64"
                        ConfigurationType="2"
-                       InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops;.\debug.vsprops"
+                       InheritedPropertySheets=".\sqlite3.vsprops;.\debug.vsprops;.\x64.vsprops"
                        CharacterSet="0"
                        >
                        <Tool
                <Configuration
                        Name="Release|x64"
                        ConfigurationType="2"
-                       InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops"
+                       InheritedPropertySheets=".\sqlite3.vsprops;.\x64.vsprops"
                        CharacterSet="0"
                        WholeProgramOptimization="1"
                        >
                <Configuration
                        Name="PGInstrument|x64"
                        ConfigurationType="2"
-                       InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops;.\pginstrument.vsprops"
+                       InheritedPropertySheets=".\sqlite3.vsprops;.\x64.vsprops;.\pginstrument.vsprops"
                        CharacterSet="0"
                        WholeProgramOptimization="1"
                        >
                <Configuration
                        Name="PGUpdate|x64"
                        ConfigurationType="2"
-                       InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops;.\pgupdate.vsprops"
+                       InheritedPropertySheets=".\sqlite3.vsprops;.\x64.vsprops;.\pgupdate.vsprops"
                        CharacterSet="0"
                        WholeProgramOptimization="1"
                        >