Issue #25523: Merge a-to-an corrections from 3.5

This commit is contained in:
Martin Panter 2015-11-02 04:27:17 +00:00
commit e56a919100
93 changed files with 146 additions and 146 deletions

View File

@ -40,7 +40,7 @@ protocol <bufferobjects>`. This protocol has two sides:
Simple objects such as :class:`bytes` and :class:`bytearray` expose their Simple objects such as :class:`bytes` and :class:`bytearray` expose their
underlying buffer in byte-oriented form. Other forms are possible; for example, underlying buffer in byte-oriented form. Other forms are possible; for example,
the elements exposed by a :class:`array.array` can be multi-byte values. the elements exposed by an :class:`array.array` can be multi-byte values.
An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase.write` An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase.write`
method of file objects: any object that can export a series of bytes through method of file objects: any object that can export a series of bytes through

View File

@ -849,7 +849,7 @@ How do I modify a string in place?
You can't, because strings are immutable. In most situations, you should You can't, because strings are immutable. In most situations, you should
simply construct a new string from the various parts you want to assemble simply construct a new string from the various parts you want to assemble
it from. However, if you need an object with the ability to modify in-place it from. However, if you need an object with the ability to modify in-place
unicode data, try using a :class:`io.StringIO` object or the :mod:`array` unicode data, try using an :class:`io.StringIO` object or the :mod:`array`
module:: module::
>>> import io >>> import io

View File

@ -530,7 +530,7 @@ allow_abbrev
^^^^^^^^^^^^ ^^^^^^^^^^^^
Normally, when you pass an argument list to the Normally, when you pass an argument list to the
:meth:`~ArgumentParser.parse_args` method of a :class:`ArgumentParser`, :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`,
it :ref:`recognizes abbreviations <prefix-matching>` of long options. it :ref:`recognizes abbreviations <prefix-matching>` of long options.
This feature can be disabled by setting ``allow_abbrev`` to ``False``:: This feature can be disabled by setting ``allow_abbrev`` to ``False``::

View File

@ -47,7 +47,7 @@ Usually an IFF-type file consists of one or more chunks. The proposed usage of
the :class:`Chunk` class defined here is to instantiate an instance at the start the :class:`Chunk` class defined here is to instantiate an instance at the start
of each chunk and read from the instance until it reaches the end, after which a of each chunk and read from the instance until it reaches the end, after which a
new instance can be instantiated. At the end of the file, creating a new new instance can be instantiated. At the end of the file, creating a new
instance will fail with a :exc:`EOFError` exception. instance will fail with an :exc:`EOFError` exception.
.. class:: Chunk(file, align=True, bigendian=True, inclheader=False) .. class:: Chunk(file, align=True, bigendian=True, inclheader=False)

View File

@ -90,7 +90,7 @@ Executor Objects
ThreadPoolExecutor ThreadPoolExecutor
------------------ ------------------
:class:`ThreadPoolExecutor` is a :class:`Executor` subclass that uses a pool of :class:`ThreadPoolExecutor` is an :class:`Executor` subclass that uses a pool of
threads to execute calls asynchronously. threads to execute calls asynchronously.
Deadlocks can occur when the callable associated with a :class:`Future` waits on Deadlocks can occur when the callable associated with a :class:`Future` waits on
@ -304,7 +304,7 @@ The :class:`Future` class encapsulates the asynchronous execution of a callable.
Added callables are called in the order that they were added and are Added callables are called in the order that they were added and are
always called in a thread belonging to the process that added them. If always called in a thread belonging to the process that added them. If
the callable raises a :exc:`Exception` subclass, it will be logged and the callable raises an :exc:`Exception` subclass, it will be logged and
ignored. If the callable raises a :exc:`BaseException` subclass, the ignored. If the callable raises a :exc:`BaseException` subclass, the
behavior is undefined. behavior is undefined.

View File

@ -39,7 +39,7 @@ loads libraries which export functions using the standard ``cdecl`` calling
convention, while *windll* libraries call functions using the ``stdcall`` convention, while *windll* libraries call functions using the ``stdcall``
calling convention. *oledll* also uses the ``stdcall`` calling convention, and calling convention. *oledll* also uses the ``stdcall`` calling convention, and
assumes the functions return a Windows :c:type:`HRESULT` error code. The error assumes the functions return a Windows :c:type:`HRESULT` error code. The error
code is used to automatically raise a :class:`OSError` exception when the code is used to automatically raise an :class:`OSError` exception when the
function call fails. function call fails.
.. versionchanged:: 3.3 .. versionchanged:: 3.3

View File

@ -278,7 +278,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
generating the delta lines) in unified diff format. generating the delta lines) in unified diff format.
Unified diffs are a compact way of showing just the lines that have changed plus Unified diffs are a compact way of showing just the lines that have changed plus
a few lines of context. The changes are shown in a inline style (instead of a few lines of context. The changes are shown in an inline style (instead of
separate before/after blocks). The number of context lines is set by *n* which separate before/after blocks). The number of context lines is set by *n* which
defaults to three. defaults to three.

View File

@ -16,13 +16,13 @@ interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines.
All functions in this module take a file descriptor *fd* as their first All functions in this module take a file descriptor *fd* as their first
argument. This can be an integer file descriptor, such as returned by argument. This can be an integer file descriptor, such as returned by
``sys.stdin.fileno()``, or a :class:`io.IOBase` object, such as ``sys.stdin`` ``sys.stdin.fileno()``, or an :class:`io.IOBase` object, such as ``sys.stdin``
itself, which provides a :meth:`~io.IOBase.fileno` that returns a genuine file itself, which provides a :meth:`~io.IOBase.fileno` that returns a genuine file
descriptor. descriptor.
.. versionchanged:: 3.3 .. versionchanged:: 3.3
Operations in this module used to raise a :exc:`IOError` where they now Operations in this module used to raise an :exc:`IOError` where they now
raise a :exc:`OSError`. raise an :exc:`OSError`.
The module defines the following functions: The module defines the following functions:

View File

@ -287,9 +287,9 @@ followed by ``lines`` for the text version or ``binary`` for the binary version.
.. method:: FTP.transfercmd(cmd, rest=None) .. method:: FTP.transfercmd(cmd, rest=None)
Initiate a transfer over the data connection. If the transfer is active, send a Initiate a transfer over the data connection. If the transfer is active, send an
``EPRT`` or ``PORT`` command and the transfer command specified by *cmd*, and ``EPRT`` or ``PORT`` command and the transfer command specified by *cmd*, and
accept the connection. If the server is passive, send a ``EPSV`` or ``PASV`` accept the connection. If the server is passive, send an ``EPSV`` or ``PASV``
command, connect to it, and start the transfer command. Either way, return the command, connect to it, and start the transfer command. Either way, return the
socket for the connection. socket for the connection.

View File

@ -1032,9 +1032,9 @@ are always available. They are listed here in alphabetical order.
:class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When used :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When used
to open a file in a binary mode with buffering, the returned class is a to open a file in a binary mode with buffering, the returned class is a
subclass of :class:`io.BufferedIOBase`. The exact class varies: in read subclass of :class:`io.BufferedIOBase`. The exact class varies: in read
binary mode, it returns a :class:`io.BufferedReader`; in write binary and binary mode, it returns an :class:`io.BufferedReader`; in write binary and
append binary modes, it returns a :class:`io.BufferedWriter`, and in append binary modes, it returns an :class:`io.BufferedWriter`, and in
read/write mode, it returns a :class:`io.BufferedRandom`. When buffering is read/write mode, it returns an :class:`io.BufferedRandom`. When buffering is
disabled, the raw stream, a subclass of :class:`io.RawIOBase`, disabled, the raw stream, a subclass of :class:`io.RawIOBase`,
:class:`io.FileIO`, is returned. :class:`io.FileIO`, is returned.

View File

@ -96,7 +96,7 @@ The module defines the following items:
Calling a :class:`GzipFile` object's :meth:`close` method does not close Calling a :class:`GzipFile` object's :meth:`close` method does not close
*fileobj*, since you might wish to append more material after the compressed *fileobj*, since you might wish to append more material after the compressed
data. This also allows you to pass a :class:`io.BytesIO` object opened for data. This also allows you to pass an :class:`io.BytesIO` object opened for
writing as *fileobj*, and retrieve the resulting memory buffer using the writing as *fileobj*, and retrieve the resulting memory buffer using the
:class:`io.BytesIO` object's :meth:`~io.BytesIO.getvalue` method. :class:`io.BytesIO` object's :meth:`~io.BytesIO.getvalue` method.

View File

@ -176,7 +176,7 @@ contained :class:`Cookie` objects.
The *response* object (usually the result of a call to The *response* object (usually the result of a call to
:meth:`urllib.request.urlopen`, or similar) should support an :meth:`info` :meth:`urllib.request.urlopen`, or similar) should support an :meth:`info`
method, which returns a :class:`email.message.Message` instance. method, which returns an :class:`email.message.Message` instance.
The *request* object (usually a :class:`urllib.request.Request` instance) The *request* object (usually a :class:`urllib.request.Request` instance)
must support the methods :meth:`get_full_url`, :meth:`get_host`, must support the methods :meth:`get_full_url`, :meth:`get_host`,

View File

@ -176,7 +176,7 @@ of which this module provides three different variants:
.. method:: handle_expect_100() .. method:: handle_expect_100()
When a HTTP/1.1 compliant server receives a ``Expect: 100-continue`` When a HTTP/1.1 compliant server receives an ``Expect: 100-continue``
request header it responds back with a ``100 Continue`` followed by ``200 request header it responds back with a ``100 Continue`` followed by ``200
OK`` headers. OK`` headers.
This method can be overridden to raise an error if the server does not This method can be overridden to raise an error if the server does not
@ -210,7 +210,7 @@ of which this module provides three different variants:
are picked up from the :meth:`version_string` and are picked up from the :meth:`version_string` and
:meth:`date_time_string` methods, respectively. If the server does not :meth:`date_time_string` methods, respectively. If the server does not
intend to send any other headers using the :meth:`send_header` method, intend to send any other headers using the :meth:`send_header` method,
then :meth:`send_response` should be followed by a :meth:`end_headers` then :meth:`send_response` should be followed by an :meth:`end_headers`
call. call.
.. versionchanged:: 3.3 .. versionchanged:: 3.3

View File

@ -674,7 +674,7 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
In Babyl mailboxes, the headers of a message are not stored contiguously In Babyl mailboxes, the headers of a message are not stored contiguously
with the body of the message. To generate a file-like representation, the with the body of the message. To generate a file-like representation, the
headers and body are copied together into a :class:`io.BytesIO` instance, headers and body are copied together into an :class:`io.BytesIO` instance,
which has an API identical to that of a which has an API identical to that of a
file. As a result, the file-like object is truly independent of the file. As a result, the file-like object is truly independent of the
underlying mailbox but does not save memory compared to a string underlying mailbox but does not save memory compared to a string

View File

@ -1046,7 +1046,7 @@ Connection objects are usually created using :func:`Pipe` -- see also
readable. readable.
.. versionchanged:: 3.3 .. versionchanged:: 3.3
This function used to raise a :exc:`IOError`, which is now an This function used to raise :exc:`IOError`, which is now an
alias of :exc:`OSError`. alias of :exc:`OSError`.

View File

@ -341,7 +341,7 @@ tuples or objects that the method normally returns will be empty.
.. method:: NNTP.over(message_spec, *, file=None) .. method:: NNTP.over(message_spec, *, file=None)
Send a ``OVER`` command, or a ``XOVER`` command on legacy servers. Send an ``OVER`` command, or an ``XOVER`` command on legacy servers.
*message_spec* can be either a string representing a message id, or *message_spec* can be either a string representing a message id, or
a ``(first, last)`` tuple of numbers indicating a range of articles in a ``(first, last)`` tuple of numbers indicating a range of articles in
the current group, or a ``(first, None)`` tuple indicating a range of the current group, or a ``(first, None)`` tuple indicating a range of

View File

@ -1324,7 +1324,7 @@ where the input parameters are
the list of arguments to process (default: ``sys.argv[1:]``) the list of arguments to process (default: ``sys.argv[1:]``)
``values`` ``values``
a :class:`optparse.Values` object to store option arguments in (default: a an :class:`optparse.Values` object to store option arguments in (default: a
new instance of :class:`Values`) -- if you give an existing object, the new instance of :class:`Values`) -- if you give an existing object, the
option defaults will not be initialized on it option defaults will not be initialized on it

View File

@ -289,7 +289,7 @@ the :mod:`glob` module.)
Return ``True`` if both pathname arguments refer to the same file or directory. Return ``True`` if both pathname arguments refer to the same file or directory.
This is determined by the device number and i-node number and raises an This is determined by the device number and i-node number and raises an
exception if a :func:`os.stat` call on either pathname fails. exception if an :func:`os.stat` call on either pathname fails.
Availability: Unix, Windows. Availability: Unix, Windows.

View File

@ -221,7 +221,7 @@ process more convenient:
The argument *file* must have two methods, a read() method that takes an The argument *file* must have two methods, a read() method that takes an
integer argument, and a readline() method that requires no arguments. Both integer argument, and a readline() method that requires no arguments. Both
methods should return bytes. Thus *file* can be an on-disk file opened for methods should return bytes. Thus *file* can be an on-disk file opened for
binary reading, a :class:`io.BytesIO` object, or any other custom object binary reading, an :class:`io.BytesIO` object, or any other custom object
that meets this interface. that meets this interface.
Optional keyword arguments are *fix_imports*, *encoding* and *errors*, Optional keyword arguments are *fix_imports*, *encoding* and *errors*,
@ -357,7 +357,7 @@ The :mod:`pickle` module exports two classes, :class:`Pickler` and
The argument *file* must have two methods, a read() method that takes an The argument *file* must have two methods, a read() method that takes an
integer argument, and a readline() method that requires no arguments. Both integer argument, and a readline() method that requires no arguments. Both
methods should return bytes. Thus *file* can be an on-disk file object methods should return bytes. Thus *file* can be an on-disk file object
opened for binary reading, a :class:`io.BytesIO` object, or any other opened for binary reading, an :class:`io.BytesIO` object, or any other
custom object that meets this interface. custom object that meets this interface.
Optional keyword arguments are *fix_imports*, *encoding* and *errors*, Optional keyword arguments are *fix_imports*, *encoding* and *errors*,

View File

@ -763,7 +763,7 @@ The ``errors`` module has the following attributes:
.. data:: XML_ERROR_UNDEFINED_ENTITY .. data:: XML_ERROR_UNDEFINED_ENTITY
A reference was made to a entity which was not defined. A reference was made to an entity which was not defined.
.. data:: XML_ERROR_UNKNOWN_ENCODING .. data:: XML_ERROR_UNKNOWN_ENCODING

View File

@ -207,8 +207,8 @@ Directory and files operations
and metadata of the linked files are copied to the new tree. and metadata of the linked files are copied to the new tree.
When *symlinks* is false, if the file pointed by the symlink doesn't When *symlinks* is false, if the file pointed by the symlink doesn't
exist, a exception will be added in the list of errors raised in exist, an exception will be added in the list of errors raised in
a :exc:`Error` exception at the end of the copy process. an :exc:`Error` exception at the end of the copy process.
You can set the optional *ignore_dangling_symlinks* flag to true if you You can set the optional *ignore_dangling_symlinks* flag to true if you
want to silence this exception. Notice that this option has no effect want to silence this exception. Notice that this option has no effect
on platforms that don't support :func:`os.symlink`. on platforms that don't support :func:`os.symlink`.

View File

@ -22,7 +22,7 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
.. class:: SMTP(host='', port=0, local_hostname=None[, timeout], source_address=None) .. class:: SMTP(host='', port=0, local_hostname=None[, timeout], source_address=None)
A :class:`SMTP` instance encapsulates an SMTP connection. It has methods An :class:`SMTP` instance encapsulates an SMTP connection. It has methods
that support a full repertoire of SMTP and ESMTP operations. If the optional that support a full repertoire of SMTP and ESMTP operations. If the optional
host and port parameters are given, the SMTP :meth:`connect` method is host and port parameters are given, the SMTP :meth:`connect` method is
called with those parameters during initialization. If specified, called with those parameters during initialization. If specified,
@ -69,7 +69,7 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
certfile=None [, timeout], context=None, \ certfile=None [, timeout], context=None, \
source_address=None) source_address=None)
A :class:`SMTP_SSL` instance behaves exactly the same as instances of An :class:`SMTP_SSL` instance behaves exactly the same as instances of
:class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is :class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is
required from the beginning of the connection and using :meth:`starttls` is required from the beginning of the connection and using :meth:`starttls` is
not appropriate. If *host* is not specified, the local host is used. If not appropriate. If *host* is not specified, the local host is used. If

View File

@ -715,7 +715,7 @@ The :mod:`socket` module also offers various network-related services:
Supported values for *address_family* are currently :const:`AF_INET` and Supported values for *address_family* are currently :const:`AF_INET` and
:const:`AF_INET6`. If the bytes object *packed_ip* is not the correct :const:`AF_INET6`. If the bytes object *packed_ip* is not the correct
length for the specified address family, :exc:`ValueError` will be raised. length for the specified address family, :exc:`ValueError` will be raised.
A :exc:`OSError` is raised for errors from the call to :func:`inet_ntop`. :exc:`OSError` is raised for errors from the call to :func:`inet_ntop`.
Availability: Unix (maybe not all platforms), Windows. Availability: Unix (maybe not all platforms), Windows.
@ -1014,7 +1014,7 @@ to sockets.
interpreted the same way as by the built-in :func:`open` function. interpreted the same way as by the built-in :func:`open` function.
The socket must be in blocking mode; it can have a timeout, but the file The socket must be in blocking mode; it can have a timeout, but the file
object's internal buffer may end up in a inconsistent state if a timeout object's internal buffer may end up in an inconsistent state if a timeout
occurs. occurs.
Closing the file object returned by :meth:`makefile` won't close the Closing the file object returned by :meth:`makefile` won't close the

View File

@ -615,7 +615,7 @@ Cursor Objects
.. attribute:: lastrowid .. attribute:: lastrowid
This read-only attribute provides the rowid of the last modified row. It is This read-only attribute provides the rowid of the last modified row. It is
only set if you issued a ``INSERT`` statement using the :meth:`execute` only set if you issued an ``INSERT`` statement using the :meth:`execute`
method. For operations other than ``INSERT`` or when :meth:`executemany` is method. For operations other than ``INSERT`` or when :meth:`executemany` is
called, :attr:`lastrowid` is set to :const:`None`. called, :attr:`lastrowid` is set to :const:`None`.

View File

@ -951,7 +951,7 @@ Notes:
runtime cost, you must switch to one of the alternatives below: runtime cost, you must switch to one of the alternatives below:
* if concatenating :class:`str` objects, you can build a list and use * if concatenating :class:`str` objects, you can build a list and use
:meth:`str.join` at the end or else write to a :class:`io.StringIO` :meth:`str.join` at the end or else write to an :class:`io.StringIO`
instance and retrieve its value when complete instance and retrieve its value when complete
* if concatenating :class:`bytes` objects, you can similarly use * if concatenating :class:`bytes` objects, you can similarly use

View File

@ -54,8 +54,8 @@ The :mod:`sunau` module defines the following functions:
Note that it does not allow read/write files. Note that it does not allow read/write files.
A *mode* of ``'r'`` returns a :class:`AU_read` object, while a *mode* of ``'w'`` A *mode* of ``'r'`` returns an :class:`AU_read` object, while a *mode* of ``'w'``
or ``'wb'`` returns a :class:`AU_write` object. or ``'wb'`` returns an :class:`AU_write` object.
.. function:: openfp(file, mode) .. function:: openfp(file, mode)

View File

@ -96,7 +96,7 @@ The module defines the following user-callable items:
causes the file to roll over to an on-disk file regardless of its size. causes the file to roll over to an on-disk file regardless of its size.
The returned object is a file-like object whose :attr:`_file` attribute The returned object is a file-like object whose :attr:`_file` attribute
is either a :class:`io.BytesIO` or :class:`io.StringIO` object (depending on is either an :class:`io.BytesIO` or :class:`io.StringIO` object (depending on
whether binary or text *mode* was specified) or a true file whether binary or text *mode* was specified) or a true file
object, depending on whether :func:`rollover` has been called. This object, depending on whether :func:`rollover` has been called. This
file-like object can be used in a :keyword:`with` statement, just like file-like object can be used in a :keyword:`with` statement, just like

View File

@ -1131,7 +1131,7 @@ you wanted a :class:`NonCallableMock` to be used:
... ...
TypeError: 'NonCallableMock' object is not callable TypeError: 'NonCallableMock' object is not callable
Another use case might be to replace an object with a :class:`io.StringIO` instance: Another use case might be to replace an object with an :class:`io.StringIO` instance:
>>> from io import StringIO >>> from io import StringIO
>>> def foo(): >>> def foo():

View File

@ -47,7 +47,7 @@ Example::
* :data:`PROCESSING_INSTRUCTION` * :data:`PROCESSING_INSTRUCTION`
* :data:`IGNORABLE_WHITESPACE` * :data:`IGNORABLE_WHITESPACE`
``node`` is a object of type :class:`xml.dom.minidom.Document`, ``node`` is an object of type :class:`xml.dom.minidom.Document`,
:class:`xml.dom.minidom.Element` or :class:`xml.dom.minidom.Text`. :class:`xml.dom.minidom.Element` or :class:`xml.dom.minidom.Text`.
Since the document is treated as a "flat" stream of events, the document "tree" Since the document is treated as a "flat" stream of events, the document "tree"

View File

@ -2358,7 +2358,7 @@ An *asynchronous iterable* is able to call asynchronous code in its
``__aiter__`` implementation, and an *asynchronous iterator* can call ``__aiter__`` implementation, and an *asynchronous iterator* can call
asynchronous code in its ``__anext__`` method. asynchronous code in its ``__anext__`` method.
Asynchronous iterators can be used in a :keyword:`async for` statement. Asynchronous iterators can be used in an :keyword:`async for` statement.
.. method:: object.__aiter__(self) .. method:: object.__aiter__(self)
@ -2393,7 +2393,7 @@ Asynchronous Context Managers
An *asynchronous context manager* is a *context manager* that is able to An *asynchronous context manager* is a *context manager* that is able to
suspend execution in its ``__aenter__`` and ``__aexit__`` methods. suspend execution in its ``__aenter__`` and ``__aexit__`` methods.
Asynchronous context managers can be used in a :keyword:`async with` statement. Asynchronous context managers can be used in an :keyword:`async with` statement.
.. method:: object.__aenter__(self) .. method:: object.__aenter__(self)

View File

@ -336,7 +336,7 @@ example::
A *finally clause* is always executed before leaving the :keyword:`try` A *finally clause* is always executed before leaving the :keyword:`try`
statement, whether an exception has occurred or not. When an exception has statement, whether an exception has occurred or not. When an exception has
occurred in the :keyword:`try` clause and has not been handled by an occurred in the :keyword:`try` clause and has not been handled by an
:keyword:`except` clause (or it has occurred in a :keyword:`except` or :keyword:`except` clause (or it has occurred in an :keyword:`except` or
:keyword:`else` clause), it is re-raised after the :keyword:`finally` clause has :keyword:`else` clause), it is re-raised after the :keyword:`finally` clause has
been executed. The :keyword:`finally` clause is also executed "on the way out" been executed. The :keyword:`finally` clause is also executed "on the way out"
when any other clause of the :keyword:`try` statement is left via a when any other clause of the :keyword:`try` statement is left via a

View File

@ -303,7 +303,7 @@ For non-negative indices, the length of a slice is the difference of the
indices, if both are within bounds. For example, the length of ``word[1:3]`` is indices, if both are within bounds. For example, the length of ``word[1:3]`` is
2. 2.
Attempting to use a index that is too large will result in an error:: Attempting to use an index that is too large will result in an error::
>>> word[42] # the word only has 6 characters >>> word[42] # the word only has 6 characters
Traceback (most recent call last): Traceback (most recent call last):

View File

@ -555,7 +555,7 @@ will include metadata, making it possible to build automated cataloguing systems
and experiment with them. With the result experience, perhaps it'll be possible and experiment with them. With the result experience, perhaps it'll be possible
to design a really good catalog and then build support for it into Python 2.2. to design a really good catalog and then build support for it into Python 2.2.
For example, the Distutils :command:`sdist` and :command:`bdist_\*` commands For example, the Distutils :command:`sdist` and :command:`bdist_\*` commands
could support a ``upload`` option that would automatically upload your could support an ``upload`` option that would automatically upload your
package to a catalog server. package to a catalog server.
You can start creating packages containing :file:`PKG-INFO` even if you're not You can start creating packages containing :file:`PKG-INFO` even if you're not

View File

@ -411,7 +411,7 @@ PEP 279: enumerate()
A new built-in function, :func:`enumerate`, will make certain loops a bit A new built-in function, :func:`enumerate`, will make certain loops a bit
clearer. ``enumerate(thing)``, where *thing* is either an iterator or a clearer. ``enumerate(thing)``, where *thing* is either an iterator or a
sequence, returns a iterator that will return ``(0, thing[0])``, ``(1, sequence, returns an iterator that will return ``(0, thing[0])``, ``(1,
thing[1])``, ``(2, thing[2])``, and so forth. thing[1])``, ``(2, thing[2])``, and so forth.
A common idiom to change every element of a list looks like this:: A common idiom to change every element of a list looks like this::

View File

@ -336,7 +336,7 @@ New, Improved, and Deprecated Modules
(Contributed by David Laban; :issue:`4739`.) (Contributed by David Laban; :issue:`4739`.)
* The :mod:`unittest` module now supports skipping individual tests or classes * The :mod:`unittest` module now supports skipping individual tests or classes
of tests. And it supports marking a test as a expected failure, a test that of tests. And it supports marking a test as an expected failure, a test that
is known to be broken, but shouldn't be counted as a failure on a is known to be broken, but shouldn't be counted as a failure on a
TestResult:: TestResult::

View File

@ -788,7 +788,7 @@ functools
:issue:`8814`.) :issue:`8814`.)
* To help write classes with rich comparison methods, a new decorator * To help write classes with rich comparison methods, a new decorator
:func:`functools.total_ordering` will use a existing equality and inequality :func:`functools.total_ordering` will use existing equality and inequality
methods to fill in the remaining methods. methods to fill in the remaining methods.
For example, supplying *__eq__* and *__lt__* will enable For example, supplying *__eq__* and *__lt__* will enable
@ -1399,7 +1399,7 @@ Aides and Brian Curtin in :issue:`9962`, :issue:`1675951`, :issue:`7471` and
Also, the :class:`zipfile.ZipExtFile` class was reworked internally to represent Also, the :class:`zipfile.ZipExtFile` class was reworked internally to represent
files stored inside an archive. The new implementation is significantly faster files stored inside an archive. The new implementation is significantly faster
and can be wrapped in a :class:`io.BufferedReader` object for more speedups. It and can be wrapped in an :class:`io.BufferedReader` object for more speedups. It
also solves an issue where interleaved calls to *read* and *readline* gave the also solves an issue where interleaved calls to *read* and *readline* gave the
wrong results. wrong results.

View File

@ -1421,7 +1421,7 @@ can be used to directly manage when the accumlated headers are sent.
:class:`http.client.HTTPResponse` now has a :class:`http.client.HTTPResponse` now has a
:meth:`~http.client.HTTPResponse.readinto` method, which means it can be used :meth:`~http.client.HTTPResponse.readinto` method, which means it can be used
as a :class:`io.RawIOBase` class. (Contributed by John Kuhn in as an :class:`io.RawIOBase` class. (Contributed by John Kuhn in
:issue:`13464`.) :issue:`13464`.)

View File

@ -465,7 +465,7 @@ not make an additional system call::
PEP 475: Retry system calls failing with EINTR PEP 475: Retry system calls failing with EINTR
---------------------------------------------- ----------------------------------------------
A :py:data:`errno.EINTR` error code is returned whenever a system call, that An :py:data:`errno.EINTR` error code is returned whenever a system call, that
is waiting for I/O, is interrupted by a signal. Previously, Python would is waiting for I/O, is interrupted by a signal. Previously, Python would
raise :exc:`InterruptedError` in such case. This meant that, when writing a raise :exc:`InterruptedError` in such case. This meant that, when writing a
Python application, the developer had two choices: Python application, the developer had two choices:

View File

@ -95,7 +95,7 @@ Proposal
numeric, sequence, and mapping. Each protocol consists of a numeric, sequence, and mapping. Each protocol consists of a
collection of related operations. If an operation that is not collection of related operations. If an operation that is not
provided by a particular type is invoked, then a standard exception, provided by a particular type is invoked, then a standard exception,
NotImplementedError is raised with a operation name as an argument. NotImplementedError is raised with an operation name as an argument.
In addition, for convenience this interface defines a set of In addition, for convenience this interface defines a set of
constructors for building objects of built-in types. This is needed constructors for building objects of built-in types. This is needed
so new objects can be returned from C functions that otherwise treat so new objects can be returned from C functions that otherwise treat

View File

@ -165,14 +165,14 @@ PyAPI_FUNC(PyObject *) PyCodec_Decoder(
const char *encoding const char *encoding
); );
/* Get a IncrementalEncoder object for the given encoding. */ /* Get an IncrementalEncoder object for the given encoding. */
PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder( PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder(
const char *encoding, const char *encoding,
const char *errors const char *errors
); );
/* Get a IncrementalDecoder object function for the given encoding. */ /* Get an IncrementalDecoder object function for the given encoding. */
PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder( PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder(
const char *encoding, const char *encoding,

View File

@ -2512,7 +2512,7 @@ class StringIO(TextIOWrapper):
def __repr__(self): def __repr__(self):
# TextIOWrapper tells the encoding in its repr. In StringIO, # TextIOWrapper tells the encoding in its repr. In StringIO,
# that's a implementation detail. # that's an implementation detail.
return object.__repr__(self) return object.__repr__(self)
@property @property

View File

@ -255,7 +255,7 @@ class StreamWriter:
def __init__(self, transport, protocol, reader, loop): def __init__(self, transport, protocol, reader, loop):
self._transport = transport self._transport = transport
self._protocol = protocol self._protocol = protocol
# drain() expects that the reader has a exception() method # drain() expects that the reader has an exception() method
assert reader is None or isinstance(reader, StreamReader) assert reader is None or isinstance(reader, StreamReader)
self._reader = reader self._reader = reader
self._loop = loop self._loop = loop

View File

@ -142,7 +142,7 @@ class Calendar(object):
def iterweekdays(self): def iterweekdays(self):
""" """
Return a iterator for one week of weekday numbers starting with the Return an iterator for one week of weekday numbers starting with the
configured first one. configured first one.
""" """
for i in range(self.firstweekday, self.firstweekday + 7): for i in range(self.firstweekday, self.firstweekday + 7):

View File

@ -21,7 +21,7 @@ Usually an IFF-type file consists of one or more chunks. The proposed
usage of the Chunk class defined here is to instantiate an instance at usage of the Chunk class defined here is to instantiate an instance at
the start of each chunk and read from the instance until it reaches the start of each chunk and read from the instance until it reaches
the end, after which a new instance can be instantiated. At the end the end, after which a new instance can be instantiated. At the end
of the file, creating a new instance will fail with a EOFError of the file, creating a new instance will fail with an EOFError
exception. exception.
Usage: Usage:

View File

@ -258,7 +258,7 @@ class IncrementalDecoder(object):
""" """
def __init__(self, errors='strict'): def __init__(self, errors='strict'):
""" """
Create a IncrementalDecoder instance. Create an IncrementalDecoder instance.
The IncrementalDecoder may use different error handling schemes by The IncrementalDecoder may use different error handling schemes by
providing the errors keyword argument. See the module docstring providing the errors keyword argument. See the module docstring
@ -1011,7 +1011,7 @@ def iterencode(iterator, encoding, errors='strict', **kwargs):
""" """
Encoding iterator. Encoding iterator.
Encodes the input strings from the iterator using a IncrementalEncoder. Encodes the input strings from the iterator using an IncrementalEncoder.
errors and kwargs are passed through to the IncrementalEncoder errors and kwargs are passed through to the IncrementalEncoder
constructor. constructor.
@ -1029,7 +1029,7 @@ def iterdecode(iterator, encoding, errors='strict', **kwargs):
""" """
Decoding iterator. Decoding iterator.
Decodes the input strings from the iterator using a IncrementalDecoder. Decodes the input strings from the iterator using an IncrementalDecoder.
errors and kwargs are passed through to the IncrementalDecoder errors and kwargs are passed through to the IncrementalDecoder
constructor. constructor.

View File

@ -521,7 +521,7 @@ class Executor(object):
raise NotImplementedError() raise NotImplementedError()
def map(self, fn, *iterables, timeout=None, chunksize=1): def map(self, fn, *iterables, timeout=None, chunksize=1):
"""Returns a iterator equivalent to map(fn, iter). """Returns an iterator equivalent to map(fn, iter).
Args: Args:
fn: A callable that will take as many arguments as there are fn: A callable that will take as many arguments as there are

View File

@ -456,7 +456,7 @@ class ProcessPoolExecutor(_base.Executor):
submit.__doc__ = _base.Executor.submit.__doc__ submit.__doc__ = _base.Executor.submit.__doc__
def map(self, fn, *iterables, timeout=None, chunksize=1): def map(self, fn, *iterables, timeout=None, chunksize=1):
"""Returns a iterator equivalent to map(fn, iter). """Returns an iterator equivalent to map(fn, iter).
Args: Args:
fn: A callable that will take as many arguments as there are fn: A callable that will take as many arguments as there are

View File

@ -1515,7 +1515,7 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None,
yield _make_line(lines,'-',0), None, True yield _make_line(lines,'-',0), None, True
continue continue
elif s.startswith(('--?+', '--+', '- ')): elif s.startswith(('--?+', '--+', '- ')):
# in delete block and see a intraline change or unchanged line # in delete block and see an intraline change or unchanged line
# coming: yield the delete line and then blanks # coming: yield the delete line and then blanks
from_line,to_line = _make_line(lines,'-',0), None from_line,to_line = _make_line(lines,'-',0), None
num_blanks_to_yield,num_blanks_pending = num_blanks_pending-1,0 num_blanks_to_yield,num_blanks_pending = num_blanks_pending-1,0

View File

@ -10,9 +10,9 @@ cygwin in no-cygwin mode).
# #
# * if you use a msvc compiled python version (1.5.2) # * if you use a msvc compiled python version (1.5.2)
# 1. you have to insert a __GNUC__ section in its config.h # 1. you have to insert a __GNUC__ section in its config.h
# 2. you have to generate a import library for its dll # 2. you have to generate an import library for its dll
# - create a def-file for python??.dll # - create a def-file for python??.dll
# - create a import library using # - create an import library using
# dlltool --dllname python15.dll --def python15.def \ # dlltool --dllname python15.dll --def python15.def \
# --output-lib libpython15.a # --output-lib libpython15.a
# #
@ -318,7 +318,7 @@ class Mingw32CCompiler(CygwinCCompiler):
self.dll_libraries = get_msvcr() self.dll_libraries = get_msvcr()
# Because these compilers aren't configured in Python's pyconfig.h file by # Because these compilers aren't configured in Python's pyconfig.h file by
# default, we should at least warn the user if he is using a unmodified # default, we should at least warn the user if he is using an unmodified
# version. # version.
CONFIG_H_OK = "ok" CONFIG_H_OK = "ok"

View File

@ -287,7 +287,7 @@ class FTP:
return self.voidcmd(cmd) return self.voidcmd(cmd)
def sendeprt(self, host, port): def sendeprt(self, host, port):
'''Send a EPRT command with the current host and the given port number.''' '''Send an EPRT command with the current host and the given port number.'''
af = 0 af = 0
if self.af == socket.AF_INET: if self.af == socket.AF_INET:
af = 1 af = 1
@ -852,7 +852,7 @@ def parse227(resp):
def parse229(resp, peer): def parse229(resp, peer):
'''Parse the '229' response for a EPSV request. '''Parse the '229' response for an EPSV request.
Raises error_proto if it does not contain '(|||port|)' Raises error_proto if it does not contain '(|||port|)'
Return ('host.addr.as.numbers', port#) tuple.''' Return ('host.addr.as.numbers', port#) tuple.'''

View File

@ -28,7 +28,7 @@ option involved with the exception.
# - RETURN_IN_ORDER option # - RETURN_IN_ORDER option
# - GNU extension with '-' as first character of option string # - GNU extension with '-' as first character of option string
# - optional arguments, specified by double colons # - optional arguments, specified by double colons
# - a option string with a W followed by semicolon should # - an option string with a W followed by semicolon should
# treat "-W foo" as "--foo" # treat "-W foo" as "--foo"
__all__ = ["GetoptError","error","getopt","gnu_getopt"] __all__ = ["GetoptError","error","getopt","gnu_getopt"]

View File

@ -1379,7 +1379,7 @@ class EditorWindow(object):
text.see("insert") text.see("insert")
text.undo_block_stop() text.undo_block_stop()
# Our editwin provides a is_char_in_string function that works # Our editwin provides an is_char_in_string function that works
# with a Tk text index, but PyParse only knows about offsets into # with a Tk text index, but PyParse only knows about offsets into
# a string. This builds a function for PyParse that accepts an # a string. This builds a function for PyParse that accepts an
# offset. # offset.

View File

@ -59,7 +59,7 @@ class ReplaceDialog(SearchDialogBase):
def default_command(self, event=None): def default_command(self, event=None):
if self.do_find(self.ok): if self.do_find(self.ok):
if self.do_replace(): # Only find next match if replace succeeded. if self.do_replace(): # Only find next match if replace succeeded.
# A bad re can cause a it to fail. # A bad re can cause it to fail.
self.do_find(0) self.do_find(0)
def _replace_expand(self, m, repl): def _replace_expand(self, m, repl):

View File

@ -19,7 +19,7 @@ streams. BytesIO is a simple stream of in-memory bytes.
Another IOBase subclass, TextIOBase, deals with the encoding and decoding Another IOBase subclass, TextIOBase, deals with the encoding and decoding
of streams into text. TextIOWrapper, which extends it, is a buffered text of streams into text. TextIOWrapper, which extends it, is a buffered text
interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
is a in-memory stream for text. is an in-memory stream for text.
Argument names are not part of the specification, and only the arguments Argument names are not part of the specification, and only the arguments
of open() are intended to be used as keyword arguments. of open() are intended to be used as keyword arguments.

View File

@ -17,7 +17,7 @@ class FixInput(fixer_base.BaseFix):
""" """
def transform(self, node, results): def transform(self, node, results):
# If we're already wrapped in a eval() call, we're done. # If we're already wrapped in an eval() call, we're done.
if context.match(node.parent.parent): if context.match(node.parent.parent):
return return

View File

@ -201,7 +201,7 @@ def _parse_overview_fmt(lines):
return fmt return fmt
def _parse_overview(lines, fmt, data_process_func=None): def _parse_overview(lines, fmt, data_process_func=None):
"""Parse the response to a OVER or XOVER command according to the """Parse the response to an OVER or XOVER command according to the
overview format `fmt`.""" overview format `fmt`."""
n_defaults = len(_DEFAULT_OVERVIEW_FMT) n_defaults = len(_DEFAULT_OVERVIEW_FMT)
overview = [] overview = []

View File

@ -359,7 +359,7 @@ class _Pickler:
The *file* argument must have a write() method that accepts a The *file* argument must have a write() method that accepts a
single bytes argument. It can thus be a file object opened for single bytes argument. It can thus be a file object opened for
binary writing, a io.BytesIO instance, or any other custom binary writing, an io.BytesIO instance, or any other custom
object that meets this interface. object that meets this interface.
If *fix_imports* is True and *protocol* is less than 3, pickle If *fix_imports* is True and *protocol* is less than 3, pickle
@ -991,7 +991,7 @@ class _Unpickler:
The argument *file* must have two methods, a read() method that The argument *file* must have two methods, a read() method that
takes an integer argument, and a readline() method that requires takes an integer argument, and a readline() method that requires
no arguments. Both methods should return bytes. Thus *file* no arguments. Both methods should return bytes. Thus *file*
can be a binary file object opened for reading, a io.BytesIO can be a binary file object opened for reading, an io.BytesIO
object, or any other custom object that meets this interface. object, or any other custom object that meets this interface.
The file-like object must have two methods, a read() method The file-like object must have two methods, a read() method

View File

@ -34,7 +34,7 @@ def _int_to_enum(value, enum_klass):
def _enum_to_int(value): def _enum_to_int(value):
"""Convert an IntEnum member to a numeric value. """Convert an IntEnum member to a numeric value.
If it's not a IntEnum member return the value itself. If it's not an IntEnum member return the value itself.
""" """
try: try:
return int(value) return int(value)

View File

@ -148,7 +148,7 @@ fmax2018 fma 9.999999 -9.999999 0E+999999 -> -100.000 Inexact Rounded
fmax2019 fma -9.999999 9.999999 0E+999999 -> -100.000 Inexact Rounded fmax2019 fma -9.999999 9.999999 0E+999999 -> -100.000 Inexact Rounded
fmax2020 fma -9.999999 -9.999999 0E+999999 -> 100.000 Inexact Rounded fmax2020 fma -9.999999 -9.999999 0E+999999 -> 100.000 Inexact Rounded
-- 1999.12.21: next one is a edge case if intermediate longs are used -- 1999.12.21: next one is an edge case if intermediate longs are used
precision: 15 precision: 15
fmax2059 fma 999999999999 9765625 0E+999999 -> 9.76562499999023E+18 Inexact Rounded fmax2059 fma 999999999999 9765625 0E+999999 -> 9.76562499999023E+18 Inexact Rounded
precision: 30 precision: 30

View File

@ -49,7 +49,7 @@ mulx018 multiply 9.999999999 -9.999999999 -> -100.000 Inexact Rounded
mulx019 multiply -9.999999999 9.999999999 -> -100.000 Inexact Rounded mulx019 multiply -9.999999999 9.999999999 -> -100.000 Inexact Rounded
mulx020 multiply -9.999999999 -9.999999999 -> 100.000 Inexact Rounded mulx020 multiply -9.999999999 -9.999999999 -> 100.000 Inexact Rounded
-- 1999.12.21: next one is a edge case if intermediate longs are used -- 1999.12.21: next one is an edge case if intermediate longs are used
precision: 15 precision: 15
mulx059 multiply 999999999999 9765625 -> 9.76562499999023E+18 Inexact Rounded mulx059 multiply 999999999999 9765625 -> 9.76562499999023E+18 Inexact Rounded
precision: 30 precision: 30

View File

@ -35,7 +35,7 @@ Version History:
Under Python 3 version 1.1 would use the normal division Under Python 3 version 1.1 would use the normal division
operator, resulting in some of the operations mistakenly operator, resulting in some of the operations mistakenly
yielding floats. Version 1.2 instead uses floor division yielding floats. Version 1.2 instead uses floor division
making the benchmark a integer benchmark again. making the benchmark an integer benchmark again.
""" """

View File

@ -309,7 +309,7 @@ if sys.platform.startswith("win"):
# The exponential backoff of the timeout amounts to a total # The exponential backoff of the timeout amounts to a total
# of ~1 second after which the deletion is probably an error # of ~1 second after which the deletion is probably an error
# anyway. # anyway.
# Testing on a i7@4.3GHz shows that usually only 1 iteration is # Testing on an i7@4.3GHz shows that usually only 1 iteration is
# required when contention occurs. # required when contention occurs.
timeout = 0.001 timeout = 0.001
while timeout < 1.0: while timeout < 1.0:

View File

@ -110,7 +110,7 @@ class samplecmdclass(cmd.Cmd):
5 12 19 5 12 19
6 13 6 13
This is a interactive test, put some commands in the cmdqueue attribute This is an interactive test, put some commands in the cmdqueue attribute
and let it execute and let it execute
This test includes the preloop(), postloop(), default(), emptyline(), This test includes the preloop(), postloop(), default(), emptyline(),
parseline(), do_help() functions parseline(), do_help() functions

View File

@ -100,7 +100,7 @@ class ReadTest(MixInCheckStateHandling):
self.assertEqual(r.read(), "") self.assertEqual(r.read(), "")
self.assertEqual(r.bytebuffer, b"") self.assertEqual(r.bytebuffer, b"")
# do the check again, this time using a incremental decoder # do the check again, this time using an incremental decoder
d = codecs.getincrementaldecoder(self.encoding)() d = codecs.getincrementaldecoder(self.encoding)()
result = "" result = ""
for (c, partialresult) in zip(input.encode(self.encoding), partialresults): for (c, partialresult) in zip(input.encode(self.encoding), partialresults):

View File

@ -3052,7 +3052,7 @@ class TestMiscellaneous(TestEmailBase):
# issue 1690608. email.utils.formataddr() should be rfc2047 aware. # issue 1690608. email.utils.formataddr() should be rfc2047 aware.
name = "H\u00e4ns W\u00fcrst" name = "H\u00e4ns W\u00fcrst"
addr = 'person@dom.ain' addr = 'person@dom.ain'
# A object without a header_encode method: # An object without a header_encode method:
bad_charset = object() bad_charset = object()
self.assertRaises(AttributeError, utils.formataddr, (name, addr), self.assertRaises(AttributeError, utils.formataddr, (name, addr),
bad_charset) bad_charset)

View File

@ -1302,7 +1302,7 @@ class IpaddrUnitTest(unittest.TestCase):
# test a /24 is summarized properly # test a /24 is summarized properly
self.assertEqual(list(summarize(ip1, ip2))[0], self.assertEqual(list(summarize(ip1, ip2))[0],
ipaddress.ip_network('1.1.1.0/24')) ipaddress.ip_network('1.1.1.0/24'))
# test an IPv4 range that isn't on a network byte boundary # test an IPv4 range that isn't on a network byte boundary
ip2 = ipaddress.ip_address('1.1.1.8') ip2 = ipaddress.ip_address('1.1.1.8')
self.assertEqual(list(summarize(ip1, ip2)), self.assertEqual(list(summarize(ip1, ip2)),
[ipaddress.ip_network('1.1.1.0/29'), [ipaddress.ip_network('1.1.1.0/29'),
@ -1315,7 +1315,7 @@ class IpaddrUnitTest(unittest.TestCase):
ip1 = ipaddress.ip_address('1::') ip1 = ipaddress.ip_address('1::')
ip2 = ipaddress.ip_address('1:ffff:ffff:ffff:ffff:ffff:ffff:ffff') ip2 = ipaddress.ip_address('1:ffff:ffff:ffff:ffff:ffff:ffff:ffff')
# test a IPv6 is sumamrized properly # test an IPv6 is summarized properly
self.assertEqual(list(summarize(ip1, ip2))[0], self.assertEqual(list(summarize(ip1, ip2))[0],
ipaddress.ip_network('1::/16')) ipaddress.ip_network('1::/16'))
# test an IPv6 range that isn't on a network byte boundary # test an IPv6 range that isn't on a network byte boundary

View File

@ -1448,7 +1448,7 @@ class TestInvalidFD(unittest.TestCase):
except OSError as e: except OSError as e:
self.assertEqual(e.errno, errno.EBADF) self.assertEqual(e.errno, errno.EBADF)
else: else:
self.fail("%r didn't raise a OSError with a bad file descriptor" self.fail("%r didn't raise an OSError with a bad file descriptor"
% f) % f)
@unittest.skipUnless(hasattr(os, 'isatty'), 'test needs os.isatty()') @unittest.skipUnless(hasattr(os, 'isatty'), 'test needs os.isatty()')

View File

@ -527,7 +527,7 @@ class urlretrieve_FileTests(unittest.TestCase):
result = urllib.request.urlretrieve("file:%s" % support.TESTFN) result = urllib.request.urlretrieve("file:%s" % support.TESTFN)
self.assertEqual(result[0], support.TESTFN) self.assertEqual(result[0], support.TESTFN)
self.assertIsInstance(result[1], email.message.Message, self.assertIsInstance(result[1], email.message.Message,
"did not get a email.message.Message instance " "did not get an email.message.Message instance "
"as second returned value") "as second returned value")
def test_copy(self): def test_copy(self):

View File

@ -947,7 +947,7 @@ class SubclassableWeakrefTestCase(TestBase):
class WeakMethodTestCase(unittest.TestCase): class WeakMethodTestCase(unittest.TestCase):
def _subclass(self): def _subclass(self):
"""Return a Object subclass overriding `some_method`.""" """Return an Object subclass overriding `some_method`."""
class C(Object): class C(Object):
def some_method(self): def some_method(self):
return 6 return 6

View File

@ -289,7 +289,7 @@ def _val_or_dict(tk, options, *args):
"""Format options then call Tk command with args and options and return """Format options then call Tk command with args and options and return
the appropriate result. the appropriate result.
If no option is specified, a dict is returned. If a option is If no option is specified, a dict is returned. If an option is
specified with the None value, the value for that option is returned. specified with the None value, the value for that option is returned.
Otherwise, the function just sets the passed options and the caller Otherwise, the function just sets the passed options and the caller
shouldn't be expecting a return value anyway.""" shouldn't be expecting a return value anyway."""

View File

@ -255,12 +255,12 @@ class TestDiscovery(unittest.TestCase):
self.addCleanup(sys.path.remove, abspath('/foo')) self.addCleanup(sys.path.remove, abspath('/foo'))
# Test data: we expect the following: # Test data: we expect the following:
# a listdir to find our package, and a isfile and isdir check on it. # a listdir to find our package, and isfile and isdir checks on it.
# a module-from-name call to turn that into a module # a module-from-name call to turn that into a module
# followed by load_tests. # followed by load_tests.
# then our load_tests will call discover() which is messy # then our load_tests will call discover() which is messy
# but that finally chains into find_tests again for the child dir - # but that finally chains into find_tests again for the child dir -
# which is why we don't have a infinite loop. # which is why we don't have an infinite loop.
# We expect to see: # We expect to see:
# the module load tests for both package and plain module called, # the module load tests for both package and plain module called,
# and the plain module result nested by the package module load_tests # and the plain module result nested by the package module load_tests

View File

@ -823,7 +823,7 @@ class MultiCallIterator:
raise ValueError("unexpected type in multicall result") raise ValueError("unexpected type in multicall result")
class MultiCall: class MultiCall:
"""server -> a object used to boxcar method calls """server -> an object used to boxcar method calls
server should be a ServerProxy object. server should be a ServerProxy object.
@ -1170,7 +1170,7 @@ class Transport:
## ##
# Create parser. # Create parser.
# #
# @return A 2-tuple containing a parser and a unmarshaller. # @return A 2-tuple containing a parser and an unmarshaller.
def getparser(self): def getparser(self):
# get parser and unmarshaller # get parser and unmarshaller

View File

@ -1331,7 +1331,7 @@ Core and Builtins
import as they are meant for use by importlib. import as they are meant for use by importlib.
- Issue #14474: Save and restore exception state in thread.start_new_thread() - Issue #14474: Save and restore exception state in thread.start_new_thread()
while writing error message if the thread leaves a unhandled exception. while writing error message if the thread leaves an unhandled exception.
- Issue #13019: Fix potential reference leaks in bytearray.extend(). Patch - Issue #13019: Fix potential reference leaks in bytearray.extend(). Patch
by Suman Saha. by Suman Saha.
@ -1969,7 +1969,7 @@ Core and Builtins
- Issue #7732: Don't open a directory as a file anymore while importing a - Issue #7732: Don't open a directory as a file anymore while importing a
module. Ignore the directory if its name matches the module name (e.g. module. Ignore the directory if its name matches the module name (e.g.
"__init__.py") and raise a ImportError instead. "__init__.py") and raise an ImportError instead.
- Issue #13021: Missing decref on an error path. Thanks to Suman Saha for - Issue #13021: Missing decref on an error path. Thanks to Suman Saha for
finding the bug and providing a patch. finding the bug and providing a patch.
@ -2021,7 +2021,7 @@ Core and Builtins
- Issue #10271: Allow warnings.showwarning() be any callable. - Issue #10271: Allow warnings.showwarning() be any callable.
- Issue #11627: Fix segfault when __new__ on a exception returns a - Issue #11627: Fix segfault when __new__ on an exception returns a
non-exception class. non-exception class.
- Issue #12149: Update the method cache after a type's dictionary gets - Issue #12149: Update the method cache after a type's dictionary gets
@ -2050,7 +2050,7 @@ Core and Builtins
with other data interleaved between marshalled objects. with other data interleaved between marshalled objects.
- Issue #12356: When required positional or keyword-only arguments are not - Issue #12356: When required positional or keyword-only arguments are not
given, produce a informative error message which includes the name(s) of the given, produce an informative error message which includes the name(s) of the
missing arguments. missing arguments.
- Issue #12370: Fix super with no arguments when __class__ is overriden in the - Issue #12370: Fix super with no arguments when __class__ is overriden in the
@ -2651,7 +2651,7 @@ Library
- Issue #12529: fix cgi.parse_header issue on strings with double-quotes and - Issue #12529: fix cgi.parse_header issue on strings with double-quotes and
semicolons together. Patch by Ben Darnell and Petri Lehtinen. semicolons together. Patch by Ben Darnell and Petri Lehtinen.
- Issue #13227: functools.lru_cache() now has a option to distinguish - Issue #13227: functools.lru_cache() now has an option to distinguish
calls with different argument types. calls with different argument types.
- Issue #6090: zipfile raises a ValueError when a document with a timestamp - Issue #6090: zipfile raises a ValueError when a document with a timestamp
@ -2914,7 +2914,7 @@ Library
- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.
- Issue #4376: ctypes now supports nested structures in a endian different than - Issue #4376: ctypes now supports nested structures in an endian different than
the parent structure. Patch by Vlad Riscutia. the parent structure. Patch by Vlad Riscutia.
- Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a - Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a
@ -2935,7 +2935,7 @@ Library
Linux for example, to have the same behaviour on all platforms. Linux for example, to have the same behaviour on all platforms.
- Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support - Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support
Python scripts using a encoding different than UTF-8 (read the coding cookie Python scripts using an encoding different than UTF-8 (read the coding cookie
of the script). of the script).
- Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors - Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors
@ -5113,7 +5113,7 @@ Library
``MaybeEncodingError`` exception. ``MaybeEncodingError`` exception.
- Issue #9244: The ``apply_async()`` and ``map_async()`` methods of - Issue #9244: The ``apply_async()`` and ``map_async()`` methods of
``multiprocessing.Pool`` now accepts a ``error_callback`` argument. This can ``multiprocessing.Pool`` now accepts an ``error_callback`` argument. This can
be a callback with the signature ``callback(exc)``, which will be called if be a callback with the signature ``callback(exc)``, which will be called if
the target raises an exception. the target raises an exception.
@ -5210,7 +5210,7 @@ Library
- Close file objects in modulefinder in a timely manner. - Close file objects in modulefinder in a timely manner.
- Close a io.TextIOWrapper object in email.parser in a timely manner. - Close an io.TextIOWrapper object in email.parser in a timely manner.
- Close a file object in distutils.sysconfig in a timely manner. - Close a file object in distutils.sysconfig in a timely manner.
@ -7308,7 +7308,7 @@ Library
- Issue #7610: Reworked implementation of the internal - Issue #7610: Reworked implementation of the internal
``zipfile.ZipExtFile`` class used to represent files stored inside an ``zipfile.ZipExtFile`` class used to represent files stored inside an
archive. The new implementation is significantly faster and can be wrapped in archive. The new implementation is significantly faster and can be wrapped in
a ``io.BufferedReader`` object for more speedups. It also solves an an ``io.BufferedReader`` object for more speedups. It also solves an
issue where interleaved calls to `read()` and `readline()` give wrong results. issue where interleaved calls to `read()` and `readline()` give wrong results.
Patch by Nir Aides. Patch by Nir Aides.
@ -8683,7 +8683,7 @@ Library
- Issue #5624: Fix the _winreg module name still used in several modules. - Issue #5624: Fix the _winreg module name still used in several modules.
- Issue #5628: Fix io.TextIOWrapper.read() with a unreadable buffer. - Issue #5628: Fix io.TextIOWrapper.read() with an unreadable buffer.
- Issue #5619: Multiprocessing children disobey the debug flag and causes - Issue #5619: Multiprocessing children disobey the debug flag and causes
popups on windows buildbots. Patch applied to work around this issue. popups on windows buildbots. Patch applied to work around this issue.
@ -9649,7 +9649,7 @@ Library
- Issue #4307: The named tuple that ``inspect.getfullargspec()`` returns now - Issue #4307: The named tuple that ``inspect.getfullargspec()`` returns now
uses ``kwonlydefaults`` instead of ``kwdefaults``. uses ``kwonlydefaults`` instead of ``kwdefaults``.
- Issue #4298: Fix a segfault when pickle.loads is passed a ill-formed input. - Issue #4298: Fix a segfault when pickle.loads is passed ill-formed input.
- Issue #4283: Fix a left-over "iteritems" call in distutils. - Issue #4283: Fix a left-over "iteritems" call in distutils.
@ -11305,7 +11305,7 @@ Core and builtins
----------------- -----------------
- Bug #1441486: The literal representation of -(sys.maxint - 1) - Bug #1441486: The literal representation of -(sys.maxint - 1)
again evaluates to a int object, not a long. again evaluates to an int object, not a long.
- Bug #1501934: The scope of global variables that are locally assigned - Bug #1501934: The scope of global variables that are locally assigned
using augmented assignment is now correctly determined. using augmented assignment is now correctly determined.
@ -15212,7 +15212,7 @@ Core and builtins
interpreter executions, would fail. interpreter executions, would fail.
- "%c" % u"a" now returns a unicode string instead of raising a - "%c" % u"a" now returns a unicode string instead of raising a
TypeError. u"%c" % 0xffffffff now raises a OverflowError instead TypeError. u"%c" % 0xffffffff now raises an OverflowError instead
of a ValueError to be consistent with "%c" % 256. See SF patch #710127. of a ValueError to be consistent with "%c" % 256. See SF patch #710127.
Extension modules Extension modules
@ -23105,7 +23105,7 @@ no longer use the default root.
- The interfaces for the bind*() and unbind() widget methods have been - The interfaces for the bind*() and unbind() widget methods have been
redesigned; the bind*() methods now return the name of the Tcl command redesigned; the bind*() methods now return the name of the Tcl command
created for the callback, and this can be passed as a optional created for the callback, and this can be passed as an optional
argument to unbind() in order to delete the command (normally, such argument to unbind() in order to delete the command (normally, such
commands are automatically unbound when the widget is destroyed, but commands are automatically unbound when the widget is destroyed, but
for some applications this isn't enough). for some applications this isn't enough).

View File

@ -506,7 +506,7 @@ Documentation
Tests Tests
----- -----
- Issue #25099: Make test_compileall not fail when a entry on sys.path cannot - Issue #25099: Make test_compileall not fail when an entry on sys.path cannot
be written to (commonly seen in administrative installs on Windows). be written to (commonly seen in administrative installs on Windows).
- Issue #23919: Prevents assert dialogs appearing in the test suite. - Issue #23919: Prevents assert dialogs appearing in the test suite.
@ -2158,7 +2158,7 @@ Library
- Issue #23132: Improve performance and introspection support of comparison - Issue #23132: Improve performance and introspection support of comparison
methods created by functool.total_ordering. methods created by functool.total_ordering.
- Issue #19776: Add a expanduser() method on Path objects. - Issue #19776: Add an expanduser() method on Path objects.
- Issue #23112: Fix SimpleHTTPServer to correctly carry the query string and - Issue #23112: Fix SimpleHTTPServer to correctly carry the query string and
fragment when it redirects to add a trailing slash. fragment when it redirects to add a trailing slash.

View File

@ -742,7 +742,7 @@ volume rotations should take care not to penalize the common case.
Conceptually, a rotate by one is equivalent to a pop on one side and an Conceptually, a rotate by one is equivalent to a pop on one side and an
append on the other. However, a pop/append pair is unnecessarily slow append on the other. However, a pop/append pair is unnecessarily slow
because it requires a incref/decref pair for an object located randomly because it requires an incref/decref pair for an object located randomly
in memory. It is better to just move the object pointer from one block in memory. It is better to just move the object pointer from one block
to the next without changing the reference count. to the next without changing the reference count.

View File

@ -350,7 +350,7 @@ LASFDE1:
.set L$set$3,LUW1-LUW0 .set L$set$3,LUW1-LUW0
.long L$set$3 .long L$set$3
/* New stack frame based off rbp. This is a itty bit of unwind /* New stack frame based off rbp. This is an itty bit of unwind
trickery in that the CFA *has* changed. There is no easy way trickery in that the CFA *has* changed. There is no easy way
to describe it correctly on entry to the function. Fortunately, to describe it correctly on entry to the function. Fortunately,
it doesn't matter too much since at all points we can correctly it doesn't matter too much since at all points we can correctly

View File

@ -366,7 +366,7 @@ ffi_closure_unix64:
.byte 0x4 /* DW_CFA_advance_loc4 */ .byte 0x4 /* DW_CFA_advance_loc4 */
.long .LUW1-.LUW0 .long .LUW1-.LUW0
/* New stack frame based off rbp. This is a itty bit of unwind /* New stack frame based off rbp. This is an itty bit of unwind
trickery in that the CFA *has* changed. There is no easy way trickery in that the CFA *has* changed. There is no easy way
to describe it correctly on entry to the function. Fortunately, to describe it correctly on entry to the function. Fortunately,
it doesn't matter too much since at all points we can correctly it doesn't matter too much since at all points we can correctly

View File

@ -351,7 +351,7 @@ LASFDE1:
.set L$set$3,LUW1-LUW0 .set L$set$3,LUW1-LUW0
.long L$set$3 .long L$set$3
/* New stack frame based off rbp. This is a itty bit of unwind /* New stack frame based off rbp. This is an itty bit of unwind
trickery in that the CFA *has* changed. There is no easy way trickery in that the CFA *has* changed. There is no easy way
to describe it correctly on entry to the function. Fortunately, to describe it correctly on entry to the function. Fortunately,
it doesn't matter too much since at all points we can correctly it doesn't matter too much since at all points we can correctly

View File

@ -684,7 +684,7 @@ _openssl_hash_name_mapper(const OBJ_NAME *openssl_obj_name, void *arg)
if (openssl_obj_name == NULL) if (openssl_obj_name == NULL)
return; return;
/* Ignore aliased names, they pollute the list and OpenSSL appears to /* Ignore aliased names, they pollute the list and OpenSSL appears to
* have a its own definition of alias as the resulting list still * have its own definition of alias as the resulting list still
* contains duplicate and alternate names for several algorithms. */ * contains duplicate and alternate names for several algorithms. */
if (openssl_obj_name->alias) if (openssl_obj_name->alias)
return; return;

View File

@ -75,7 +75,7 @@ PyDoc_STRVAR(module_doc,
"Another IOBase subclass, TextIOBase, deals with the encoding and decoding\n" "Another IOBase subclass, TextIOBase, deals with the encoding and decoding\n"
"of streams into text. TextIOWrapper, which extends it, is a buffered text\n" "of streams into text. TextIOWrapper, which extends it, is a buffered text\n"
"interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO\n" "interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO\n"
"is a in-memory stream for text.\n" "is an in-memory stream for text.\n"
"\n" "\n"
"Argument names are not part of the specification, and only the arguments\n" "Argument names are not part of the specification, and only the arguments\n"
"of open() are intended to be used as keyword arguments.\n" "of open() are intended to be used as keyword arguments.\n"

View File

@ -905,8 +905,8 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
if (self->encoding == NULL) { if (self->encoding == NULL) {
catch_ImportError: catch_ImportError:
/* /*
Importing locale can raise a ImportError because of Importing locale can raise an ImportError because of
_functools, and locale.getpreferredencoding can raise a _functools, and locale.getpreferredencoding can raise an
ImportError if _locale is not available. These will happen ImportError if _locale is not available. These will happen
during module building. during module building.
*/ */

View File

@ -4162,7 +4162,7 @@ version of Python needed to read the pickle produced.
The *file* argument must have a write() method that accepts a single The *file* argument must have a write() method that accepts a single
bytes argument. It can thus be a file object opened for binary bytes argument. It can thus be a file object opened for binary
writing, a io.BytesIO instance, or any other custom object that meets writing, an io.BytesIO instance, or any other custom object that meets
this interface. this interface.
If *fix_imports* is True and protocol is less than 3, pickle will try If *fix_imports* is True and protocol is less than 3, pickle will try
@ -4173,7 +4173,7 @@ to map the new Python 3 names to the old module names used in Python
static int static int
_pickle_Pickler___init___impl(PicklerObject *self, PyObject *file, _pickle_Pickler___init___impl(PicklerObject *self, PyObject *file,
PyObject *protocol, int fix_imports) PyObject *protocol, int fix_imports)
/*[clinic end generated code: output=b5f31078dab17fb0 input=b8cdeb7e3f5ee674]*/ /*[clinic end generated code: output=b5f31078dab17fb0 input=4faabdbc763c2389]*/
{ {
_Py_IDENTIFIER(persistent_id); _Py_IDENTIFIER(persistent_id);
_Py_IDENTIFIER(dispatch_table); _Py_IDENTIFIER(dispatch_table);
@ -6576,7 +6576,7 @@ representation are ignored.
The argument *file* must have two methods, a read() method that takes The argument *file* must have two methods, a read() method that takes
an integer argument, and a readline() method that requires no an integer argument, and a readline() method that requires no
arguments. Both methods should return bytes. Thus *file* can be a arguments. Both methods should return bytes. Thus *file* can be a
binary file object opened for reading, a io.BytesIO object, or any binary file object opened for reading, an io.BytesIO object, or any
other custom object that meets this interface. other custom object that meets this interface.
Optional keyword arguments are *fix_imports*, *encoding* and *errors*, Optional keyword arguments are *fix_imports*, *encoding* and *errors*,
@ -6593,7 +6593,7 @@ static int
_pickle_Unpickler___init___impl(UnpicklerObject *self, PyObject *file, _pickle_Unpickler___init___impl(UnpicklerObject *self, PyObject *file,
int fix_imports, const char *encoding, int fix_imports, const char *encoding,
const char *errors) const char *errors)
/*[clinic end generated code: output=e2c8ce748edc57b0 input=30b4dc9e976b890c]*/ /*[clinic end generated code: output=e2c8ce748edc57b0 input=04ece661aa884837]*/
{ {
_Py_IDENTIFIER(persistent_load); _Py_IDENTIFIER(persistent_load);
@ -7012,7 +7012,7 @@ version of Python needed to read the pickle produced.
The *file* argument must have a write() method that accepts a single The *file* argument must have a write() method that accepts a single
bytes argument. It can thus be a file object opened for binary bytes argument. It can thus be a file object opened for binary
writing, a io.BytesIO instance, or any other custom object that meets writing, an io.BytesIO instance, or any other custom object that meets
this interface. this interface.
If *fix_imports* is True and protocol is less than 3, pickle will try If *fix_imports* is True and protocol is less than 3, pickle will try
@ -7023,7 +7023,7 @@ to map the new Python 3 names to the old module names used in Python
static PyObject * static PyObject *
_pickle_dump_impl(PyModuleDef *module, PyObject *obj, PyObject *file, _pickle_dump_impl(PyModuleDef *module, PyObject *obj, PyObject *file,
PyObject *protocol, int fix_imports) PyObject *protocol, int fix_imports)
/*[clinic end generated code: output=0de7dff89c406816 input=e9e5fdd48de92eae]*/ /*[clinic end generated code: output=0de7dff89c406816 input=830f8a64cef6f042]*/
{ {
PicklerObject *pickler = _Pickler_New(); PicklerObject *pickler = _Pickler_New();
@ -7122,7 +7122,7 @@ representation are ignored.
The argument *file* must have two methods, a read() method that takes The argument *file* must have two methods, a read() method that takes
an integer argument, and a readline() method that requires no an integer argument, and a readline() method that requires no
arguments. Both methods should return bytes. Thus *file* can be a arguments. Both methods should return bytes. Thus *file* can be a
binary file object opened for reading, a io.BytesIO object, or any binary file object opened for reading, an io.BytesIO object, or any
other custom object that meets this interface. other custom object that meets this interface.
Optional keyword arguments are *fix_imports*, *encoding* and *errors*, Optional keyword arguments are *fix_imports*, *encoding* and *errors*,
@ -7138,7 +7138,7 @@ string instances as bytes objects.
static PyObject * static PyObject *
_pickle_load_impl(PyModuleDef *module, PyObject *file, int fix_imports, _pickle_load_impl(PyModuleDef *module, PyObject *file, int fix_imports,
const char *encoding, const char *errors) const char *encoding, const char *errors)
/*[clinic end generated code: output=798f1c57cb2b4eb1 input=da97372e38e510a6]*/ /*[clinic end generated code: output=798f1c57cb2b4eb1 input=2df7c7a1e6742204]*/
{ {
PyObject *result; PyObject *result;
UnpicklerObject *unpickler = _Unpickler_New(); UnpicklerObject *unpickler = _Unpickler_New();

View File

@ -257,7 +257,7 @@ atexit_free(PyObject *m)
PyDoc_STRVAR(atexit_unregister__doc__, PyDoc_STRVAR(atexit_unregister__doc__,
"unregister(func) -> None\n\ "unregister(func) -> None\n\
\n\ \n\
Unregister a exit function which was previously registered using\n\ Unregister an exit function which was previously registered using\n\
atexit.register\n\ atexit.register\n\
\n\ \n\
func - function to be unregistered"); func - function to be unregistered");

View File

@ -112,7 +112,7 @@ static PyInt16 _st_ulaw2linear16[256] = {
/* /*
* linear2ulaw() accepts a 14-bit signed integer and encodes it as u-law data * linear2ulaw() accepts a 14-bit signed integer and encodes it as u-law data
* stored in a unsigned char. This function should only be called with * stored in an unsigned char. This function should only be called with
* the data shifted such that it only contains information in the lower * the data shifted such that it only contains information in the lower
* 14-bits. * 14-bits.
* *
@ -218,7 +218,7 @@ static PyInt16 _st_alaw2linear16[256] = {
/* /*
* linear2alaw() accepts an 13-bit signed integer and encodes it as A-law data * linear2alaw() accepts an 13-bit signed integer and encodes it as A-law data
* stored in a unsigned char. This function should only be called with * stored in an unsigned char. This function should only be called with
* the data shifted such that it only contains information in the lower * the data shifted such that it only contains information in the lower
* 13-bits. * 13-bits.
* *

View File

@ -77,7 +77,7 @@ PyDoc_STRVAR(_pickle_Pickler___init____doc__,
"\n" "\n"
"The *file* argument must have a write() method that accepts a single\n" "The *file* argument must have a write() method that accepts a single\n"
"bytes argument. It can thus be a file object opened for binary\n" "bytes argument. It can thus be a file object opened for binary\n"
"writing, a io.BytesIO instance, or any other custom object that meets\n" "writing, an io.BytesIO instance, or any other custom object that meets\n"
"this interface.\n" "this interface.\n"
"\n" "\n"
"If *fix_imports* is True and protocol is less than 3, pickle will try\n" "If *fix_imports* is True and protocol is less than 3, pickle will try\n"
@ -260,7 +260,7 @@ PyDoc_STRVAR(_pickle_Unpickler___init____doc__,
"The argument *file* must have two methods, a read() method that takes\n" "The argument *file* must have two methods, a read() method that takes\n"
"an integer argument, and a readline() method that requires no\n" "an integer argument, and a readline() method that requires no\n"
"arguments. Both methods should return bytes. Thus *file* can be a\n" "arguments. Both methods should return bytes. Thus *file* can be a\n"
"binary file object opened for reading, a io.BytesIO object, or any\n" "binary file object opened for reading, an io.BytesIO object, or any\n"
"other custom object that meets this interface.\n" "other custom object that meets this interface.\n"
"\n" "\n"
"Optional keyword arguments are *fix_imports*, *encoding* and *errors*,\n" "Optional keyword arguments are *fix_imports*, *encoding* and *errors*,\n"
@ -369,7 +369,7 @@ PyDoc_STRVAR(_pickle_dump__doc__,
"\n" "\n"
"The *file* argument must have a write() method that accepts a single\n" "The *file* argument must have a write() method that accepts a single\n"
"bytes argument. It can thus be a file object opened for binary\n" "bytes argument. It can thus be a file object opened for binary\n"
"writing, a io.BytesIO instance, or any other custom object that meets\n" "writing, an io.BytesIO instance, or any other custom object that meets\n"
"this interface.\n" "this interface.\n"
"\n" "\n"
"If *fix_imports* is True and protocol is less than 3, pickle will try\n" "If *fix_imports* is True and protocol is less than 3, pickle will try\n"
@ -462,7 +462,7 @@ PyDoc_STRVAR(_pickle_load__doc__,
"The argument *file* must have two methods, a read() method that takes\n" "The argument *file* must have two methods, a read() method that takes\n"
"an integer argument, and a readline() method that requires no\n" "an integer argument, and a readline() method that requires no\n"
"arguments. Both methods should return bytes. Thus *file* can be a\n" "arguments. Both methods should return bytes. Thus *file* can be a\n"
"binary file object opened for reading, a io.BytesIO object, or any\n" "binary file object opened for reading, an io.BytesIO object, or any\n"
"other custom object that meets this interface.\n" "other custom object that meets this interface.\n"
"\n" "\n"
"Optional keyword arguments are *fix_imports*, *encoding* and *errors*,\n" "Optional keyword arguments are *fix_imports*, *encoding* and *errors*,\n"
@ -545,4 +545,4 @@ _pickle_loads(PyModuleDef *module, PyObject *args, PyObject *kwargs)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=06f3a5233298448e input=a9049054013a1b77]*/ /*[clinic end generated code: output=aecd61660d1cf31d input=a9049054013a1b77]*/

View File

@ -21,7 +21,7 @@
* *
* *
* The Solution: * The Solution:
* Prefix all a exported symbols with "PyExpat_". This is similar to * Prefix all exported symbols with "PyExpat_". This is similar to
* what Mozilla does for some common libs: * what Mozilla does for some common libs:
* http://lxr.mozilla.org/seamonkey/source/modules/libimg/png/mozpngconf.h#115 * http://lxr.mozilla.org/seamonkey/source/modules/libimg/png/mozpngconf.h#115
* *

View File

@ -30,7 +30,7 @@
/* /*
* Helper code to synchronize access to the hash object when the GIL is * Helper code to synchronize access to the hash object when the GIL is
* released around a CPU consuming hashlib operation. All code paths that * released around a CPU consuming hashlib operation. All code paths that
* access a mutable part of obj must be enclosed in a ENTER_HASHLIB / * access a mutable part of obj must be enclosed in an ENTER_HASHLIB /
* LEAVE_HASHLIB block or explicitly acquire and release the lock inside * LEAVE_HASHLIB block or explicitly acquire and release the lock inside
* a PY_BEGIN / END_ALLOW_THREADS block if they wish to release the GIL for * a PY_BEGIN / END_ALLOW_THREADS block if they wish to release the GIL for
* an operation. * an operation.

View File

@ -1236,7 +1236,7 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
return NULL; return NULL;
} }
/* We got an EOF, return a empty string. */ /* We got an EOF, return an empty string. */
if (p == NULL) { if (p == NULL) {
p = PyMem_RawMalloc(1); p = PyMem_RawMalloc(1);
if (p != NULL) if (p != NULL)

View File

@ -1288,7 +1288,7 @@ PyNumber_Long(PyObject *o)
if (truncated == NULL || PyLong_Check(truncated)) if (truncated == NULL || PyLong_Check(truncated))
return truncated; return truncated;
/* __trunc__ is specified to return an Integral type, /* __trunc__ is specified to return an Integral type,
but int() needs to return a int. */ but int() needs to return an int. */
m = truncated->ob_type->tp_as_number; m = truncated->ob_type->tp_as_number;
if (m == NULL || m->nb_int == NULL) { if (m == NULL || m->nb_int == NULL) {
PyErr_Format( PyErr_Format(

View File

@ -874,7 +874,7 @@ OSError_init(PyOSErrorObject *self, PyObject *args, PyObject *kwds);
static int static int
oserror_use_init(PyTypeObject *type) oserror_use_init(PyTypeObject *type)
{ {
/* When __init__ is defined in a OSError subclass, we want any /* When __init__ is defined in an OSError subclass, we want any
extraneous argument to __new__ to be ignored. The only reasonable extraneous argument to __new__ to be ignored. The only reasonable
solution, given __new__ takes a variable number of arguments, solution, given __new__ takes a variable number of arguments,
is to defer arg parsing and initialization to __init__. is to defer arg parsing and initialization to __init__.

View File

@ -548,7 +548,7 @@ compiler_enter_scope(struct compiler *c, identifier name,
return 0; return 0;
} }
if (u->u_ste->ste_needs_class_closure) { if (u->u_ste->ste_needs_class_closure) {
/* Cook up a implicit __class__ cell. */ /* Cook up an implicit __class__ cell. */
_Py_IDENTIFIER(__class__); _Py_IDENTIFIER(__class__);
PyObject *tuple, *name, *zero; PyObject *tuple, *name, *zero;
int res; int res;

View File

@ -31,7 +31,7 @@
threads. threads.
This is valid for HP-UX 11.23 running on an ia64 system. If needed, add This is valid for HP-UX 11.23 running on an ia64 system. If needed, add
a check of __ia64 to verify that we're running on a ia64 system instead a check of __ia64 to verify that we're running on an ia64 system instead
of a pa-risc system. of a pa-risc system.
*/ */
#ifdef __hpux #ifdef __hpux

View File

@ -91,7 +91,7 @@ class NullPyObjectPtr(RuntimeError):
def safety_limit(val): def safety_limit(val):
# Given a integer value from the process being debugged, limit it to some # Given an integer value from the process being debugged, limit it to some
# safety threshold so that arbitrary breakage within said process doesn't # safety threshold so that arbitrary breakage within said process doesn't
# break the gdb process too much (e.g. sizes of iterations, sizes of lists) # break the gdb process too much (e.g. sizes of iterations, sizes of lists)
return min(val, 1000) return min(val, 1000)
@ -158,7 +158,7 @@ class TruncatedStringIO(object):
class PyObjectPtr(object): class PyObjectPtr(object):
""" """
Class wrapping a gdb.Value that's a either a (PyObject*) within the Class wrapping a gdb.Value that's either a (PyObject*) within the
inferior process, or some subclass pointer e.g. (PyBytesObject*) inferior process, or some subclass pointer e.g. (PyBytesObject*)
There will be a subclass for every refined PyObject type that we care There will be a subclass for every refined PyObject type that we care