Skip to content

Commit 863d947

Browse files
committed
Merge branch 'main' into move-globals-removal-to-main-optimizer-pass
2 parents ab5374d + e46d403 commit 863d947

Some content is hidden

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

51 files changed

+617
-543
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ repos:
2222
name: Run Ruff (lint) on Argument Clinic
2323
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]
2424
files: ^Tools/clinic/|Lib/test/test_clinic.py
25+
- id: ruff
26+
name: Run Ruff (lint) on Tools/peg_generator/
27+
args: [--exit-non-zero-on-fix, --config=Tools/peg_generator/.ruff.toml]
28+
files: ^Tools/peg_generator/
2529
- id: ruff-format
2630
name: Run Ruff (format) on Doc/
2731
args: [--check]

Doc/extending/extending.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ A pointer to the module definition must be returned via :c:func:`PyModuleDef_Ini
426426
so that the import machinery can create the module and store it in ``sys.modules``.
427427

428428
When embedding Python, the :c:func:`!PyInit_spam` function is not called
429-
automatically unless there's an entry in the :c:data:`PyImport_Inittab` table.
429+
automatically unless there's an entry in the :c:data:`!PyImport_Inittab` table.
430430
To add the module to the initialization table, use :c:func:`PyImport_AppendInittab`,
431431
optionally followed by an import of the module::
432432

Doc/library/collections.abc.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,17 @@ Collections Abstract Base Classes -- Detailed Descriptions
272272
linked list), the mixins will have quadratic performance and will
273273
likely need to be overridden.
274274

275-
.. versionchanged:: 3.5
276-
The index() method added support for *stop* and *start*
277-
arguments.
275+
.. method:: index(value, start=0, stop=None)
276+
277+
Return first index of *value*.
278+
279+
Raises :exc:`ValueError` if the value is not present.
280+
281+
Supporting the *start* and *stop* arguments is optional, but recommended.
282+
283+
.. versionchanged:: 3.5
284+
The :meth:`!index` method added support for *stop* and *start*
285+
arguments.
278286

279287
.. class:: Set
280288
MutableSet

Doc/library/test.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ The :mod:`test.support` module defines the following functions:
851851
Decorator for tests that fill the address space.
852852

853853

854-
.. function:: linked_with_musl()
854+
.. function:: linked_to_musl()
855855

856856
Return ``False`` if there is no evidence the interpreter was compiled with
857857
``musl``, otherwise return a version triple, either ``(0, 0, 0)`` if the

Doc/library/venv.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ It also creates a :file:`bin` (or :file:`Scripts` on Windows) subdirectory
7878
containing a copy or symlink of the Python executable
7979
(as appropriate for the platform or arguments used at environment creation time).
8080
It also creates a :file:`lib/pythonX.Y/site-packages` subdirectory
81-
(on Windows, this is :file:`Lib\site-packages`).
81+
(on Windows, this is :file:`Lib\\site-packages`).
8282
If an existing directory is specified, it will be re-used.
8383

8484
.. versionchanged:: 3.5

Doc/reference/lexical_analysis.rst

Lines changed: 51 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,67 +1351,62 @@ Formally, imaginary literals are described by the following lexical definition:
13511351
imagnumber: (`floatnumber` | `digitpart`) ("j" | "J")
13521352

13531353

1354-
.. _operators:
1355-
1356-
Operators
1357-
=========
1358-
1359-
.. index:: single: operators
1360-
1361-
The following tokens are operators:
1362-
1363-
.. code-block:: none
1364-
1365-
1366-
+ - * ** / // % @
1367-
<< >> & | ^ ~ :=
1368-
< > <= >= == !=
1369-
1370-
13711354
.. _delimiters:
1372-
1373-
Delimiters
1374-
==========
1375-
1376-
.. index:: single: delimiters
1377-
1378-
The following tokens serve as delimiters in the grammar:
1379-
1380-
.. code-block:: none
1381-
1382-
( ) [ ] { }
1383-
, : ! . ; @ =
1384-
1385-
The period can also occur in floating-point and imaginary literals.
1386-
1355+
.. _operators:
13871356
.. _lexical-ellipsis:
13881357

1389-
A sequence of three periods has a special meaning as an
1390-
:py:data:`Ellipsis` literal:
1391-
1392-
.. code-block:: none
1393-
1394-
...
1395-
1396-
The following *augmented assignment operators* serve
1397-
lexically as delimiters, but also perform an operation:
1358+
Operators and delimiters
1359+
========================
13981360

1399-
.. code-block:: none
1400-
1401-
-> += -= *= /= //= %=
1402-
@= &= |= ^= >>= <<= **=
1403-
1404-
The following printing ASCII characters have special meaning as part of other
1405-
tokens or are otherwise significant to the lexical analyzer:
1406-
1407-
.. code-block:: none
1408-
1409-
' " # \
1361+
.. index::
1362+
single: operators
1363+
single: delimiters
14101364

1411-
The following printing ASCII characters are not used in Python. Their
1412-
occurrence outside string literals and comments is an unconditional error:
1365+
The following grammar defines :dfn:`operator` and :dfn:`delimiter` tokens,
1366+
that is, the generic :data:`~token.OP` token type.
1367+
A :ref:`list of these tokens and their names <token_operators_delimiters>`
1368+
is also available in the :mod:`!token` module documentation.
14131369

1414-
.. code-block:: none
1370+
.. grammar-snippet::
1371+
:group: python-grammar
14151372

1416-
$ ? `
1373+
OP:
1374+
| assignment_operator
1375+
| bitwise_operator
1376+
| comparison_operator
1377+
| enclosing_delimiter
1378+
| other_delimiter
1379+
| arithmetic_operator
1380+
| "..."
1381+
| other_op
1382+
1383+
assignment_operator: "+=" | "-=" | "*=" | "**=" | "/=" | "//=" | "%=" |
1384+
"&=" | "|=" | "^=" | "<<=" | ">>=" | "@=" | ":="
1385+
bitwise_operator: "&" | "|" | "^" | "~" | "<<" | ">>"
1386+
comparison_operator: "<=" | ">=" | "<" | ">" | "==" | "!="
1387+
enclosing_delimiter: "(" | ")" | "[" | "]" | "{" | "}"
1388+
other_delimiter: "," | ":" | "!" | ";" | "=" | "->"
1389+
arithmetic_operator: "+" | "-" | "**" | "*" | "//" | "/" | "%"
1390+
other_op: "." | "@"
1391+
1392+
.. note::
1393+
1394+
Generally, *operators* are used to combine :ref:`expressions <expressions>`,
1395+
while *delimiters* serve other purposes.
1396+
However, there is no clear, formal distinction between the two categories.
1397+
1398+
Some tokens can serve as either operators or delimiters, depending on usage.
1399+
For example, ``*`` is both the multiplication operator and a delimiter used
1400+
for sequence unpacking, and ``@`` is both the matrix multiplication and
1401+
a delimiter that introduces decorators.
1402+
1403+
For some tokens, the distinction is unclear.
1404+
For example, some people consider ``.``, ``(``, and ``)`` to be delimiters, while others
1405+
see the :py:func:`getattr` operator and the function call operator(s).
1406+
1407+
Some of Python's operators, like ``and``, ``or``, and ``not in``, use
1408+
:ref:`keyword <keywords>` tokens rather than "symbols" (operator tokens).
1409+
1410+
A sequence of three consecutive periods (``...``) has a special
1411+
meaning as an :py:data:`Ellipsis` literal.
14171412

Doc/reference/simple_stmts.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,9 @@ where the :keyword:`import` statement occurs.
831831

832832
.. index:: single: __all__ (optional module attribute)
833833

834+
.. attribute:: module.__all__
835+
:no-typesetting:
836+
834837
The *public names* defined by a module are determined by checking the module's
835838
namespace for a variable named ``__all__``; if defined, it must be a sequence
836839
of strings which are names defined or imported by that module. The names

Doc/tools/.nitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Doc/c-api/module.rst
1111
Doc/c-api/stable.rst
1212
Doc/c-api/type.rst
1313
Doc/c-api/typeobj.rst
14-
Doc/extending/extending.rst
1514
Doc/library/ast.rst
1615
Doc/library/asyncio-extending.rst
1716
Doc/library/email.charset.rst
@@ -57,11 +56,6 @@ Doc/library/xmlrpc.server.rst
5756
Doc/library/zlib.rst
5857
Doc/reference/compound_stmts.rst
5958
Doc/reference/datamodel.rst
60-
Doc/using/windows.rst
6159
Doc/whatsnew/2.4.rst
6260
Doc/whatsnew/2.5.rst
6361
Doc/whatsnew/2.6.rst
64-
Doc/whatsnew/3.4.rst
65-
Doc/whatsnew/3.5.rst
66-
Doc/whatsnew/3.6.rst
67-
Doc/whatsnew/3.10.rst

Doc/using/windows.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ customization.
398398
- Description
399399

400400
* - ``default_tag``
401-
- ``PYTHON_MANAGER_DEFAULT``
401+
- .. envvar:: PYTHON_MANAGER_DEFAULT
402402
- The preferred default version to launch or install.
403403
By default, this is interpreted as the most recent non-prerelease version
404404
from the CPython team.
@@ -812,7 +812,7 @@ default).
812812
``python.exe`` alias is set to "Python (default)"
813813

814814
* - ``python`` and ``py`` don't launch the runtime I expect
815-
- Check your ``PYTHON_MANAGER_DEFAULT`` environment variable
815+
- Check your :envvar:`PYTHON_MANAGER_DEFAULT` environment variable
816816
or ``default_tag`` configuration.
817817
The ``py list`` command will show your default based on these settings.
818818

@@ -1802,7 +1802,7 @@ program, which performs a :envvar:`PATH` search.
18021802
If an executable matching the first argument after the ``env`` command cannot
18031803
be found, but the argument starts with ``python``, it will be handled as
18041804
described for the other virtual commands.
1805-
The environment variable :envvar:`PYLAUNCHER_NO_SEARCH_PATH` may be set
1805+
The environment variable :envvar:`!PYLAUNCHER_NO_SEARCH_PATH` may be set
18061806
(to any value) to skip this search of :envvar:`PATH`.
18071807

18081808
Shebang lines that do not match any of these patterns are looked up in the
@@ -1869,7 +1869,7 @@ For example, a shebang line of ``#!python`` has no version qualifier, while
18691869
``#!python3`` has a version qualifier which specifies only a major version.
18701870

18711871
If no version qualifiers are found in a command, the environment
1872-
variable :envvar:`PY_PYTHON` can be set to specify the default version
1872+
variable :envvar:`!PY_PYTHON` can be set to specify the default version
18731873
qualifier. If it is not set, the default is "3". The variable can
18741874
specify any value that may be passed on the command line, such as "3",
18751875
"3.7", "3.7-32" or "3.7-64". (Note that the "-64" option is only
@@ -1942,7 +1942,7 @@ For example:
19421942
Diagnostics
19431943
-----------
19441944

1945-
If an environment variable :envvar:`PYLAUNCHER_DEBUG` is set (to any value), the
1945+
If an environment variable :envvar:`!PYLAUNCHER_DEBUG` is set (to any value), the
19461946
launcher will print diagnostic information to stderr (i.e. to the console).
19471947
While this information manages to be simultaneously verbose *and* terse, it
19481948
should allow you to see what versions of Python were located, why a
@@ -1952,7 +1952,7 @@ target Python. It is primarily intended for testing and debugging.
19521952
Dry Run
19531953
-------
19541954

1955-
If an environment variable :envvar:`PYLAUNCHER_DRYRUN` is set (to any value),
1955+
If an environment variable :envvar:`!PYLAUNCHER_DRYRUN` is set (to any value),
19561956
the launcher will output the command it would have run, but will not actually
19571957
launch Python. This may be useful for tools that want to use the launcher to
19581958
detect and then launch Python directly. Note that the command written to
@@ -1962,14 +1962,14 @@ the console.
19621962
Install on demand
19631963
-----------------
19641964

1965-
If an environment variable :envvar:`PYLAUNCHER_ALLOW_INSTALL` is set (to any
1965+
If an environment variable :envvar:`!PYLAUNCHER_ALLOW_INSTALL` is set (to any
19661966
value), and the requested Python version is not installed but is available on
19671967
the Microsoft Store, the launcher will attempt to install it. This may require
19681968
user interaction to complete, and you may need to run the command again.
19691969

1970-
An additional :envvar:`PYLAUNCHER_ALWAYS_INSTALL` variable causes the launcher
1970+
An additional :envvar:`!PYLAUNCHER_ALWAYS_INSTALL` variable causes the launcher
19711971
to always try to install Python, even if it is detected. This is mainly intended
1972-
for testing (and should be used with :envvar:`PYLAUNCHER_DRYRUN`).
1972+
for testing (and should be used with :envvar:`!PYLAUNCHER_DRYRUN`).
19731973

19741974
Return codes
19751975
------------

Doc/whatsnew/3.10.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ Improved Modules
901901
asyncio
902902
-------
903903
904-
Add missing :meth:`~asyncio.events.AbstractEventLoop.connect_accepted_socket`
904+
Add missing :meth:`~asyncio.loop.connect_accepted_socket`
905905
method.
906906
(Contributed by Alex Grönholm in :issue:`41332`.)
907907
@@ -933,7 +933,7 @@ Base32 Encoding with Extended Hex Alphabet.
933933
bdb
934934
---
935935
936-
Add :meth:`~bdb.Breakpoint.clearBreakpoints` to reset all set breakpoints.
936+
Add :meth:`!clearBreakpoints` to reset all set breakpoints.
937937
(Contributed by Irit Katriel in :issue:`24160`.)
938938
939939
bisect
@@ -1398,7 +1398,7 @@ A new verify flag :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN` has been added.
13981398
sqlite3
13991399
-------
14001400
1401-
Add audit events for :func:`~sqlite3.connect/handle`,
1401+
Add audit events for :func:`~sqlite3.connect`,
14021402
:meth:`~sqlite3.Connection.enable_load_extension`, and
14031403
:meth:`~sqlite3.Connection.load_extension`.
14041404
(Contributed by Erlend E. Aasland in :issue:`43762`.)

0 commit comments

Comments
 (0)