Skip to content

Commit 25fc8e4

Browse files
authored
Merge branch 'main' into ceval
2 parents f98832b + 7e5227f commit 25fc8e4

43 files changed

Lines changed: 317 additions & 149 deletions

Some content is hidden

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

‎Doc/c-api/bool.rst‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@ are available, however.
2525
2626
.. c:var:: PyObject* Py_False
2727
28-
The Python ``False`` object. This object has no methods and is
29-
:term:`immortal`.
28+
The Python ``False`` object. This object is :term:`immortal`.
3029
3130
.. versionchanged:: 3.12
3231
:c:data:`Py_False` is :term:`immortal`.
3332
3433
3534
.. c:var:: PyObject* Py_True
3635
37-
The Python ``True`` object. This object has no methods and is
38-
:term:`immortal`.
36+
The Python ``True`` object. This object is :term:`immortal`.
3937
4038
.. versionchanged:: 3.12
4139
:c:data:`Py_True` is :term:`immortal`.

‎Doc/library/asyncio-runner.rst‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ to simplify async code usage for common wide-spread scenarios.
2222
Running an asyncio Program
2323
==========================
2424

25-
.. function:: run(coro, *, debug=None, loop_factory=None)
25+
.. function:: run(coro, *, debug=None, loop_factory=None, eager_tasks=False)
2626

2727
Execute *coro* in an asyncio event loop and return the result.
2828

@@ -45,10 +45,18 @@ Running an asyncio Program
4545
and should ideally only be called once. It is recommended to use
4646
*loop_factory* to configure the event loop.
4747

48+
If *eager_tasks* is ``True``, the created loop is configured to use
49+
:ref:`eager-task-factory` by default.
50+
4851
The executor is given a timeout duration of 5 minutes to shutdown.
4952
If the executor hasn't finished within that duration, a warning is
5053
emitted and the executor is closed.
5154

55+
.. note::
56+
57+
Users concerned about performance are encouraged to experiment with
58+
``eager_tasks=True`` in their code.
59+
5260
Example::
5361

5462
async def main():
@@ -74,11 +82,15 @@ Running an asyncio Program
7482

7583
*coro* can be any awaitable object.
7684

85+
.. versionchanged:: 3.16
86+
87+
Added *eager_tasks* parameter.
88+
7789

7890
Runner context manager
7991
======================
8092

81-
.. class:: Runner(*, debug=None, loop_factory=None)
93+
.. class:: Runner(*, debug=None, loop_factory=None, eager_tasks=False)
8294

8395
A context manager that simplifies *multiple* async function calls in the same
8496
context.
@@ -95,6 +107,9 @@ Runner context manager
95107
current one. By default :func:`asyncio.new_event_loop` is used and set as
96108
current event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``.
97109

110+
If *eager_tasks* is ``True``, the created loop is configured to use
111+
:ref:`eager-task-factory` by default.
112+
98113
Basically, :func:`asyncio.run` example can be rewritten with the runner usage::
99114

100115
async def main():
@@ -104,8 +119,17 @@ Runner context manager
104119
with asyncio.Runner() as runner:
105120
runner.run(main())
106121

122+
.. note::
123+
124+
Users concerned about performance are encouraged to experiment with
125+
``eager_tasks=True`` in their code.
126+
107127
.. versionadded:: 3.11
108128

129+
.. versionchanged:: 3.16
130+
131+
Added *eager_tasks* parameter.
132+
109133
.. method:: run(coro, *, context=None)
110134

111135
Execute *coro* in the embedded event loop.

‎Doc/library/calendar.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ For simple text calendars this module provides the following functions.
432432

433433
.. function:: prcal(theyear, w=0, l=0, c=6, m=3)
434434

435-
Prints the calendar for an entire year as returned by :func:`calendar`.
435+
Prints the calendar for an entire year as returned by
436+
:func:`~calendar.calendar`.
436437

437438

438439
.. function:: calendar(theyear, w=2, l=1, c=6, m=3)

‎Doc/library/ctypes.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3758,9 +3758,9 @@ fields, or any other data types containing pointer type fields.
37583758
.. class:: CFieldInfo(anonymous=False, bit_width=None)
37593759
:module: ctypes.util
37603760

3761-
Information regarding a structure field defined by the :func:`struct`
3762-
decorator. This should be used in the second argument of a
3763-
:class:`typing.Annotated` wrapping a ctypes type.
3761+
Information regarding a structure field defined by the
3762+
:func:`~ctypes.util.struct` decorator. This should be used in the second
3763+
argument of a :class:`typing.Annotated` wrapping a ctypes type.
37643764

37653765
*anonymous* specifies whether the field will be present in the
37663766
:attr:`~ctypes.Structure._anonymous_` attribute of the generated class.

‎Doc/library/datetime.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,9 +1386,9 @@ Instance methods:
13861386
hour=self.hour, minute=self.minute, second=self.second, microsecond=self.microsecond, \
13871387
tzinfo=self.tzinfo, *, fold=0)
13881388
1389-
Return a new :class:`datetime` object with the same attributes, but with
1390-
specified parameters updated. Note that ``tzinfo=None`` can be specified to
1391-
create a naive datetime from an aware datetime with no conversion of date
1389+
Return a new :class:`~datetime.datetime` object with the same attributes, but
1390+
with specified parameters updated. Note that ``tzinfo=None`` can be specified
1391+
to create a naive datetime from an aware datetime with no conversion of date
13921392
and time data.
13931393

13941394
:class:`.datetime` objects are also supported by generic function

‎Doc/library/dis.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,9 @@ operation is being performed, so the intermediate analysis object isn't useful:
395395
source line information (if any) is taken directly from the disassembled code
396396
object.
397397

398-
The *adaptive* parameter works as it does in :func:`dis`.
398+
The *adaptive* parameter works as it does in :func:`~dis.dis`.
399399

400-
The *show_jit* parameter works as it does in :func:`dis`.
400+
The *show_jit* parameter works as it does in :func:`~dis.dis`.
401401

402402
.. versionadded:: 3.4
403403

‎Doc/library/fnmatch.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ a :class:`!str` filename, and vice-versa.
5353

5454
Finally, note that :deco:`functools.lru_cache` with a *maxsize* of 32768
5555
is used to cache the (typed) compiled regex patterns in the following
56-
functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`, :func:`.filterfalse`.
56+
functions: :func:`~fnmatch.fnmatch`, :func:`fnmatchcase`, :func:`.filter`,
57+
:func:`.filterfalse`.
5758

5859

5960
.. function:: fnmatch(name, pat)

‎Doc/library/getopt.rst‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ exception:
8080

8181
.. function:: gnu_getopt(args, shortopts, longopts=[])
8282

83-
This function works like :func:`getopt`, except that GNU style scanning mode is
84-
used by default. This means that option and non-option arguments may be
85-
intermixed. The :func:`getopt` function stops processing options as soon as a
86-
non-option argument is encountered.
83+
This function works like :func:`~getopt.getopt`, except that GNU style
84+
scanning mode is used by default. This means that option and non-option
85+
arguments may be intermixed. The :func:`~getopt.getopt` function stops
86+
processing options as soon as a non-option argument is encountered.
8787

8888
If the first character of the option string is ``'+'``, or if the environment
8989
variable :envvar:`!POSIXLY_CORRECT` is set, then option processing stops as

‎Doc/library/getpass.rst‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ The :mod:`!getpass` module provides two functions:
2727
typed character is replaced by it. For example, ``echo_char='*'`` will
2828
display asterisks instead of the actual input.
2929

30-
If echo-free input is unavailable, :func:`getpass` falls back to printing
31-
a warning message to *stream* and reading from :data:`sys.stdin` and
30+
If echo-free input is unavailable, :func:`~getpass.getpass` falls back to
31+
printing a warning message to *stream* and reading from :data:`sys.stdin` and
3232
issuing a :exc:`GetPassWarning`.
3333

3434
.. note::
35-
If you call :func:`getpass` from within IDLE, the input may be done in the
36-
terminal you launched IDLE from rather than the idle window itself.
35+
If you call :func:`~getpass.getpass` from within IDLE, the input may be
36+
done in the terminal you launched IDLE from rather than the idle window
37+
itself.
3738

3839
.. note::
3940
On Unix systems, when *echo_char* is set, the terminal will be

‎Doc/library/gettext.rst‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ class-based API instead.
8989
.. function:: dnpgettext(domain, context, singular, plural, n, /)
9090

9191
Similar to the corresponding functions without the ``p`` in the prefix (that
92-
is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`),
93-
but the translation is restricted to the given message *context*.
92+
is, :func:`~gettext.gettext`, :func:`dgettext`, :func:`ngettext`,
93+
:func:`dngettext`), but the translation is restricted to the given message
94+
*context*.
9495

9596
.. versionadded:: 3.8
9697

@@ -426,7 +427,8 @@ take the following steps:
426427

427428
In order to prepare your code for I18N, you need to look at all the strings in
428429
your files. Any string that needs to be translated should be marked by wrapping
429-
it in ``_('...')`` --- that is, a call to the function :func:`_ <gettext>`. For example::
430+
it in ``_('...')`` --- that is, a call to the function
431+
:func:`_ <gettext.gettext>`. For example::
430432

431433
filename = 'mylog.txt'
432434
message = _('writing a log message')

0 commit comments

Comments
 (0)