Skip to content

Commit b04de9d

Browse files
committed
Merge commit '689ada79150f28b0053fa6c1fb646b75ab2cc200' into pythongh-116380
2 parents aceb85f + 689ada7 commit b04de9d

File tree

237 files changed

+4380
-1238
lines changed

Some content is hidden

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

237 files changed

+4380
-1238
lines changed

Doc/c-api/unicode.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ APIs:
523523
- Get the fully qualified name of an object type;
524524
call :c:func:`PyType_GetFullyQualifiedName`.
525525
526-
* - ``T#``
526+
* - ``#T``
527527
- :c:expr:`PyObject*`
528528
- Similar to ``T`` format, but use a colon (``:``) as separator between
529529
the module name and the qualified name.
@@ -533,7 +533,7 @@ APIs:
533533
- Get the fully qualified name of a type;
534534
call :c:func:`PyType_GetFullyQualifiedName`.
535535
536-
* - ``N#``
536+
* - ``#N``
537537
- :c:expr:`PyTypeObject*`
538538
- Similar to ``N`` format, but use a colon (``:``) as separator between
539539
the module name and the qualified name.
@@ -574,7 +574,7 @@ APIs:
574574
copied as-is to the result string, and any extra arguments discarded.
575575
576576
.. versionchanged:: 3.13
577-
Support for ``%T``, ``%T#``, ``%N`` and ``%N#`` formats added.
577+
Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added.
578578
579579
580580
.. c:function:: PyObject* PyUnicode_FromFormatV(const char *format, va_list vargs)

Doc/library/asyncio-queue.rst

+32
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ Queue
6262
Remove and return an item from the queue. If queue is empty,
6363
wait until an item is available.
6464

65+
Raises :exc:`QueueShutDown` if the queue has been shut down and
66+
is empty, or if the queue has been shut down immediately.
67+
6568
.. method:: get_nowait()
6669

6770
Return an item if one is immediately available, else raise
@@ -82,6 +85,8 @@ Queue
8285
Put an item into the queue. If the queue is full, wait until a
8386
free slot is available before adding the item.
8487

88+
Raises :exc:`QueueShutDown` if the queue has been shut down.
89+
8590
.. method:: put_nowait(item)
8691

8792
Put an item into the queue without blocking.
@@ -92,6 +97,22 @@ Queue
9297

9398
Return the number of items in the queue.
9499

100+
.. method:: shutdown(immediate=False)
101+
102+
Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put`
103+
raise :exc:`QueueShutDown`.
104+
105+
By default, :meth:`~Queue.get` on a shut down queue will only
106+
raise once the queue is empty. Set *immediate* to true to make
107+
:meth:`~Queue.get` raise immediately instead.
108+
109+
All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get`
110+
will be unblocked. If *immediate* is true, a task will be marked
111+
as done for each remaining item in the queue, which may unblock
112+
callers of :meth:`~Queue.join`.
113+
114+
.. versionadded:: 3.13
115+
95116
.. method:: task_done()
96117

97118
Indicate that a formerly enqueued task is complete.
@@ -105,6 +126,9 @@ Queue
105126
call was received for every item that had been :meth:`~Queue.put`
106127
into the queue).
107128

129+
``shutdown(immediate=True)`` calls :meth:`task_done` for each
130+
remaining item in the queue.
131+
108132
Raises :exc:`ValueError` if called more times than there were
109133
items placed in the queue.
110134

@@ -145,6 +169,14 @@ Exceptions
145169
on a queue that has reached its *maxsize*.
146170

147171

172+
.. exception:: QueueShutDown
173+
174+
Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is
175+
called on a queue which has been shut down.
176+
177+
.. versionadded:: 3.13
178+
179+
148180
Examples
149181
========
150182

Doc/library/asyncio-stream.rst

+11
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,19 @@ StreamReader
260260
buffer is reset. The :attr:`IncompleteReadError.partial` attribute
261261
may contain a portion of the separator.
262262

263+
The *separator* may also be an :term:`iterable` of separators. In this
264+
case the return value will be the shortest possible that has any
265+
separator as the suffix. For the purposes of :exc:`LimitOverrunError`,
266+
the shortest possible separator is considered to be the one that
267+
matched.
268+
263269
.. versionadded:: 3.5.2
264270

271+
.. versionchanged:: 3.13
272+
273+
The *separator* parameter may now be an :term:`iterable` of
274+
separators.
275+
265276
.. method:: at_eof()
266277

267278
Return ``True`` if the buffer is empty and :meth:`feed_eof`

Doc/library/asyncio-task.rst

+30
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,27 @@ is also included in the exception group.
392392
The same special case is made for
393393
:exc:`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph.
394394

395+
Task groups are careful not to mix up the internal cancellation used to
396+
"wake up" their :meth:`~object.__aexit__` with cancellation requests
397+
for the task in which they are running made by other parties.
398+
In particular, when one task group is syntactically nested in another,
399+
and both experience an exception in one of their child tasks simultaneously,
400+
the inner task group will process its exceptions, and then the outer task group
401+
will receive another cancellation and process its own exceptions.
402+
403+
In the case where a task group is cancelled externally and also must
404+
raise an :exc:`ExceptionGroup`, it will call the parent task's
405+
:meth:`~asyncio.Task.cancel` method. This ensures that a
406+
:exc:`asyncio.CancelledError` will be raised at the next
407+
:keyword:`await`, so the cancellation is not lost.
408+
409+
Task groups preserve the cancellation count
410+
reported by :meth:`asyncio.Task.cancelling`.
411+
412+
.. versionchanged:: 3.13
413+
414+
Improved handling of simultaneous internal and external cancellations
415+
and correct preservation of cancellation counts.
395416

396417
Sleeping
397418
========
@@ -1369,6 +1390,15 @@ Task Object
13691390
catching :exc:`CancelledError`, it needs to call this method to remove
13701391
the cancellation state.
13711392

1393+
When this method decrements the cancellation count to zero,
1394+
the method checks if a previous :meth:`cancel` call had arranged
1395+
for :exc:`CancelledError` to be thrown into the task.
1396+
If it hasn't been thrown yet, that arrangement will be
1397+
rescinded (by resetting the internal ``_must_cancel`` flag).
1398+
1399+
.. versionchanged:: 3.13
1400+
Changed to rescind pending cancellation requests upon reaching zero.
1401+
13721402
.. method:: cancelling()
13731403

13741404
Return the number of pending cancellation requests to this Task, i.e.,

Doc/library/code.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ build applications which provide an interactive interpreter prompt.
4141
the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is
4242
provided, it is passed to the :class:`InteractiveConsole` constructor for
4343
use as the default namespace for the interpreter loop. If *local_exit* is provided,
44-
it is passed to the :class:`InteractiveConsole` constructor. The :meth:`interact`
44+
it is passed to the :class:`InteractiveConsole` constructor. The :meth:`~InteractiveConsole.interact`
4545
method of the instance is then run with *banner* and *exitmsg* passed as the
4646
banner and exit message to use, if provided. The console object is discarded
4747
after use.

Doc/library/os.path.rst

+3-4
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ the :mod:`glob` module.)
145145

146146
.. function:: lexists(path)
147147

148-
Return ``True`` if *path* refers to an existing path. Returns ``True`` for
148+
Return ``True`` if *path* refers to an existing path, including
149149
broken symbolic links. Equivalent to :func:`exists` on platforms lacking
150150
:func:`os.lstat`.
151151

@@ -409,9 +409,8 @@ the :mod:`glob` module.)
409409
style names such as ``C:\\PROGRA~1`` to ``C:\\Program Files``.
410410

411411
If a path doesn't exist or a symlink loop is encountered, and *strict* is
412-
``True``, :exc:`OSError` is raised. If *strict* is ``False``, the path is
413-
resolved as far as possible and any remainder is appended without checking
414-
whether it exists.
412+
``True``, :exc:`OSError` is raised. If *strict* is ``False`` these errors
413+
are ignored, and so the result might be missing or otherwise inaccessible.
415414

416415
.. note::
417416
This function emulates the operating system's procedure for making a path

Doc/library/queue.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,10 @@ them down.
245245
queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise
246246
immediately instead.
247247

248-
All blocked callers of :meth:`~Queue.put` will be unblocked. If *immediate*
249-
is true, also unblock callers of :meth:`~Queue.get` and :meth:`~Queue.join`.
248+
All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be
249+
unblocked. If *immediate* is true, a task will be marked as done for each
250+
remaining item in the queue, which may unblock callers of
251+
:meth:`~Queue.join`.
250252

251253
.. versionadded:: 3.13
252254

0 commit comments

Comments
 (0)