Skip to content

Commit d5ec309

Browse files
committed
Merge branch 'main' into bpo-44530-code-qualname
2 parents 3f2c9e9 + 693cec0 commit d5ec309

File tree

101 files changed

+9012
-6670
lines changed

Some content is hidden

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

101 files changed

+9012
-6670
lines changed

Doc/c-api/memory.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ Customize Memory Allocators
490490
Debug hooks on the Python memory allocators
491491
===========================================
492492
493-
When :ref:`Python is built is debug mode <debug-build>`, the
493+
When :ref:`Python is built in debug mode <debug-build>`, the
494494
:c:func:`PyMem_SetupDebugHooks` function is called at the :ref:`Python
495495
preinitialization <c-preinit>` to setup debug hooks on Python memory allocators
496496
to detect memory errors.

Doc/library/asyncio-eventloop.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,16 +1132,12 @@ Executing code in thread or process pools
11321132
.. method:: loop.set_default_executor(executor)
11331133

11341134
Set *executor* as the default executor used by :meth:`run_in_executor`.
1135-
*executor* should be an instance of
1135+
*executor* must be an instance of
11361136
:class:`~concurrent.futures.ThreadPoolExecutor`.
11371137

1138-
.. deprecated:: 3.8
1139-
Using an executor that is not an instance of
1140-
:class:`~concurrent.futures.ThreadPoolExecutor` is deprecated and
1141-
will trigger an error in Python 3.9.
1142-
1143-
*executor* must be an instance of
1144-
:class:`concurrent.futures.ThreadPoolExecutor`.
1138+
.. versionchanged:: 3.11
1139+
*executor* must be an instance of
1140+
:class:`~concurrent.futures.ThreadPoolExecutor`.
11451141

11461142

11471143
Error Handling API

Doc/library/asyncio-task.rst

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ other coroutines::
148148
* a *coroutine object*: an object returned by calling a
149149
*coroutine function*.
150150

151-
asyncio also supports legacy :ref:`generator-based
152-
<asyncio_generator_based_coro>` coroutines.
153-
154151

155152
.. rubric:: Tasks
156153

@@ -1042,60 +1039,3 @@ Task Object
10421039
in the :func:`repr` output of a task object.
10431040

10441041
.. versionadded:: 3.8
1045-
1046-
1047-
.. _asyncio_generator_based_coro:
1048-
1049-
Generator-based Coroutines
1050-
==========================
1051-
1052-
.. note::
1053-
1054-
Support for generator-based coroutines is **deprecated** and
1055-
is scheduled for removal in Python 3.10.
1056-
1057-
Generator-based coroutines predate async/await syntax. They are
1058-
Python generators that use ``yield from`` expressions to await
1059-
on Futures and other coroutines.
1060-
1061-
Generator-based coroutines should be decorated with
1062-
:func:`@asyncio.coroutine <asyncio.coroutine>`, although this is not
1063-
enforced.
1064-
1065-
1066-
.. decorator:: coroutine
1067-
1068-
Decorator to mark generator-based coroutines.
1069-
1070-
This decorator enables legacy generator-based coroutines to be
1071-
compatible with async/await code::
1072-
1073-
@asyncio.coroutine
1074-
def old_style_coroutine():
1075-
yield from asyncio.sleep(1)
1076-
1077-
async def main():
1078-
await old_style_coroutine()
1079-
1080-
This decorator should not be used for :keyword:`async def`
1081-
coroutines.
1082-
1083-
.. deprecated-removed:: 3.8 3.10
1084-
1085-
Use :keyword:`async def` instead.
1086-
1087-
.. function:: iscoroutine(obj)
1088-
1089-
Return ``True`` if *obj* is a :ref:`coroutine object <coroutine>`.
1090-
1091-
This method is different from :func:`inspect.iscoroutine` because
1092-
it returns ``True`` for generator-based coroutines.
1093-
1094-
.. function:: iscoroutinefunction(func)
1095-
1096-
Return ``True`` if *func* is a :ref:`coroutine function
1097-
<coroutine>`.
1098-
1099-
This method is different from :func:`inspect.iscoroutinefunction`
1100-
because it returns ``True`` for generator-based coroutine functions
1101-
decorated with :func:`@coroutine <coroutine>`.

Doc/library/atexit.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ internal error is detected, or when :func:`os._exit` is called.
4848

4949
.. function:: unregister(func)
5050

51-
Remove *func* from the list of functions to be run at interpreter
52-
shutdown. After calling :func:`unregister`, *func* is guaranteed not to be
53-
called when the interpreter shuts down, even if it was registered more than
54-
once. :func:`unregister` silently does nothing if *func* was not previously
55-
registered.
51+
Remove *func* from the list of functions to be run at interpreter shutdown.
52+
:func:`unregister` silently does nothing if *func* was not previously
53+
registered. If *func* has been registered more than once, every occurrence
54+
of that function in the :mod:`atexit` call stack will be removed. Equality
55+
comparisons (``==``) are used internally during unregistration, so function
56+
references do not need to have matching identities.
5657

5758

5859
.. seealso::

Doc/library/collections.abc.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ ABC Inherits from Abstract Methods Mixin
198198

199199
.. note::
200200
In CPython, generator-based coroutines (generators decorated with
201-
:func:`types.coroutine` or :func:`asyncio.coroutine`) are
201+
:func:`types.coroutine`) are
202202
*awaitables*, even though they do not have an :meth:`__await__` method.
203203
Using ``isinstance(gencoro, Awaitable)`` for them will return ``False``.
204204
Use :func:`inspect.isawaitable` to detect them.
@@ -216,7 +216,7 @@ ABC Inherits from Abstract Methods Mixin
216216

217217
.. note::
218218
In CPython, generator-based coroutines (generators decorated with
219-
:func:`types.coroutine` or :func:`asyncio.coroutine`) are
219+
:func:`types.coroutine`) are
220220
*awaitables*, even though they do not have an :meth:`__await__` method.
221221
Using ``isinstance(gencoro, Coroutine)`` for them will return ``False``.
222222
Use :func:`inspect.isawaitable` to detect them.

Doc/library/contextlib.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ Functions and classes provided:
515515
These context managers may suppress exceptions just as they normally
516516
would if used directly as part of a :keyword:`with` statement.
517517

518+
.. versionchanged:: 3.11
519+
Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm*
520+
is not a context manager.
521+
518522
.. method:: push(exit)
519523

520524
Adds a context manager's :meth:`__exit__` method to the callback stack.
@@ -585,6 +589,10 @@ Functions and classes provided:
585589
Similar to :meth:`enter_context` but expects an asynchronous context
586590
manager.
587591

592+
.. versionchanged:: 3.11
593+
Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm*
594+
is not an asynchronous context manager.
595+
588596
.. method:: push_async_exit(exit)
589597

590598
Similar to :meth:`push` but expects either an asynchronous context manager

Doc/library/dis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ All of the following opcodes use their arguments.
936936
.. versionadded:: 3.9
937937

938938

939-
.. opcode:: DICT_MERGE
939+
.. opcode:: DICT_MERGE (i)
940940

941941
Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys.
942942

Doc/library/graphlib.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@
154154

155155
.. method:: static_order()
156156

157-
Returns an iterable of nodes in a topological order. Using this method
158-
does not require to call :meth:`TopologicalSorter.prepare` or
159-
:meth:`TopologicalSorter.done`. This method is equivalent to::
157+
Returns an iterator object which will iterate over nodes in a topological
158+
order. When using this method, :meth:`~TopologicalSorter.prepare` and
159+
:meth:`~TopologicalSorter.done` should not be called. This method is
160+
equivalent to::
160161

161162
def static_order(self):
162163
self.prepare()
@@ -206,4 +207,4 @@ The :mod:`graphlib` module defines the following exception classes:
206207
The detected cycle can be accessed via the second element in the :attr:`~CycleError.args`
207208
attribute of the exception instance and consists in a list of nodes, such that each node is,
208209
in the graph, an immediate predecessor of the next node in the list. In the reported list,
209-
the first and the last node will be the same, to make it clear that it is cyclic.
210+
the first and the last node will be the same, to make it clear that it is cyclic.

Doc/library/marshal.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ The module defines these functions:
6666
The *version* argument indicates the data format that ``dump`` should use
6767
(see below).
6868

69+
.. audit-event:: marshal.dumps value,version marshal.dump
70+
6971

7072
.. function:: load(file)
7173

@@ -74,11 +76,18 @@ The module defines these functions:
7476
format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. The
7577
file must be a readable :term:`binary file`.
7678

79+
.. audit-event:: marshal.load "" marshal.load
80+
7781
.. note::
7882

7983
If an object containing an unsupported type was marshalled with :func:`dump`,
8084
:func:`load` will substitute ``None`` for the unmarshallable type.
8185

86+
.. versionchanged:: 3.10
87+
88+
This call used to raise a ``code.__new__`` audit event for each code object. Now
89+
it raises a single ``marshal.load`` event for the entire load operation.
90+
8291

8392
.. function:: dumps(value[, version])
8493

@@ -89,13 +98,22 @@ The module defines these functions:
8998
The *version* argument indicates the data format that ``dumps`` should use
9099
(see below).
91100

101+
.. audit-event:: marshal.dumps value,version marshal.dump
102+
92103

93104
.. function:: loads(bytes)
94105

95106
Convert the :term:`bytes-like object` to a value. If no valid value is found, raise
96107
:exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. Extra bytes in the
97108
input are ignored.
98109

110+
.. audit-event:: marshal.loads bytes marshal.load
111+
112+
.. versionchanged:: 3.10
113+
114+
This call used to raise a ``code.__new__`` audit event for each code object. Now
115+
it raises a single ``marshal.loads`` event for the entire load operation.
116+
99117

100118
In addition, the following constants are defined:
101119

Doc/library/pprint.rst

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,36 @@ The :mod:`pprint` module defines one class:
4242
compact=False, sort_dicts=True, underscore_numbers=False)
4343

4444
Construct a :class:`PrettyPrinter` instance. This constructor understands
45-
several keyword parameters. An output stream may be set using the *stream*
46-
keyword; the only method used on the stream object is the file protocol's
47-
:meth:`write` method. If not specified, the :class:`PrettyPrinter` adopts
48-
``sys.stdout``. The
49-
amount of indentation added for each recursive level is specified by *indent*;
50-
the default is one. Other values can cause output to look a little odd, but can
51-
make nesting easier to spot. The number of levels which may be printed is
52-
controlled by *depth*; if the data structure being printed is too deep, the next
53-
contained level is replaced by ``...``. By default, there is no constraint on
54-
the depth of the objects being formatted. The desired output width is
55-
constrained using the *width* parameter; the default is 80 characters. If a
56-
structure cannot be formatted within the constrained width, a best effort will
57-
be made. If *compact* is false (the default) each item of a long sequence
58-
will be formatted on a separate line. If *compact* is true, as many items
59-
as will fit within the *width* will be formatted on each output line. If
60-
*sort_dicts* is true (the default), dictionaries will be formatted with their
61-
keys sorted, otherwise they will display in insertion order. If
62-
*underscore_numbers* is true, integers will be formatted with the
45+
several keyword parameters.
46+
47+
*stream* (default ``sys.stdout``) is a :term:`file-like object` to
48+
which the output will be written by calling its :meth:`write` method.
49+
50+
Other values configure the manner in which nesting of complex data
51+
structures is displayed.
52+
53+
*indent* (default 1) specifies the amount of indentation added for
54+
each nesting level.
55+
56+
*depth* controls the number of nesting levels which may be printed; if
57+
the data structure being printed is too deep, the next contained level
58+
is replaced by ``...``. By default, there is no constraint on the
59+
depth of the objects being formatted.
60+
61+
*width* (default 80) specifies the desired maximum number of characters per
62+
line in the output. If a structure cannot be formatted within the width
63+
constraint, a best effort will be made.
64+
65+
*compact* impacts the way that long sequences (lists, tuples, sets, etc)
66+
are formatted. If *compact* is false (the default) then each item of a
67+
sequence will be formatted on a separate line. If *compact* is true, as
68+
many items as will fit within the *width* will be formatted on each output
69+
line.
70+
71+
If *sort_dicts* is true (the default), dictionaries will be formatted with
72+
their keys sorted, otherwise they will display in insertion order.
73+
74+
If *underscore_numbers* is true, integers will be formatted with the
6375
``_`` character for a thousands separator, otherwise underscores are not
6476
displayed (the default).
6577

Doc/library/venv.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,12 @@ creation according to their needs, the :class:`EnvBuilder` class.
170170

171171
.. method:: ensure_directories(env_dir)
172172

173-
Creates the environment directory and all necessary directories, and
174-
returns a context object. This is just a holder for attributes (such as
175-
paths), for use by the other methods. The directories are allowed to
176-
exist already, as long as either ``clear`` or ``upgrade`` were
177-
specified to allow operating on an existing environment directory.
173+
Creates the environment directory and all necessary subdirectories that
174+
don't already exist, and returns a context object. This context object
175+
is just a holder for attributes (such as paths) for use by the other
176+
methods. If the :class:`EnvBuilder` is created with the arg
177+
``clear=True``, contents of the environment directory will be cleared
178+
and then all necessary subdirectories will be recreated.
178179

179180
.. method:: create_configuration(context)
180181

Doc/reference/datamodel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2714,7 +2714,7 @@ are awaitable.
27142714
.. note::
27152715

27162716
The :term:`generator iterator` objects returned from generators
2717-
decorated with :func:`types.coroutine` or :func:`asyncio.coroutine`
2717+
decorated with :func:`types.coroutine`
27182718
are also awaitable, but they do not implement :meth:`__await__`.
27192719

27202720
.. method:: object.__await__(self)

0 commit comments

Comments
 (0)