Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
bc7c102
gh-149231: tomllib: Limit the number of parts in a key (GH-149233)
encukou May 4, 2026
7b7fa3f
gh-148292: Update _ssl._SSLSocket for OpenSSL 4 (#149102)
vstinner May 4, 2026
1504bd6
gh-149351: Avoid possible broken macOS framework install names when …
ned-deily May 4, 2026
2ba0a81
gh-148352: Add more colour to `calendar` CLI output (#148354)
hugovk May 4, 2026
7aedd0a
gh-87245: Improve IPv6Address.ipv4_mapped documentation (#92572)
wbolster May 4, 2026
fc96028
gh-148600: Add OpenSSL 4.0.0 support to test configurations (#149356)
vstinner May 4, 2026
ce51c18
gh-146063: Add PyObject_CallFinalizerFromDealloc() to the limited C A…
vstinner May 4, 2026
c3972f2
gh-148418: Fix a possible reference leak in a corrupted TYPE_CODE mar…
Wulian233 May 4, 2026
5235467
gh-149010: Improve reliability of inspect CLI (#149357)
ncoghlan May 4, 2026
72f29dc
gh-147998: Fix possible memory leak in _pop_preserved (crossinterp.c)…
maurycy May 4, 2026
6e6f905
gh-148675: Add Zd/Zf formats to array, ctypes, memoryview, struct (#1…
vstinner May 4, 2026
1e21cf6
gh-148292: Remove shutdown() test in test_ssl.test_got_eof() (#149366)
vstinner May 4, 2026
b8ebd07
gh-137337: Clarify import statement namespace binding (GH-144607)
kovan May 4, 2026
5dd5c8b
gh-148675: Remove F and D formats from array and memoryview (GH-149368)
vstinner May 4, 2026
6ca5cdb
gh-149225: Expose Py_CriticalSection in Stable ABI (GH-149227)
encukou May 4, 2026
952784a
gh-137030: Fix YIELD_VALUE bytecode assertion (#149184)
vstinner May 4, 2026
9846407
gh-143732: add specialization for `FOR_ITER` (GH-148745)
NekoAsakura May 4, 2026
10f950c
gh-148690: Build Windows freethreaded binaries into separate director…
zooba May 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ jobs:
- { name: openssl, version: 3.4.5 }
- { name: openssl, version: 3.5.6 }
- { name: openssl, version: 3.6.2 }
- { name: openssl, version: 4.0.0 }
## AWS-LC
- { name: aws-lc, version: 1.72.1 }
env:
Expand Down
61 changes: 52 additions & 9 deletions Doc/c-api/synchronization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ there is no :c:type:`PyObject` -- for example, when working with a C type that
does not extend or wrap :c:type:`PyObject` but still needs to call into the C
API in a manner that might lead to deadlocks.

The functions and structs used by the macros are exposed for cases
where C macros are not available. They should only be used as in the
given macro expansions. Note that the sizes and contents of the structures may
change in future Python versions.

.. note::

Operations that need to lock two objects at once must use
Expand All @@ -114,12 +109,15 @@ section API avoids potential deadlocks due to reentrancy and lock ordering
by allowing the runtime to temporarily suspend the critical section if the
code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.

.. _critical-section-macros:

.. c:macro:: Py_BEGIN_CRITICAL_SECTION(op)

Acquires the per-object lock for the object *op* and begins a
critical section.

In the free-threaded build, this macro expands to::
In the free-threaded build, and when building for the
:ref:`Stable ABI <stable-abi>`, this macro expands to::

{
PyCriticalSection _py_cs;
Expand Down Expand Up @@ -150,7 +148,8 @@ code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.

Ends the critical section and releases the per-object lock.

In the free-threaded build, this macro expands to::
In the free-threaded build, and when building for the
:ref:`Stable ABI <stable-abi>`, this macro expands to::

PyCriticalSection_End(&_py_cs);
}
Expand Down Expand Up @@ -179,7 +178,8 @@ code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.

Locks the mutexes *m1* and *m2* and begins a critical section.

In the free-threaded build, this macro expands to::
In the free-threaded build, and when building for the
:ref:`Stable ABI <stable-abi>`, this macro expands to::

{
PyCriticalSection2 _py_cs2;
Expand All @@ -196,7 +196,8 @@ code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.

Ends the critical section and releases the per-object locks.

In the free-threaded build, this macro expands to::
In the free-threaded build, and when building for the
:ref:`Stable ABI <stable-abi>`, this macro expands to::

PyCriticalSection2_End(&_py_cs2);
}
Expand All @@ -205,6 +206,48 @@ code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.

.. versionadded:: 3.13

Low-level critical section API
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The following functions and structs are exposed for cases where C macros
are not available.

.. c:function:: void PyCriticalSection_Begin(PyCriticalSection *c, PyObject *op)
void PyCriticalSection_End(PyCriticalSection *c)
void PyCriticalSection2_Begin(PyCriticalSection2 *c, PyObject *a, PyObject *b)
void PyCriticalSection2_End(PyCriticalSection2 *c);

To be used only as in the macro expansions
listed :ref:`earlier in this section <critical-section-macros>`.

In non-:term:`free-threaded <free threading>` builds of CPython, these
functions do nothing.

.. versionadded:: 3.13

.. c:type:: PyCriticalSection
PyCriticalSection2

To be used only as in the macro expansions
listed :ref:`earlier in this section <critical-section-macros>`.
Note that the contents of the structures are private and their meaning may
change in future Python versions.

.. versionadded:: 3.13

.. c:function:: void PyCriticalSection_BeginMutex(PyCriticalSection *c, PyMutex *m);
void PyCriticalSection2_BeginMutex(PyCriticalSection2 *c, PyMutex *m1, PyMutex *m2);

.. (These need to be in a separate section without a Stable ABI anotation.)

To be used only as in the macro expansions
listed :ref:`earlier in this section <critical-section-macros>`.

In non-:term:`free-threaded <free threading>` builds of CPython, these
functions do nothing.

.. versionadded:: 3.14


Legacy locking APIs
-------------------
Expand Down
11 changes: 11 additions & 0 deletions Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions Doc/library/array.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ defined:
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'d'`` | double | float | 8 | |
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'F'`` | float complex | complex | 8 | \(4) |
| ``'Zf'`` | float complex | complex | 8 | \(4) |
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'D'`` | double complex | complex | 16 | \(4) |
| ``'Zd'`` | double complex | complex | 16 | \(4) |
+-----------+--------------------+-------------------+-----------------------+-------+


Expand Down Expand Up @@ -80,7 +80,7 @@ Notes:
.. versionadded:: 3.15

(4)
Complex types (``F`` and ``D``) are available unconditionally,
Complex types (``Zf`` and ``Zd``) are available unconditionally,
regardless on support for complex types (the Annex G of the C11 standard)
by the C compiler.
As specified in the C11 standard, each complex type is represented by a
Expand All @@ -105,7 +105,10 @@ The module defines the following item:

.. data:: typecodes

A string with all available type codes.
A tuple with all available type codes.

.. versionchanged:: next
The type changed from :class:`str` to :class:`tuple`.


The module defines the following type:
Expand Down
5 changes: 5 additions & 0 deletions Doc/library/calendar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,11 @@ The following options are accepted:
By default, today's date is highlighted in color and can be
:ref:`controlled using environment variables <using-on-controlling-color>`.

.. versionchanged:: next
By default, the month is now also highlighted in color, and
the days of the week are also in color. This behavior can be
:ref:`controlled using environment variables <using-on-controlling-color>`.

*HTML-mode options:*

.. option:: --css CSS, -c CSS
Expand Down
10 changes: 7 additions & 3 deletions Doc/library/ctypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,19 @@ in both C and ``libffi``, the following complex types are available:
* - :class:`c_float_complex`
- :c:expr:`float complex`
- :py:class:`complex`
- ``'F'``
- ``'Zf'``
* - :class:`c_double_complex`
- :c:expr:`double complex`
- :py:class:`complex`
- ``'D'``
- ``'Zd'``
* - :class:`c_longdouble_complex`
- :c:expr:`long double complex`
- :py:class:`complex`
- ``'G'``
- ``'Zg'``

.. versionchanged:: next
The :py:attr:`~_SimpleCData._type_` types ``F``, ``D`` and ``G`` have been
replaced with ``Zf``, ``Zd`` and ``Zg``.


All these types can be created by calling them with an optional initializer of
Expand Down
9 changes: 8 additions & 1 deletion Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1833,8 +1833,15 @@ from the command line.

By default, accepts the name of a module and prints the source of that
module. A class or function within the module can be printed instead by
appended a colon and the qualified name of the target object.
appending a colon and the qualified name of the target object.

.. option:: --details

Print information about the specified object rather than the source code

.. versionchanged:: next

The ``--details`` option now supports basic introspection for modules
without available source code and indicates when modules are frozen.
It also indicates when the given target reference is not the canonical
name of the referenced object.
6 changes: 3 additions & 3 deletions Doc/library/ipaddress.rst
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ write code that handles both IP versions correctly. Address objects are

.. attribute:: ipv4_mapped

For addresses that appear to be IPv4 mapped addresses (starting with
``::FFFF/96``), this property will report the embedded IPv4 address.
For any other address, this property will be ``None``.
For addresses that appear to be IPv4 mapped addresses in the range
``::FFFF:0:0/96`` as defined by :RFC:`4291`, this property reports the
embedded IPv4 address. For any other address, this property will be ``None``.

.. attribute:: scope_id

Expand Down
9 changes: 8 additions & 1 deletion Doc/library/struct.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ platform-dependent.
+--------+--------------------------+--------------------+----------------+------------+
| ``D`` | :c:expr:`double complex` | complex | 16 | \(10) |
+--------+--------------------------+--------------------+----------------+------------+
| ``Zf`` | :c:expr:`float complex` | complex | 8 | \(10) |
+--------+--------------------------+--------------------+----------------+------------+
| ``Zd`` | :c:expr:`double complex` | complex | 16 | \(10) |
+--------+--------------------------+--------------------+----------------+------------+
| ``s`` | :c:expr:`char[]` | bytes | | \(9) |
+--------+--------------------------+--------------------+----------------+------------+
| ``p`` | :c:expr:`char[]` | bytes | | \(8) |
Expand All @@ -280,6 +284,9 @@ platform-dependent.
.. versionchanged:: 3.14
Added support for the ``'F'`` and ``'D'`` formats.

.. versionchanged:: next
Added support for the ``'Zf'`` and ``'Zd'`` formats.

.. seealso::

The :mod:`array` and :ref:`ctypes <ctypes-fundamental-data-types>` modules,
Expand Down Expand Up @@ -372,7 +379,7 @@ Notes:
For the ``'F'`` and ``'D'`` format characters, the packed representation uses
the IEEE 754 binary32 and binary64 format for components of the complex
number, regardless of the floating-point format used by the platform.
Note that complex types (``F`` and ``D``) are available unconditionally,
Note that complex types (``F``/``Zf`` and ``D``/``Zd``) are available unconditionally,
despite complex types being an optional feature in C.
As specified in the C11 standard, each complex type is represented by a
two-element C array containing, respectively, the real and imaginary parts.
Expand Down
7 changes: 4 additions & 3 deletions Doc/reference/simple_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,9 @@ The basic import statement (no :keyword:`from` clause) is executed in two
steps:

#. find a module, loading and initializing it if necessary
#. define a name or names in the local namespace for the scope where
the :keyword:`import` statement occurs.
#. define a name or names in the current namespace for the scope where
the :keyword:`import` statement occurs, just as an assignment statement
would (including :keyword:`global` and :keyword:`nonlocal` semantics).

When the statement contains multiple clauses (separated by
commas) the two steps are carried out separately for each clause, just
Expand Down Expand Up @@ -807,7 +808,7 @@ The :keyword:`from` form uses a slightly more complex process:
#. if not, attempt to import a submodule with that name and then
check the imported module again for that attribute
#. if the attribute is not found, :exc:`ImportError` is raised.
#. otherwise, a reference to that value is stored in the local namespace,
#. otherwise, a reference to that value is stored in the current namespace,
using the name in the :keyword:`!as` clause if it is present,
otherwise using the attribute name

Expand Down
38 changes: 31 additions & 7 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,9 @@ Other language changes
(Contributed by James Hilton-Balfe in :gh:`128335`.)

* The class :class:`memoryview` now supports the :c:expr:`float complex` and
:c:expr:`double complex` C types: formatting characters ``'F'`` and ``'D'``
:c:expr:`double complex` C types: formatting characters ``'Zf'`` and ``'Zd'``
respectively.
(Contributed by Sergey B Kirpichev in :gh:`146151`.)
(Contributed by Victor Stinner in :gh:`146151` and :gh:`148675`.)

* Allow the *count* argument of :meth:`bytes.replace` to be a keyword.
(Contributed by Stan Ulbrych in :gh:`147856`.)
Expand Down Expand Up @@ -724,13 +724,17 @@ array
-----

* Support the :c:expr:`float complex` and :c:expr:`double complex` C types:
formatting characters ``'F'`` and ``'D'`` respectively.
(Contributed by Sergey B Kirpichev in :gh:`146151`.)
formatting characters ``'Zf'`` and ``'Zd'`` respectively.
(Contributed by Victor Stinner in :gh:`146151` and :gh:`148675`.)

* Support half-floats (16-bit IEEE 754 binary interchange format): formatting
character ``'e'``.
(Contributed by Sergey B Kirpichev in :gh:`146238`.)

* The :data:`array.typecodes` type changed from :class:`str` to :class:`tuple`
to support type codes longer than 1 character (``Zf`` and ``Zd``).
(Contributed by Victor Stinner in :gh:`148675`.)


ast
---
Expand Down Expand Up @@ -832,14 +836,19 @@ binascii
calendar
--------

* Calendar pages generated by the :class:`calendar.HTMLCalendar` class now support
dark mode and have been migrated to the HTML5 standard for improved accessibility.
(Contributed by Jiahao Li and Hugo van Kemenade in :gh:`137634`.)
* :mod:`calendar`'s :ref:`command-line <calendar-cli>` text output has more
color. This can be controlled with :ref:`environment variables
<using-on-controlling-color>`.
(Contributed by Hugo van Kemenade in :gh:`148352`.)

* The :mod:`calendar`'s :ref:`command-line <calendar-cli>` HTML output now
accepts the year-month option: ``python -m calendar -t html 2009 06``.
(Contributed by Pål Grønås Drange in :gh:`140212`.)

* Calendar pages generated by the :class:`calendar.HTMLCalendar` class now support
dark mode and have been migrated to the HTML5 standard for improved accessibility.
(Contributed by Jiahao Li and Hugo van Kemenade in :gh:`137634`.)


collections
-----------
Expand Down Expand Up @@ -1736,6 +1745,12 @@ ctypes
which has been deprecated since Python 3.13.
(Contributed by Bénédikt Tran in :gh:`133866`.)

* Change the :py:attr:`~ctypes._SimpleCData._type_` of
:class:`~ctypes.c_float_complex`, :class:`~ctypes.c_double_complex` and
:class:`~ctypes.c_longdouble_complex` from ``F``, ``D`` and ``G`` to ``Zf``,
``Zd`` and ``Zg`` for compatibility with numpy.
(Contributed by Victor Stinner in :gh:`148675`.)


datetime
--------
Expand Down Expand Up @@ -2045,6 +2060,10 @@ New features

(Contributed by Victor Stinner in :gh:`141510`.)

* Add :c:func:`PyObject_CallFinalizerFromDealloc` function to the limited C
API.
(Contributed by Victor Stinner in :gh:`146063`.)

* Add :c:func:`PySys_GetAttr`, :c:func:`PySys_GetAttrString`,
:c:func:`PySys_GetOptionalAttr`, and :c:func:`PySys_GetOptionalAttrString`
functions as replacements for :c:func:`PySys_GetObject`.
Expand Down Expand Up @@ -2079,6 +2098,11 @@ New features

(Contributed by Victor Stinner in :gh:`129813`.)

* :c:type:`PyCriticalSection` and related functions are added to the Stable
ABI.

(Contributed in :gh:`149227`.)

* Add a new :c:func:`PyImport_CreateModuleFromInitfunc` C-API for creating
a module from a *spec* and *initfunc*.
(Contributed by Itamar Oren in :gh:`116146`.)
Expand Down
Loading
Loading