New Features:
- Support free-threaded CPython (3.13t). Add
py::mod_gil_not_used()
tag to indicate if a module supports running with the GIL disabled. #5148 - Support for Python 3.6 was removed. (Official end-of-life: 2021-12-23). #5177
py::list
gained a.clear()
method. #5153- Support for
Union
,Optional
,type[T]
,typing.TypeGuard
,typing.TypeIs
,typing.Never
,typing.NoReturn
andtyping.Literal
was added topybind11/typing.h
. #5166 #5165 #5194 #5193 #5192 - In CMake, if
PYBIND11_USE_CROSSCOMPILING
is enabled, thenCMAKE_CROSSCOMPILING
will be respected and will keep pybind11 from accessing the interpreter during configuration. Several CMake variables will be required in this case, but can be deduced from the environment variableSETUPTOOLS_EXT_SUFFIX
. The default (currentlyOFF
) may be changed in the future. #5083
Bug fixes:
- A refcount bug (leading to heap-use-after-free) involving trampoline functions with
PyObject *
return type was fixed. #5156 - Return
py::ssize_t
from.ref_count()
instead ofint
. #5139 - A subtle bug involving C++ types with unusual
operator&
overrides was fixed. #5189 - Support Python 3.13 with minor fix, add to CI. #5127
- Fix mistake affecting old cmake and old boost. #5149
Documentation:
- Build docs updated to feature scikit-build-core and meson-python, and updated setuptools instructions. #5168
Tests:
- Avoid immortal objects in tests. #5150
CI:
- Compile against Python 3.13t in CI.
- Use
macos-13
(Intel) for CI jobs for now (will drop Python 3.7 soon). #5109 - Releases now have artifact attestations, visible at https://github.com/pybind/pybind11/attestations. #5196
Other: