Skip to content

Commit 769173e

Browse files
committed
Merge branch 'master' into math-err-msg/101410
2 parents 513a6d9 + bd47ec9 commit 769173e

File tree

119 files changed

+1549
-735
lines changed

Some content is hidden

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

119 files changed

+1549
-735
lines changed

Doc/c-api/gcsupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ the garbage collector.
277277
278278
Type of the visitor function to be passed to :c:func:`PyUnstable_GC_VisitObjects`.
279279
*arg* is the same as the *arg* passed to ``PyUnstable_GC_VisitObjects``.
280-
Return ``0`` to continue iteration, return ``1`` to stop iteration. Other return
280+
Return ``1`` to continue iteration, return ``0`` to stop iteration. Other return
281281
values are reserved for now so behavior on returning anything else is undefined.
282282
283283
.. versionadded:: 3.12

Doc/c-api/typeobj.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
611611
Note that the :c:member:`~PyVarObject.ob_size` field may later be used for
612612
other purposes. For example, :py:type:`int` instances use the bits of
613613
:c:member:`~PyVarObject.ob_size` in an implementation-defined
614-
way; the underlying storage and its size should be acessed using
614+
way; the underlying storage and its size should be accessed using
615615
:c:func:`PyLong_Export`.
616616

617617
.. note::

Doc/c-api/unicode.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,14 @@ APIs:
596596
Objects other than Unicode or its subtypes will cause a :exc:`TypeError`.
597597
598598
599+
.. c:function:: PyObject* PyUnicode_FromOrdinal(int ordinal)
600+
601+
Create a Unicode Object from the given Unicode code point *ordinal*.
602+
603+
The ordinal must be in ``range(0x110000)``. A :exc:`ValueError` is
604+
raised in the case it is not.
605+
606+
599607
.. c:function:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, \
600608
const char *encoding, const char *errors)
601609
@@ -622,7 +630,7 @@ APIs:
622630
623631
On error, set *\*p_left* to ``NULL`` and set an exception.
624632
625-
On sucess, set *\*p_left* to a new strong reference to the result.
633+
On success, set *\*p_left* to a new strong reference to the result.
626634
627635
628636
.. c:function:: void PyUnicode_AppendAndDel(PyObject **p_left, PyObject *right)

Doc/data/refcounts.dat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2770,6 +2770,9 @@ PyUnicode_FromFormatV:PyObject*::+1:
27702770
PyUnicode_FromFormatV:const char*:format::
27712771
PyUnicode_FromFormatV:va_list:args::
27722772

2773+
PyUnicode_FromOrdinal:PyObject*::+1:
2774+
PyUnicode_FromOrdinal:int:ordinal::
2775+
27732776
PyUnicode_Append:void:::
27742777
PyUnicode_Append:PyObject**:p_left:0:
27752778
PyUnicode_Append:PyObject*:right::

Doc/deprecations/pending-removal-in-3.16.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Pending removal in Python 3.16
3232
* :class:`asyncio.WindowsProactorEventLoopPolicy`
3333
* :func:`asyncio.get_event_loop_policy`
3434
* :func:`asyncio.set_event_loop_policy`
35-
* :func:`asyncio.set_event_loop`
3635

3736
Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with
3837
*loop_factory* to use the desired event loop implementation.

Doc/howto/logging-cookbook.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,19 @@ which, when run, will produce:
626626
of each message with the handler's level, and only passes a message to a
627627
handler if it's appropriate to do so.
628628

629+
.. versionchanged:: next
630+
The :class:`QueueListener` can be started (and stopped) via the
631+
:keyword:`with` statement. For example:
632+
633+
.. code-block:: python
634+
635+
with QueueListener(que, handler) as listener:
636+
# The queue listener automatically starts
637+
# when the 'with' block is entered.
638+
pass
639+
# The queue listener automatically stops once
640+
# the 'with' block is exited.
641+
629642
.. _network-logging:
630643

631644
Sending and receiving logging events across a network

Doc/library/annotationlib.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,22 @@ Functions
317317
Compute the annotations dict for an object.
318318

319319
*obj* may be a callable, class, module, or other object with
320-
:attr:`~object.__annotate__` and :attr:`~object.__annotations__` attributes.
321-
Passing in an object of any other type raises :exc:`TypeError`.
320+
:attr:`~object.__annotate__` or :attr:`~object.__annotations__` attributes.
321+
Passing any other object raises :exc:`TypeError`.
322322

323323
The *format* parameter controls the format in which annotations are returned,
324324
and must be a member of the :class:`Format` enum or its integer equivalent.
325+
The different formats work as follows:
326+
327+
* VALUE: :attr:`!object.__annotations__` is tried first; if that does not exist,
328+
the :attr:`!object.__annotate__` function is called if it exists.
329+
* FORWARDREF: If :attr:`!object.__annotations__` exists and can be evaluated successfully,
330+
it is used; otherwise, the :attr:`!object.__annotate__` function is called. If it
331+
does not exist either, :attr:`!object.__annotations__` is tried again and any error
332+
from accessing it is re-raised.
333+
* STRING: If :attr:`!object.__annotate__` exists, it is called first;
334+
otherwise, :attr:`!object.__annotations__` is used and stringified
335+
using :func:`annotations_to_string`.
325336

326337
Returns a dict. :func:`!get_annotations` returns a new dict every time
327338
it's called; calling it twice on the same object will return two

Doc/library/asyncio-eventloop.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,14 @@ an event loop:
6565
.. note::
6666

6767
The :mod:`!asyncio` policy system is deprecated and will be removed
68-
in Python 3.16; from there on, this function will always return the
69-
running event loop.
70-
68+
in Python 3.16; from there on, this function will return the current
69+
running event loop if present else it will return the
70+
loop set by :func:`set_event_loop`.
7171

7272
.. function:: set_event_loop(loop)
7373

7474
Set *loop* as the current event loop for the current OS thread.
7575

76-
.. deprecated:: 3.14
77-
The :func:`set_event_loop` function is deprecated and will be removed
78-
in Python 3.16.
79-
8076
.. function:: new_event_loop()
8177

8278
Create and return a new event loop object.
@@ -1444,6 +1440,8 @@ Allows customizing how exceptions are handled in the event loop.
14441440
* 'protocol' (optional): :ref:`Protocol <asyncio-protocol>` instance;
14451441
* 'transport' (optional): :ref:`Transport <asyncio-transport>` instance;
14461442
* 'socket' (optional): :class:`socket.socket` instance;
1443+
* 'source_traceback' (optional): Traceback of the source;
1444+
* 'handle_traceback' (optional): Traceback of the handle;
14471445
* 'asyncgen' (optional): Asynchronous generator that caused
14481446
the exception.
14491447

Doc/library/asyncio-future.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ Future Functions
5151

5252
.. important::
5353

54-
See also the :func:`create_task` function which is the
55-
preferred way for creating new Tasks.
56-
5754
Save a reference to the result of this function, to avoid
5855
a task disappearing mid-execution.
5956

57+
See also the :func:`create_task` function which is the
58+
preferred way for creating new tasks or use :class:`asyncio.TaskGroup`
59+
which keeps reference to the task internally.
60+
6061
.. versionchanged:: 3.5.1
6162
The function accepts any :term:`awaitable` object.
6263

Doc/library/asyncio-task.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,10 @@ Task Object
13811381

13821382
Request the Task to be cancelled.
13831383

1384-
This arranges for a :exc:`CancelledError` exception to be thrown
1384+
If the Task is already *done* or *cancelled*, return ``False``,
1385+
otherwise, return ``True``.
1386+
1387+
The method arranges for a :exc:`CancelledError` exception to be thrown
13851388
into the wrapped coroutine on the next cycle of the event loop.
13861389

13871390
The coroutine then has a chance to clean up or even deny the

0 commit comments

Comments
 (0)