Skip to content

Commit 585ba90

Browse files
Merge branch 'main' into directive-splitting
2 parents 6125846 + fd190d1 commit 585ba90

Some content is hidden

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

53 files changed

+626
-222
lines changed

.github/workflows/tail-call.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
# Un-comment as we add support for more platforms for tail-calling interpreters.
3939
# - i686-pc-windows-msvc/msvc
4040
- x86_64-pc-windows-msvc/msvc
41+
- free-threading-msvc
4142
# - aarch64-pc-windows-msvc/msvc
4243
- x86_64-apple-darwin/clang
4344
- aarch64-apple-darwin/clang
@@ -53,6 +54,9 @@ jobs:
5354
- target: x86_64-pc-windows-msvc/msvc
5455
architecture: x64
5556
runner: windows-2025-vs2026
57+
- target: free-threading-msvc
58+
architecture: x64
59+
runner: windows-2025-vs2026
5660
# - target: aarch64-pc-windows-msvc/msvc
5761
# architecture: ARM64
5862
# runner: windows-2022
@@ -80,13 +84,21 @@ jobs:
8084
python-version: '3.11'
8185

8286
- name: Native Windows MSVC (release)
83-
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
87+
if: runner.os == 'Windows' && matrix.architecture != 'ARM64' && matrix.target != 'free-threading-msvc'
8488
shell: pwsh
8589
run: |
8690
$env:PlatformToolset = "v145"
8791
./PCbuild/build.bat --tail-call-interp -c Release -p ${{ matrix.architecture }}
8892
./PCbuild/rt.bat -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
8993
94+
# No tests:
95+
- name: Native Windows MSVC with free-threading (release)
96+
if: matrix.target == 'free-threading-msvc'
97+
shell: pwsh
98+
run: |
99+
$env:PlatformToolset = "v145"
100+
./PCbuild/build.bat --tail-call-interp --disable-gil -c Release -p ${{ matrix.architecture }}
101+
90102
# No tests (yet):
91103
- name: Emulated Windows Clang (release)
92104
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.14.10
3+
rev: v0.15.0
44
hooks:
55
- id: ruff-check
66
name: Run Ruff (lint) on Apple/
@@ -52,14 +52,14 @@ repos:
5252
files: ^Tools/wasm/
5353

5454
- repo: https://github.com/psf/black-pre-commit-mirror
55-
rev: 25.12.0
55+
rev: 26.1.0
5656
hooks:
5757
- id: black
5858
name: Run Black on Tools/jit/
5959
files: ^Tools/jit/
6060

6161
- repo: https://github.com/Lucas-C/pre-commit-hooks
62-
rev: v1.5.5
62+
rev: v1.5.6
6363
hooks:
6464
- id: remove-tabs
6565
types: [python]
@@ -83,19 +83,19 @@ repos:
8383
files: '^\.github/CODEOWNERS|\.(gram)$'
8484

8585
- repo: https://github.com/python-jsonschema/check-jsonschema
86-
rev: 0.36.0
86+
rev: 0.36.1
8787
hooks:
8888
- id: check-dependabot
8989
- id: check-github-workflows
9090
- id: check-readthedocs
9191

9292
- repo: https://github.com/rhysd/actionlint
93-
rev: v1.7.9
93+
rev: v1.7.10
9494
hooks:
9595
- id: actionlint
9696

9797
- repo: https://github.com/woodruffw/zizmor-pre-commit
98-
rev: v1.19.0
98+
rev: v1.22.0
9999
hooks:
100100
- id: zizmor
101101

Doc/c-api/module.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -725,10 +725,11 @@ remove it.
725725
726726
An array of additional slots, terminated by a ``{0, NULL}`` entry.
727727
728-
This array may not contain slots corresponding to :c:type:`PyModuleDef`
729-
members.
730-
For example, you cannot use :c:macro:`Py_mod_name` in :c:member:`!m_slots`;
731-
the module name must be given as :c:member:`PyModuleDef.m_name`.
728+
If the array contains slots corresponding to :c:type:`PyModuleDef`
729+
members, the values must match.
730+
For example, if you use :c:macro:`Py_mod_name` in :c:member:`!m_slots`,
731+
:c:member:`PyModuleDef.m_name` must be set to the same pointer
732+
(not just an equal string).
732733
733734
.. versionchanged:: 3.5
734735

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ although there is currently no date scheduled for their removal.
3535
* Support for ``__complex__()`` method returning a strict subclass of
3636
:class:`complex`: these methods will be required to return an instance of
3737
:class:`complex`.
38-
* Delegation of ``int()`` to ``__trunc__()`` method.
3938
* Passing a complex number as the *real* or *imag* argument in the
4039
:func:`complex` constructor is now deprecated; it should only be passed
4140
as a single positional argument.

Doc/library/argparse.rst

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ Subcommands
17711771
>>> parser.parse_args(['--foo', 'b', '--baz', 'Z'])
17721772
Namespace(baz='Z', foo=True)
17731773

1774-
Note that the object returned by :meth:`parse_args` will only contain
1774+
Note that the object returned by :meth:`~ArgumentParser.parse_args` will only contain
17751775
attributes for the main parser and the subparser that was selected by the
17761776
command line (and not any other subparsers). So in the example above, when
17771777
the ``a`` command is specified, only the ``foo`` and ``bar`` attributes are
@@ -1814,7 +1814,7 @@ Subcommands
18141814
-h, --help show this help message and exit
18151815
--baz {X,Y,Z} baz help
18161816

1817-
The :meth:`add_subparsers` method also supports ``title`` and ``description``
1817+
The :meth:`~ArgumentParser.add_subparsers` method also supports ``title`` and ``description``
18181818
keyword arguments. When either is present, the subparser's commands will
18191819
appear in their own group in the help output. For example::
18201820

@@ -1835,34 +1835,8 @@ Subcommands
18351835

18361836
{foo,bar} additional help
18371837

1838-
Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional
1839-
*aliases* argument,
1840-
which allows multiple strings to refer to the same subparser. This example,
1841-
like ``svn``, aliases ``co`` as a shorthand for ``checkout``::
1842-
1843-
>>> parser = argparse.ArgumentParser()
1844-
>>> subparsers = parser.add_subparsers()
1845-
>>> checkout = subparsers.add_parser('checkout', aliases=['co'])
1846-
>>> checkout.add_argument('foo')
1847-
>>> parser.parse_args(['co', 'bar'])
1848-
Namespace(foo='bar')
1849-
1850-
:meth:`~_SubParsersAction.add_parser` supports also an additional
1851-
*deprecated* argument, which allows to deprecate the subparser.
1852-
1853-
>>> import argparse
1854-
>>> parser = argparse.ArgumentParser(prog='chicken.py')
1855-
>>> subparsers = parser.add_subparsers()
1856-
>>> run = subparsers.add_parser('run')
1857-
>>> fly = subparsers.add_parser('fly', deprecated=True)
1858-
>>> parser.parse_args(['fly']) # doctest: +SKIP
1859-
chicken.py: warning: command 'fly' is deprecated
1860-
Namespace()
1861-
1862-
.. versionadded:: 3.13
1863-
18641838
One particularly effective way of handling subcommands is to combine the use
1865-
of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so
1839+
of the :meth:`~ArgumentParser.add_subparsers` method with calls to :meth:`~ArgumentParser.set_defaults` so
18661840
that each subparser knows which Python function it should execute. For
18671841
example::
18681842

@@ -1898,12 +1872,12 @@ Subcommands
18981872
>>> args.func(args)
18991873
((XYZYX))
19001874

1901-
This way, you can let :meth:`parse_args` do the job of calling the
1875+
This way, you can let :meth:`~ArgumentParser.parse_args` do the job of calling the
19021876
appropriate function after argument parsing is complete. Associating
19031877
functions with actions like this is typically the easiest way to handle the
19041878
different actions for each of your subparsers. However, if it is necessary
19051879
to check the name of the subparser that was invoked, the ``dest`` keyword
1906-
argument to the :meth:`add_subparsers` call will work::
1880+
argument to the :meth:`~ArgumentParser.add_subparsers` call will work::
19071881

19081882
>>> parser = argparse.ArgumentParser()
19091883
>>> subparsers = parser.add_subparsers(dest='subparser_name')
@@ -1922,6 +1896,43 @@ Subcommands
19221896
the main parser.
19231897

19241898

1899+
.. method:: _SubParsersAction.add_parser(name, *, help=None, aliases=None, \
1900+
deprecated=False, **kwargs)
1901+
1902+
Create and return a new :class:`ArgumentParser` object for the
1903+
subcommand *name*.
1904+
1905+
The *name* argument is the name of the sub-command.
1906+
1907+
The *help* argument provides a short description for this sub-command.
1908+
1909+
The *aliases* argument allows providing alternative names for this
1910+
sub-command. For example::
1911+
1912+
>>> parser = argparse.ArgumentParser()
1913+
>>> subparsers = parser.add_subparsers()
1914+
>>> checkout = subparsers.add_parser('checkout', aliases=['co'])
1915+
>>> checkout.add_argument('foo')
1916+
>>> parser.parse_args(['co', 'bar'])
1917+
Namespace(foo='bar')
1918+
1919+
The *deprecated* argument, if ``True``, marks the sub-command as
1920+
deprecated and will issue a warning when used. For example::
1921+
1922+
>>> parser = argparse.ArgumentParser(prog='chicken.py')
1923+
>>> subparsers = parser.add_subparsers()
1924+
>>> fly = subparsers.add_parser('fly', deprecated=True)
1925+
>>> args = parser.parse_args(['fly'])
1926+
chicken.py: warning: command 'fly' is deprecated
1927+
Namespace()
1928+
1929+
All other keyword arguments are passed directly to the
1930+
:class:`!ArgumentParser` constructor.
1931+
1932+
.. versionadded:: 3.13
1933+
Added the *deprecated* parameter.
1934+
1935+
19251936
FileType objects
19261937
^^^^^^^^^^^^^^^^
19271938

Doc/library/asyncio-task.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,9 @@ Timeouts
771771
An :ref:`asynchronous context manager <async-context-managers>`
772772
for cancelling overdue coroutines.
773773

774+
Prefer using :func:`asyncio.timeout` or :func:`asyncio.timeout_at`
775+
rather than instantiating :class:`!Timeout` directly.
776+
774777
``when`` should be an absolute time at which the context should time out,
775778
as measured by the event loop's clock:
776779

Doc/library/datetime.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,7 +2540,7 @@ requires, and these work on all supported platforms.
25402540
| ``%e`` | The day of the month as a | ␣1, ␣2, ..., 31 | |
25412541
| | space-padded decimal number. | | |
25422542
+-----------+--------------------------------+------------------------+-------+
2543-
| ``%F`` | Equivalent to ``%Y-%m-%d``, | 2025-10-11, | \(0) |
2543+
| ``%F`` | Equivalent to ``%Y-%m-%d``, | 2025-10-11, | |
25442544
| | the ISO 8601 format. | 1001-12-30 | |
25452545
+-----------+--------------------------------+------------------------+-------+
25462546
| ``%g`` | Last 2 digits of ISO 8601 year | 00, 01, ..., 99 | \(0) |
@@ -2673,10 +2673,10 @@ differences between platforms in handling of unsupported format specifiers.
26732673
``%G``, ``%u`` and ``%V`` were added.
26742674

26752675
.. versionadded:: 3.12
2676-
``%:z`` was added for :meth:`~.datetime.strftime`
2676+
``%:z`` was added for :meth:`~.datetime.strftime`.
26772677

26782678
.. versionadded:: 3.15
2679-
``%:z`` was added for :meth:`~.datetime.strptime`
2679+
``%:z`` and ``%F`` were added for :meth:`~.datetime.strptime`.
26802680

26812681
Technical Detail
26822682
^^^^^^^^^^^^^^^^

Doc/library/enum.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ Utilities and Decorators
10531053
>>> enum.bin(~10) # ~10 is -11
10541054
'0b1 0101'
10551055

1056-
.. versionadded:: 3.10
1056+
.. versionadded:: 3.11
10571057

10581058
---------------
10591059

Doc/library/pathlib.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ Pure paths provide the following methods and properties:
486486
>>> PurePosixPath('my/library').stem
487487
'library'
488488

489+
.. versionchanged:: 3.14
490+
491+
A single dot ("``.``") is considered a valid suffix.
492+
489493

490494
.. method:: PurePath.as_posix()
491495

Doc/library/secrets.rst

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,39 +62,44 @@ The :mod:`!secrets` module provides functions for generating secure
6262
tokens, suitable for applications such as password resets,
6363
hard-to-guess URLs, and similar.
6464

65-
.. function:: token_bytes([nbytes=None])
65+
.. function:: token_bytes(nbytes=None)
6666

6767
Return a random byte string containing *nbytes* number of bytes.
68-
If *nbytes* is ``None`` or not supplied, a reasonable default is
69-
used.
68+
69+
If *nbytes* is not specified or ``None``, :const:`DEFAULT_ENTROPY`
70+
is used instead.
7071

7172
.. doctest::
7273

73-
>>> token_bytes(16) #doctest:+SKIP
74+
>>> token_bytes(16) # doctest: +SKIP
7475
b'\xebr\x17D*t\xae\xd4\xe3S\xb6\xe2\xebP1\x8b'
7576

7677

77-
.. function:: token_hex([nbytes=None])
78+
.. function:: token_hex(nbytes=None)
7879

7980
Return a random text string, in hexadecimal. The string has *nbytes*
80-
random bytes, each byte converted to two hex digits. If *nbytes* is
81-
``None`` or not supplied, a reasonable default is used.
81+
random bytes, each byte converted to two hex digits.
82+
83+
If *nbytes* is not specified or ``None``, :const:`DEFAULT_ENTROPY`
84+
is used instead.
8285

8386
.. doctest::
8487

85-
>>> token_hex(16) #doctest:+SKIP
88+
>>> token_hex(16) # doctest: +SKIP
8689
'f9bf78b9a18ce6d46a0cd2b0b86df9da'
8790

88-
.. function:: token_urlsafe([nbytes=None])
91+
.. function:: token_urlsafe(nbytes=None)
8992

9093
Return a random URL-safe text string, containing *nbytes* random
9194
bytes. The text is Base64 encoded, so on average each byte results
92-
in approximately 1.3 characters. If *nbytes* is ``None`` or not
93-
supplied, a reasonable default is used.
95+
in approximately 1.3 characters.
96+
97+
If *nbytes* is not specified or ``None``, :const:`DEFAULT_ENTROPY`
98+
is used instead.
9499

95100
.. doctest::
96101

97-
>>> token_urlsafe(16) #doctest:+SKIP
102+
>>> token_urlsafe(16) # doctest: +SKIP
98103
'Drmhze6EPcv0fN_81Bj-nA'
99104

100105

@@ -115,11 +120,13 @@ argument to the various ``token_*`` functions. That argument is taken
115120
as the number of bytes of randomness to use.
116121

117122
Otherwise, if no argument is provided, or if the argument is ``None``,
118-
the ``token_*`` functions will use a reasonable default instead.
123+
the ``token_*`` functions uses :const:`DEFAULT_ENTROPY` instead.
119124

120-
.. note::
125+
.. data:: DEFAULT_ENTROPY
126+
127+
Default number of bytes of randomness used by the ``token_*`` functions.
121128

122-
That default is subject to change at any time, including during
129+
The exact value is subject to change at any time, including during
123130
maintenance releases.
124131

125132

0 commit comments

Comments
 (0)