mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
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. ........
This commit is contained in:
parent
e69a6b2ddf
commit
d75fcb4ddf
11 changed files with 61 additions and 26 deletions
|
@ -62,7 +62,8 @@ The modern interface provides:
|
||||||
.. function:: urlsafe_b64encode(s)
|
.. function:: urlsafe_b64encode(s)
|
||||||
|
|
||||||
Encode string *s* using a URL-safe alphabet, which substitutes ``-`` instead of
|
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)
|
.. function:: urlsafe_b64decode(s)
|
||||||
|
|
|
@ -348,6 +348,11 @@ The following exceptions are the exceptions that are actually raised.
|
||||||
more precise exception such as :exc:`IndexError`.
|
more precise exception such as :exc:`IndexError`.
|
||||||
|
|
||||||
|
|
||||||
|
.. exception:: VMSError
|
||||||
|
|
||||||
|
Only available on VMS. Raised when a VMS-specific error occurs.
|
||||||
|
|
||||||
|
|
||||||
.. exception:: WindowsError
|
.. exception:: WindowsError
|
||||||
|
|
||||||
Raised when a Windows-specific error occurs or when the error number does not
|
Raised when a Windows-specific error occurs or when the error number does not
|
||||||
|
|
|
@ -1035,16 +1035,19 @@ are always available. They are listed here in alphabetical order.
|
||||||
|
|
||||||
.. function:: super([type[, object-or-type]])
|
.. 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
|
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 an object, ``isinstance(obj, type)`` must be true. If
|
||||||
the second argument is a type, ``issubclass(type2, type)`` must be true.
|
the second argument is a type, ``issubclass(type2, type)`` must be true (this
|
||||||
Calling :func:`super` without arguments is equivalent to ``super(this_class,
|
is useful for classmethods).
|
||||||
first_arg)``.
|
|
||||||
|
|
||||||
There are two typical use cases for :func:`super`. In a class hierarchy with
|
There are two typical use cases for "super". In a class hierarchy with
|
||||||
single inheritance, :func:`super` can be used to refer to parent classes without
|
single inheritance, "super" can be used to refer to parent classes without
|
||||||
naming them explicitly, thus making the code more maintainable. This use
|
naming them explicitly, thus making the code more maintainable. This use
|
||||||
closely parallels the use of "super" in other programming languages.
|
closely parallels the use of "super" in other programming languages.
|
||||||
|
|
||||||
|
|
|
@ -508,7 +508,7 @@ An example for the :class:`ThreadingMixIn` class::
|
||||||
# Exit the server thread when the main thread terminates
|
# Exit the server thread when the main thread terminates
|
||||||
server_thread.setDaemon(True)
|
server_thread.setDaemon(True)
|
||||||
server_thread.start()
|
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 1")
|
||||||
client(ip, port, b"Hello World 2")
|
client(ip, port, b"Hello World 2")
|
||||||
|
|
|
@ -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 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
|
* 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
|
"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.
|
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:
|
* 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
|
The object must be an iterable with the same number of items as there are
|
||||||
in the target list, and its items are assigned, from left to right, to the
|
targets in the target list, and its items are assigned, from left to right,
|
||||||
corresponding targets.
|
to the corresponding targets.
|
||||||
|
|
||||||
.. index:: pair: attribute; assignment
|
.. index:: pair: attribute; assignment
|
||||||
|
|
||||||
|
|
|
@ -1139,6 +1139,9 @@ class Popen(object):
|
||||||
if data:
|
if data:
|
||||||
os.waitpid(self.pid, 0)
|
os.waitpid(self.pid, 0)
|
||||||
child_exception = pickle.loads(data)
|
child_exception = pickle.loads(data)
|
||||||
|
for fd in (p2cwrite, c2pread, errread):
|
||||||
|
if fd is not None:
|
||||||
|
os.close(fd)
|
||||||
raise child_exception
|
raise child_exception
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! -*- coding: koi8-r -*-
|
# -*- coding: koi8-r -*-
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test import support
|
from test import support
|
||||||
|
|
|
@ -521,6 +521,22 @@ class ProcessTestCase(unittest.TestCase):
|
||||||
p = subprocess.Popen([sys.executable, "-c", "pass"], bufsize=None)
|
p = subprocess.Popen([sys.executable, "-c", "pass"], bufsize=None)
|
||||||
self.assertEqual(p.wait(), 0)
|
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
|
# POSIX tests
|
||||||
#
|
#
|
||||||
|
|
|
@ -566,13 +566,14 @@ CDataType_in_dll(PyObject *type, PyObject *args)
|
||||||
#else
|
#else
|
||||||
address = (void *)ctypes_dlsym(handle, name);
|
address = (void *)ctypes_dlsym(handle, name);
|
||||||
if (!address) {
|
if (!address) {
|
||||||
PyErr_Format(PyExc_ValueError,
|
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
/* dlerror() isn't very helpful on cygwin */
|
/* dlerror() isn't very helpful on cygwin */
|
||||||
|
PyErr_Format(PyExc_ValueError,
|
||||||
"symbol '%s' not found (%s) ",
|
"symbol '%s' not found (%s) ",
|
||||||
name,
|
name);
|
||||||
|
#else
|
||||||
|
PyErr_SetString(PyExc_ValueError, ctypes_dlerror());
|
||||||
#endif
|
#endif
|
||||||
ctypes_dlerror());
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3208,13 +3209,14 @@ CFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
#else
|
#else
|
||||||
address = (PPROC)ctypes_dlsym(handle, name);
|
address = (PPROC)ctypes_dlsym(handle, name);
|
||||||
if (!address) {
|
if (!address) {
|
||||||
PyErr_Format(PyExc_AttributeError,
|
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
/* dlerror() isn't very helpful on cygwin */
|
/* dlerror() isn't very helpful on cygwin */
|
||||||
|
PyErr_Format(PyExc_AttributeError,
|
||||||
"function '%s' not found (%s) ",
|
"function '%s' not found (%s) ",
|
||||||
name,
|
name);
|
||||||
|
#else
|
||||||
|
PyErr_SetString(PyExc_AttributeError, ctypes_dlerror());
|
||||||
#endif
|
#endif
|
||||||
ctypes_dlerror());
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1591,7 +1591,7 @@ int unicode_decode_call_errorhandler(const char *errors, PyObject **errorHandler
|
||||||
if (restuple == NULL)
|
if (restuple == NULL)
|
||||||
goto onError;
|
goto onError;
|
||||||
if (!PyTuple_Check(restuple)) {
|
if (!PyTuple_Check(restuple)) {
|
||||||
PyErr_Format(PyExc_TypeError, &argparse[4]);
|
PyErr_SetString(PyExc_TypeError, &argparse[4]);
|
||||||
goto onError;
|
goto onError;
|
||||||
}
|
}
|
||||||
if (!PyArg_ParseTuple(restuple, argparse, &PyUnicode_Type, &repunicode, &newpos))
|
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)
|
if (restuple == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!PyTuple_Check(restuple)) {
|
if (!PyTuple_Check(restuple)) {
|
||||||
PyErr_Format(PyExc_TypeError, &argparse[4]);
|
PyErr_SetString(PyExc_TypeError, &argparse[4]);
|
||||||
Py_DECREF(restuple);
|
Py_DECREF(restuple);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -5128,7 +5128,7 @@ static PyObject *unicode_translate_call_errorhandler(const char *errors,
|
||||||
if (restuple == NULL)
|
if (restuple == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!PyTuple_Check(restuple)) {
|
if (!PyTuple_Check(restuple)) {
|
||||||
PyErr_Format(PyExc_TypeError, &argparse[4]);
|
PyErr_SetString(PyExc_TypeError, &argparse[4]);
|
||||||
Py_DECREF(restuple);
|
Py_DECREF(restuple);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|x64"
|
Name="Debug|x64"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops;.\debug.vsprops"
|
InheritedPropertySheets=".\sqlite3.vsprops;.\debug.vsprops;.\x64.vsprops"
|
||||||
CharacterSet="0"
|
CharacterSet="0"
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
|
@ -204,7 +204,7 @@
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|x64"
|
Name="Release|x64"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops"
|
InheritedPropertySheets=".\sqlite3.vsprops;.\x64.vsprops"
|
||||||
CharacterSet="0"
|
CharacterSet="0"
|
||||||
WholeProgramOptimization="1"
|
WholeProgramOptimization="1"
|
||||||
>
|
>
|
||||||
|
@ -327,7 +327,7 @@
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="PGInstrument|x64"
|
Name="PGInstrument|x64"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops;.\pginstrument.vsprops"
|
InheritedPropertySheets=".\sqlite3.vsprops;.\x64.vsprops;.\pginstrument.vsprops"
|
||||||
CharacterSet="0"
|
CharacterSet="0"
|
||||||
WholeProgramOptimization="1"
|
WholeProgramOptimization="1"
|
||||||
>
|
>
|
||||||
|
@ -449,7 +449,7 @@
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="PGUpdate|x64"
|
Name="PGUpdate|x64"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops;.\pgupdate.vsprops"
|
InheritedPropertySheets=".\sqlite3.vsprops;.\x64.vsprops;.\pgupdate.vsprops"
|
||||||
CharacterSet="0"
|
CharacterSet="0"
|
||||||
WholeProgramOptimization="1"
|
WholeProgramOptimization="1"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue