summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-02-19 04:22:03 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-02-19 04:22:03 (GMT)
commitd75fcb4ddfb76b290083982e44b80582ab13aae2 (patch)
tree0d9a58da6e89a9d44d07546d32770b7adb029c8e
parente69a6b2ddf3eb37df79d7f0d52339a8cab238bc8 (diff)
downloadcpython-d75fcb4ddfb76b290083982e44b80582ab13aae2.zip
cpython-d75fcb4ddfb76b290083982e44b80582ab13aae2.tar.gz
cpython-d75fcb4ddfb76b290083982e44b80582ab13aae2.tar.bz2
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. ........
-rw-r--r--Doc/library/base64.rst3
-rw-r--r--Doc/library/exceptions.rst5
-rw-r--r--Doc/library/functions.rst15
-rw-r--r--Doc/library/socketserver.rst2
-rw-r--r--Doc/reference/simple_stmts.rst13
-rw-r--r--Lib/subprocess.py3
-rw-r--r--Lib/test/test_pep263.py2
-rw-r--r--Lib/test/test_subprocess.py16
-rw-r--r--Modules/_ctypes/_ctypes.c14
-rw-r--r--Objects/unicodeobject.c6
-rw-r--r--PCbuild/sqlite3.vcproj8
11 files changed, 61 insertions, 26 deletions
diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst
index 48d24db..ef9c02a 100644
--- a/Doc/library/base64.rst
+++ b/Doc/library/base64.rst
@@ -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)
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst
index 7129df5..b1626f2 100644
--- a/Doc/library/exceptions.rst
+++ b/Doc/library/exceptions.rst
@@ -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
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index b5a4fb8..f9205b6 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1035,16 +1035,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.
diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst
index d827b9e..f82f538 100644
--- a/Doc/library/socketserver.rst
+++ b/Doc/library/socketserver.rst
@@ -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")
diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst
index 1e3cb85..d1e89e5 100644
--- a/Doc/reference/simple_stmts.rst
+++ b/Doc/reference/simple_stmts.rst
@@ -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
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 391edca..bd158f6 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1139,6 +1139,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
diff --git a/Lib/test/test_pep263.py b/Lib/test/test_pep263.py
index 106b3ab..72764f9 100644
--- a/Lib/test/test_pep263.py
+++ b/Lib/test/test_pep263.py
@@ -1,4 +1,4 @@
-#! -*- coding: koi8-r -*-
+# -*- coding: koi8-r -*-
import unittest
from test import support
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index eb4e759..5d3e040 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -521,6 +521,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"
+ pass # XXX see #5312
+
#
# POSIX tests
#
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 9eb4975..61d34ab 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -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
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 0db13b1..aeaa53b 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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))
@@ -3854,7 +3854,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;
}
@@ -5128,7 +5128,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;
}
diff --git a/PCbuild/sqlite3.vcproj b/PCbuild/sqlite3.vcproj
index 0af1cdc..70badf5 100644
--- a/PCbuild/sqlite3.vcproj
+++ b/PCbuild/sqlite3.vcproj
@@ -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
@@ -204,7 +204,7 @@
<Configuration
Name="Release|x64"
ConfigurationType="2"
- InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops"
+ InheritedPropertySheets=".\sqlite3.vsprops;.\x64.vsprops"
CharacterSet="0"
WholeProgramOptimization="1"
>
@@ -327,7 +327,7 @@
<Configuration
Name="PGInstrument|x64"
ConfigurationType="2"
- InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops;.\pginstrument.vsprops"
+ InheritedPropertySheets=".\sqlite3.vsprops;.\x64.vsprops;.\pginstrument.vsprops"
CharacterSet="0"
WholeProgramOptimization="1"
>
@@ -449,7 +449,7 @@
<Configuration
Name="PGUpdate|x64"
ConfigurationType="2"
- InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops;.\pgupdate.vsprops"
+ InheritedPropertySheets=".\sqlite3.vsprops;.\x64.vsprops;.\pgupdate.vsprops"
CharacterSet="0"
WholeProgramOptimization="1"
>