Skip to content

Commit 8ffe0bc

Browse files
committed
Merged revisions 76923,76926,77009,77082-77083,77085,77087,77121 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ................ r76923 | georg.brandl | 2009-12-20 15:24:06 +0100 (So, 20 Dez 2009) | 1 line #7493: more review fixes. ................ r76926 | georg.brandl | 2009-12-20 15:38:23 +0100 (So, 20 Dez 2009) | 9 lines Recorded merge of revisions 76925 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76925 | georg.brandl | 2009-12-20 15:33:20 +0100 (So, 20 Dez 2009) | 1 line #7381: subprocess documentation and library docstring consistency fixes. ........ ................ r77009 | georg.brandl | 2009-12-23 11:30:45 +0100 (Mi, 23 Dez 2009) | 1 line #7417: add signature to open() docstring. ................ r77082 | georg.brandl | 2009-12-28 08:59:20 +0100 (Mo, 28 Dez 2009) | 1 line #7577: fix signature info for getbufferproc. ................ r77083 | georg.brandl | 2009-12-28 09:00:47 +0100 (Mo, 28 Dez 2009) | 9 lines Merged revisions 77081 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77081 | georg.brandl | 2009-12-28 08:59:05 +0100 (Mo, 28 Dez 2009) | 1 line #7577: fix signature of PyBuffer_FillInfo(). ........ ................ r77085 | georg.brandl | 2009-12-28 09:02:38 +0100 (Mo, 28 Dez 2009) | 9 lines Merged revisions 77084 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77084 | georg.brandl | 2009-12-28 09:01:59 +0100 (Mo, 28 Dez 2009) | 1 line #7586: fix typo. ........ ................ r77087 | georg.brandl | 2009-12-28 09:10:38 +0100 (Mo, 28 Dez 2009) | 9 lines Recorded merge of revisions 77086 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77086 | georg.brandl | 2009-12-28 09:09:32 +0100 (Mo, 28 Dez 2009) | 1 line #7381: consistency update, and backport avoiding ``None >= 0`` check from py3k. ........ ................ r77121 | georg.brandl | 2009-12-29 22:38:35 +0100 (Di, 29 Dez 2009) | 1 line #7590: exception classes no longer are in the "exceptions" module. Also clean up text that was written with string exceptions in mind. ................
1 parent 107690c commit 8ffe0bc

8 files changed

Lines changed: 115 additions & 135 deletions

File tree

Doc/c-api/buffer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ Buffer-related functions
324324
given shape with the given number of bytes per element.
325325

326326

327-
.. cfunction:: int PyBuffer_FillInfo(Py_buffer *view, void *buf, Py_ssize_t len, int readonly, int infoflags)
327+
.. cfunction:: int PyBuffer_FillInfo(Py_buffer *view, PyObject *obj, void *buf, Py_ssize_t len, int readonly, int infoflags)
328328

329329
Fill in a buffer-info structure, *view*, correctly for an exporter that can
330330
only share a contiguous chunk of memory of "unsigned bytes" of the given

Doc/c-api/typeobj.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ member in the :ctype:`PyTypeObject` structure should be *NULL*. Otherwise, the
12101210

12111211
This should fill a :ctype:`Py_buffer` with the necessary data for
12121212
exporting the type. The signature of :data:`getbufferproc` is ``int
1213-
(PyObject *obj, PyObject *view, int flags)``. *obj* is the object to
1213+
(PyObject *obj, Py_buffer *view, int flags)``. *obj* is the object to
12141214
export, *view* is the :ctype:`Py_buffer` struct to fill, and *flags* gives
12151215
the conditions the caller wants the memory under. (See
12161216
:cfunc:`PyObject_GetBuffer` for all flags.) :cmember:`bf_getbuffer` is

Doc/faq/design.rst

Lines changed: 79 additions & 91 deletions
Large diffs are not rendered by default.

Doc/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ a fixed-width print format:
709709
Point: x= 3.000 y= 4.000 hypot= 5.000
710710
Point: x=14.000 y= 0.714 hypot=14.018
711711

712-
The subclass shown above sets ``__slots__`` to an empty tuple. This keeps
712+
The subclass shown above sets ``__slots__`` to an empty tuple. This helps
713713
keep memory requirements low by preventing the creation of instance dictionaries.
714714

715715

Doc/library/exceptions.rst

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,12 @@
33
Built-in Exceptions
44
===================
55

6-
.. module:: exceptions
7-
:synopsis: Standard exception classes.
8-
9-
10-
Exceptions should be class objects. The exceptions are defined in the module
11-
:mod:`exceptions`. This module never needs to be imported explicitly: the
12-
exceptions are provided in the built-in namespace as well as the
13-
:mod:`exceptions` module.
14-
156
.. index::
167
statement: try
178
statement: except
189

19-
For class exceptions, in a :keyword:`try` statement with an :keyword:`except`
10+
In Python, all exceptions must be instances of a class that derives from
11+
:class:`BaseException`. In a :keyword:`try` statement with an :keyword:`except`
2012
clause that mentions a particular class, that clause also handles any exception
2113
classes derived from that class (but not exception classes from which *it* is
2214
derived). Two exception classes that are not related via subclassing are never
@@ -44,7 +36,7 @@ programmers are encouraged to at least derive new exceptions from the
4436
defining exceptions is available in the Python Tutorial under
4537
:ref:`tut-userexceptions`.
4638

47-
The following exceptions are only used as base classes for other exceptions.
39+
The following exceptions are used mostly as base classes for other exceptions.
4840

4941
.. XXX document with_traceback()
5042
@@ -99,8 +91,8 @@ The following exceptions are only used as base classes for other exceptions.
9991
In this last case, :attr:`args` contains the verbatim constructor arguments as a
10092
tuple.
10193

102-
The following exceptions are the exceptions that are actually raised.
10394

95+
The following exceptions are the exceptions that are usually raised.
10496

10597
.. exception:: AssertionError
10698

@@ -369,10 +361,10 @@ The following exceptions are the exceptions that are actually raised.
369361
associated value is a string indicating the type of the operands and the
370362
operation.
371363

364+
372365
The following exceptions are used as warning categories; see the :mod:`warnings`
373366
module for more information.
374367

375-
376368
.. exception:: Warning
377369

378370
Base class for warning categories.

Doc/library/subprocess.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,9 @@ This module defines one class called :class:`Popen`:
136136

137137
.. note::
138138

139-
If specified, *env* must provide any variables required
140-
for the program to execute. On Windows, in order to run a
141-
`side-by-side assembly`_ the specified *env* **must** include a valid
142-
:envvar:`SystemRoot`.
139+
If specified, *env* must provide any variables required for the program to
140+
execute. On Windows, in order to run a `side-by-side assembly`_ the
141+
specified *env* **must** include a valid :envvar:`SystemRoot`.
143142

144143
.. _side-by-side assembly: http://en.wikipedia.org/wiki/Side-by-Side_Assembly
145144

@@ -188,7 +187,7 @@ This module also defines four shortcut functions:
188187

189188
The arguments are the same as for the Popen constructor. Example::
190189

191-
retcode = call(["ls", "-l"])
190+
>>> retcode = subprocess.call(["ls", "-l"])
192191

193192
.. warning::
194193

@@ -206,7 +205,8 @@ This module also defines four shortcut functions:
206205

207206
The arguments are the same as for the Popen constructor. Example::
208207

209-
check_call(["ls", "-l"])
208+
>>> subprocess.check_call(["ls", "-l"])
209+
0
210210

211211
.. warning::
212212

@@ -225,15 +225,15 @@ This module also defines four shortcut functions:
225225
The arguments are the same as for the :class:`Popen` constructor. Example::
226226

227227
>>> subprocess.check_output(["ls", "-l", "/dev/null"])
228-
'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
228+
b'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
229229

230230
The stdout argument is not allowed as it is used internally.
231231
To capture standard error in the result, use ``stderr=subprocess.STDOUT``::
232232

233233
>>> subprocess.check_output(
234-
["/bin/sh", "-c", "ls non_existent_file ; exit 0"],
235-
stderr=subprocess.STDOUT)
236-
'ls: non_existent_file: No such file or directory\n'
234+
... ["/bin/sh", "-c", "ls non_existent_file; exit 0"],
235+
... stderr=subprocess.STDOUT)
236+
b'ls: non_existent_file: No such file or directory\n'
237237

238238
.. versionadded:: 3.1
239239

@@ -247,7 +247,6 @@ This module also defines four shortcut functions:
247247
stripped from the output. The exit status for the command can be interpreted
248248
according to the rules for the C function :cfunc:`wait`. Example::
249249

250-
>>> import subprocess
251250
>>> subprocess.getstatusoutput('ls /bin/ls')
252251
(0, '/bin/ls')
253252
>>> subprocess.getstatusoutput('cat /bin/junk')
@@ -264,7 +263,6 @@ This module also defines four shortcut functions:
264263
Like :func:`getstatusoutput`, except the exit status is ignored and the return
265264
value is a string containing the command's output. Example::
266265

267-
>>> import subprocess
268266
>>> subprocess.getoutput('ls /bin/ls')
269267
'/bin/ls'
270268

Lib/subprocess.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class Popen(args, bufsize=0, executable=None,
110110
111111
The arguments are the same as for the Popen constructor. Example:
112112
113-
retcode = call(["ls", "-l"])
113+
>>> retcode = call(["ls", "-l"])
114114
115115
check_call(*popenargs, **kwargs):
116116
Run command with arguments. Wait for command to complete. If the
@@ -120,7 +120,8 @@ class Popen(args, bufsize=0, executable=None,
120120
121121
The arguments are the same as for the Popen constructor. Example:
122122
123-
check_call(["ls", "-l"])
123+
>>> check_call(["ls", "-l"])
124+
0
124125
125126
getstatusoutput(cmd):
126127
Return (status, output) of executing cmd in a shell.
@@ -131,7 +132,6 @@ class Popen(args, bufsize=0, executable=None,
131132
is stripped from the output. The exit status for the command can be
132133
interpreted according to the rules for the C function wait(). Example:
133134
134-
>>> import subprocess
135135
>>> subprocess.getstatusoutput('ls /bin/ls')
136136
(0, '/bin/ls')
137137
>>> subprocess.getstatusoutput('cat /bin/junk')
@@ -145,20 +145,19 @@ class Popen(args, bufsize=0, executable=None,
145145
Like getstatusoutput(), except the exit status is ignored and the return
146146
value is a string containing the command's output. Example:
147147
148-
>>> import subprocess
149148
>>> subprocess.getoutput('ls /bin/ls')
150149
'/bin/ls'
151150
152151
check_output(*popenargs, **kwargs):
153-
Run command with arguments and return its output as a byte string.
152+
Run command with arguments and return its output as a byte string.
154153
155-
If the exit code was non-zero it raises a CalledProcessError. The
156-
CalledProcessError object will have the return code in the returncode
157-
attribute and output in the output attribute.
154+
If the exit code was non-zero it raises a CalledProcessError. The
155+
CalledProcessError object will have the return code in the returncode
156+
attribute and output in the output attribute.
158157
159-
The arguments are the same as for the Popen constructor. Example:
158+
The arguments are the same as for the Popen constructor. Example:
160159
161-
output = subprocess.check_output(["ls", "-l", "/dev/null"])
160+
>>> output = subprocess.check_output(["ls", "-l", "/dev/null"])
162161
163162
164163
Exceptions
@@ -437,7 +436,7 @@ def check_call(*popenargs, **kwargs):
437436

438437

439438
def check_output(*popenargs, **kwargs):
440-
"""Run command with arguments and return its output as a byte string.
439+
r"""Run command with arguments and return its output as a byte string.
441440
442441
If the exit code was non-zero it raises a CalledProcessError. The
443442
CalledProcessError object will have the return code in the returncode
@@ -446,15 +445,15 @@ def check_output(*popenargs, **kwargs):
446445
The arguments are the same as for the Popen constructor. Example:
447446
448447
>>> check_output(["ls", "-l", "/dev/null"])
449-
'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
448+
b'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
450449
451450
The stdout argument is not allowed as it is used internally.
452-
To capture standard error in the result, use stderr=subprocess.STDOUT.
451+
To capture standard error in the result, use stderr=STDOUT.
453452
454453
>>> check_output(["/bin/sh", "-c",
455-
"ls -l non_existent_file ; exit 0"],
456-
stderr=subprocess.STDOUT)
457-
'ls: non_existent_file: No such file or directory\n'
454+
... "ls -l non_existent_file ; exit 0"],
455+
... stderr=STDOUT)
456+
b'ls: non_existent_file: No such file or directory\n'
458457
"""
459458
if 'stdout' in kwargs:
460459
raise ValueError('stdout argument not allowed, it will be overridden.')

Modules/_io/_iomodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ PyObject *PyExc_BlockingIOError = (PyObject *)&_PyExc_BlockingIOError;
176176
* The main open() function
177177
*/
178178
PyDoc_STRVAR(open_doc,
179+
"open(file, mode='r', buffering=None, encoding=None,\n"
180+
" errors=None, newline=None, closefd=True) -> file object\n"
181+
"\n"
179182
"Open file and return a stream. Raise IOError upon failure.\n"
180183
"\n"
181184
"file is either a text or byte string giving the name (and the path\n"

0 commit comments

Comments
 (0)