* :pep:`728`: :ref:`TypedDict with typed extra items <whatsnew315-typeddict>`
* :pep:`747`: :ref:`Annotating type forms with TypeForm
<whatsnew315-typeform>`
-* :pep:`800`: Disjoint bases in the type system
+* :pep:`800`: :ref:`Disjoint bases in the type system <whatsnew315-disjoint-base>`
* :pep:`782`: :ref:`A new PyBytesWriter C API to create a Python bytes object
<whatsnew315-pybyteswriter>`
* :pep:`803`, :pep:`820 <820>`, :pep:`793 <793>`:
.. _whatsnew315-abi3t:
-:pep:`803` -- Stable ABI for free-threaded builds
--------------------------------------------------
+:pep:`803`: Stable ABI for free-threaded builds
+-----------------------------------------------
C extensions that target the :ref:`Stable ABI <stable-abi>` can now be
compiled for the new *Stable ABI for Free-Threaded Builds* (also known
Stable ABI for Free-Threaded Builds should typically
be selected in a build tool (such as, for example, Setuptools, meson-python,
scikit-build-core, or Maturin).
-At the time of writing, these tools did **not** support ``abi3t``.
+At the time of writing, these tools do **not** support ``abi3t``.
If this is the case for your tool, compile for ``cp315t`` separately.
If not using a build tool -- or when writing such a tool -- you can select
``abi3t`` by setting the macro :c:macro:`!Py_TARGET_ABI3T` as discussed
(Contributed by Alex Grönholm & Gregory P. Smith in :gh:`125862`.)
+ctypes
+------
+
+* 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`.)
+
+
dataclasses
-----------
------------------
* Previously, when accessing a distribution metadata directory not
- containing a metadata file, ``metadata()`` and ``Distribution.metadata()``
+ containing a metadata file, ``metadata()`` and ``Distribution.metadata``
would return an empty ``PackageMetadata`` object as if the file
was present but empty. Now, a ``MetadataNotFound`` exception is raised.
See `importlib_metadata#493 <https://github.com/python/importlib_metadata/issues/493>`_
(Contributed by Petr Viktorin for :cve:`2025-4517`.)
+pathlib
+-------
+
+* :meth:`pathlib.Path.mkdir` now has a *parent_mode* parameter that allows
+ specifying the mode for intermediate directories when ``parents=True``.
+ (Contributed by Gregory P. Smith in :gh:`86533`.)
+
+
pdb
---
supports "External PSKs" in TLSv1.3, as described in :rfc:`9258`.
(Contributed by Will Childs-Klein in :gh:`133624`.)
-* Added new methods for managing groups used for SSL key agreement
+* Added new methods for managing groups used for SSL key agreement:
* :meth:`ssl.SSLContext.set_groups` sets the groups allowed for doing
key agreement, extending the previous
as it was incorrectly inferred at runtime before.
(Contributed by Nikita Sobolev in :gh:`137191`.)
+ .. _whatsnew315-disjoint-base:
+
* :pep:`800`: Add :deco:`typing.disjoint_base`, a new decorator marking a class
as a disjoint base. This is an advanced feature primarily intended to allow
type checkers to faithfully reflect the runtime semantics of types defined
whether a string can be used as an element or attribute name in XML.
(Contributed by Serhiy Storchaka in :gh:`139489`.)
-* Add the :func:`xml.is_valid_text` function, which allows to check
- whether a string can be used in the XML document.
+* Add the :func:`xml.is_valid_text` function to check
+ whether a string can be used in an XML document.
(Contributed by Serhiy Storchaka in :gh:`139489`.)
code results in constants, the code can be simplified by the JIT.
(Contributed by Ken Jin and Savannah Ostrowski in :gh:`132732`.)
-:term:`Reference count`\ s are avoided whenever it is safe to do so. This generally
-reduces the cost of most operations in Python.
+:term:`Reference counts <reference count>` are avoided whenever it is safe to
+do so. This generally reduces the cost of most operations in Python.
(Contributed by Ken Jin, Donghee Na, Zheao Li, Hai Zhu, Savannah Ostrowski,
Reiden Ong, Noam Cohen, Tomas Roun, PuQing, Cajetan Rodrigues, and Sacul in :gh:`134584`.)
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
--------
pathlib
-------
-* :meth:`pathlib.Path.mkdir` now has a *parent_mode* parameter that allows
- specifying the mode for intermediate directories when ``parents=True``.
- (Contributed by Gregory P. Smith in :gh:`86533`.)
-
* Removed deprecated :meth:`!pathlib.PurePath.is_reserved`.
Use :func:`os.path.isreserved` to detect reserved paths on Windows.
(Contributed by Nikita Sobolev in :gh:`133875`.)
types
-----
-* Removed deprecated in :pep:`626` since Python 3.12
- :attr:`!codeobject.co_lnotab` from :class:`types.CodeType`.
+* Removed :attr:`!codeobject.co_lnotab` from :class:`types.CodeType`,
+ deprecated since Python 3.12 by :pep:`626`.
(Contributed by Nikita Sobolev in :gh:`134690`.)
and changing its value does *not* explicitly close the current file.
+* :mod:`profile`:
+
+ * The :mod:`!profile` module is deprecated and will be removed in
+ Python 3.17. Use :mod:`profiling.tracing` instead, which provides a
+ compatible API. See :pep:`799` for details.
+ (Contributed by Pablo Galindo and László Kiss Kollár in :gh:`138122`.)
+
+
* :mod:`re`:
* :func:`re.match` and :meth:`re.Pattern.match` are now
(Contributed by Sergey B Kirpichev and Serhiy Storchaka in :gh:`143715`.)
- * Using ``'F'`` and ``'D'`` type codes now are :term:`soft deprecated`
- in favor of two-letter forms ``'Zf'`` and ``'Zd'``.
+ * The ``'F'`` and ``'D'`` type codes are now :term:`soft deprecated`
+ in favor of the two-letter forms ``'Zf'`` and ``'Zd'``.
(Contributed by Sergey B Kirpichev in :gh:`121249`.)
functions as replacements for :c:func:`PySys_GetObject`.
(Contributed by Serhiy Storchaka in :gh:`108512`.)
-* Add :c:type:`PyUnstable_Unicode_GET_CACHED_HASH` to get the cached hash of
+* Add :c:func:`PyUnstable_Unicode_GET_CACHED_HASH` to get the cached hash of
a string. See the documentation for caveats.
(Contributed by Petr Viktorin in :gh:`131510`.)
* :c:func:`PyBytesWriter_Create`
* :c:func:`PyBytesWriter_Discard`
+ * :c:func:`PyBytesWriter_Finish`
* :c:func:`PyBytesWriter_FinishWithPointer`
* :c:func:`PyBytesWriter_FinishWithSize`
- * :c:func:`PyBytesWriter_Finish`
* :c:func:`PyBytesWriter_Format`
* :c:func:`PyBytesWriter_GetData`
* :c:func:`PyBytesWriter_GetSize`
- * :c:func:`PyBytesWriter_GrowAndUpdatePointer`
* :c:func:`PyBytesWriter_Grow`
+ * :c:func:`PyBytesWriter_GrowAndUpdatePointer`
* :c:func:`PyBytesWriter_Resize`
* :c:func:`PyBytesWriter_WriteBytes`
(Contributed in :gh:`149227`.)
-* Add a new :c:func:`PyImport_CreateModuleFromInitfunc` C-API for creating
+* 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`.)
thread state.
(Contributed by Victor Stinner in :gh:`139653`.)
-* Add :c:func:`PyUnstable_SetImmortal` C-API function to mark objects as :term:`immortal`.
+* Add :c:func:`PyUnstable_SetImmortal` C API function to mark objects as :term:`immortal`.
(Contributed by Kumar Aditya in :gh:`143300`.)
* Restore private provisional ``_Py_InitializeMain()`` function removed in
At runtime, huge pages must be explicitly enabled by setting the
:envvar:`PYTHON_PYMALLOC_HUGEPAGES` environment variable to ``1``.
-* Annotating anonymous mmap usage is now supported if Linux kernel supports
+* Annotating anonymous mmap usage is now supported if the Linux kernel supports
:manpage:`PR_SET_VMA_ANON_NAME <PR_SET_VMA(2const)>` (Linux 5.17 or newer).
Annotations are visible in ``/proc/<pid>/maps`` if the kernel supports the feature
- and :option:`-X dev <-X>` is passed to the Python or Python is built in :ref:`debug mode <debug-build>`.
+ and :option:`-X dev <-X>` is passed to Python,
+ or Python is built in :ref:`debug mode <debug-build>`.
(Contributed by Donghee Na in :gh:`141770`.)
* CPython is now built with frame pointers enabled by default