Skip to content

Commit 5532a8a

Browse files
authored
Merge branch 'main' into eager-loop
2 parents ca1f860 + 5a97efe commit 5532a8a

121 files changed

Lines changed: 1582 additions & 505 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Doc/builtins/exceptions.rst‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,9 @@ The following exceptions are the exceptions that are usually raised.
396396

397397
.. attribute:: strerror
398398

399-
The corresponding error message, as provided by
400-
the operating system. It is formatted by the C
401-
functions :c:func:`!perror` under POSIX, and :c:func:`!FormatMessage`
402-
under Windows.
399+
The corresponding error message, as provided by the operating system.
400+
Under POSIX, it is obtained using the C functions :c:func:`!strerror`
401+
or :c:func:`!strerror_r`; under Windows, :c:func:`!FormatMessage` is used.
403402

404403
.. attribute:: filename
405404
filename2
@@ -567,11 +566,6 @@ The following exceptions are the exceptions that are usually raised.
567566
The column in the end line where the error occurred finishes. This is
568567
1-indexed: the first character in the line has an ``offset`` of 1.
569568

570-
For errors in f-string fields, the message is prefixed by "f-string: "
571-
and the offsets are offsets in a text constructed from the replacement
572-
expression. For example, compiling f'Bad {a b} field' results in this
573-
args attribute: ('f-string: ...', ('', 1, 2, '(a b)\n', 1, 5)).
574-
575569
.. versionchanged:: 3.10
576570
Added the :attr:`end_lineno` and :attr:`end_offset` attributes.
577571

‎Doc/builtins/functions.rst‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ are always available. They are listed here in alphabetical order.
772772
still access all builtins.
773773

774774
The *closure* argument specifies a closure--a tuple of cellvars.
775-
It's only valid when the *object* is a code object containing
775+
It's only valid when *source* is a code object containing
776776
:term:`free (closure) variables <closure variable>`.
777777
The length of the tuple must exactly match the length of the code object's
778778
:attr:`~codeobject.co_freevars` attribute.
@@ -2166,10 +2166,10 @@ are always available. They are listed here in alphabetical order.
21662166

21672167
When called directly within an ordinary method of a class, both arguments may
21682168
be omitted ("zero-argument :func:`!super`"). In this case, *type* will be the
2169-
enclosing class, and *obj* will be the first argument of the immediately
2170-
enclosing function (typically ``self``). (This means that zero-argument
2169+
enclosing class, and *object_or_type* will be the first argument of the
2170+
immediately enclosing function (typically ``self``). Zero-argument
21712171
:func:`!super` will not work as expected within nested functions, including
2172-
generator expressions, which implicitly create nested functions.)
2172+
generator expressions, which implicitly create nested functions.
21732173

21742174
There are two typical use cases for *super*. In a class hierarchy with
21752175
single inheritance, *super* can be used to refer to parent classes without
@@ -2428,10 +2428,9 @@ are always available. They are listed here in alphabetical order.
24282428
determine the package context of the :keyword:`import` statement.
24292429

24302430
*level* specifies whether to use absolute or relative imports. ``0`` (the
2431-
default) means only perform absolute imports. Positive values for
2432-
*level* indicate the number of parent directories to search relative to the
2433-
directory of the module calling :func:`__import__` (see :pep:`328` for the
2434-
details).
2431+
default) means only perform absolute imports. For relative imports,
2432+
``1`` refers to the current package, ``2`` to its parent package, and so on
2433+
(see :pep:`328` for details).
24352434

24362435
When the *name* variable is of the form ``package.module``, normally, the
24372436
top-level package (the name up till the first dot) is returned, *not* the

‎Doc/builtins/stdtypes.rst‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5667,7 +5667,7 @@ can be used interchangeably to index the same dictionary entry.
56675667

56685668
* Use a comma-separated list of ``key: value`` pairs within braces:
56695669
``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``
5670-
* Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``
5670+
* Use a dict comprehension: ``{x: x ** 2 for x in range(10)}``
56715671
* Use the type constructor: ``dict()``,
56725672
``dict([('foo', 100), ('bar', 200)])``, ``dict(foo=100, bar=200)``
56735673

@@ -5878,9 +5878,8 @@ can be used interchangeably to index the same dictionary entry.
58785878
Return a new view of the dictionary's values. See the
58795879
:ref:`documentation of view objects <dict-views>`.
58805880

5881-
An equality comparison between one ``dict.values()`` view and another
5882-
will always return ``False``. This also applies when comparing
5883-
``dict.values()`` to itself::
5881+
An equality comparison between two distinct ``dict.values()`` views
5882+
will always return ``False``, even for views of the same dictionary::
58845883

58855884
>>> d = {'a': 1}
58865885
>>> d.values() == d.values()

‎Doc/deprecations/pending-removal-in-3.20.rst‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,27 @@ Pending removal in Python 3.20
3939

4040
(Contributed by Hugo van Kemenade and Stan Ulbrych in :gh:`76007`.)
4141

42+
* The ``__author__``, ``__credits__``, ``__copyright__`` and ``__date__``
43+
attributes have been deprecated in these standard library modules and will
44+
be removed in Python 3.20. Attribution is preserved in the source code
45+
and the version control history.
46+
47+
- :mod:`bz2`
48+
- :mod:`concurrent.futures`
49+
- :mod:`inspect`
50+
- :mod:`io`
51+
- :mod:`json`
52+
- :mod:`logging`
53+
- :mod:`optparse`
54+
- :mod:`platform`
55+
- :mod:`pydoc`
56+
- :mod:`tarfile`
57+
- :mod:`tkinter.ttk`
58+
- :mod:`tokenize`
59+
- :mod:`uuid`
60+
61+
(Contributed by Stan Ulbrych in :gh:`159240`.)
62+
4263
* Deprecations defined by :pep:`829`:
4364

4465
* Warnings are produced for ``import`` lines found in :file:`{name}.pth`

‎Doc/library/inspect.rst‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,12 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
284284
| | | ``AGEN_SUSPENDED``, or |
285285
| | | ``AGEN_CLOSED`` |
286286
+-----------------+-------------------+---------------------------+
287+
| async generator | aga_gen | async generator driven by |
288+
| awaitable | | the awaitable returned |
289+
| | | from ``asend()``, |
290+
| | | ``athrow()``, or |
291+
| | | ``aclose()`` |
292+
+-----------------+-------------------+---------------------------+
287293
| coroutine | __name__ | name |
288294
+-----------------+-------------------+---------------------------+
289295
| | __qualname__ | qualified name |
@@ -360,6 +366,11 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
360366
Add ``gi_state`` attribute to generators, ``cr_state`` attribute to
361367
coroutines, and ``ag_state`` attribute to async generators.
362368

369+
.. versionchanged:: 3.16
370+
371+
Add ``aga_gen`` attribute to the awaitables returned by the ``asend()``,
372+
``athrow()`` and ``aclose()`` methods of async generators.
373+
363374
.. function:: getmembers(object[, predicate])
364375

365376
Return all the members of an object in a list of ``(name, value)``

‎Doc/library/numbers.rst‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ them to the same values. This may be subtle if there are two different
9393
extensions of the real numbers. See also :ref:`numeric-hash`.
9494

9595

96-
Adding More Numeric ABCs
96+
Adding more numeric ABCs
9797
~~~~~~~~~~~~~~~~~~~~~~~~
9898

9999
There are, of course, more possible ABCs for numbers, and this would
@@ -143,11 +143,12 @@ defined as::
143143

144144

145145
There are 5 different cases for a mixed-type operation on subclasses
146-
of :class:`Complex`. I'll refer to all of the above code that doesn't
147-
refer to ``MyIntegral`` and ``OtherTypeIKnowAbout`` as
148-
"boilerplate". ``a`` will be an instance of ``A``, which is a subtype
149-
of :class:`Complex` (``a : A <: Complex``), and ``b : B <:
150-
Complex``. I'll consider ``a + b``:
146+
of :class:`Complex`. All of the above code that doesn't refer to
147+
``MyIntegral`` and ``OtherTypeIKnowAbout`` is referred to as "boilerplate".
148+
149+
In this description, ``a`` is an instance of ``A`` and ``b`` is an
150+
instance of ``B``, where ``A`` and ``B`` are both subtypes of :class:`Complex`.
151+
Consider ``a + b``:
151152

152153
1. If ``A`` defines an :meth:`~object.__add__` which accepts ``b``, all is
153154
well.
@@ -162,13 +163,14 @@ Complex``. I'll consider ``a + b``:
162163
4. If it falls back to the boilerplate, there are no more possible
163164
methods to try, so this is where the default implementation
164165
should live.
165-
5. If ``B <: A``, Python tries ``B.__radd__`` before
166+
5. If ``B`` is a subtype of ``A``, Python tries ``B.__radd__`` before
166167
``A.__add__``. This is ok, because it was implemented with
167168
knowledge of ``A``, so it can handle those instances before
168169
delegating to :class:`Complex`.
169170

170-
If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge,
171-
then the appropriate shared operation is the one involving the built
171+
If ``A`` is a subtype of :class:`Complex` and ``B`` is a subtype of
172+
:class:`Real` without sharing any other knowledge, then the appropriate
173+
shared operation is the one involving the built
172174
in :class:`complex`, and both :meth:`~object.__radd__` s land there, so ``a+b
173175
== b+a``.
174176

‎Doc/library/shutil.rst‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
753753
unpacked. If not provided, the current working directory is used.
754754

755755
*format* is the archive format: one of "zip", "tar", "gztar", "bztar",
756-
"xztar", or "zstdtar". Or any other format registered with
756+
"xztar", "zstdtar", or "whl". Or any other format registered with
757757
:func:`register_unpack_format`. If not provided, :func:`unpack_archive`
758758
will use the archive file name extension and see if an unpacker was
759759
registered for that extension. In case none is found,
@@ -786,6 +786,9 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
786786
.. versionchanged:: 3.12
787787
Added the *filter* argument.
788788

789+
.. versionchanged:: next
790+
Added the "whl" format.
791+
789792
.. function:: register_unpack_format(name, extensions, function[, extra_args[, description]])
790793

791794
Registers an unpack format. *name* is the name of the format and
@@ -827,10 +830,16 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
827830
- *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available).
828831
- *zstdtar*: Zstandard compressed tar-file (if the :mod:`compression.zstd`
829832
module is available).
833+
- *whl*: `wheel file <https://packaging.python.org/en/latest/discussions/package-formats/#what-is-a-wheel>`__
834+
(unpacking compressed files works only if the corresponding module is
835+
available).
830836

831837
You can register new formats or provide your own unpacker for any existing
832838
formats, by using :func:`register_unpack_format`.
833839

840+
.. versionchanged:: next
841+
Added the *whl* format.
842+
834843

835844
.. _shutil-archiving-example:
836845

‎Doc/library/test.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,14 @@ The :mod:`!test.support` module defines the following functions:
10871087

10881088
.. versionadded:: 3.6
10891089

1090+
1091+
.. function:: check_deprecated_module_attributes(test_case, module, *names, remove)
1092+
1093+
Assert that accessing each attribute in *names* on *module* emits a
1094+
:exc:`DeprecationWarning` naming the attribute and the Python version
1095+
*remove*, given as a ``(major, minor)`` tuple, in which it will be removed.
1096+
1097+
10901098
.. function:: skip_if_broken_multiprocessing_synchronize()
10911099

10921100
Skip tests if the :mod:`!multiprocessing.synchronize` module is missing, if

‎Doc/library/urllib.error.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ The following exceptions are raised by :mod:`!urllib.error` as appropriate:
2727
:exc:`URLError` used to be a subtype of :exc:`IOError`, which is now an
2828
alias of :exc:`OSError`.
2929

30+
.. versionchanged:: 3.16
31+
The :attr:`~OSError.errno` and :attr:`~OSError.strerror` attributes are
32+
now set from :attr:`reason` when it is an :exc:`OSError`.
33+
3034

3135
.. exception:: HTTPError(url, code, msg, hdrs, fp)
3236

‎Doc/whatsnew/3.16.rst‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,9 @@ shutil
690690
:func:`shutil.copystat`, e.g. when copying a read-only tree.
691691
(Contributed by Łukasz Langa in :gh:`89721`.)
692692

693+
* :func:`shutil.unpack_archive` can now unpack wheel files using the ``whl`` format.
694+
(Contributed by Emma Harper Smith and Stan Ulbrych in :gh:`84027`.)
695+
693696

694697
socket
695698
------
@@ -1198,6 +1201,29 @@ New deprecations
11981201
3.9, now issues a deprecation warning on use. This property is slated for
11991202
removal in 3.21. Use ``ast.Tuple.elts`` instead.
12001203

1204+
* ``__author__``, ``__credits__``, ``__copyright__`` and ``__date__``:
1205+
1206+
* The ``__author__``, ``__credits__``, ``__copyright__`` and ``__date__``
1207+
attributes have been deprecated in these standard library modules and will
1208+
be removed in Python 3.20. Attribution is preserved in the source code
1209+
and the version control history.
1210+
1211+
- :mod:`bz2`
1212+
- :mod:`concurrent.futures`
1213+
- :mod:`inspect`
1214+
- :mod:`io`
1215+
- :mod:`json`
1216+
- :mod:`logging`
1217+
- :mod:`optparse`
1218+
- :mod:`platform`
1219+
- :mod:`pydoc`
1220+
- :mod:`tarfile`
1221+
- :mod:`tkinter.ttk`
1222+
- :mod:`tokenize`
1223+
- :mod:`uuid`
1224+
1225+
(Contributed by Stan Ulbrych in :gh:`159240`.)
1226+
12011227
* :mod:`functools`:
12021228

12031229
* Using a return annotation to infer the dispatch type for

0 commit comments

Comments
 (0)