Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d75fcb4

Browse files
committed
Merged revisions 69576,69579-69580,69589,69619-69620,69633,69703-69704,69728-69730 via svnmerge from
svn+ssh://[email protected]/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. ........
1 parent e69a6b2 commit d75fcb4

11 files changed

Lines changed: 61 additions & 26 deletions

File tree

Doc/library/base64.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ The modern interface provides:
6262
.. function:: urlsafe_b64encode(s)
6363

6464
Encode string *s* using a URL-safe alphabet, which substitutes ``-`` instead of
65-
``+`` and ``_`` instead of ``/`` in the standard Base64 alphabet.
65+
``+`` and ``_`` instead of ``/`` in the standard Base64 alphabet. The result
66+
can still contain ``=``.
6667

6768

6869
.. function:: urlsafe_b64decode(s)

Doc/library/exceptions.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,11 @@ The following exceptions are the exceptions that are actually raised.
348348
more precise exception such as :exc:`IndexError`.
349349

350350

351+
.. exception:: VMSError
352+
353+
Only available on VMS. Raised when a VMS-specific error occurs.
354+
355+
351356
.. exception:: WindowsError
352357

353358
Raised when a Windows-specific error occurs or when the error number does not

Doc/library/functions.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,16 +1035,19 @@ are always available. They are listed here in alphabetical order.
10351035

10361036
.. function:: super([type[, object-or-type]])
10371037

1038-
Return a *super* object that acts as a proxy to superclasses of *type*.
1038+
Return a proxy object that delegates method calls to a parent class of
1039+
*type*. This is useful for accessing inherited methods that have been
1040+
overriden in a child class. The search order for parent classes is
1041+
determined by the ``__mro__`` attribute of the *type* and can change
1042+
whenever the parent classes are updated.
10391043

10401044
If the second argument is omitted the super object returned is unbound. If
10411045
the second argument is an object, ``isinstance(obj, type)`` must be true. If
1042-
the second argument is a type, ``issubclass(type2, type)`` must be true.
1043-
Calling :func:`super` without arguments is equivalent to ``super(this_class,
1044-
first_arg)``.
1046+
the second argument is a type, ``issubclass(type2, type)`` must be true (this
1047+
is useful for classmethods).
10451048

1046-
There are two typical use cases for :func:`super`. In a class hierarchy with
1047-
single inheritance, :func:`super` can be used to refer to parent classes without
1049+
There are two typical use cases for "super". In a class hierarchy with
1050+
single inheritance, "super" can be used to refer to parent classes without
10481051
naming them explicitly, thus making the code more maintainable. This use
10491052
closely parallels the use of "super" in other programming languages.
10501053

Doc/library/socketserver.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ An example for the :class:`ThreadingMixIn` class::
508508
# Exit the server thread when the main thread terminates
509509
server_thread.setDaemon(True)
510510
server_thread.start()
511-
print("Server loop running in thread:", server_thread.getName())
511+
print("Server loop running in thread:", server_thread.name)
512512

513513
client(ip, port, b"Hello World 1")
514514
client(ip, port, b"Hello World 2")

Doc/reference/simple_stmts.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ square brackets, is recursively defined as follows.
116116

117117
* If the target list is a single target: The object is assigned to that target.
118118

119-
* If the target list is a comma-separated list of targets:
119+
* If the target list is a comma-separated list of targets: The object must be an
120+
iterable with the same number of items as there are targets in the target list,
121+
and the items are assigned, from left to right, to the corresponding targets.
122+
(This rule is relaxed as of Python 1.5; in earlier versions, the object had to
123+
be a tuple. Since strings are sequences, an assignment like ``a, b = "xy"`` is
124+
now legal as long as the string has the right length.)
120125

121126
* If the target list contains one target prefixed with an asterisk, called a
122127
"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.
152157
be deallocated and its destructor (if it has one) to be called.
153158

154159
* If the target is a target list enclosed in parentheses or in square brackets:
155-
The object must be a sequence with the same number of items as there are targets
156-
in the target list, and its items are assigned, from left to right, to the
157-
corresponding targets.
160+
The object must be an iterable with the same number of items as there are
161+
targets in the target list, and its items are assigned, from left to right,
162+
to the corresponding targets.
158163

159164
.. index:: pair: attribute; assignment
160165

Lib/subprocess.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,9 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
11391139
if data:
11401140
os.waitpid(self.pid, 0)
11411141
child_exception = pickle.loads(data)
1142+
for fd in (p2cwrite, c2pread, errread):
1143+
if fd is not None:
1144+
os.close(fd)
11421145
raise child_exception
11431146

11441147

Lib/test/test_pep263.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! -*- coding: koi8-r -*-
1+
# -*- coding: koi8-r -*-
22

33
import unittest
44
from test import support

Lib/test/test_subprocess.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,22 @@ def test_bufsize_is_none(self):
521521
p = subprocess.Popen([sys.executable, "-c", "pass"], bufsize=None)
522522
self.assertEqual(p.wait(), 0)
523523

524+
def test_leaking_fds_on_error(self):
525+
# see bug #5179: Popen leaks file descriptors to PIPEs if
526+
# the child fails to execute; this will eventually exhaust
527+
# the maximum number of open fds. 1024 seems a very common
528+
# value for that limit, but Windows has 2048, so we loop
529+
# 1024 times (each call leaked two fds).
530+
for i in range(1024):
531+
try:
532+
subprocess.Popen(['nonexisting_i_hope'],
533+
stdout=subprocess.PIPE,
534+
stderr=subprocess.PIPE)
535+
# Windows raises IOError
536+
except (IOError, OSError) as err:
537+
if err.errno != 2: # ignore "no such file"
538+
pass # XXX see #5312
539+
524540
#
525541
# POSIX tests
526542
#

Modules/_ctypes/_ctypes.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,14 @@ CDataType_in_dll(PyObject *type, PyObject *args)
566566
#else
567567
address = (void *)ctypes_dlsym(handle, name);
568568
if (!address) {
569-
PyErr_Format(PyExc_ValueError,
570569
#ifdef __CYGWIN__
571570
/* dlerror() isn't very helpful on cygwin */
571+
PyErr_Format(PyExc_ValueError,
572572
"symbol '%s' not found (%s) ",
573-
name,
573+
name);
574+
#else
575+
PyErr_SetString(PyExc_ValueError, ctypes_dlerror());
574576
#endif
575-
ctypes_dlerror());
576577
return NULL;
577578
}
578579
#endif
@@ -3208,13 +3209,14 @@ CFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
32083209
#else
32093210
address = (PPROC)ctypes_dlsym(handle, name);
32103211
if (!address) {
3211-
PyErr_Format(PyExc_AttributeError,
32123212
#ifdef __CYGWIN__
32133213
/* dlerror() isn't very helpful on cygwin */
3214+
PyErr_Format(PyExc_AttributeError,
32143215
"function '%s' not found (%s) ",
3215-
name,
3216+
name);
3217+
#else
3218+
PyErr_SetString(PyExc_AttributeError, ctypes_dlerror());
32163219
#endif
3217-
ctypes_dlerror());
32183220
return NULL;
32193221
}
32203222
#endif

Objects/unicodeobject.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ int unicode_decode_call_errorhandler(const char *errors, PyObject **errorHandler
15911591
if (restuple == NULL)
15921592
goto onError;
15931593
if (!PyTuple_Check(restuple)) {
1594-
PyErr_Format(PyExc_TypeError, &argparse[4]);
1594+
PyErr_SetString(PyExc_TypeError, &argparse[4]);
15951595
goto onError;
15961596
}
15971597
if (!PyArg_ParseTuple(restuple, argparse, &PyUnicode_Type, &repunicode, &newpos))
@@ -3854,7 +3854,7 @@ static PyObject *unicode_encode_call_errorhandler(const char *errors,
38543854
if (restuple == NULL)
38553855
return NULL;
38563856
if (!PyTuple_Check(restuple)) {
3857-
PyErr_Format(PyExc_TypeError, &argparse[4]);
3857+
PyErr_SetString(PyExc_TypeError, &argparse[4]);
38583858
Py_DECREF(restuple);
38593859
return NULL;
38603860
}
@@ -5128,7 +5128,7 @@ static PyObject *unicode_translate_call_errorhandler(const char *errors,
51285128
if (restuple == NULL)
51295129
return NULL;
51305130
if (!PyTuple_Check(restuple)) {
5131-
PyErr_Format(PyExc_TypeError, &argparse[4]);
5131+
PyErr_SetString(PyExc_TypeError, &argparse[4]);
51325132
Py_DECREF(restuple);
51335133
return NULL;
51345134
}

0 commit comments

Comments
 (0)