Skip to content

Commit f192e38

Browse files
committed
Merge branch 'main' into gh-110722-presite
2 parents 8a201b4 + 05439d3 commit f192e38

File tree

144 files changed

+6890
-6621
lines changed

Some content is hidden

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

144 files changed

+6890
-6621
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,6 @@ repos:
2323
- id: trailing-whitespace
2424
types_or: [c, inc, python, rst]
2525

26-
- repo: local
27-
hooks:
28-
- id: python-file-whitespace
29-
name: "Check Python file whitespace"
30-
entry: 'python Tools/patchcheck/reindent.py --nobackup --newline LF'
31-
language: 'system'
32-
types: [python]
33-
exclude: '^(Lib/test/tokenizedata/|Tools/c-analyzer/cpython/_parser).*$'
34-
35-
- repo: local
36-
hooks:
37-
- id: c-file-whitespace
38-
name: "Check C file whitespace"
39-
entry: "python Tools/patchcheck/untabify.py"
40-
language: "system"
41-
types_or: ['c', 'c++']
42-
# Don't check the style of vendored libraries
43-
exclude: |
44-
(?x)^(
45-
Modules/_decimal/.*
46-
| Modules/libmpdec/.*
47-
| Modules/expat/.*
48-
)$
49-
5026
- repo: https://github.com/sphinx-contrib/sphinx-lint
5127
rev: v0.6.8
5228
hooks:

Doc/c-api/memory.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -491,18 +491,18 @@ Customize Memory Allocators
491491
492492
:c:func:`PyMem_SetAllocator` does have the following contract:
493493
494-
* It can be called after :c:func:`Py_PreInitialize` and before
495-
:c:func:`Py_InitializeFromConfig` to install a custom memory
496-
allocator. There are no restrictions over the installed allocator
497-
other than the ones imposed by the domain (for instance, the Raw
498-
Domain allows the allocator to be called without the GIL held). See
499-
:ref:`the section on allocator domains <allocator-domains>` for more
500-
information.
501-
502-
* If called after Python has finish initializing (after
503-
:c:func:`Py_InitializeFromConfig` has been called) the allocator
504-
**must** wrap the existing allocator. Substituting the current
505-
allocator for some other arbitrary one is **not supported**.
494+
* It can be called after :c:func:`Py_PreInitialize` and before
495+
:c:func:`Py_InitializeFromConfig` to install a custom memory
496+
allocator. There are no restrictions over the installed allocator
497+
other than the ones imposed by the domain (for instance, the Raw
498+
Domain allows the allocator to be called without the GIL held). See
499+
:ref:`the section on allocator domains <allocator-domains>` for more
500+
information.
501+
502+
* If called after Python has finish initializing (after
503+
:c:func:`Py_InitializeFromConfig` has been called) the allocator
504+
**must** wrap the existing allocator. Substituting the current
505+
allocator for some other arbitrary one is **not supported**.
506506
507507
.. versionchanged:: 3.12
508508
All allocators must be thread-safe.

Doc/howto/enum.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,13 +1156,14 @@ the following are true:
11561156
There is a new boundary mechanism that controls how out-of-range / invalid
11571157
bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:
11581158

1159-
* STRICT --> raises an exception when presented with invalid values
1160-
* CONFORM --> discards any invalid bits
1161-
* EJECT --> lose Flag status and become a normal int with the given value
1162-
* KEEP --> keep the extra bits
1163-
- keeps Flag status and extra bits
1164-
- extra bits do not show up in iteration
1165-
- extra bits do show up in repr() and str()
1159+
* STRICT --> raises an exception when presented with invalid values
1160+
* CONFORM --> discards any invalid bits
1161+
* EJECT --> lose Flag status and become a normal int with the given value
1162+
* KEEP --> keep the extra bits
1163+
1164+
- keeps Flag status and extra bits
1165+
- extra bits do not show up in iteration
1166+
- extra bits do show up in repr() and str()
11661167

11671168
The default for Flag is ``STRICT``, the default for ``IntFlag`` is ``EJECT``,
11681169
and the default for ``_convert_`` is ``KEEP`` (see ``ssl.Options`` for an

Doc/howto/instrumentation.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ DTrace and SystemTap are monitoring tools, each providing a way to inspect
1313
what the processes on a computer system are doing. They both use
1414
domain-specific languages allowing a user to write scripts which:
1515

16-
- filter which processes are to be observed
17-
- gather data from the processes of interest
18-
- generate reports on the data
16+
- filter which processes are to be observed
17+
- gather data from the processes of interest
18+
- generate reports on the data
1919

2020
As of Python 3.6, CPython can be built with embedded "markers", also
2121
known as "probes", that can be observed by a DTrace or SystemTap script,
@@ -246,11 +246,9 @@ The output looks like this:
246246
247247
where the columns are:
248248

249-
- time in microseconds since start of script
250-
251-
- name of executable
252-
253-
- PID of process
249+
- time in microseconds since start of script
250+
- name of executable
251+
- PID of process
254252

255253
and the remainder indicates the call/return hierarchy as the script executes.
256254

Doc/library/__main__.rst

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,45 +54,45 @@ The top-level code environment can be:
5454

5555
* the scope of an interactive prompt::
5656

57-
>>> __name__
58-
'__main__'
57+
>>> __name__
58+
'__main__'
5959

6060
* the Python module passed to the Python interpreter as a file argument:
6161

62-
.. code-block:: shell-session
62+
.. code-block:: shell-session
6363
64-
$ python helloworld.py
65-
Hello, world!
64+
$ python helloworld.py
65+
Hello, world!
6666
6767
* the Python module or package passed to the Python interpreter with the
6868
:option:`-m` argument:
6969

70-
.. code-block:: shell-session
70+
.. code-block:: shell-session
7171
72-
$ python -m tarfile
73-
usage: tarfile.py [-h] [-v] (...)
72+
$ python -m tarfile
73+
usage: tarfile.py [-h] [-v] (...)
7474
7575
* Python code read by the Python interpreter from standard input:
7676

77-
.. code-block:: shell-session
77+
.. code-block:: shell-session
7878
79-
$ echo "import this" | python
80-
The Zen of Python, by Tim Peters
79+
$ echo "import this" | python
80+
The Zen of Python, by Tim Peters
8181
82-
Beautiful is better than ugly.
83-
Explicit is better than implicit.
84-
...
82+
Beautiful is better than ugly.
83+
Explicit is better than implicit.
84+
...
8585
8686
* Python code passed to the Python interpreter with the :option:`-c` argument:
8787

88-
.. code-block:: shell-session
88+
.. code-block:: shell-session
8989
90-
$ python -c "import this"
91-
The Zen of Python, by Tim Peters
90+
$ python -c "import this"
91+
The Zen of Python, by Tim Peters
9292
93-
Beautiful is better than ugly.
94-
Explicit is better than implicit.
95-
...
93+
Beautiful is better than ugly.
94+
Explicit is better than implicit.
95+
...
9696
9797
In each of these situations, the top-level module's ``__name__`` is set to
9898
``'__main__'``.
@@ -102,9 +102,9 @@ top-level environment by checking its own ``__name__``, which allows a common
102102
idiom for conditionally executing code when the module is not initialized from
103103
an import statement::
104104

105-
if __name__ == '__main__':
106-
# Execute when the module is not initialized from an import statement.
107-
...
105+
if __name__ == '__main__':
106+
# Execute when the module is not initialized from an import statement.
107+
...
108108

109109
.. seealso::
110110

Doc/library/_thread.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ In addition to these methods, lock objects can also be used via the
208208

209209
**Caveats:**
210210

211-
.. index:: pair: module; signal
211+
.. index:: pair: module; signal
212212

213213
* Threads interact strangely with interrupts: the :exc:`KeyboardInterrupt`
214214
exception will be received by an arbitrary thread. (When the :mod:`signal`

Doc/library/asyncio-eventloop.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,13 +1686,13 @@ Event Loop Implementations
16861686
asyncio ships with two different event loop implementations:
16871687
:class:`SelectorEventLoop` and :class:`ProactorEventLoop`.
16881688

1689-
By default asyncio is configured to use :class:`SelectorEventLoop`
1690-
on Unix and :class:`ProactorEventLoop` on Windows.
1689+
By default asyncio is configured to use :class:`EventLoop`.
16911690

16921691

16931692
.. class:: SelectorEventLoop
16941693

1695-
An event loop based on the :mod:`selectors` module.
1694+
A subclass of :class:`AbstractEventLoop` based on the
1695+
:mod:`selectors` module.
16961696

16971697
Uses the most efficient *selector* available for the given
16981698
platform. It is also possible to manually configure the
@@ -1714,7 +1714,7 @@ on Unix and :class:`ProactorEventLoop` on Windows.
17141714

17151715
.. class:: ProactorEventLoop
17161716

1717-
An event loop for Windows that uses "I/O Completion Ports" (IOCP).
1717+
A subclass of :class:`AbstractEventLoop` for Windows that uses "I/O Completion Ports" (IOCP).
17181718

17191719
.. availability:: Windows.
17201720

@@ -1723,6 +1723,14 @@ on Unix and :class:`ProactorEventLoop` on Windows.
17231723
`MSDN documentation on I/O Completion Ports
17241724
<https://docs.microsoft.com/en-ca/windows/desktop/FileIO/i-o-completion-ports>`_.
17251725

1726+
.. class:: EventLoop
1727+
1728+
An alias to the most efficient available subclass of :class:`AbstractEventLoop` for the given
1729+
platform.
1730+
1731+
It is an alias to :class:`SelectorEventLoop` on Unix and :class:`ProactorEventLoop` on Windows.
1732+
1733+
.. versionadded:: 3.13
17261734

17271735
.. class:: AbstractEventLoop
17281736

Doc/library/asyncio-runner.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Running an asyncio Program
4242
This function should be used as a main entry point for asyncio programs,
4343
and should ideally only be called once. It is recommended to use
4444
*loop_factory* to configure the event loop instead of policies.
45+
Passing :class:`asyncio.EventLoop` allows running asyncio without the
46+
policy system.
4547

4648
The executor is given a timeout duration of 5 minutes to shutdown.
4749
If the executor hasn't finished within that duration, a warning is

Doc/library/binascii.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@ The :mod:`binascii` module defines the following functions:
5757
data will raise :exc:`binascii.Error`.
5858

5959
Valid base64:
60-
* Conforms to :rfc:`3548`.
61-
* Contains only characters from the base64 alphabet.
62-
* Contains no excess data after padding (including excess padding, newlines, etc.).
63-
* Does not start with a padding.
60+
61+
* Conforms to :rfc:`3548`.
62+
* Contains only characters from the base64 alphabet.
63+
* Contains no excess data after padding (including excess padding, newlines, etc.).
64+
* Does not start with a padding.
6465

6566
.. versionchanged:: 3.11
6667
Added the *strict_mode* parameter.

Doc/library/collections.rst

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -120,26 +120,26 @@ The class can be used to simulate nested scopes and is useful in templating.
120120

121121
.. seealso::
122122

123-
* The `MultiContext class
124-
<https://github.com/enthought/codetools/blob/4.0.0/codetools/contexts/multi_context.py>`_
125-
in the Enthought `CodeTools package
126-
<https://github.com/enthought/codetools>`_ has options to support
127-
writing to any mapping in the chain.
123+
* The `MultiContext class
124+
<https://github.com/enthought/codetools/blob/4.0.0/codetools/contexts/multi_context.py>`_
125+
in the Enthought `CodeTools package
126+
<https://github.com/enthought/codetools>`_ has options to support
127+
writing to any mapping in the chain.
128128

129-
* Django's `Context class
130-
<https://github.com/django/django/blob/main/django/template/context.py>`_
131-
for templating is a read-only chain of mappings. It also features
132-
pushing and popping of contexts similar to the
133-
:meth:`~collections.ChainMap.new_child` method and the
134-
:attr:`~collections.ChainMap.parents` property.
129+
* Django's `Context class
130+
<https://github.com/django/django/blob/main/django/template/context.py>`_
131+
for templating is a read-only chain of mappings. It also features
132+
pushing and popping of contexts similar to the
133+
:meth:`~collections.ChainMap.new_child` method and the
134+
:attr:`~collections.ChainMap.parents` property.
135135

136-
* The `Nested Contexts recipe
137-
<https://code.activestate.com/recipes/577434/>`_ has options to control
138-
whether writes and other mutations apply only to the first mapping or to
139-
any mapping in the chain.
136+
* The `Nested Contexts recipe
137+
<https://code.activestate.com/recipes/577434/>`_ has options to control
138+
whether writes and other mutations apply only to the first mapping or to
139+
any mapping in the chain.
140140

141-
* A `greatly simplified read-only version of Chainmap
142-
<https://code.activestate.com/recipes/305268/>`_.
141+
* A `greatly simplified read-only version of Chainmap
142+
<https://code.activestate.com/recipes/305268/>`_.
143143

144144

145145
:class:`ChainMap` Examples and Recipes
@@ -429,22 +429,22 @@ or subtracting from an empty counter.
429429

430430
.. seealso::
431431

432-
* `Bag class <https://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html>`_
433-
in Smalltalk.
432+
* `Bag class <https://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html>`_
433+
in Smalltalk.
434434

435-
* Wikipedia entry for `Multisets <https://en.wikipedia.org/wiki/Multiset>`_.
435+
* Wikipedia entry for `Multisets <https://en.wikipedia.org/wiki/Multiset>`_.
436436

437-
* `C++ multisets <http://www.java2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm>`_
438-
tutorial with examples.
437+
* `C++ multisets <http://www.java2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm>`_
438+
tutorial with examples.
439439

440-
* For mathematical operations on multisets and their use cases, see
441-
*Knuth, Donald. The Art of Computer Programming Volume II,
442-
Section 4.6.3, Exercise 19*.
440+
* For mathematical operations on multisets and their use cases, see
441+
*Knuth, Donald. The Art of Computer Programming Volume II,
442+
Section 4.6.3, Exercise 19*.
443443

444-
* To enumerate all distinct multisets of a given size over a given set of
445-
elements, see :func:`itertools.combinations_with_replacement`::
444+
* To enumerate all distinct multisets of a given size over a given set of
445+
elements, see :func:`itertools.combinations_with_replacement`::
446446

447-
map(Counter, combinations_with_replacement('ABC', 2)) # --> AA AB AC BB BC CC
447+
map(Counter, combinations_with_replacement('ABC', 2)) # --> AA AB AC BB BC CC
448448

449449

450450
:class:`deque` objects
@@ -1062,20 +1062,20 @@ fields:
10621062

10631063
.. seealso::
10641064

1065-
* See :class:`typing.NamedTuple` for a way to add type hints for named
1066-
tuples. It also provides an elegant notation using the :keyword:`class`
1067-
keyword::
1065+
* See :class:`typing.NamedTuple` for a way to add type hints for named
1066+
tuples. It also provides an elegant notation using the :keyword:`class`
1067+
keyword::
10681068

1069-
class Component(NamedTuple):
1070-
part_number: int
1071-
weight: float
1072-
description: Optional[str] = None
1069+
class Component(NamedTuple):
1070+
part_number: int
1071+
weight: float
1072+
description: Optional[str] = None
10731073

1074-
* See :meth:`types.SimpleNamespace` for a mutable namespace based on an
1075-
underlying dictionary instead of a tuple.
1074+
* See :meth:`types.SimpleNamespace` for a mutable namespace based on an
1075+
underlying dictionary instead of a tuple.
10761076

1077-
* The :mod:`dataclasses` module provides a decorator and functions for
1078-
automatically adding generated special methods to user-defined classes.
1077+
* The :mod:`dataclasses` module provides a decorator and functions for
1078+
automatically adding generated special methods to user-defined classes.
10791079

10801080

10811081
:class:`OrderedDict` objects

0 commit comments

Comments
 (0)