Skip to content

Commit d5d1b53

Browse files
committed
Merge branch 'develop' into gh42765-timit-execution-environment
2 parents 8e736e4 + 3f8e7c0 commit d5d1b53

File tree

309 files changed

+6568
-2220
lines changed

Some content is hidden

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

309 files changed

+6568
-2220
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ PCbuild/readme.txt dos
6666
[attr]generated linguist-generated=true diff=generated
6767

6868
**/clinic/*.c.h generated
69+
**/clinic/*.cpp.h generated
70+
**/clinic/*.h.h generated
6971
*_db.h generated
7072
Doc/data/stable_abi.dat generated
7173
Doc/library/token-list.inc generated

.github/workflows/mypy.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
paths:
1010
- "Tools/clinic/**"
1111
- "Tools/cases_generator/**"
12+
- "Tools/peg_generator/**"
1213
- "Tools/requirements-dev.txt"
1314
- ".github/workflows/mypy.yml"
1415
workflow_dispatch:
@@ -29,7 +30,11 @@ jobs:
2930
mypy:
3031
strategy:
3132
matrix:
32-
target: ["Tools/cases_generator", "Tools/clinic"]
33+
target: [
34+
"Tools/cases_generator",
35+
"Tools/clinic",
36+
"Tools/peg_generator",
37+
]
3338
name: Run mypy on ${{ matrix.target }}
3439
runs-on: ubuntu-latest
3540
timeout-minutes: 10

Doc/c-api/stable.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ way; see :ref:`stable-abi-platform` below).
1818
So, code compiled for Python 3.10.0 will work on 3.10.8 and vice versa,
1919
but will need to be compiled separately for 3.9.x and 3.10.x.
2020

21-
There are two tiers of C API with different stability exepectations:
21+
There are two tiers of C API with different stability expectations:
2222

2323
- :ref:`Unstable API <unstable-c-api>`, may change in minor versions without
2424
a deprecation period. It is marked by the ``PyUnstable`` prefix in names.

Doc/c-api/typeobj.rst

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -528,28 +528,6 @@ type objects) *must* have the :c:member:`~PyVarObject.ob_size` field.
528528
This field is inherited by subtypes.
529529

530530

531-
.. c:member:: PyObject* PyObject._ob_next
532-
PyObject* PyObject._ob_prev
533-
534-
These fields are only present when the macro ``Py_TRACE_REFS`` is defined
535-
(see the :option:`configure --with-trace-refs option <--with-trace-refs>`).
536-
537-
Their initialization to ``NULL`` is taken care of by the
538-
``PyObject_HEAD_INIT`` macro. For :ref:`statically allocated objects
539-
<static-types>`, these fields always remain ``NULL``. For :ref:`dynamically
540-
allocated objects <heap-types>`, these two fields are used to link the
541-
object into a doubly linked list of *all* live objects on the heap.
542-
543-
This could be used for various debugging purposes; currently the only uses
544-
are the :func:`sys.getobjects` function and to print the objects that are
545-
still alive at the end of a run when the environment variable
546-
:envvar:`PYTHONDUMPREFS` is set.
547-
548-
**Inheritance:**
549-
550-
These fields are not inherited by subtypes.
551-
552-
553531
PyVarObject Slots
554532
-----------------
555533

@@ -1728,7 +1706,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
17281706
treated as read-only.
17291707

17301708
Some types may not store their dictionary in this slot.
1731-
Use :c:func:`PyType_GetDict` to retreive the dictionary for an arbitrary
1709+
Use :c:func:`PyType_GetDict` to retrieve the dictionary for an arbitrary
17321710
type.
17331711

17341712
.. versionchanged:: 3.12

Doc/howto/clinic.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ process a single source file, like this:
158158
The CLI supports the following options:
159159

160160
.. program:: ./Tools/clinic/clinic.py [-h] [-f] [-o OUTPUT] [-v] \
161-
[--converters] [--make] [--srcdir SRCDIR] [FILE ...]
161+
[--converters] [--make] [--srcdir SRCDIR] [--limited] [FILE ...]
162162

163163
.. option:: -h, --help
164164

@@ -193,6 +193,11 @@ The CLI supports the following options:
193193
A file to exclude in :option:`--make` mode.
194194
This option can be given multiple times.
195195

196+
.. option:: --limited
197+
198+
Use the :ref:`Limited API <limited-c-api>` to parse arguments in the generated C code.
199+
See :ref:`clinic-howto-limited-capi`.
200+
196201
.. option:: FILE ...
197202

198203
The list of files to process.
@@ -1905,6 +1910,22 @@ blocks embedded in Python files look slightly different. They look like this:
19051910
#/*[python checksum:...]*/
19061911
19071912
1913+
.. _clinic-howto-limited-capi:
1914+
1915+
How to use the Limited C API
1916+
----------------------------
1917+
1918+
If Argument Clinic :term:`input` is located within a C source file
1919+
that contains ``#define Py_LIMITED_API``, Argument Clinic will generate C code
1920+
that uses the :ref:`Limited API <limited-c-api>` to parse arguments. The
1921+
advantage of this is that the generated code will not use private functions.
1922+
However, this *can* result in Argument Clinic generating less efficient code
1923+
in some cases. The extent of the performance penalty will depend
1924+
on the parameters (types, number, etc.).
1925+
1926+
.. versionadded:: 3.13
1927+
1928+
19081929
.. _clinic-howto-override-signature:
19091930

19101931
How to override the generated signature

Doc/howto/enum.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,17 @@ enumeration, with the exception of special methods (:meth:`__str__`,
426426
:meth:`__add__`, etc.), descriptors (methods are also descriptors), and
427427
variable names listed in :attr:`_ignore_`.
428428

429-
Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__` then
429+
Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__`,
430430
any value(s) given to the enum member will be passed into those methods.
431431
See `Planet`_ for an example.
432432

433+
.. note::
434+
435+
The :meth:`__new__` method, if defined, is used during creation of the Enum
436+
members; it is then replaced by Enum's :meth:`__new__` which is used after
437+
class creation for lookup of existing members. See :ref:`new-vs-init` for
438+
more details.
439+
433440

434441
Restricted Enum subclassing
435442
---------------------------
@@ -895,6 +902,8 @@ Some rules:
895902
:meth:`__str__` method has been reset to their data types'
896903
:meth:`__str__` method.
897904

905+
.. _new-vs-init:
906+
898907
When to use :meth:`__new__` vs. :meth:`__init__`
899908
------------------------------------------------
900909

@@ -927,6 +936,11 @@ want one of them to be the value::
927936
>>> print(Coordinate(3))
928937
Coordinate.VY
929938

939+
.. warning::
940+
941+
*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the one
942+
that is found; instead, use the data type directly.
943+
930944

931945
Finer Points
932946
^^^^^^^^^^^^
@@ -1353,6 +1367,13 @@ to handle any extra arguments::
13531367
members; it is then replaced by Enum's :meth:`__new__` which is used after
13541368
class creation for lookup of existing members.
13551369

1370+
.. warning::
1371+
1372+
*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the one
1373+
that is found; instead, use the data type directly -- e.g.::
1374+
1375+
obj = int.__new__(cls, value)
1376+
13561377

13571378
OrderedEnum
13581379
^^^^^^^^^^^

Doc/howto/logging-cookbook.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ printed on the console; on the server side, you should see something like:
761761
762762
Note that there are some security issues with pickle in some scenarios. If
763763
these affect you, you can use an alternative serialization scheme by overriding
764-
the :meth:`~handlers.SocketHandler.makePickle` method and implementing your
764+
the :meth:`~SocketHandler.makePickle` method and implementing your
765765
alternative there, as well as adapting the above script to use your alternative
766766
serialization.
767767

@@ -835,6 +835,8 @@ To test these files, do the following in a POSIX environment:
835835
You may need to tweak the configuration files in the unlikely event that the
836836
configured ports clash with something else in your test environment.
837837

838+
.. currentmodule:: logging
839+
838840
.. _context-info:
839841

840842
Adding contextual information to your logging output
@@ -1546,7 +1548,7 @@ Sometimes you want to let a log file grow to a certain size, then open a new
15461548
file and log to that. You may want to keep a certain number of these files, and
15471549
when that many files have been created, rotate the files so that the number of
15481550
files and the size of the files both remain bounded. For this usage pattern, the
1549-
logging package provides a :class:`~handlers.RotatingFileHandler`::
1551+
logging package provides a :class:`RotatingFileHandler`::
15501552

15511553
import glob
15521554
import logging
@@ -1594,6 +1596,8 @@ and each time it reaches the size limit it is renamed with the suffix
15941596
Obviously this example sets the log length much too small as an extreme
15951597
example. You would want to set *maxBytes* to an appropriate value.
15961598

1599+
.. currentmodule:: logging
1600+
15971601
.. _format-styles:
15981602

15991603
Use of alternative formatting styles
@@ -1840,6 +1844,7 @@ However, it should be borne in mind that each link in the chain adds run-time
18401844
overhead to all logging operations, and the technique should only be used when
18411845
the use of a :class:`Filter` does not provide the desired result.
18421846

1847+
.. currentmodule:: logging.handlers
18431848

18441849
.. _zeromq-handlers:
18451850

@@ -1917,6 +1922,8 @@ of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::
19171922
:ref:`A more advanced logging tutorial <logging-advanced-tutorial>`
19181923

19191924

1925+
.. currentmodule:: logging
1926+
19201927
An example dictionary-based configuration
19211928
-----------------------------------------
19221929

@@ -3918,8 +3925,8 @@ that in other languages such as Java and C#, loggers are often static class
39183925
attributes. However, this pattern doesn't make sense in Python, where the
39193926
module (and not the class) is the unit of software decomposition.
39203927

3921-
Adding handlers other than :class:`NullHandler` to a logger in a library
3922-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3928+
Adding handlers other than :class:`~logging.NullHandler` to a logger in a library
3929+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39233930

39243931
Configuring logging by adding handlers, formatters and filters is the
39253932
responsibility of the application developer, not the library developer. If you

Doc/library/ast.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ Expressions
585585
:class:`Name` or :class:`Attribute` object. Of the arguments:
586586

587587
* ``args`` holds a list of the arguments passed by position.
588-
* ``keywords`` holds a list of :class:`keyword` objects representing
588+
* ``keywords`` holds a list of :class:`.keyword` objects representing
589589
arguments passed by keyword.
590590

591591
When creating a ``Call`` node, ``args`` and ``keywords`` are required, but
@@ -2024,7 +2024,7 @@ Function and class definitions
20242024

20252025
* ``name`` is a raw string for the class name
20262026
* ``bases`` is a list of nodes for explicitly specified base classes.
2027-
* ``keywords`` is a list of :class:`keyword` nodes, principally for 'metaclass'.
2027+
* ``keywords`` is a list of :class:`.keyword` nodes, principally for 'metaclass'.
20282028
Other keywords will be passed to the metaclass, as per `PEP-3115
20292029
<https://peps.python.org/pep-3115/>`_.
20302030
* ``body`` is a list of nodes representing the code within the class

Doc/library/idle.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ Search and Replace
479479

480480
Any selection becomes a search target. However, only selections within
481481
a line work because searches are only performed within lines with the
482-
terminal newline removed. If ``[x] Regular expresion`` is checked, the
482+
terminal newline removed. If ``[x] Regular expression`` is checked, the
483483
target is interpreted according to the Python re module.
484484

485485
.. _completions:

Doc/library/importlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ an :term:`importer`.
12701270

12711271
You can get the same effect as this function by implementing the
12721272
basic interface of multi-phase init (:pep:`489`) and lying about
1273-
support for mulitple interpreters (or per-interpreter GIL).
1273+
support for multiple interpreters (or per-interpreter GIL).
12741274

12751275
.. warning::
12761276
Using this function to disable the check can lead to

0 commit comments

Comments
 (0)