[Python-checkins] r69754 - in python/branches/py3k: Doc/library/base64.rst Doc/library/exceptions.rst Doc/library/functions.rst Doc/library/socketserver.rst Doc/reference/simple_stmts.rst Lib/subprocess.py Lib/test/test_pep263.py Lib/test/test_subprocess.py Modules/_ctypes/_ctypes.c Objects/unicodeobject.c PCbuild/sqlite3.vcproj
benjamin.peterson
python-checkins at python.org
Thu Feb 19 05:22:04 CET 2009
Author: benjamin.peterson
Date: Thu Feb 19 05:22:03 2009
New Revision: 69754
Log:
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 (2009年2月13日) | 1 line
#1661108: note that urlsafe encoded string can contain "=".
........
r69579 | georg.brandl | 2009年02月13日 05:06:59 -0600 (2009年2月13日) | 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 (2009年2月13日) | 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 (2009年2月13日) | 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 (2009年2月14日) | 1 line
this needn't be a shebang line
........
r69620 | georg.brandl | 2009年02月14日 11:01:36 -0600 (2009年2月14日) | 1 line
#5179: don't leak PIPE fds when child execution fails.
........
r69633 | hirokazu.yamamoto | 2009年02月15日 03:19:48 -0600 (2009年2月15日) | 1 line
Fixed typo.
........
r69703 | raymond.hettinger | 2009年02月16日 16:42:54 -0600 (2009年2月16日) | 3 lines
Issue 5229: Documentation for super() neglects to say what super() actually does
........
r69704 | raymond.hettinger | 2009年02月16日 17:00:25 -0600 (2009年2月16日) | 1 line
Add explanation for super(type1, type2).
........
r69728 | georg.brandl | 2009年02月17日 18:22:55 -0600 (2009年2月17日) | 2 lines
#5297: fix example.
........
r69729 | georg.brandl | 2009年02月17日 18:25:13 -0600 (2009年2月17日) | 2 lines
#5296: sequence -> iterable.
........
r69730 | georg.brandl | 2009年02月17日 18:31:36 -0600 (2009年2月17日) | 2 lines
#5268: mention VMSError.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Doc/library/base64.rst
python/branches/py3k/Doc/library/exceptions.rst
python/branches/py3k/Doc/library/functions.rst
python/branches/py3k/Doc/library/socketserver.rst
python/branches/py3k/Doc/reference/simple_stmts.rst
python/branches/py3k/Lib/subprocess.py
python/branches/py3k/Lib/test/test_pep263.py
python/branches/py3k/Lib/test/test_subprocess.py
python/branches/py3k/Modules/_ctypes/_ctypes.c
python/branches/py3k/Objects/unicodeobject.c
python/branches/py3k/PCbuild/sqlite3.vcproj
Modified: python/branches/py3k/Doc/library/base64.rst
==============================================================================
--- python/branches/py3k/Doc/library/base64.rst (original)
+++ python/branches/py3k/Doc/library/base64.rst Thu Feb 19 05:22:03 2009
@@ -62,7 +62,8 @@
.. 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)
Modified: python/branches/py3k/Doc/library/exceptions.rst
==============================================================================
--- python/branches/py3k/Doc/library/exceptions.rst (original)
+++ python/branches/py3k/Doc/library/exceptions.rst Thu Feb 19 05:22:03 2009
@@ -348,6 +348,11 @@
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
Modified: python/branches/py3k/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k/Doc/library/functions.rst (original)
+++ python/branches/py3k/Doc/library/functions.rst Thu Feb 19 05:22:03 2009
@@ -1035,16 +1035,19 @@
.. 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.
Modified: python/branches/py3k/Doc/library/socketserver.rst
==============================================================================
--- python/branches/py3k/Doc/library/socketserver.rst (original)
+++ python/branches/py3k/Doc/library/socketserver.rst Thu Feb 19 05:22:03 2009
@@ -508,7 +508,7 @@
# 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")
Modified: python/branches/py3k/Doc/reference/simple_stmts.rst
==============================================================================
--- python/branches/py3k/Doc/reference/simple_stmts.rst (original)
+++ python/branches/py3k/Doc/reference/simple_stmts.rst Thu Feb 19 05:22:03 2009
@@ -116,7 +116,12 @@
* 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 @@
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
Modified: python/branches/py3k/Lib/subprocess.py
==============================================================================
--- python/branches/py3k/Lib/subprocess.py (original)
+++ python/branches/py3k/Lib/subprocess.py Thu Feb 19 05:22:03 2009
@@ -1139,6 +1139,9 @@
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
Modified: python/branches/py3k/Lib/test/test_pep263.py
==============================================================================
--- python/branches/py3k/Lib/test/test_pep263.py (original)
+++ python/branches/py3k/Lib/test/test_pep263.py Thu Feb 19 05:22:03 2009
@@ -1,4 +1,4 @@
-#! -*- coding: koi8-r -*-
+# -*- coding: koi8-r -*-
import unittest
from test import support
Modified: python/branches/py3k/Lib/test/test_subprocess.py
==============================================================================
--- python/branches/py3k/Lib/test/test_subprocess.py (original)
+++ python/branches/py3k/Lib/test/test_subprocess.py Thu Feb 19 05:22:03 2009
@@ -521,6 +521,22 @@
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
#
Modified: python/branches/py3k/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/_ctypes.c (original)
+++ python/branches/py3k/Modules/_ctypes/_ctypes.c Thu Feb 19 05:22:03 2009
@@ -566,13 +566,14 @@
#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 @@
#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
Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c (original)
+++ python/branches/py3k/Objects/unicodeobject.c Thu Feb 19 05:22:03 2009
@@ -1591,7 +1591,7 @@
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 @@
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 @@
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;
}
Modified: python/branches/py3k/PCbuild/sqlite3.vcproj
==============================================================================
--- python/branches/py3k/PCbuild/sqlite3.vcproj (original)
+++ python/branches/py3k/PCbuild/sqlite3.vcproj Thu Feb 19 05:22:03 2009
@@ -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"
>
More information about the Python-checkins
mailing list