Skip to content

Commit fff1bd2

Browse files
committed
Merge 'origin/main' into pythongh-127266-type-slots-ts
2 parents 64547e9 + 3940e1f commit fff1bd2

File tree

225 files changed

+16067
-4495
lines changed

Some content is hidden

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

225 files changed

+16067
-4495
lines changed

.github/workflows/build.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ jobs:
264264
fail-fast: false
265265
matrix:
266266
os: [ubuntu-24.04]
267-
openssl_ver: [3.0.15, 3.1.7, 3.2.3, 3.3.2, 3.4.0]
267+
openssl_ver: [3.0.16, 3.1.8, 3.2.4, 3.3.3, 3.4.1]
268268
# See Tools/ssl/make_ssl_data.py for notes on adding a new version
269269
env:
270270
OPENSSL_VER: ${{ matrix.openssl_ver }}
@@ -331,7 +331,7 @@ jobs:
331331
needs: build-context
332332
if: needs.build-context.outputs.run-tests == 'true'
333333
env:
334-
OPENSSL_VER: 3.0.15
334+
OPENSSL_VER: 3.0.16
335335
PYTHONSTRICTEXTENSIONBUILD: 1
336336
steps:
337337
- uses: actions/checkout@v4
@@ -422,8 +422,9 @@ jobs:
422422
# failing when executed from inside a virtual environment.
423423
"${VENV_PYTHON}" -m test \
424424
-W \
425-
-o \
425+
--slowest \
426426
-j4 \
427+
--timeout 900 \
427428
-x test_asyncio \
428429
-x test_multiprocessing_fork \
429430
-x test_multiprocessing_forkserver \
@@ -450,7 +451,7 @@ jobs:
450451
matrix:
451452
os: [ubuntu-24.04]
452453
env:
453-
OPENSSL_VER: 3.0.15
454+
OPENSSL_VER: 3.0.16
454455
PYTHONSTRICTEXTENSIONBUILD: 1
455456
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
456457
steps:

Doc/c-api/arg.rst

+8
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,19 @@ small to receive the value.
274274
Convert a Python integer to a C :c:expr:`unsigned long` without
275275
overflow checking.
276276

277+
.. versionchanged:: next
278+
Use :meth:`~object.__index__` if available.
279+
277280
``L`` (:class:`int`) [long long]
278281
Convert a Python integer to a C :c:expr:`long long`.
279282

280283
``K`` (:class:`int`) [unsigned long long]
281284
Convert a Python integer to a C :c:expr:`unsigned long long`
282285
without overflow checking.
283286

287+
.. versionchanged:: next
288+
Use :meth:`~object.__index__` if available.
289+
284290
``n`` (:class:`int`) [:c:type:`Py_ssize_t`]
285291
Convert a Python integer to a C :c:type:`Py_ssize_t`.
286292

@@ -669,6 +675,8 @@ Building values
669675
``L`` (:class:`int`) [long long]
670676
Convert a C :c:expr:`long long` to a Python integer object.
671677
678+
.. _capi-py-buildvalue-format-K:
679+
672680
``K`` (:class:`int`) [unsigned long long]
673681
Convert a C :c:expr:`unsigned long long` to a Python integer object.
674682

Doc/c-api/init.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ Cautions regarding runtime finalization
11311131
In the late stage of :term:`interpreter shutdown`, after attempting to wait for
11321132
non-daemon threads to exit (though this can be interrupted by
11331133
:class:`KeyboardInterrupt`) and running the :mod:`atexit` functions, the runtime
1134-
is marked as *finalizing*: :c:func:`_Py_IsFinalizing` and
1134+
is marked as *finalizing*: :c:func:`Py_IsFinalizing` and
11351135
:func:`sys.is_finalizing` return true. At this point, only the *finalization
11361136
thread* that initiated finalization (typically the main thread) is allowed to
11371137
acquire the :term:`GIL`.

Doc/c-api/init_config.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ Configuration Options
320320
* - ``"cpu_count"``
321321
- :c:member:`cpu_count <PyConfig.cpu_count>`
322322
- ``int``
323-
- Read-only
323+
- Public
324324
* - ``"dev_mode"``
325325
- :c:member:`dev_mode <PyConfig.dev_mode>`
326326
- ``bool``
@@ -619,6 +619,8 @@ Some options are read from the :mod:`sys` attributes. For example, the option
619619
The caller must have an :term:`attached thread state`. The function cannot
620620
be called before Python initialization nor after Python finalization.
621621
622+
.. audit-event:: cpython.PyConfig_Set name,value c.PyConfig_Set
623+
622624
.. versionadded:: 3.14
623625
624626

Doc/deprecations/c-api-pending-removal-in-3.15.rst

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ Pending removal in Python 3.15
1010
:c:func:`PyWeakref_GetRef` on Python 3.12 and older.
1111
* :c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro:
1212
Use :c:type:`wchar_t` instead.
13+
* :c:func:`!PyUnicode_AsDecodedObject`:
14+
Use :c:func:`PyCodec_Decode` instead.
15+
* :c:func:`!PyUnicode_AsDecodedUnicode`:
16+
Use :c:func:`PyCodec_Decode` instead; Note that some codecs (for example, "base64")
17+
may return a type other than :class:`str`, such as :class:`bytes`.
18+
* :c:func:`!PyUnicode_AsEncodedObject`:
19+
Use :c:func:`PyCodec_Encode` instead.
20+
* :c:func:`!PyUnicode_AsEncodedUnicode`:
21+
Use :c:func:`PyCodec_Encode` instead; Note that some codecs (for example, "base64")
22+
may return a type other than :class:`bytes`, such as :class:`str`.
1323
* Python initialization functions, deprecated in Python 3.13:
1424

1525
* :c:func:`Py_GetPath`:

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

-8
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ although there is currently no date scheduled for their removal.
1818
Use :c:func:`PyOS_AfterFork_Child` instead.
1919
* :c:func:`PySlice_GetIndicesEx`:
2020
Use :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices` instead.
21-
* :c:func:`!PyUnicode_AsDecodedObject`:
22-
Use :c:func:`PyCodec_Decode` instead.
23-
* :c:func:`!PyUnicode_AsDecodedUnicode`:
24-
Use :c:func:`PyCodec_Decode` instead.
25-
* :c:func:`!PyUnicode_AsEncodedObject`:
26-
Use :c:func:`PyCodec_Encode` instead.
27-
* :c:func:`!PyUnicode_AsEncodedUnicode`:
28-
Use :c:func:`PyCodec_Encode` instead.
2921
* :c:func:`PyUnicode_READY`:
3022
Unneeded since Python 3.12
3123
* :c:func:`!PyErr_Display`:

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

+8
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ Pending removal in Python 3.16
6161
* Calling the Python implementation of :func:`functools.reduce` with *function*
6262
or *sequence* as keyword arguments has been deprecated since Python 3.14.
6363

64+
* :mod:`mimetypes`:
65+
66+
* Valid extensions start with a '.' or are empty for
67+
:meth:`mimetypes.MimeTypes.add_type`.
68+
Undotted extensions are deprecated and will
69+
raise a :exc:`ValueError` in Python 3.16.
70+
(Contributed by Hugo van Kemenade in :gh:`75223`.)
71+
6472
* :mod:`shutil`:
6573

6674
* The :class:`!ExecError` exception

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

+3
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,6 @@ although there is currently no date scheduled for their removal.
153153
:class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it
154154
will always return ``True``. Prefer explicit ``len(elem)`` or
155155
``elem is not None`` tests instead.
156+
157+
* :func:`sys._clear_type_cache` is deprecated:
158+
use :func:`sys._clear_internal_caches` instead.

Doc/howto/remote_debugging.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ file format structures from the binary file on disk. The ELF header contains a
110110
pointer to the section header table. Each section header contains metadata about
111111
a section including its name (stored in a separate string table), offset, and
112112
size. To find a specific section like .PyRuntime, you need to walk through these
113-
headers and match the section name. The section header then provdes the offset
113+
headers and match the section name. The section header then provides the offset
114114
where that section exists in the file, which can be used to calculate its
115115
runtime address when the binary is loaded into memory.
116116

Doc/library/ast.rst

+37
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,43 @@ Pattern matching
17611761

17621762
.. versionadded:: 3.10
17631763

1764+
1765+
Type annotations
1766+
^^^^^^^^^^^^^^^^
1767+
1768+
.. class:: TypeIgnore(lineno, tag)
1769+
1770+
A ``# type: ignore`` comment located at *lineno*.
1771+
*tag* is the optional tag specified by the form ``# type: ignore <tag>``.
1772+
1773+
.. doctest::
1774+
1775+
>>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), indent=4))
1776+
Module(
1777+
body=[
1778+
Assign(
1779+
targets=[
1780+
Name(id='x', ctx=Store())],
1781+
value=Constant(value=1))],
1782+
type_ignores=[
1783+
TypeIgnore(lineno=1, tag='')])
1784+
>>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', type_comments=True), indent=4))
1785+
Module(
1786+
body=[
1787+
AnnAssign(
1788+
target=Name(id='x', ctx=Store()),
1789+
annotation=Name(id='bool', ctx=Load()),
1790+
value=Constant(value=1),
1791+
simple=1)],
1792+
type_ignores=[
1793+
TypeIgnore(lineno=1, tag='[assignment]')])
1794+
1795+
.. note::
1796+
:class:`!TypeIgnore` nodes are not generated when the *type_comments* parameter
1797+
is set to ``False`` (default). See :func:`ast.parse` for more details.
1798+
1799+
.. versionadded:: 3.8
1800+
17641801
.. _ast-type-params:
17651802

17661803
Type parameters

Doc/library/decimal.rst

+21-12
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,14 @@ function to temporarily change the active context.
10311031
.. versionchanged:: 3.11
10321032
:meth:`localcontext` now supports setting context attributes through the use of keyword arguments.
10331033

1034+
.. function:: IEEEContext(bits)
1035+
1036+
Return a context object initialized to the proper values for one of the
1037+
IEEE interchange formats. The argument must be a multiple of 32 and less
1038+
than :const:`IEEE_CONTEXT_MAX_BITS`.
1039+
1040+
.. versionadded:: next
1041+
10341042
New contexts can also be created using the :class:`Context` constructor
10351043
described below. In addition, the module provides three pre-made contexts:
10361044

@@ -1552,18 +1560,19 @@ Constants
15521560
The constants in this section are only relevant for the C module. They
15531561
are also included in the pure Python version for compatibility.
15541562

1555-
+---------------------+---------------------+-------------------------------+
1556-
| | 32-bit | 64-bit |
1557-
+=====================+=====================+===============================+
1558-
| .. data:: MAX_PREC | ``425000000`` | ``999999999999999999`` |
1559-
+---------------------+---------------------+-------------------------------+
1560-
| .. data:: MAX_EMAX | ``425000000`` | ``999999999999999999`` |
1561-
+---------------------+---------------------+-------------------------------+
1562-
| .. data:: MIN_EMIN | ``-425000000`` | ``-999999999999999999`` |
1563-
+---------------------+---------------------+-------------------------------+
1564-
| .. data:: MIN_ETINY | ``-849999999`` | ``-1999999999999999997`` |
1565-
+---------------------+---------------------+-------------------------------+
1566-
1563+
+---------------------------------+---------------------+-------------------------------+
1564+
| | 32-bit | 64-bit |
1565+
+=================================+=====================+===============================+
1566+
| .. data:: MAX_PREC | ``425000000`` | ``999999999999999999`` |
1567+
+---------------------------------+---------------------+-------------------------------+
1568+
| .. data:: MAX_EMAX | ``425000000`` | ``999999999999999999`` |
1569+
+---------------------------------+---------------------+-------------------------------+
1570+
| .. data:: MIN_EMIN | ``-425000000`` | ``-999999999999999999`` |
1571+
+---------------------------------+---------------------+-------------------------------+
1572+
| .. data:: MIN_ETINY | ``-849999999`` | ``-1999999999999999997`` |
1573+
+---------------------------------+---------------------+-------------------------------+
1574+
| .. data:: IEEE_CONTEXT_MAX_BITS | ``256`` | ``512`` |
1575+
+---------------------------------+---------------------+-------------------------------+
15671576

15681577
.. data:: HAVE_THREADS
15691578

Doc/library/exceptions.rst

+4
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,17 @@ The following exceptions are the exceptions that are usually raised.
428428
:exc:`PythonFinalizationError` during the Python finalization:
429429

430430
* Creating a new Python thread.
431+
* :meth:`Joining <threading.Thread.join>` a running daemon thread.
431432
* :func:`os.fork`.
432433

433434
See also the :func:`sys.is_finalizing` function.
434435

435436
.. versionadded:: 3.13
436437
Previously, a plain :exc:`RuntimeError` was raised.
437438

439+
.. versionchanged:: next
440+
441+
:meth:`threading.Thread.join` can now raise this exception.
438442

439443
.. exception:: RecursionError
440444

Doc/library/faulthandler.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ Dumping the C stack
8484
C Stack Compatibility
8585
*********************
8686

87-
If the system does not support the C-level :manpage:`backtrace(3)`,
88-
:manpage:`backtrace_symbols(3)`, or :manpage:`dladdr(3)`, then C stack dumps
89-
will not work. An error will be printed instead of the stack.
87+
If the system does not support the C-level :manpage:`backtrace(3)`
88+
or :manpage:`dladdr1(3)`, then C stack dumps will not work.
89+
An error will be printed instead of the stack.
9090

9191
Additionally, some compilers do not support :term:`CPython's <CPython>`
9292
implementation of C stack dumps. As a result, a different error may be printed

Doc/library/importlib.metadata.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ Distribution files
297297
package is not installed in the current Python environment.
298298

299299
Returns :const:`None` if the distribution is found but the installation
300-
database records reporting the files associated with the distribuion package
300+
database records reporting the files associated with the distribution package
301301
are missing.
302302

303303
.. class:: PackagePath

Doc/library/mimetypes.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,18 @@ than one MIME-type database; it provides an interface similar to the one of the
301301

302302
.. method:: MimeTypes.add_type(type, ext, strict=True)
303303

304-
Add a mapping from the MIME type *type* to the extension *ext*. When the
304+
Add a mapping from the MIME type *type* to the extension *ext*.
305+
Valid extensions start with a '.' or are empty. When the
305306
extension is already known, the new type will replace the old one. When the type
306307
is already known the extension will be added to the list of known extensions.
307308

308309
When *strict* is ``True`` (the default), the mapping will be added to the
309310
official MIME types, otherwise to the non-standard ones.
310311

312+
.. deprecated-removed:: 3.14 3.16
313+
Invalid, undotted extensions will raise a
314+
:exc:`ValueError` in Python 3.16.
315+
311316

312317
.. _mimetypes-cli:
313318

Doc/library/socket.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@ Constants
476476
network interface instead of its name.
477477

478478
.. versionchanged:: 3.14
479-
Added missing ``IP_RECVERR``, ``IPV6_RECVERR``, ``IP_RECVTTL``, and
480-
``IP_RECVORIGDSTADDR`` on Linux.
479+
Added missing ``IP_FREEBIND``, ``IP_RECVERR``, ``IPV6_RECVERR``,
480+
``IP_RECVTTL``, and ``IP_RECVORIGDSTADDR`` on Linux.
481481

482482
.. versionchanged:: 3.14
483483
Added support for ``TCP_QUICKACK`` on Windows platforms when available.

Doc/library/sysconfig.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,10 @@ Other functions
429429
Return the path of :file:`Makefile`.
430430

431431
.. _sysconfig-cli:
432+
.. _using-sysconfig-as-a-script:
432433

433-
Using :mod:`sysconfig` as a script
434-
----------------------------------
434+
Command-line usage
435+
------------------
435436

436437
You can use :mod:`sysconfig` as a script with Python's *-m* option:
437438

Doc/library/tarfile.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Some facts and figures:
112112
``'w|bz2'``, :func:`tarfile.open` accepts the keyword argument
113113
*compresslevel* (default ``9``) to specify the compression level of the file.
114114

115-
For modes ``'w:xz'`` and ``'x:xz'``, :func:`tarfile.open` accepts the
115+
For modes ``'w:xz'``, ``'x:xz'`` and ``'w|xz'``, :func:`tarfile.open` accepts the
116116
keyword argument *preset* to specify the compression level of the file.
117117

118118
For special purposes, there is a second format for *mode*:
@@ -167,6 +167,9 @@ Some facts and figures:
167167
.. versionchanged:: 3.12
168168
The *compresslevel* keyword argument also works for streams.
169169

170+
.. versionchanged:: next
171+
The *preset* keyword argument also works for streams.
172+
170173

171174
.. class:: TarFile
172175
:noindex:

Doc/library/threading.rst

+8
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,14 @@ since it is impossible to detect the termination of alien threads.
448448
an error to :meth:`~Thread.join` a thread before it has been started
449449
and attempts to do so raise the same exception.
450450

451+
If an attempt is made to join a running daemonic thread in in late stages
452+
of :term:`Python finalization <interpreter shutdown>` :meth:`!join`
453+
raises a :exc:`PythonFinalizationError`.
454+
455+
.. versionchanged:: next
456+
457+
May raise :exc:`PythonFinalizationError`.
458+
451459
.. attribute:: name
452460

453461
A string used for identification purposes only. It has no semantics.

Doc/library/webbrowser.rst

+11-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,17 @@ If the environment variable :envvar:`BROWSER` exists, it is interpreted as the
2424
:data:`os.pathsep`-separated list of browsers to try ahead of the platform
2525
defaults. When the value of a list part contains the string ``%s``, then it is
2626
interpreted as a literal browser command line to be used with the argument URL
27-
substituted for ``%s``; if the part does not contain ``%s``, it is simply
28-
interpreted as the name of the browser to launch. [1]_
27+
substituted for ``%s``; if the value is a single word that refers to one of the
28+
already registered browsers this browser is added to the front of the search list;
29+
if the part does not contain ``%s``, it is simply interpreted as the name of the
30+
browser to launch. [1]_
31+
32+
.. versionchanged:: next
33+
34+
The :envvar:`BROWSER` variable can now also be used to reorder the list of
35+
platform defaults. This is particularly useful on macOS where the platform
36+
defaults do not refer to command-line tools on :envvar:`PATH`.
37+
2938

3039
For non-Unix platforms, or when a remote browser is available on Unix, the
3140
controlling process will not wait for the user to finish with the browser, but

Doc/using/configure.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Features and minimum versions required to build CPython:
2222

2323
* Support for threads.
2424

25-
* OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.9 is the recommended
25+
* OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.16 is the recommended
2626
minimum version for the :mod:`ssl` and :mod:`hashlib` extension modules.
2727

2828
* SQLite 3.15.2 for the :mod:`sqlite3` extension module.

0 commit comments

Comments
 (0)