Issue #26778: Fixed "a/an/and" typos in code comment and documentation.

This commit is contained in:
Serhiy Storchaka 2016-04-17 08:32:47 +03:00
parent 50dd1f7dd6
commit 6a7b3a77b4
64 changed files with 88 additions and 87 deletions

View File

@ -128,7 +128,7 @@ or :class:`frozenset` or instances of their subtypes.
of brand new frozensets before they are exposed to other code). Return 0 on of brand new frozensets before they are exposed to other code). Return 0 on
success or -1 on failure. Raise a :exc:`TypeError` if the *key* is success or -1 on failure. Raise a :exc:`TypeError` if the *key* is
unhashable. Raise a :exc:`MemoryError` if there is no room to grow. Raise a unhashable. Raise a :exc:`MemoryError` if there is no room to grow. Raise a
:exc:`SystemError` if *set* is an not an instance of :class:`set` or its :exc:`SystemError` if *set* is not an instance of :class:`set` or its
subtype. subtype.
@ -142,7 +142,7 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~set.discard` :exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~set.discard`
method, this function does not automatically convert unhashable sets into method, this function does not automatically convert unhashable sets into
temporary frozensets. Raise :exc:`PyExc_SystemError` if *set* is an not an temporary frozensets. Raise :exc:`PyExc_SystemError` if *set* is not an
instance of :class:`set` or its subtype. instance of :class:`set` or its subtype.
@ -150,7 +150,7 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
Return a new reference to an arbitrary object in the *set*, and removes the Return a new reference to an arbitrary object in the *set*, and removes the
object from the *set*. Return *NULL* on failure. Raise :exc:`KeyError` if the object from the *set*. Return *NULL* on failure. Raise :exc:`KeyError` if the
set is empty. Raise a :exc:`SystemError` if *set* is an not an instance of set is empty. Raise a :exc:`SystemError` if *set* is not an instance of
:class:`set` or its subtype. :class:`set` or its subtype.

View File

@ -367,7 +367,7 @@ These APIs can be used to work with surrogates:
.. c:macro:: Py_UNICODE_IS_HIGH_SURROGATE(ch) .. c:macro:: Py_UNICODE_IS_HIGH_SURROGATE(ch)
Check if *ch* is an high surrogate (``0xD800 <= ch <= 0xDBFF``). Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``).
.. c:macro:: Py_UNICODE_IS_LOW_SURROGATE(ch) .. c:macro:: Py_UNICODE_IS_LOW_SURROGATE(ch)
@ -450,7 +450,7 @@ APIs:
| :attr:`%%` | *n/a* | The literal % character. | | :attr:`%%` | *n/a* | The literal % character. |
+-------------------+---------------------+--------------------------------+ +-------------------+---------------------+--------------------------------+
| :attr:`%c` | int | A single character, | | :attr:`%c` | int | A single character, |
| | | represented as an C int. | | | | represented as a C int. |
+-------------------+---------------------+--------------------------------+ +-------------------+---------------------+--------------------------------+
| :attr:`%d` | int | Exactly equivalent to | | :attr:`%d` | int | Exactly equivalent to |
| | | ``printf("%d")``. | | | | ``printf("%d")``. |

View File

@ -837,7 +837,7 @@ selection by :class:`MSVCCompiler`.
.. module:: distutils.bcppcompiler .. module:: distutils.bcppcompiler
This module provides :class:`BorlandCCompiler`, an subclass of the abstract This module provides :class:`BorlandCCompiler`, a subclass of the abstract
:class:`CCompiler` class for the Borland C++ compiler. :class:`CCompiler` class for the Borland C++ compiler.

View File

@ -513,7 +513,7 @@ Low-level socket operations
The *address* must be already resolved to avoid the trap of hanging the The *address* must be already resolved to avoid the trap of hanging the
entire event loop when the address requires doing a DNS lookup. For entire event loop when the address requires doing a DNS lookup. For
example, it must be an IP address, not an hostname, for example, it must be an IP address, not a hostname, for
:py:data:`~socket.AF_INET` and :py:data:`~socket.AF_INET6` address families. :py:data:`~socket.AF_INET` and :py:data:`~socket.AF_INET6` address families.
Use :meth:`getaddrinfo` to resolve the hostname asynchronously. Use :meth:`getaddrinfo` to resolve the hostname asynchronously.

View File

@ -671,7 +671,7 @@ positive integer::
TenPointsArrayType = POINT * 10 TenPointsArrayType = POINT * 10
Here is an example of an somewhat artificial data type, a structure containing 4 Here is an example of a somewhat artificial data type, a structure containing 4
POINTs among other stuff:: POINTs among other stuff::
>>> from ctypes import * >>> from ctypes import *
@ -1888,7 +1888,7 @@ Utility functions
.. function:: POINTER(type) .. function:: POINTER(type)
This factory function creates and returns a new ctypes pointer type. Pointer This factory function creates and returns a new ctypes pointer type. Pointer
types are cached an reused internally, so calling this function repeatedly is types are cached and reused internally, so calling this function repeatedly is
cheap. *type* must be a ctypes type. cheap. *type* must be a ctypes type.

View File

@ -128,7 +128,7 @@ Find Selection
Search for the currently selected string, if there is one. Search for the currently selected string, if there is one.
Find in Files... Find in Files...
Open a file search dialog. Put results in an new output window. Open a file search dialog. Put results in a new output window.
Replace... Replace...
Open a search-and-replace dialog. Open a search-and-replace dialog.

View File

@ -342,7 +342,7 @@ Directory and files operations
Return the path to an executable which would be run if the given *cmd* was Return the path to an executable which would be run if the given *cmd* was
called. If no *cmd* would be called, return ``None``. called. If no *cmd* would be called, return ``None``.
*mode* is a permission mask passed a to :func:`os.access`, by default *mode* is a permission mask passed to :func:`os.access`, by default
determining if the file exists and executable. determining if the file exists and executable.
When no *path* is specified, the results of :func:`os.environ` are used, When no *path* is specified, the results of :func:`os.environ` are used,

View File

@ -129,7 +129,7 @@ Some facts and figures:
| ``'r|bz2'`` | Open a bzip2 compressed *stream* for | | ``'r|bz2'`` | Open a bzip2 compressed *stream* for |
| | reading. | | | reading. |
+-------------+--------------------------------------------+ +-------------+--------------------------------------------+
| ``'r|xz'`` | Open a lzma compressed *stream* for | | ``'r|xz'`` | Open an lzma compressed *stream* for |
| | reading. | | | reading. |
+-------------+--------------------------------------------+ +-------------+--------------------------------------------+
| ``'w|'`` | Open an uncompressed *stream* for writing. | | ``'w|'`` | Open an uncompressed *stream* for writing. |

View File

@ -267,7 +267,7 @@ File Selectors
The `ExFileSelectBox The `ExFileSelectBox
<http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixExFileSelectBox.htm>`_ <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixExFileSelectBox.htm>`_
widget is usually embedded in a tixExFileSelectDialog widget. It provides an widget is usually embedded in a tixExFileSelectDialog widget. It provides a
convenient method for the user to select files. The style of the convenient method for the user to select files. The style of the
:class:`ExFileSelectBox` widget is very similar to the standard file dialog on :class:`ExFileSelectBox` widget is very similar to the standard file dialog on
MS Windows 3.1. MS Windows 3.1.

View File

@ -397,7 +397,7 @@ objects, such as lists.
Though tuples may seem similar to lists, they are often used in different Though tuples may seem similar to lists, they are often used in different
situations and for different purposes. situations and for different purposes.
Tuples are :term:`immutable`, and usually contain an heterogeneous sequence of Tuples are :term:`immutable`, and usually contain a heterogeneous sequence of
elements that are accessed via unpacking (see later in this section) or indexing elements that are accessed via unpacking (see later in this section) or indexing
(or even by attribute in the case of :func:`namedtuples <collections.namedtuple>`). (or even by attribute in the case of :func:`namedtuples <collections.namedtuple>`).
Lists are :term:`mutable`, and their elements are usually homogeneous and are Lists are :term:`mutable`, and their elements are usually homogeneous and are

View File

@ -720,7 +720,7 @@ possible types of the operands.
(The controversy is over whether this is *really* a design flaw, and whether (The controversy is over whether this is *really* a design flaw, and whether
it's worth breaking existing code to fix this. It's caused endless discussions it's worth breaking existing code to fix this. It's caused endless discussions
on python-dev, and in July 2001 erupted into an storm of acidly sarcastic on python-dev, and in July 2001 erupted into a storm of acidly sarcastic
postings on :newsgroup:`comp.lang.python`. I won't argue for either side here postings on :newsgroup:`comp.lang.python`. I won't argue for either side here
and will stick to describing what's implemented in 2.2. Read :pep:`238` for a and will stick to describing what's implemented in 2.2. Read :pep:`238` for a
summary of arguments and counter-arguments.) summary of arguments and counter-arguments.)

View File

@ -1457,7 +1457,7 @@ s), as well as a :meth:`~ssl.SSLContext.get_ca_certs` method that returns a
list of the loaded ``CA`` certificates. (Contributed by Christian Heimes in list of the loaded ``CA`` certificates. (Contributed by Christian Heimes in
:issue:`18147`.) :issue:`18147`.)
If OpenSSL 0.9.8 or later is available, :class:`~ssl.SSLContext` has an new If OpenSSL 0.9.8 or later is available, :class:`~ssl.SSLContext` has a new
attribute :attr:`~ssl.SSLContext.verify_flags` that can be used to control the attribute :attr:`~ssl.SSLContext.verify_flags` that can be used to control the
certificate verification process by setting it to some combination of the new certificate verification process by setting it to some combination of the new
constants :data:`~ssl.VERIFY_DEFAULT`, :data:`~ssl.VERIFY_CRL_CHECK_LEAF`, constants :data:`~ssl.VERIFY_DEFAULT`, :data:`~ssl.VERIFY_CRL_CHECK_LEAF`,

View File

@ -2,7 +2,7 @@
/* List object interface */ /* List object interface */
/* /*
Another generally useful object type is an list of object pointers. Another generally useful object type is a list of object pointers.
This is a mutable type: the list items can be changed, and items can be This is a mutable type: the list items can be changed, and items can be
added or removed. Out-of-range indices or non-list objects are ignored. added or removed. Out-of-range indices or non-list objects are ignored.

View File

@ -844,7 +844,7 @@ PyAPI_FUNC(int) PyUnicode_Resize(
Py_ssize_t length /* New length */ Py_ssize_t length /* New length */
); );
/* Decode obj to an Unicode object. /* Decode obj to a Unicode object.
bytes, bytearray and other bytes-like objects are decoded according to the bytes, bytearray and other bytes-like objects are decoded according to the
given encoding and error handler. The encoding and error handler can be given encoding and error handler. The encoding and error handler can be

View File

@ -252,7 +252,7 @@ class InvalidOperation(DecimalException):
class ConversionSyntax(InvalidOperation): class ConversionSyntax(InvalidOperation):
"""Trying to convert badly formed string. """Trying to convert badly formed string.
This occurs and signals invalid-operation if an string is being This occurs and signals invalid-operation if a string is being
converted to a number and it does not conform to the numeric string converted to a number and it does not conform to the numeric string
syntax. The result is [0,qNaN]. syntax. The result is [0,qNaN].
""" """

View File

@ -439,7 +439,7 @@ class IOBase(metaclass=abc.ABCMeta):
return self.__closed return self.__closed
def _checkClosed(self, msg=None): def _checkClosed(self, msg=None):
"""Internal: raise an ValueError if file is closed """Internal: raise a ValueError if file is closed
""" """
if self.closed: if self.closed:
raise ValueError("I/O operation on closed file." raise ValueError("I/O operation on closed file."

View File

@ -387,7 +387,7 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
The address must be already resolved to avoid the trap of hanging the The address must be already resolved to avoid the trap of hanging the
entire event loop when the address requires doing a DNS lookup. For entire event loop when the address requires doing a DNS lookup. For
example, it must be an IP address, not an hostname, for AF_INET and example, it must be an IP address, not a hostname, for AF_INET and
AF_INET6 address families. Use getaddrinfo() to resolve the hostname AF_INET6 address families. Use getaddrinfo() to resolve the hostname
asynchronously. asynchronously.

View File

@ -1522,7 +1522,7 @@ def get_qp_ctext(value):
This is not the RFC ctext, since we are handling nested comments in comment This is not the RFC ctext, since we are handling nested comments in comment
and unquoting quoted-pairs here. We allow anything except the '()' and unquoting quoted-pairs here. We allow anything except the '()'
characters, but if we find any ASCII other than the RFC defined printable characters, but if we find any ASCII other than the RFC defined printable
ASCII an NonPrintableDefect is added to the token's defects list. Since ASCII, a NonPrintableDefect is added to the token's defects list. Since
quoted pairs are converted to their unquoted values, what is returned is quoted pairs are converted to their unquoted values, what is returned is
a 'ptext' token. In this case it is a WhiteSpaceTerminal, so it's value a 'ptext' token. In this case it is a WhiteSpaceTerminal, so it's value
is ' '. is ' '.
@ -1537,7 +1537,7 @@ def get_qcontent(value):
"""qcontent = qtext / quoted-pair """qcontent = qtext / quoted-pair
We allow anything except the DQUOTE character, but if we find any ASCII We allow anything except the DQUOTE character, but if we find any ASCII
other than the RFC defined printable ASCII an NonPrintableDefect is other than the RFC defined printable ASCII, a NonPrintableDefect is
added to the token's defects list. Any quoted pairs are converted to their added to the token's defects list. Any quoted pairs are converted to their
unquoted values, so what is returned is a 'ptext' token. In this case it unquoted values, so what is returned is a 'ptext' token. In this case it
is a ValueTerminal. is a ValueTerminal.
@ -1882,7 +1882,7 @@ def get_dtext(value):
obs-dtext = obs-NO-WS-CTL / quoted-pair obs-dtext = obs-NO-WS-CTL / quoted-pair
We allow anything except the excluded characters, but if we find any We allow anything except the excluded characters, but if we find any
ASCII other than the RFC defined printable ASCII an NonPrintableDefect is ASCII other than the RFC defined printable ASCII, a NonPrintableDefect is
added to the token's defects list. Quoted pairs are converted to their added to the token's defects list. Quoted pairs are converted to their
unquoted values, so what is returned is a ptext token, in this case a unquoted values, so what is returned is a ptext token, in this case a
ValueTerminal. If there were quoted-printables, an ObsoleteHeaderDefect is ValueTerminal. If there were quoted-printables, an ObsoleteHeaderDefect is

View File

@ -109,7 +109,7 @@ class Group:
def __init__(self, display_name=None, addresses=None): def __init__(self, display_name=None, addresses=None):
"""Create an object representing an address group. """Create an object representing an address group.
An address group consists of a display_name followed by colon and an An address group consists of a display_name followed by colon and a
list of addresses (see Address) terminated by a semi-colon. The Group list of addresses (see Address) terminated by a semi-colon. The Group
is created by specifying a display_name and a possibly empty list of is created by specifying a display_name and a possibly empty list of
Address objects. A Group can also be used to represent a single Address objects. A Group can also be used to represent a single

View File

@ -64,7 +64,7 @@ class AutoComplete:
def try_open_completions_event(self, event): def try_open_completions_event(self, event):
"""Happens when it would be nice to open a completion list, but not """Happens when it would be nice to open a completion list, but not
really necessary, for example after an dot, so function really necessary, for example after a dot, so function
calls won't be made. calls won't be made.
""" """
lastchar = self.text.get("insert-1c") lastchar = self.text.get("insert-1c")

View File

@ -372,7 +372,7 @@ class StackViewer(ScrolledList):
def __init__(self, master, flist, gui): def __init__(self, master, flist, gui):
if macosxSupport.isAquaTk(): if macosxSupport.isAquaTk():
# At least on with the stock AquaTk version on OSX 10.4 you'll # At least on with the stock AquaTk version on OSX 10.4 you'll
# get an shaking GUI that eventually kills IDLE if the width # get a shaking GUI that eventually kills IDLE if the width
# argument is specified. # argument is specified.
ScrolledList.__init__(self, master) ScrolledList.__init__(self, master)
else: else:

View File

@ -68,7 +68,7 @@ class WidgetRedirector:
'''Return OriginalCommand(operation) after registering function. '''Return OriginalCommand(operation) after registering function.
Registration adds an operation: function pair to ._operations. Registration adds an operation: function pair to ._operations.
It also adds an widget function attribute that masks the tkinter It also adds a widget function attribute that masks the tkinter
class instance method. Method masking operates independently class instance method. Method masking operates independently
from command dispatch. from command dispatch.

View File

@ -1196,7 +1196,7 @@ class ConfigDialog(Toplevel):
All values are treated as text, and it is up to the user to supply All values are treated as text, and it is up to the user to supply
reasonable values. The only exception to this are the 'enable*' options, reasonable values. The only exception to this are the 'enable*' options,
which are boolean, and can be toggled with an True/False button. which are boolean, and can be toggled with a True/False button.
""" """
parent = self.parent parent = self.parent
frame = self.tabPages.pages['Extensions'].frame frame = self.tabPages.pages['Extensions'].frame

View File

@ -49,7 +49,7 @@ class BaseFix(object):
"""Initializer. Subclass may override. """Initializer. Subclass may override.
Args: Args:
options: an dict containing the options passed to RefactoringTool options: a dict containing the options passed to RefactoringTool
that could be used to customize the fixer through the command line. that could be used to customize the fixer through the command line.
log: a list to append warnings and other messages to. log: a list to append warnings and other messages to.
""" """

View File

@ -184,7 +184,7 @@ class RefactoringTool(object):
Args: Args:
fixer_names: a list of fixers to import fixer_names: a list of fixers to import
options: an dict with configuration. options: a dict with configuration.
explicit: a list of fixers to run even if they are explicit. explicit: a list of fixers to run even if they are explicit.
""" """
self.fixers = fixer_names self.fixers = fixer_names

View File

@ -279,7 +279,7 @@ def open(filename, mode="rb", *,
constructor: LZMAFile(filename, mode, ...). In this case, the constructor: LZMAFile(filename, mode, ...). In this case, the
encoding, errors and newline arguments must not be provided. encoding, errors and newline arguments must not be provided.
For text mode, a LZMAFile object is created, and wrapped in an For text mode, an LZMAFile object is created, and wrapped in an
io.TextIOWrapper instance with the specified encoding, error io.TextIOWrapper instance with the specified encoding, error
handling behavior, and line ending(s). handling behavior, and line ending(s).

View File

@ -1821,7 +1821,7 @@ class BabylMessage(Message):
_type_specific_attributes = ['_labels', '_visible'] _type_specific_attributes = ['_labels', '_visible']
def __init__(self, message=None): def __init__(self, message=None):
"""Initialize an BabylMessage instance.""" """Initialize a BabylMessage instance."""
self._labels = [] self._labels = []
self._visible = Message() self._visible = Message()
Message.__init__(self, message) Message.__init__(self, message)

View File

@ -842,7 +842,7 @@ def RebuildProxy(func, token, serializer, kwds):
def MakeProxyType(name, exposed, _cache={}): def MakeProxyType(name, exposed, _cache={}):
''' '''
Return an proxy type whose methods are given by `exposed` Return a proxy type whose methods are given by `exposed`
''' '''
exposed = tuple(exposed) exposed = tuple(exposed)
try: try:

View File

@ -1361,7 +1361,7 @@ class OptionParser (OptionContainer):
sys.argv[1:]). Any errors result in a call to 'error()', which sys.argv[1:]). Any errors result in a call to 'error()', which
by default prints the usage message to stderr and calls by default prints the usage message to stderr and calls
sys.exit() with an error message. On success returns a pair sys.exit() with an error message. On success returns a pair
(values, args) where 'values' is an Values instance (with all (values, args) where 'values' is a Values instance (with all
your option values) and 'args' is the list of arguments left your option values) and 'args' is the list of arguments left
over after parsing options. over after parsing options.
""" """

View File

@ -72,7 +72,7 @@ def isrecursive(object):
class _safe_key: class _safe_key:
"""Helper function for key functions when sorting unorderable objects. """Helper function for key functions when sorting unorderable objects.
The wrapped-object will fallback to an Py2.x style comparison for The wrapped-object will fallback to a Py2.x style comparison for
unorderable types (sorting first comparing the type name and then by unorderable types (sorting first comparing the type name and then by
the obj ids). Does not work recursively, so dict.items() must have the obj ids). Does not work recursively, so dict.items() must have
_safe_key applied to both the key and the value. _safe_key applied to both the key and the value.

View File

@ -685,7 +685,7 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
global default timeout setting returned by :func:`getdefaulttimeout` global default timeout setting returned by :func:`getdefaulttimeout`
is used. If *source_address* is set it must be a tuple of (host, port) is used. If *source_address* is set it must be a tuple of (host, port)
for the socket to bind as a source address before making the connection. for the socket to bind as a source address before making the connection.
An host of '' or port 0 tells the OS to use the default. A host of '' or port 0 tells the OS to use the default.
""" """
host, port = address host, port = address

View File

@ -736,7 +736,7 @@ class StreamRequestHandler(BaseRequestHandler):
try: try:
self.wfile.flush() self.wfile.flush()
except socket.error: except socket.error:
# An final socket error may have occurred here, such as # A final socket error may have occurred here, such as
# the local error ECONNABORTED. # the local error ECONNABORTED.
pass pass
self.wfile.close() self.wfile.close()

View File

@ -73,7 +73,7 @@ class RegressionTests(unittest.TestCase):
def CheckStatementFinalizationOnCloseDb(self): def CheckStatementFinalizationOnCloseDb(self):
# pysqlite versions <= 2.3.3 only finalized statements in the statement # pysqlite versions <= 2.3.3 only finalized statements in the statement
# cache when closing the database. statements that were still # cache when closing the database. statements that were still
# referenced in cursors weren't closed an could provoke " # referenced in cursors weren't closed and could provoke "
# "OperationalError: Unable to close due to unfinalised statements". # "OperationalError: Unable to close due to unfinalised statements".
con = sqlite.connect(":memory:") con = sqlite.connect(":memory:")
cursors = [] cursors = []

View File

@ -1525,9 +1525,9 @@ class TarFile(object):
'x' or 'x:' create a tarfile exclusively without compression, raise 'x' or 'x:' create a tarfile exclusively without compression, raise
an exception if the file is already created an exception if the file is already created
'x:gz' create an gzip compressed tarfile, raise an exception 'x:gz' create a gzip compressed tarfile, raise an exception
if the file is already created if the file is already created
'x:bz2' create an bzip2 compressed tarfile, raise an exception 'x:bz2' create a bzip2 compressed tarfile, raise an exception
if the file is already created if the file is already created
'x:xz' create an lzma compressed tarfile, raise an exception 'x:xz' create an lzma compressed tarfile, raise an exception
if the file is already created if the file is already created

View File

@ -1182,7 +1182,7 @@ class SelectorSslTransportTests(test_utils.TestCase):
self.assertIs(exc, waiter.exception()) self.assertIs(exc, waiter.exception())
def test_cancel_handshake(self): def test_cancel_handshake(self):
# Python issue #23197: cancelling an handshake must not raise an # Python issue #23197: cancelling a handshake must not raise an
# exception or log an error, even if the handshake failed # exception or log an error, even if the handshake failed
waiter = asyncio.Future(loop=self.loop) waiter = asyncio.Future(loop=self.loop)
transport = self.ssl_transport(waiter=waiter) transport = self.ssl_transport(waiter=waiter)

View File

@ -40,7 +40,7 @@ class SslProtoHandshakeTests(test_utils.TestCase):
ssl_proto.connection_made(transport) ssl_proto.connection_made(transport)
def test_cancel_handshake(self): def test_cancel_handshake(self):
# Python issue #23197: cancelling an handshake must not raise an # Python issue #23197: cancelling a handshake must not raise an
# exception or log an error, even if the handshake failed # exception or log an error, even if the handshake failed
waiter = asyncio.Future(loop=self.loop) waiter = asyncio.Future(loop=self.loop)
ssl_proto = self.ssl_protocol(waiter) ssl_proto = self.ssl_protocol(waiter)

View File

@ -58,7 +58,7 @@ class Rat(object):
den = property(_get_den, None) den = property(_get_den, None)
def __repr__(self): def __repr__(self):
"""Convert a Rat to an string resembling a Rat constructor call.""" """Convert a Rat to a string resembling a Rat constructor call."""
return "Rat(%d, %d)" % (self.__num, self.__den) return "Rat(%d, %d)" % (self.__num, self.__den)
def __str__(self): def __str__(self):

View File

@ -683,7 +683,7 @@ class FaultHandlerTests(unittest.TestCase):
sys.stderr = stderr sys.stderr = stderr
def test_stderr_None(self): def test_stderr_None(self):
# Issue #21497: provide an helpful error if sys.stderr is None, # Issue #21497: provide a helpful error if sys.stderr is None,
# instead of just an attribute error: "None has no attribute fileno". # instead of just an attribute error: "None has no attribute fileno".
with self.check_stderr_none(): with self.check_stderr_none():
faulthandler.enable() faulthandler.enable()

View File

@ -200,7 +200,7 @@ class _BasePurePathTest(object):
def _check_str_subclass(self, *args): def _check_str_subclass(self, *args):
# Issue #21127: it should be possible to construct a PurePath object # Issue #21127: it should be possible to construct a PurePath object
# from an str subclass instance, and it then gets converted to # from a str subclass instance, and it then gets converted to
# a pure str object. # a pure str object.
class StrSubclass(str): class StrSubclass(str):
pass pass

View File

@ -644,7 +644,7 @@ class SysModuleTest(unittest.TestCase):
self.assertEqual(os.path.abspath(sys.executable), sys.executable) self.assertEqual(os.path.abspath(sys.executable), sys.executable)
# Issue #7774: Ensure that sys.executable is an empty string if argv[0] # Issue #7774: Ensure that sys.executable is an empty string if argv[0]
# has been set to an non existent program name and Python is unable to # has been set to a non existent program name and Python is unable to
# retrieve the real program name # retrieve the real program name
# For a normal installation, it should work without 'cwd' # For a normal installation, it should work without 'cwd'

View File

@ -1082,7 +1082,7 @@ class EventTests(lock_tests.EventTests):
eventtype = staticmethod(threading.Event) eventtype = staticmethod(threading.Event)
class ConditionAsRLockTests(lock_tests.RLockTests): class ConditionAsRLockTests(lock_tests.RLockTests):
# An Condition uses an RLock by default and exports its API. # Condition uses an RLock by default and exports its API.
locktype = staticmethod(threading.Condition) locktype = staticmethod(threading.Condition)
class ConditionTests(lock_tests.ConditionTests): class ConditionTests(lock_tests.ConditionTests):

View File

@ -22,7 +22,7 @@ class Gprof2htmlTests(unittest.TestCase):
sys.argv = [] sys.argv = []
def test_gprof(self): def test_gprof(self):
# Issue #14508: this used to fail with an NameError. # Issue #14508: this used to fail with a NameError.
with mock.patch.object(self.gprof, 'webbrowser') as wmock, \ with mock.patch.object(self.gprof, 'webbrowser') as wmock, \
tempfile.TemporaryDirectory() as tmpdir: tempfile.TemporaryDirectory() as tmpdir:
fn = os.path.join(tmpdir, 'abc') fn = os.path.join(tmpdir, 'abc')

View File

@ -195,7 +195,7 @@ class ZipAppTest(unittest.TestCase):
self.assertTrue(new_target.getvalue().startswith(b'#!python2.7\n')) self.assertTrue(new_target.getvalue().startswith(b'#!python2.7\n'))
def test_read_from_pathobj(self): def test_read_from_pathobj(self):
# Test that we can copy an archive using an pathlib.Path object # Test that we can copy an archive using a pathlib.Path object
# for the source. # for the source.
source = self.tmpdir / 'source' source = self.tmpdir / 'source'
source.mkdir() source.mkdir()

View File

@ -2772,7 +2772,7 @@ class Menu(Widget):
self.deletecommand(c) self.deletecommand(c)
self.tk.call(self._w, 'delete', index1, index2) self.tk.call(self._w, 'delete', index1, index2)
def entrycget(self, index, option): def entrycget(self, index, option):
"""Return the resource value of an menu item for OPTION at INDEX.""" """Return the resource value of a menu item for OPTION at INDEX."""
return self.tk.call(self._w, 'entrycget', index, '-' + option) return self.tk.call(self._w, 'entrycget', index, '-' + option)
def entryconfigure(self, index, cnf=None, **kw): def entryconfigure(self, index, cnf=None, **kw):
"""Configure a menu item at INDEX.""" """Configure a menu item at INDEX."""

View File

@ -3,7 +3,7 @@
This is very preliminary. I currently only support dnd *within* one This is very preliminary. I currently only support dnd *within* one
application, between different windows (or within the same window). application, between different windows (or within the same window).
I an trying to make this as generic as possible -- not dependent on I am trying to make this as generic as possible -- not dependent on
the use of a particular widget or icon type, etc. I also hope that the use of a particular widget or icon type, etc. I also hope that
this will work with Pmw. this will work with Pmw.

View File

@ -193,7 +193,7 @@ class InternalFunctionsTest(unittest.TestCase):
## Testing type = vsapi ## Testing type = vsapi
# vsapi type expects at least a class name and a part_id, so this # vsapi type expects at least a class name and a part_id, so this
# should raise an ValueError since it tries to get two elements from # should raise a ValueError since it tries to get two elements from
# an empty tuple # an empty tuple
self.assertRaises(ValueError, ttk._format_elemcreate, 'vsapi') self.assertRaises(ValueError, ttk._format_elemcreate, 'vsapi')

View File

@ -221,7 +221,7 @@ class Tk(tkinter.Tk, tixCommand):
self.tk.eval('package require Tix') self.tk.eval('package require Tix')
def destroy(self): def destroy(self):
# For safety, remove an delete_window binding before destroy # For safety, remove the delete_window binding before destroy
self.protocol("WM_DELETE_WINDOW", "") self.protocol("WM_DELETE_WINDOW", "")
tkinter.Tk.destroy(self) tkinter.Tk.destroy(self)
@ -702,7 +702,7 @@ class DirSelectBox(TixWidget):
class ExFileSelectBox(TixWidget): class ExFileSelectBox(TixWidget):
"""ExFileSelectBox - MS Windows style file select box. """ExFileSelectBox - MS Windows style file select box.
It provides an convenient method for the user to select files. It provides a convenient method for the user to select files.
Subwidget Class Subwidget Class
--------- ----- --------- -----
@ -760,7 +760,7 @@ class DirSelectDialog(TixWidget):
# Should inherit from a Dialog class # Should inherit from a Dialog class
class ExFileSelectDialog(TixWidget): class ExFileSelectDialog(TixWidget):
"""ExFileSelectDialog - MS Windows style file select dialog. """ExFileSelectDialog - MS Windows style file select dialog.
It provides an convenient method for the user to select files. It provides a convenient method for the user to select files.
Subwidgets Class Subwidgets Class
---------- ----- ---------- -----

View File

@ -1474,7 +1474,7 @@ class LabeledScale(Frame):
can be accessed through instance.label""" can be accessed through instance.label"""
def __init__(self, master=None, variable=None, from_=0, to=10, **kw): def __init__(self, master=None, variable=None, from_=0, to=10, **kw):
"""Construct an horizontal LabeledScale with parent master, a """Construct a horizontal LabeledScale with parent master, a
variable to be associated with the Ttk Scale widget and its range. variable to be associated with the Ttk Scale widget and its range.
If variable is not specified, a tkinter.IntVar is created. If variable is not specified, a tkinter.IntVar is created.

View File

@ -1446,7 +1446,7 @@ class ServerProxy:
# magic method dispatcher # magic method dispatcher
return _Method(self.__request, name) return _Method(self.__request, name)
# note: to call a remote object with an non-standard name, use # note: to call a remote object with a non-standard name, use
# result getattr(server, "strange-python-name")(args) # result getattr(server, "strange-python-name")(args)
def __call__(self, attr): def __call__(self, attr):

View File

@ -89,9 +89,10 @@ def create_archive(source, target=None, interpreter=None, main=None):
The created application archive will have a shebang line specifying The created application archive will have a shebang line specifying
that it should run with INTERPRETER (there will be no shebang line if that it should run with INTERPRETER (there will be no shebang line if
INTERPRETER is None), and a __main__.py which runs MAIN (if MAIN is INTERPRETER is None), and a __main__.py which runs MAIN (if MAIN is
not specified, an existing __main__.py will be used). It is an to specify not specified, an existing __main__.py will be used). It is an error
MAIN for anything other than a directory source with no __main__.py, and it to specify MAIN for anything other than a directory source with no
is an error to omit MAIN if the directory has no __main__.py. __main__.py, and it is an error to omit MAIN if the directory has no
__main__.py.
""" """
# Are we copying an existing archive? # Are we copying an existing archive?
source_is_file = False source_is_file = False

View File

@ -7220,7 +7220,7 @@ Library
cElementTree module is updated too. cElementTree module is updated too.
- Issue #7774: Set sys.executable to an empty string if argv[0] has been set to - Issue #7774: Set sys.executable to an empty string if argv[0] has been set to
an non existent program name and Python is unable to retrieve the real program a non existent program name and Python is unable to retrieve the real program
name. name.
- Issue #7880: Fix sysconfig when the python executable is a symbolic link. - Issue #7880: Fix sysconfig when the python executable is a symbolic link.
@ -14013,7 +14013,7 @@ Core and builtins
would not be removed while allocating a new weakref object. Since would not be removed while allocating a new weakref object. Since
GC could be invoked at that time, however, that assumption was GC could be invoked at that time, however, that assumption was
invalid. In a truly obscure case of GC being triggered during invalid. In a truly obscure case of GC being triggered during
creation for a new weakref object for an referent which already creation for a new weakref object for a referent which already
has a weakref without a callback which is only referenced from has a weakref without a callback which is only referenced from
cyclic trash, a memory error can occur. This consistently created a cyclic trash, a memory error can occur. This consistently created a
segfault in a debug build, but provided less predictable behavior in segfault in a debug build, but provided less predictable behavior in
@ -18737,7 +18737,7 @@ Standard library
- xml.dom.minidom offers a toprettyxml method. A number of DOM - xml.dom.minidom offers a toprettyxml method. A number of DOM
conformance issues have been resolved. In particular, Element now conformance issues have been resolved. In particular, Element now
has an hasAttributes method, and the handling of namespaces was has a hasAttributes method, and the handling of namespaces was
improved. improved.
- Ka-Ping Yee contributed two new modules: inspect.py, a module for - Ka-Ping Yee contributed two new modules: inspect.py, a module for
@ -20227,7 +20227,7 @@ list of all new modules is included below.
Probably the most pervasive change is the addition of Unicode support. Probably the most pervasive change is the addition of Unicode support.
We've added a new fundamental datatype, the Unicode string, a new We've added a new fundamental datatype, the Unicode string, a new
build-in function unicode(), an numerous C APIs to deal with Unicode built-in function unicode(), and numerous C APIs to deal with Unicode
and encodings. See the file Misc/unicode.txt for details, or and encodings. See the file Misc/unicode.txt for details, or
http://starship.python.net/crew/lemburg/unicode-proposal.txt. http://starship.python.net/crew/lemburg/unicode-proposal.txt.
@ -21712,7 +21712,7 @@ real list objects.
- The uu module now deals better with trailing garbage generated by - The uu module now deals better with trailing garbage generated by
some broke uuencoders. some broke uuencoders.
- The telnet module now has an my_interact() method which uses threads - The telnet module now has a my_interact() method which uses threads
instead of select. The interact() method uses this by default on instead of select. The interact() method uses this by default on
Windows (where the single-threaded version doesn't work). Windows (where the single-threaded version doesn't work).
@ -22769,7 +22769,7 @@ PyEval_CallMethod().
- New macros to access object members for PyFunction, PyCFunction - New macros to access object members for PyFunction, PyCFunction
objects. objects.
- New APIs PyImport_AppendInittab() an PyImport_ExtendInittab() to - New APIs PyImport_AppendInittab() and PyImport_ExtendInittab() to
dynamically add one or many entries to the table of built-in modules. dynamically add one or many entries to the table of built-in modules.
- New macro Py_InitModule3(name, methods, doc) which calls - New macro Py_InitModule3(name, methods, doc) which calls
@ -27179,7 +27179,7 @@ a string it is returned unchanged, otherwise it returns `x`.
* repr(x) returns the same as `x`. (Some users found it easier to * repr(x) returns the same as `x`. (Some users found it easier to
have this as a function.) have this as a function.)
* round(x) returns the floating point number x rounded to an whole * round(x) returns the floating point number x rounded to a whole
number, represented as a floating point number. round(x, n) returns x number, represented as a floating point number. round(x, n) returns x
rounded to n digits. rounded to n digits.

View File

@ -1169,7 +1169,7 @@ Core and Builtins
- Issue #24407: Fix crash when dict is mutated while being updated. - Issue #24407: Fix crash when dict is mutated while being updated.
- Issue #24619: New approach for tokenizing async/await. As a consequence, - Issue #24619: New approach for tokenizing async/await. As a consequence,
is is now possible to have one-line 'async def foo(): await ..' functions. it is now possible to have one-line 'async def foo(): await ..' functions.
- Issue #24687: Plug refleak on SyntaxError in function parameters - Issue #24687: Plug refleak on SyntaxError in function parameters
annotations. annotations.
@ -3515,7 +3515,7 @@ Library
- Issue #21000: Improve the command-line interface of json.tool. - Issue #21000: Improve the command-line interface of json.tool.
- Issue #20995: Enhance default ciphers used by the ssl module to enable - Issue #20995: Enhance default ciphers used by the ssl module to enable
better security an prioritize perfect forward secrecy. better security and prioritize perfect forward secrecy.
- Issue #20884: Don't assume that __file__ is defined on importlib.__init__. - Issue #20884: Don't assume that __file__ is defined on importlib.__init__.

View File

@ -731,7 +731,7 @@ parse_process_char(ReaderObj *self, Py_UCS4 c)
break; break;
case QUOTE_IN_QUOTED_FIELD: case QUOTE_IN_QUOTED_FIELD:
/* doublequote - seen a quote in an quoted field */ /* doublequote - seen a quote in a quoted field */
if (dialect->quoting != QUOTE_NONE && if (dialect->quoting != QUOTE_NONE &&
c == dialect->quotechar) { c == dialect->quotechar) {
/* save "" as " */ /* save "" as " */

View File

@ -3802,7 +3802,7 @@ PyCFuncPtr_call(PyCFuncPtrObject *self, PyObject *inargs, PyObject *kwds)
return NULL; return NULL;
} }
/* there should be more checks? No, in Python */ /* there should be more checks? No, in Python */
/* First arg is an pointer to an interface instance */ /* First arg is a pointer to an interface instance */
if (!this->b_ptr || *(void **)this->b_ptr == NULL) { if (!this->b_ptr || *(void **)this->b_ptr == NULL) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"NULL COM pointer access"); "NULL COM pointer access");

View File

@ -4629,7 +4629,7 @@ calc_binsize(char *bytes, int nbytes)
/* s contains x bytes of a little-endian integer. Return its value as a /* s contains x bytes of a little-endian integer. Return its value as a
* C int. Obscure: when x is 1 or 2, this is an unsigned little-endian * C int. Obscure: when x is 1 or 2, this is an unsigned little-endian
* int, but when x is 4 it's a signed one. This is an historical source * int, but when x is 4 it's a signed one. This is a historical source
* of x-platform bugs. * of x-platform bugs.
*/ */
static long static long

View File

@ -519,7 +519,7 @@ tracemalloc_realloc(void *ctx, void *ptr, size_t new_size)
the caller, because realloc() may already have shrinked the the caller, because realloc() may already have shrinked the
memory block and so removed bytes. memory block and so removed bytes.
This case is very unlikely: an hash entry has just been This case is very unlikely: a hash entry has just been
released, so the hash table should have at least one free entry. released, so the hash table should have at least one free entry.
The GIL and the table lock ensures that only one thread is The GIL and the table lock ensures that only one thread is

View File

@ -1051,7 +1051,7 @@ static PyMethodDef module_methods[] = {
{"register", {"register",
(PyCFunction)faulthandler_register_py, METH_VARARGS|METH_KEYWORDS, (PyCFunction)faulthandler_register_py, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("register(signum, file=sys.stderr, all_threads=True, chain=False): " PyDoc_STR("register(signum, file=sys.stderr, all_threads=True, chain=False): "
"register an handler for the signal 'signum': dump the " "register a handler for the signal 'signum': dump the "
"traceback of the current thread, or of all threads if " "traceback of the current thread, or of all threads if "
"all_threads is True, into file")}, "all_threads is True, into file")},
{"unregister", {"unregister",

View File

@ -4483,7 +4483,7 @@ static PyMethodDef zip_longest_methods[] = {
PyDoc_STRVAR(zip_longest_doc, PyDoc_STRVAR(zip_longest_doc,
"zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> zip_longest object\n\ "zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> zip_longest object\n\
\n\ \n\
Return an zip_longest object whose .__next__() method returns a tuple where\n\ Return a zip_longest object whose .__next__() method returns a tuple where\n\
the i-th element comes from the i-th iterable argument. The .__next__()\n\ the i-th element comes from the i-th iterable argument. The .__next__()\n\
method continues until the longest iterable in the argument sequence\n\ method continues until the longest iterable in the argument sequence\n\
is exhausted and then it raises StopIteration. When the shorter iterables\n\ is exhausted and then it raises StopIteration. When the shorter iterables\n\

View File

@ -3091,7 +3091,7 @@ bytearray(bytes_or_buffer) -> mutable copy of bytes_or_buffer\n\
bytearray(int) -> bytes array of size given by the parameter initialized with null bytes\n\ bytearray(int) -> bytes array of size given by the parameter initialized with null bytes\n\
bytearray() -> empty bytes array\n\ bytearray() -> empty bytes array\n\
\n\ \n\
Construct an mutable bytearray object from:\n\ Construct a mutable bytearray object from:\n\
- an iterable yielding integers in range(256)\n\ - an iterable yielding integers in range(256)\n\
- a text string encoded using the specified encoding\n\ - a text string encoded using the specified encoding\n\
- a bytes or a buffer object\n\ - a bytes or a buffer object\n\

View File

@ -5,7 +5,7 @@
/* Support objects whose length is > PY_SSIZE_T_MAX. /* Support objects whose length is > PY_SSIZE_T_MAX.
This could be sped up for small PyLongs if they fit in an Py_ssize_t. This could be sped up for small PyLongs if they fit in a Py_ssize_t.
This only matters on Win64. Though we could use PY_LONG_LONG which This only matters on Win64. Though we could use PY_LONG_LONG which
would presumably help perf. would presumably help perf.
*/ */

View File

@ -1226,7 +1226,7 @@ static PyTypeObject PyFieldNameIter_Type = {
0}; 0};
/* unicode_formatter_field_name_split is used to implement /* unicode_formatter_field_name_split is used to implement
string.Formatter.vformat. it takes an PEP 3101 "field name", and string.Formatter.vformat. it takes a PEP 3101 "field name", and
returns a tuple of (first, rest): "first", the part before the returns a tuple of (first, rest): "first", the part before the
first '.' or '['; and "rest", an iterator for the rest of the field first '.' or '['; and "rest", an iterator for the rest of the field
name. it's a wrapper around stringlib/string_format.h's name. it's a wrapper around stringlib/string_format.h's

View File

@ -120,7 +120,7 @@ PyDoc_STRVAR(winreg_ConnectRegistry__doc__,
"ConnectRegistry($module, computer_name, key, /)\n" "ConnectRegistry($module, computer_name, key, /)\n"
"--\n" "--\n"
"\n" "\n"
"Establishes a connection to the registry on on another computer.\n" "Establishes a connection to the registry on another computer.\n"
"\n" "\n"
" computer_name\n" " computer_name\n"
" The name of the remote computer, of the form r\"\\\\computername\". If\n" " The name of the remote computer, of the form r\"\\\\computername\". If\n"
@ -913,7 +913,7 @@ PyDoc_STRVAR(winreg_SetValueEx__doc__,
" references to environment variables (for example,\n" " references to environment variables (for example,\n"
" %PATH%).\n" " %PATH%).\n"
" REG_LINK -- A Unicode symbolic link.\n" " REG_LINK -- A Unicode symbolic link.\n"
" REG_MULTI_SZ -- An sequence of null-terminated strings, terminated\n" " REG_MULTI_SZ -- A sequence of null-terminated strings, terminated\n"
" by two null characters. Note that Python handles\n" " by two null characters. Note that Python handles\n"
" this termination automatically.\n" " this termination automatically.\n"
" REG_NONE -- No defined value type.\n" " REG_NONE -- No defined value type.\n"
@ -1056,4 +1056,4 @@ winreg_QueryReflectionKey(PyModuleDef *module, PyObject *arg)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=71f5bc30b646807b input=a9049054013a1b77]*/ /*[clinic end generated code: output=5e346dccc296f9f1 input=a9049054013a1b77]*/

View File

@ -792,7 +792,7 @@ winreg.ConnectRegistry -> HKEY
The predefined key to connect to. The predefined key to connect to.
/ /
Establishes a connection to the registry on on another computer. Establishes a connection to the registry on another computer.
The return value is the handle of the opened key. The return value is the handle of the opened key.
If the function fails, an OSError exception is raised. If the function fails, an OSError exception is raised.
@ -801,7 +801,7 @@ If the function fails, an OSError exception is raised.
static HKEY static HKEY
winreg_ConnectRegistry_impl(PyModuleDef *module, Py_UNICODE *computer_name, winreg_ConnectRegistry_impl(PyModuleDef *module, Py_UNICODE *computer_name,
HKEY key) HKEY key)
/*[clinic end generated code: output=5c52f6f7ba6e7b46 input=9a056558ce318433]*/ /*[clinic end generated code: output=5c52f6f7ba6e7b46 input=5f98a891a347e68e]*/
{ {
HKEY retKey; HKEY retKey;
long rc; long rc;
@ -1605,7 +1605,7 @@ winreg.SetValueEx
references to environment variables (for example, references to environment variables (for example,
%PATH%). %PATH%).
REG_LINK -- A Unicode symbolic link. REG_LINK -- A Unicode symbolic link.
REG_MULTI_SZ -- An sequence of null-terminated strings, terminated REG_MULTI_SZ -- A sequence of null-terminated strings, terminated
by two null characters. Note that Python handles by two null characters. Note that Python handles
this termination automatically. this termination automatically.
REG_NONE -- No defined value type. REG_NONE -- No defined value type.
@ -1631,7 +1631,7 @@ the configuration registry to help the registry perform efficiently.
static PyObject * static PyObject *
winreg_SetValueEx_impl(PyModuleDef *module, HKEY key, Py_UNICODE *value_name, winreg_SetValueEx_impl(PyModuleDef *module, HKEY key, Py_UNICODE *value_name,
PyObject *reserved, DWORD type, PyObject *value) PyObject *reserved, DWORD type, PyObject *value)
/*[clinic end generated code: output=ea092a935c361582 input=e73dec535ebeea7d]*/ /*[clinic end generated code: output=ea092a935c361582 input=f1b16cbcc3ed4101]*/
{ {
BYTE *data; BYTE *data;
DWORD len; DWORD len;

View File

@ -231,7 +231,7 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
} }
/* /*
* Return the thread Id instead of an handle. The Id is said to uniquely identify the * Return the thread Id instead of a handle. The Id is said to uniquely identify the
* thread in the system * thread in the system
*/ */
long long