https://github.com/python/cpython/commit/e4fe32b6b9c497887c4e0767527c2575f0e11acd commit: e4fe32b6b9c497887c4e0767527c2575f0e11acd branch: 3.14 author: Inada Naoki <[email protected]> committer: methane <[email protected]> date: 2026-11-07T10:29:41Z summary:
docs: Fix typos and obvious errors (GH-161386) (cherry picked from commit cbaba022cf2778c5f02445ae231a8af1f1db53a1) Co-authored-by: Stan Ulbrych <[email protected]> files: M Doc/c-api/typeobj.rst M Doc/extending/embedding.rst M Doc/extending/extending.rst M Doc/howto/descriptor.rst M Doc/howto/instrumentation.rst M Doc/howto/isolating-extensions.rst M Doc/howto/logging-cookbook.rst M Doc/library/annotationlib.rst M Doc/library/argparse.rst M Doc/library/asyncio-eventloop.rst M Doc/library/binascii.rst M Doc/library/calendar.rst M Doc/library/cgi.rst M Doc/library/cgitb.rst M Doc/library/codecs.rst M Doc/library/doctest.rst M Doc/library/ftplib.rst M Doc/library/http.client.rst M Doc/library/http.cookies.rst M Doc/library/io.rst M Doc/library/logging.rst M Doc/library/multiprocessing.rst M Doc/library/optparse.rst M Doc/library/os.rst M Doc/library/pdb.rst M Doc/library/profile.rst M Doc/library/ssl.rst M Doc/library/tarfile.rst M Doc/library/threading.rst M Doc/library/tracemalloc.rst M Doc/library/xml.dom.rst M Doc/whatsnew/2.3.rst M Doc/whatsnew/2.4.rst M Doc/whatsnew/2.5.rst M Doc/whatsnew/2.7.rst M Doc/whatsnew/3.1.rst M Doc/whatsnew/3.11.rst M Doc/whatsnew/3.12.rst M Doc/whatsnew/3.4.rst M Doc/whatsnew/3.6.rst M Doc/whatsnew/3.7.rst M Doc/whatsnew/3.8.rst M Doc/whatsnew/3.9.rst diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst index 7940c4f27a4abfd..138838bc3a7f3da 100644 --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -3422,7 +3422,7 @@ A type that supports weakrefs, instance dicts, and hashing:: .tp_new = myobj_new, .tp_traverse = (traverseproc)myobj_traverse, .tp_clear = (inquiry)myobj_clear, - .tp_alloc = PyType_GenericNew, + .tp_alloc = PyType_GenericAlloc, .tp_dealloc = (destructor)myobj_dealloc, .tp_repr = (reprfunc)myobj_repr, .tp_hash = (hashfunc)myobj_hash, diff --git a/Doc/extending/embedding.rst b/Doc/extending/embedding.rst index cb41889437c8b0d..8a87d7cb1c3b4ca 100644 --- a/Doc/extending/embedding.rst +++ b/Doc/extending/embedding.rst @@ -95,15 +95,16 @@ perform some operation on a file. :: See :ref:`arg-parsing-string-and-buffers` for a description of this macro. Setting :c:member:`PyConfig.program_name` should be called before -:c:func:`Py_InitializeFromConfig` to inform the interpreter about paths to Python run-time -libraries. Next, the Python interpreter is initialized with -:c:func:`Py_Initialize`, followed by the execution of a hard-coded Python script -that prints the date and time. Afterwards, the :c:func:`Py_FinalizeEx` call shuts -the interpreter down, followed by the end of the program. In a real program, -you may want to get the Python script from another source, perhaps a text-editor -routine, a file, or a database. Getting the Python code from a file can better -be done by using the :c:func:`PyRun_SimpleFile` function, which saves you the -trouble of allocating memory space and loading the file contents. +:c:func:`Py_InitializeFromConfig` to inform the interpreter about paths to +Python run-time libraries. Next, the Python interpreter is initialized with +:c:func:`Py_InitializeFromConfig`, followed by the execution of a hard-coded +Python script that prints the date and time. Afterwards, the +:c:func:`Py_FinalizeEx` call shuts the interpreter down, followed by the end of +the program. In a real program, you may want to get the Python script from +another source, perhaps a text-editor routine, a file, or a database. Getting +the Python code from a file can better be done by using the +:c:func:`PyRun_SimpleFile` function, which saves you the trouble of allocating +memory space and loading the file contents. .. _lower-level-embedding: diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst index 38d4f18afad5fa5..a8c37b1a345ce3c 100644 --- a/Doc/extending/extending.rst +++ b/Doc/extending/extending.rst @@ -1339,7 +1339,7 @@ exporting module, not a client module. Finally, the module's :c:data:`mod_exec } Note that ``PySpam_API`` is declared ``static``; otherwise the pointer -array would disappear when :c:func:`!PyInit_spam` terminates! +array would disappear when :c:func:`!spam_module_exec` terminates! The bulk of the work is in the header file :file:`spammodule.h`, which looks like this:: diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst index 0a582ebb6d23998..5b4191d6342a2b7 100644 --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -1681,7 +1681,7 @@ variables: def __new__(mcls, clsname, bases, mapping, **kwargs): 'Emulate type_new() in Objects/typeobject.c' - # type_new() calls PyTypeReady() which calls add_methods() + # type_new() calls PyType_Ready() which calls add_methods() slot_names = mapping.get('slot_names', []) for offset, name in enumerate(slot_names): mapping[name] = Member(name, clsname, offset) diff --git a/Doc/howto/instrumentation.rst b/Doc/howto/instrumentation.rst index 1e1ba702f8659ac..936e434d0d9801e 100644 --- a/Doc/howto/instrumentation.rst +++ b/Doc/howto/instrumentation.rst @@ -433,7 +433,7 @@ Here is a tapset file, based on a non-shared build of CPython: /* Provide a higher-level wrapping around the function__entry and function__return markers: - \*/ + */ probe python.function.entry = process("python").mark("function__entry") { filename = user_string($arg1); @@ -501,7 +501,7 @@ frames, each second, across the whole system: } probe timer.ms(1000) { - printf("\033[2J\033[1;1H") /* clear screen \*/ + printf("\033[2J\033[1;1H") /* clear screen */ printf("%6s %80s %6s %30s %6s\n", "PID", "FILENAME", "LINE", "FUNCTION", "CALLS") foreach ([pid, filename, funcname, lineno] in fn_calls- limit 20) { diff --git a/Doc/howto/isolating-extensions.rst b/Doc/howto/isolating-extensions.rst index 302c15528d5ef31..fcf2abb8157fa46 100644 --- a/Doc/howto/isolating-extensions.rst +++ b/Doc/howto/isolating-extensions.rst @@ -557,9 +557,9 @@ For example:: {"example_method", (PyCFunction)(void(*)(void))example_method, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, - example_method_doc} + example_method_doc}, {NULL}, - } + }; Module State Access from Slot Methods, Getters and Setters diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst index a7e410c46b9c95b..6e7cd573dc70484 100644 --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1087,7 +1087,7 @@ each request is handled by a thread: # A dummy set of requests which will be used in the simulation - we'll just pick # from this list randomly. Note that all GET requests are from 192.168.2.XXX - # addresses, whereas POST requests are from 192.16.3.XXX addresses. Three users + # addresses, whereas POST requests are from 192.168.3.XXX addresses. Three users # are represented in the sample requests. REQUESTS = [ diff --git a/Doc/library/annotationlib.rst b/Doc/library/annotationlib.rst index 5703564c5a7d5d3..9961c43e7497296 100644 --- a/Doc/library/annotationlib.rst +++ b/Doc/library/annotationlib.rst @@ -581,7 +581,7 @@ Or used as the annotate function for an object: >>> class C: ... pass >>> C.__annotate__ = Annotate() - >>> get_annotations(Annotate(), format=Format.STRING) + >>> get_annotations(C, format=Format.STRING) {'x': 'MyType'} diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 93293852bf3c3be..bc08b1ec86ec3ad 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -742,11 +742,11 @@ the upper-cased name. For example:: >>> parser.parse_args(['--foo-bar', 'FOO-BAR']) Namespace(foo_bar='FOO-BAR') >>> parser.print_help() - usage: [-h] [--foo-bar FOO-BAR] + usage: [-h] [--foo-bar FOO_BAR] optional arguments: -h, --help show this help message and exit - --foo-bar FOO-BAR + --foo-bar FOO_BAR .. _action: diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index a5065817f34ae69..3b1c0df4074800f 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -2029,7 +2029,7 @@ Display the current date with call_later() An example of a callback displaying the current date every second. The callback uses the :meth:`loop.call_later` method to reschedule itself -after 5 seconds, and then stops the event loop:: +after 1 second, and eventually stops the event loop:: import asyncio import datetime as dt diff --git a/Doc/library/binascii.rst b/Doc/library/binascii.rst index 4cd390d27e44e65..fd5e0059e3b567f 100644 --- a/Doc/library/binascii.rst +++ b/Doc/library/binascii.rst @@ -90,11 +90,11 @@ The :mod:`!binascii` module defines the following functions: encoding. The return value is the converted line(s). If the optional argument *quotetabs* is present and true, all tabs and spaces will be encoded. If the optional argument *istext* is present and true, newlines are not encoded but - trailing whitespace will be encoded. If the optional argument *header* is - present and true, spaces will be encoded as underscores per :rfc:`1522`. If the - optional argument *header* is present and false, newline characters will be - encoded as well; otherwise linefeed conversion might corrupt the binary data - stream. + trailing whitespace will be encoded. If the optional argument *istext* is + present and false, newline characters will be encoded as well; otherwise + linefeed conversion might corrupt the binary data stream. If the optional + argument *header* is present and true, spaces will be encoded as underscores + per :rfc:`1522`. .. function:: crc_hqx(data, value) diff --git a/Doc/library/calendar.rst b/Doc/library/calendar.rst index 7db9e7a7d1b703b..ed06c718f77ff91 100644 --- a/Doc/library/calendar.rst +++ b/Doc/library/calendar.rst @@ -159,10 +159,10 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is :class:`TextCalendar` instances have the following methods: - .. method:: formatday(theday, weekday, width) + .. method:: formatday(day, weekday, width) Return a string representing a single day formatted with the given *width*. - If *theday* is ``0``, return a string of spaces of + If *day* is ``0``, return a string of spaces of the specified width, representing an empty day. The *weekday* parameter is unused. @@ -174,10 +174,10 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is :meth:`setfirstweekday` method. - .. method:: formatweekday(weekday, width) + .. method:: formatweekday(day, width) Return a string representing the name of a single weekday formatted to - the specified *width*. The *weekday* parameter is an integer representing + the specified *width*. The *day* parameter is an integer representing the day of the week, where ``0`` is Monday and ``6`` is Sunday. diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst index f9108fa954a906f..6e4d277fcefe754 100644 --- a/Doc/library/cgi.rst +++ b/Doc/library/cgi.rst @@ -12,8 +12,8 @@ It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in Python 3.11. The removal was decided in :pep:`594`. A fork of the module on PyPI can be used instead: :pypi:`legacy-cgi`. -This is a copy of the cgi module, no longer maintained or supported by the core -Python team. +This package contains copies of the :mod:`!cgi` and :mod:`!cgitb` modules, +which are no longer maintained or supported by the core Python team. The last version of Python that provided the :mod:`!cgi` module was `Python 3.12 <https://docs.python.org/3.12/library/cgi.html>`_. diff --git a/Doc/library/cgitb.rst b/Doc/library/cgitb.rst index fc646aa4c48acd0..081a4f561bd3667 100644 --- a/Doc/library/cgitb.rst +++ b/Doc/library/cgitb.rst @@ -12,8 +12,8 @@ It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in Python 3.11. The removal was decided in :pep:`594`. A fork of the module on PyPI can now be used instead: :pypi:`legacy-cgi`. -This is a copy of the cgi module, no longer maintained or supported by the core -Python team. +This package contains copies of the :mod:`!cgi` and :mod:`!cgitb` modules, +which are no longer maintained or supported by the core Python team. The last version of Python that provided the :mod:`!cgitb` module was `Python 3.12 <https://docs.python.org/3.12/library/cgitb.html>`_. diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index d03d19d318b85b4..c434a3d6f4ef447 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -1629,7 +1629,7 @@ This module implements the following exception: .. moduleauthor:: Martin v. Löwis This module implements :rfc:`3490` (Internationalized Domain Names in -Applications) and :rfc:`3492` (Nameprep: A Stringprep Profile for +Applications) and :rfc:`3491` (Nameprep: A Stringprep Profile for Internationalized Domain Names (IDN)). It builds upon the ``punycode`` encoding and :mod:`stringprep`. diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index a303afe60b7a43b..8aa75da12b2a1cf 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -1617,7 +1617,7 @@ DocTestRunner objects verbosity is not specified, then the :class:`DocTestRunner`'s verbosity is used. - :class:`DocTestParser` has the following attributes: + :class:`DocTestRunner` has the following attributes: .. attribute:: tries diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst index b359e49be6946a4..398d677415d493d 100644 --- a/Doc/library/ftplib.rst +++ b/Doc/library/ftplib.rst @@ -92,7 +92,7 @@ FTP objects :param str user: |param_doc_user| - If given, :code:`login(host, passwd, acct)` is implicitly called + If given, :code:`login(user, passwd, acct)` is implicitly called by the constructor. :param str passwd: @@ -464,7 +464,7 @@ FTP_TLS objects :param str user: |param_doc_user| - If given, :code:`login(host, passwd, acct)` is implicitly called + If given, :code:`login(user, passwd, acct)` is implicitly called by the constructor. :param str passwd: diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 72049d07d435ca6..698167208124660 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -646,7 +646,7 @@ method attribute. Here is an example session that uses the ``PUT`` method:: >>> conn.request("PUT", "/file", BODY) >>> response = conn.getresponse() >>> print(response.status, response.reason) - 200, OK + 200 OK .. _httpmessage-objects: diff --git a/Doc/library/http.cookies.rst b/Doc/library/http.cookies.rst index 1b2d17975a5edbf..c1bc923c6cb8b22 100644 --- a/Doc/library/http.cookies.rst +++ b/Doc/library/http.cookies.rst @@ -160,7 +160,7 @@ Morsel Objects that the cookie was first set in. For this to be accepted by the user agent, you **must** also set ``Secure``. - In addition, it is recommended to use the ``__Host`` prefix when setting + In addition, it is recommended to use the ``__Host-`` prefix when setting partitioned cookies to make them bound to the hostname and not the registrable domain. Read `CHIPS (Cookies Having Independent Partitioned State)`_ diff --git a/Doc/library/io.rst b/Doc/library/io.rst index 7f72e72b3c86f96..8af1b2c85b7587c 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -226,7 +226,7 @@ High-level Module Interface def read_text(path, encoding=None): encoding = io.text_encoding(encoding) # stacklevel=2 - with open(path, encoding) as f: + with open(path, encoding=encoding) as f: return f.read() In this example, an :class:`EncodingWarning` is emitted for the caller of diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index 6e38d45504c4db8..3f8485dfadb01cf 100644 --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -750,14 +750,14 @@ Formatter Objects .. versionchanged:: 3.3 Previously, the default format was hard-coded as in this example: ``2010-09-06 22:38:15,292`` where the part before the comma is - handled by a strptime format string (``'%Y-%m-%d %H:%M:%S'``), and the - part after the comma is a millisecond value. Because strptime does not + handled by a strftime format string (``'%Y-%m-%d %H:%M:%S'``), and the + part after the comma is a millisecond value. Because strftime does not have a format placeholder for milliseconds, the millisecond value is appended using another format string, ``'%s,%03d'`` --- and both of these format strings have been hardcoded into this method. With the change, these strings are defined as class-level attributes which can be overridden at the instance level when desired. The names of the - attributes are ``default_time_format`` (for the strptime format string) + attributes are ``default_time_format`` (for the strftime format string) and ``default_msec_format`` (for appending the millisecond value). .. versionchanged:: 3.9 diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index dba2b069831eccd..08265619fe9e111 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -2725,7 +2725,7 @@ multiple connections at the same time. assumed to be the fastest available. See :ref:`multiprocessing-address-formats`. Note that if *family* is ``'AF_UNIX'`` and address is ``None`` then the socket will be created in a - private temporary directory created using :func:`tempfile.mkstemp`. + private temporary directory created using :func:`tempfile.mkdtemp`. If the listener object uses a socket then *backlog* (1 by default) is passed to the :meth:`~socket.socket.listen` method of the socket once it has been diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst index c6ec00bf3e3e861..dfb9f206379d427 100644 --- a/Doc/library/optparse.rst +++ b/Doc/library/optparse.rst @@ -2000,7 +2000,7 @@ To add new types, you need to define your own subclass of :mod:`!optparse`'s (e.g., ``-f``), and ``value`` is the string from the command line that must be checked and converted to your desired type. ``check_mytype()`` should return an object of the hypothetical type ``mytype``. The value returned by - a type-checking function will wind up in the OptionValues instance returned + a type-checking function will wind up in the Values instance returned by :meth:`OptionParser.parse_args`, or be passed to a callback as the ``value`` parameter. @@ -2067,7 +2067,7 @@ Adding new actions is a bit trickier, because you have to understand that "store" actions actions that result in :mod:`!optparse` storing a value to an attribute of the - current OptionValues instance; these options require a :attr:`~Option.dest` + current Values instance; these options require a :attr:`~Option.dest` attribute to be supplied to the Option constructor. "typed" actions @@ -2149,8 +2149,8 @@ Features of note: control back to :meth:`Option.take_action` for the standard :mod:`!optparse` actions. -* ``values`` is an instance of the optparse_parser.Values class, which provides - the very useful :meth:`ensure_value` method. :meth:`ensure_value` is +* ``values`` is an instance of the optparse.Values class, which provides + the very useful :meth:`!ensure_value` method. :meth:`!ensure_value` is essentially :func:`getattr` with a safety valve; it is called as :: values.ensure_value(attr, value) @@ -2160,9 +2160,9 @@ Features of note: very handy for actions like ``"extend"``, ``"append"``, and ``"count"``, all of which accumulate data in a variable and expect that variable to be of a certain type (a list for the first two, an integer for the latter). Using - :meth:`ensure_value` means that scripts using your action don't have to worry + :meth:`!ensure_value` means that scripts using your action don't have to worry about setting a default value for the option destinations in question; they - can just leave the default as ``None`` and :meth:`ensure_value` will take care of + can just leave the default as ``None`` and :meth:`!ensure_value` will take care of getting it right when it's needed. Exceptions diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 78b5fcbc7f75917..59f60b7fd195a4c 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -3259,7 +3259,7 @@ features: .. versionchanged:: 3.12 ``st_ctime_ns`` is deprecated on Windows. Use ``st_birthtime_ns`` - for the file creation time. In the future, ``st_ctime`` will contain + for the file creation time. In the future, ``st_ctime_ns`` will contain the time of the most recent metadata change, as for other platforms. .. attribute:: st_birthtime @@ -4959,7 +4959,7 @@ written in Python, such as a mail server's external command delivery program. parent's signal mask. This argument corresponds to the C library :c:macro:`!POSIX_SPAWN_SETSIGMASK` flag. - The *sigdef* argument will reset the disposition of all signals in the set + The *setsigdef* argument will reset the disposition of all signals in the set specified. This argument corresponds to the C library :c:macro:`!POSIX_SPAWN_SETSIGDEF` flag. diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index da4cd36526eceba..8aa5dc1973dc02c 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -810,7 +810,7 @@ can be overridden by the local file. List or jump between chained exceptions. - When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained exception + When using ``pdb.pm()`` or ``pdb.post_mortem(...)`` with a chained exception instead of a traceback, it allows the user to move between the chained exceptions using ``exceptions`` command to list exceptions, and ``exceptions <number>`` to switch to that exception. diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst index 57f997792b85b12..05752b835e86bdb 100644 --- a/Doc/library/profile.rst +++ b/Doc/library/profile.rst @@ -259,7 +259,7 @@ functions: the *timer* argument. This must be a function that returns a single number representing the current time. If the number is an integer, the *timeunit* specifies a multiplier that specifies the duration of each unit of time. For - example, if the timer returns times measured in thousands of seconds, the + example, if the timer returns times measured in thousandths of seconds, the time unit would be ``.001``. Directly using the :class:`Profile` class allows formatting profile results @@ -700,7 +700,7 @@ you are using :class:`profile.Profile` or :class:`cProfile.Profile`, ``your_time_func`` should return a single number. If it returns integers, you can also invoke the class constructor with a second argument specifying the real duration of one unit of time. For example, if - ``your_integer_time_func`` returns times measured in thousands of seconds, + ``your_integer_time_func`` returns times measured in thousandths of seconds, you would construct the :class:`Profile` instance as follows:: pr = cProfile.Profile(your_integer_time_func, 0.001) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 04d74ff427d607a..7ab6f9b749364ff 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -2442,7 +2442,7 @@ Visual inspection shows that the certificate does identify the desired service Now the SSL channel is established and the certificate verified, you can proceed to talk with the server:: - >>> conn.sendall(b"HEAD / HTTP/1.0\r\nHost: linuxfr.org\r\n\r\n") + >>> conn.sendall(b"HEAD / HTTP/1.0\r\nHost: www.python.org\r\n\r\n") >>> pprint.pprint(conn.recv(1024).split(b"\r\n")) [b'HTTP/1.1 200 OK', b'Date: Sat, 18 Oct 2014 18:27:20 GMT', @@ -2651,7 +2651,7 @@ provided. When compared to :class:`SSLSocket`, this object lacks the following features: - - Any form of network IO; ``recv()`` and ``send()`` read and write only to + - Any form of network IO; ``read()`` and ``write()`` read and write only to the underlying :class:`MemoryBIO` buffers. - There is no *do_handshake_on_connect* machinery. You must always manually diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst index fb550e27778908a..0c0ffd2066e7bbf 100644 --- a/Doc/library/tarfile.rst +++ b/Doc/library/tarfile.rst @@ -763,7 +763,7 @@ call the :meth:`~TarInfo.replace` method to create a modified copy in one step. Several attributes can be set to ``None`` to indicate that a piece of metadata is unused or unknown. -Different :class:`TarInfo` methods handle ``None`` differently: +Different :class:`TarFile` methods handle ``None`` differently: - The :meth:`~TarFile.extract` or :meth:`~TarFile.extractall` methods will ignore the corresponding metadata, leaving it set to a default. @@ -1443,7 +1443,7 @@ The same example using the :keyword:`with` statement:: How to create and write an archive to stdout using :data:`sys.stdout.buffer <sys.stdout>` in the *fileobj* parameter -in :meth:`TarFile.add`:: +in :func:`~tarfile.open`:: import sys import tarfile diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 69539fa1fd4bb57..ed8f8082ab1c48e 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -812,7 +812,7 @@ locks. In the locked state, some thread owns the lock; in the unlocked state, no thread owns it. Threads call a lock's :meth:`~RLock.acquire` method to lock it, -and its :meth:`~Lock.release` method to unlock it. +and its :meth:`~RLock.release` method to unlock it. .. note:: @@ -823,7 +823,7 @@ and its :meth:`~Lock.release` method to unlock it. RLock's :meth:`~RLock.acquire`/:meth:`~RLock.release` call pairs may be nested, unlike Lock's :meth:`~Lock.acquire`/:meth:`~Lock.release`. Only the final -:meth:`~RLock.release` (the :meth:`~Lock.release` of the outermost pair) resets +:meth:`~RLock.release` (the :meth:`~RLock.release` of the outermost pair) resets the lock to an unlocked state and allows another thread blocked in :meth:`~RLock.acquire` to proceed. diff --git a/Doc/library/tracemalloc.rst b/Doc/library/tracemalloc.rst index 4a19acb430b0d13..6ce677b15a51b4a 100644 --- a/Doc/library/tracemalloc.rst +++ b/Doc/library/tracemalloc.rst @@ -750,7 +750,7 @@ Traceback Example:: print("Traceback (most recent call first):") - for line in traceback: + for line in traceback.format(most_recent_first=True): print(line) Output:: diff --git a/Doc/library/xml.dom.rst b/Doc/library/xml.dom.rst index 7e77f8cb434f961..0446bfd049621aa 100644 --- a/Doc/library/xml.dom.rst +++ b/Doc/library/xml.dom.rst @@ -504,7 +504,7 @@ NodeList Objects A :class:`NodeList` represents a sequence of nodes. These objects are used in two ways in the DOM Core recommendation: an :class:`Element` object provides one as its list of child nodes, and the :meth:`~Element.getElementsByTagName` -and :meth:`~Element.getElementsByTagNameNS` methods of :class:`Node` return +and :meth:`~Element.getElementsByTagNameNS` methods of :class:`Element` return objects with this interface to represent query results. :class:`NodeList` does *not* inherit from :class:`Node`. diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst index f2d372440717517..984f9d363eb7187 100644 --- a/Doc/whatsnew/2.3.rst +++ b/Doc/whatsnew/2.3.rst @@ -1357,7 +1357,7 @@ complete list of changes, or look through the CVS logs for all the details. other than ``e`` and ``10``. (Contributed by Raymond Hettinger.) * Several new POSIX functions (:func:`!getpgid`, :func:`!killpg`, :func:`!lchown`, - :func:`!loadavg`, :func:`!major`, :func:`!makedev`, :func:`!minor`, and + :func:`!getloadavg`, :func:`!major`, :func:`!makedev`, :func:`!minor`, and :func:`!mknod`) were added to the :mod:`posix` module that underlies the :mod:`os` module. (Contributed by Gustavo Niemeyer, Geert Jansen, and Denis S. Otkidach.) @@ -1658,7 +1658,7 @@ complete list of changes, or look through the CVS logs for all the details. has been added. The "idna" encoding can be used to convert between a Unicode domain name and the ASCII-compatible encoding (ACE) of that name. :: - >{}>{}> u"www.Alliancefrançaise.nu".encode("idna") + >>> u"www.Alliancefrançaise.nu".encode("idna") 'www.xn--alliancefranaise-npb.nu' The :mod:`socket` module has also been extended to transparently convert diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst index ae3e9ed4646eeda..a3c75ec7f8e39ad 100644 --- a/Doc/whatsnew/2.4.rst +++ b/Doc/whatsnew/2.4.rst @@ -1072,7 +1072,7 @@ complete list of changes, or look through the CVS logs for all the details. 3.0 version of the package uses a new incremental parser for MIME messages, available in the :mod:`!email.FeedParser` module. The new parser doesn't require reading the entire message into memory, and doesn't raise exceptions if a - message is malformed; instead it records any problems in the :attr:`!defect` + message is malformed; instead it records any problems in the :attr:`!defects` attribute of the message. (Developed by Anthony Baxter, Barry Warsaw, Thomas Wouters, and others.) @@ -1177,7 +1177,7 @@ complete list of changes, or look through the CVS logs for all the details. import logging logging.basicConfig(filename='/var/log/application.log', level=0, # Log all messages - format='%(levelname):%(process):%(thread):%(message)') + format='%(levelname)s:%(process)d:%(thread)d:%(message)s') Other additions to the :mod:`logging` package include a ``log(level, msg)`` convenience method, as well as a :class:`~logging.handlers.TimedRotatingFileHandler` class that diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst index 0449644833b7e9c..0e3d3ae7ace3f86 100644 --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -1738,7 +1738,7 @@ constructor that will create a :c:expr:`PyObject *` pointer. A simple usage:: d = {} ctypes.pythonapi.PyObject_SetItem(ctypes.py_object(d), ctypes.py_object("abc"), ctypes.py_object(1)) - # d is now {'abc', 1}. + # d is now {'abc': 1}. Don't forget to use :func:`~ctypes.py_object`; if it's omitted you end up with a segmentation fault. @@ -2182,7 +2182,7 @@ Changes to Python's build process and to the C API include: specified *type* and uses a fast-calling qualifier. :c:macro:`Py_LOCAL_INLINE` does the same thing and also requests the function be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined before - :file:`python.h` is included, a set of more aggressive optimizations are enabled + :file:`Python.h` is included, a set of more aggressive optimizations are enabled for the module; you should benchmark the results to find out if these optimizations actually make the code faster. (Contributed by Fredrik Lundh at the NeedForSpeed sprint.) diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst index de90c37a38d38ff..bc766e37e380e82 100644 --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -2298,7 +2298,7 @@ and getting the pointer requires providing the name: void *vtable; - if (!PyCapsule_IsValid(capsule, "mymodule.CAPI") { + if (!PyCapsule_IsValid(capsule, "mymodule.CAPI")) { PyErr_SetString(PyExc_ValueError, "argument type invalid"); return NULL; } diff --git a/Doc/whatsnew/3.1.rst b/Doc/whatsnew/3.1.rst index 9dc63c7976c5123..6c170abd402b871 100644 --- a/Doc/whatsnew/3.1.rst +++ b/Doc/whatsnew/3.1.rst @@ -310,7 +310,7 @@ New, Improved, and Deprecated Modules CSV header, SQL field list, or user input:: >>> query = input() - SELECT region, dept, count(*) FROM main GROUPBY region, dept + SELECT region, dept, count(*) FROM main GROUP BY region, dept >>> cursor.execute(query) >>> query_fields = [desc[0] for desc in cursor.description] diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index fe9385d1d66aef5..fba3f138e93d474 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -1912,8 +1912,8 @@ C APIs pending removal are * :meth:`!importlib.machinery.PathFinder.find_module` * :meth:`!importlib.machinery.WindowsRegistryFinder.find_module` * :func:`!importlib.util.module_for_loader` -* :func:`!importlib.util.set_loader_wrapper` -* :func:`!importlib.util.set_package_wrapper` +* :func:`!importlib.util.set_loader` +* :func:`!importlib.util.set_package` * :class:`!pkgutil.ImpImporter` * :class:`!pkgutil.ImpLoader` * :meth:`!pathlib.Path.link_to` diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index 7963b3eca3df484..6ee7184f92575b0 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -133,7 +133,7 @@ Security improvements: C API improvements: -* :ref:`PEP 697 <whatsnew312-pep697>`, unstable C API tier +* :ref:`PEP 689 <whatsnew312-pep689>`, unstable C API tier * :ref:`PEP 683 <whatsnew312-pep683>`, immortal objects CPython implementation improvements: @@ -1035,13 +1035,13 @@ unittest Add a ``--durations`` command line option, showing the N slowest test cases:: - python3 -m unittest --durations=3 lib.tests.test_threading + python3 -m unittest --durations=3 test.test_threading ..... Slowest test durations ---------------------------------------------------------------------- - 1.210s test_timeout (Lib.test.test_threading.BarrierTests) - 1.003s test_default_timeout (Lib.test.test_threading.BarrierTests) - 0.518s test_timeout (Lib.test.test_threading.EventTests) + 1.210s test_timeout (test.test_threading.BarrierTests) + 1.003s test_default_timeout (test.test_threading.BarrierTests) + 0.518s test_timeout (test.test_threading.EventTests) (0.000 durations hidden. Use -v to show these durations.) ---------------------------------------------------------------------- @@ -1856,8 +1856,9 @@ New Features ------------ .. _whatsnew312-pep697: +.. _whatsnew312-pep689: -* :pep:`697`: Introduce the :ref:`Unstable C API tier <unstable-c-api>`, +* :pep:`689`: Introduce the :ref:`Unstable C API tier <unstable-c-api>`, intended for low-level tools like debuggers and JIT compilers. This API may change in each minor release of CPython without deprecation warnings. diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst index 2aa23f87b4507b5..81fde508bd76cfc 100644 --- a/Doc/whatsnew/3.4.rst +++ b/Doc/whatsnew/3.4.rst @@ -2281,7 +2281,7 @@ Changes in the Python API * :meth:`!importlib.util.module_for_loader` now sets ``__loader__`` and ``__package__`` unconditionally to properly support reloading. If this is not desired then you will need to set these attributes manually. You can use - :func:`!importlib.util.module_to_load` for module management. + :func:`!importlib.util._module_to_load` for module management. * Import now resets relevant attributes (e.g. ``__name__``, ``__loader__``, ``__package__``, ``__file__``, ``__cached__``) unconditionally when reloading. @@ -2298,7 +2298,7 @@ Changes in the Python API * Frozen modules no longer define a ``__file__`` attribute. It's semantically incorrect for frozen modules to set the attribute as they are not loaded from any explicit location. If you must know that a module comes from frozen code - then you can see if the module's ``__spec__.location`` is set to ``'frozen'``, + then you can see if the module's ``__spec__.origin`` is set to ``'frozen'``, check if the loader is a subclass of :class:`importlib.machinery.FrozenImporter`, or if Python 2 compatibility is necessary you can use :func:`!imp.is_frozen`. diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst index b1e3269239d6297..70d8760dd1c41fb 100644 --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -2111,11 +2111,11 @@ API and Feature Removals name for a given path. (Contributed by Yury Selivanov in :issue:`13248`.) -* ``traceback.Ignore`` class and ``traceback.usage``, ``traceback.modname``, - ``traceback.fullmodname``, ``traceback.find_lines_from_code``, - ``traceback.find_lines``, ``traceback.find_strings``, - ``traceback.find_executable_lines`` methods were removed from the - :mod:`traceback` module. They were undocumented methods deprecated since +* ``trace.Ignore`` class and ``trace.usage``, ``trace.modname``, + ``trace.fullmodname``, ``trace.find_lines_from_code``, + ``trace.find_lines``, ``trace.find_strings``, + ``trace.find_executable_linenos`` methods were removed from the + :mod:`trace` module. They were undocumented methods deprecated since Python 3.2 and equivalent functionality is available from private methods. * The ``tk_menuBar()`` and ``tk_bindForTraversal()`` dummy methods in diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 5116be5adacc175..0d4c144a7d5b189 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -248,7 +248,7 @@ locales are available on the running system, it has the downside of having no effect on extension modules (such as GNU ``readline``), child processes running non-Python applications, and child processes running older versions of Python. To reduce the risk of corrupting text data when communicating with such -components, Python 3.7 also implements :ref:`whatsnew37-pep540`). +components, Python 3.7 also implements :ref:`whatsnew37-pep538`. The UTF-8 mode is enabled by default when the locale is ``C`` or ``POSIX``, and the :pep:`538` locale coercion feature fails to change it to a UTF-8 based @@ -1085,7 +1085,7 @@ itertools :func:`itertools.islice` now accepts :meth:`integer-like objects <object.__index__>` as start, stop, -and slice arguments. +and step arguments. (Contributed by Will Roberts in :issue:`30537`.) diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index a3a92689a01db31..a41309f48c9f1a7 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -2082,7 +2082,7 @@ Changes in the C API return NULL; #if PY_VERSION_HEX < 0x03080000 // Workaround for Python issue 35810; no longer necessary in Python 3.8 - PY_INCREF(type) + Py_INCREF(type); #endif return foo; } diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 49a52b7504bc951..e2731b6de15a3e0 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -1031,8 +1031,8 @@ Removed :exc:`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki in :issue:`39377`) -* ``with (await asyncio.lock):`` and ``with (yield from asyncio.lock):`` statements are - not longer supported, use ``async with lock`` instead. The same is correct for +* ``with (await lock):`` and ``with (yield from lock):`` statements are + no longer supported, use ``async with lock`` instead. The same is correct for ``asyncio.Condition`` and ``asyncio.Semaphore``. (Contributed by Andrew Svetlov in :issue:`34793`.) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
