Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Created by
brew bump
Created with
brew bump-formula-pr
.release notes
The
smart_holder
branch has been merged, enablingpy::class_<T, py::smart_holder>
, which handles two-way conversion withstd::unique_ptr<T>
andstd::shared_ptr<T>
(simultaneously), disowning a Python object being passed tostd::unique_ptr<T>
, trampoline objects, andstd::enable_shared_from_this
. #5542Added support for
std::shared_ptr<const T>
inpy::init()
when usingpy::smart_holder
, complementing existing support forstd::unique_ptr<const T>
. #5731Support const-only smart pointers. #5718
Eliminate cross-DSO RTTI reliance from
trampoline_self_life_support
functionality,smart_holder
deleter detection, and othersmart_holder
bookkeeping. Resolves platform-specific issues on macOS related to cross-DSOdynamic_cast
andtypeid
mismatches. #5728 (replaces #5700)Changed
PYBIND11_MODULE
macro implementation to perform multi-phase module initialization (PEP 489) behind the scenes. #5574 and avoid destruction #5688Support for sub-interpreters (both isolated (with separate GILs) and legacy (with a global GIL). Add the
py::multiple_interpreters::per_interpreter_gil()
tag (or,py::multiple_interpreters::shared_gil()
for legacy interpreter support) toPYBIND11_MODULE
calls (as the third parameter) to indicate that a module supports running with sub-interpreters. #5564Rename macro
PYBIND11_SUBINTERPRETER_SUPPORT
->PYBIND11_HAS_SUBINTERPRETER_SUPPORT
to meet naming convention. #5682Allow subinterpreter support to be disabled if defined to 0. This is mostly an emergency workaround, and is not exposed in CMake. #5708 and #5710
Modify internals pointer-to-pointer implementation to not use
thread_local
(better iOS support). #5709Support implementations without subinterpreter support. #5732
Changed
PYBIND11_EMBEDDED_MODULE
macro implementation to perform multi-phase module initialization (PEP 489) behind the scenes and to supportpy::mod_gil_not_used()
,py::multiple_interpreters::per_interpreter_gil()
andpy::multiple_interpreters::shared_gil()
. #5665 and consolidate code #5670Added API in
pybind11/subinterpreter.h
for embedding sub-intepreters (requires Python 3.12+). #5666py::native_enum
was added, for conversions between Python's native (stdlib) enum types and C++ enums. #5555Add class doc string to
py::native_enum
. #5617Fix signature for functions with a
native_enum
in the signature. #5619Support
py::numpy_scalar<>
/py::make_scalar()
for NumPy types. #5726A
py::release_gil_before_calling_cpp_dtor
option (forpy::class_
) was added to resolve the long-standing issue #1446. #5522Add
dtype::normalized_num
anddtype::num_of
. #5429Add support for
array_t<handle>
andarray_t<object>
. #5427Added
py::warnings
namespace withpy::warnings::warn
andpy::warnings::new_warning_type
that provides the interface for Python warnings. #5291stl.h
list|set|map_caster
were made more user friendly: it is no longer necessary to explicitly convert Python iterables totuple()
,set()
, ormap()
in many common situations. #4686The
array_caster
in pybind11/stl.h was enhanced to support value types that are not default-constructible. #5305pybind11/conduit/pybind11_platform_abi_id.h
was factored out, to maximize reusability ofPYBIND11_PLATFORM_ABI_ID
(for other Python/C++ binding systems). Separately, a note was added to explain that the conduit feature only covers from-Python-to-C++ conversions. #5375 | #5740Added support for finding pybind11 using pkgconf distributed on pypi. #5552
Support
--extension-suffix
on the pybind11 command. #5360Add semi-public API:
pybind11::detail::is_holder_constructed
and update example forpybind11::custom_type_setup
in documentation. #5669Added
py::scoped_critical_section
to support free-threaded mode. #5684 | #5706New Features / fixes (typing):
Added option for different arg/return type hints to
type_caster
. Updatedstl/filesystem
to use correct arg/return type hints. Updatedpybind11::typing
to use correct arg/return type hints for nested types. #5450Updated type hint for
py::capsule
totype.CapsuleType
. #5567Adds support for
typing.SupportsInt
andtyping.SupportsFloat
. UpdateFinal
to be narrower type hint. Makestd::function
matchCallable
type. Fixio_name
bug inattr_with_type_hint
. #5540Rework of arg/return type hints to support
.noconvert()
. #5486Add
attr_with_type
for declaring attribute types andFinal
,ClassVar
type annotations. #5460Allow annotate methods with
py::pos_only
when only have theself
argument. Make arguments for auto-generated dunder methods positional-only. #5403Added
py::Args
andpy::KWArgs
to enable custom type hinting of*args
and**kwargs
(see PEP 484). #5357Switched to
numpy.typing.NDArray
andnumpy.typing.ArrayLike
. #5212Use
numpy.object_
instead ofobject
. #5571Fix module type hint. #5469
Fix Buffer type hint. #5662
Added support for
collections.abc
in type hints and convertible checks of STL casters andpy::buffer
. #5566Fix
typing
andcollections.abc
type hint ambiguity. #5663Add
typing_extensions
alternatives for all types that need them. #5693Removals:
Remove support for pybind11 v2 internals versions (4, 5, 6). (The internals version number has been bumped for pybind11 v3.) #5512 | #5530
Remove
make_simple_namespace
(added in 2.8.0, deprecated in 2.8.1). #5597Legacy-mode option
PYBIND11_NUMPY_1_ONLY
has been removed. #5595Add a deprecation warning to
.get_type
(deprecated in pybind11 2.6 in 2020). #5596Bug fixes:
Set
__file__
on submodules. #5584. Except on embedded modules. #5650pybind11-bound functions are now pickleable. #5580
Fix bug in
attr_with_type_hint
to allow objects to be inattr_with_type_hint
. #5576A
-Wmaybe-uninitialized
warning suppression was added inpybind11/eigen/matrix.h
. #5516PYBIND11_WARNING_POP
was incorrectly defined asPYBIND11_PRAGMA(clang diagnostic push)
. #5448PYBIND11_PLATFORM_ABI_ID
(which is used in composingPYBIND11_INTERNALS_ID
) was modernized to reflect actual ABI compatibility more accurately. #4953 | #5439Fix buffer protocol implementation. #5407
Fix iterator increment operator does not skip first item. #5400
When getting or deleting an element in a container bound by
bind_map
, print the key inKeyError
if it does not exist. #5397pybind11::builtin_exception
is now explicitly exported when linked to libc++. #5390Allow subclasses of
py::args
andpy::kwargs
. #5381Disable false-positive GCC 12 Bound Check warning. #5355
Update the dict when restoring pickles, instead of assigning a replacement dict. #5658
Properly define
_DEBUG
macro to1
instead of defining it without value. #5639Fix a missing time cast causing a compile error for newer ICC. #5621
Change the behavior of the default constructor of
py::slice
to be equivalent to::
in Python. #5620Bug fixes and features (CMake):
Enable FindPython mode by default, with a
COMPAT
mode that sets some of the old variables to ease transition. #5553Add an author warning that auto-calculated
PYTHON_MODULE_EXTENSION
may not respectSETUPTOOLS_EXT_SUFFIX
during cross-compilation. #5495Don't strip with
CMAKE_BUILD_TYPE
None. #5392Fix an issue with
NO_EXTRAS
addingpybind11::windows_extras
anyway. #5378Fix issue with NEW/OLD message showing up. #5656
Use CMake's warnings as errors if available (CMake 3.24+). #5612
Add support for running pybind11's tests via presets in CMake 3.25+. #5655 and support
--fresh
. #5668Experimental CMake support for Android. #5733
Presets now generate
compile_commands.json
. #5685Bug fixes (free-threading):
Fix data race in free threaded CPython when accessing a shared static variable. #5494
A free-threading data race in
all_type_info()
was fixed. #5419Added exception translator specific mutex used with
try_translate_exceptions
in the free-threaded build for internal locking. #5362Internals:
Consolidated all
PYBIND11_HAS_...
feature macros intopybind11/detail/common.h
to streamline backward compatibility checks and simplify internal refactoring. This change ensures consistent macro availability regardless of header inclusion order. #5647pybind11/gil_simple.h
was factored out frompybind11/gil.h
, so that it can easily be reused. #5614Use CPython macros to construct
PYBIND11_VERSION_HEX
. #5683Documentation:
Improved
reference_internal
policy documentation. #5528A new "Double locking, deadlocking, GIL" document was added. #5394
Add documenting for free-threading and subinterpreters.
#5659
Tests:
Download the final Catch2 2.x release if Catch download is requested. #5568
Explicitly used
signed char
for two numpy dtype tests. As seen when compiling usingclang
on Linux with the-funsigned-char
flag. #5545CI testing now includes
-Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls
in some jobs. #5523Add nightly wheels to scientific-python's nightly wheelhouse. #5675
Expect free-threaded warning when loading a non-free-threaded module. #5680
Run pytest under Python devmode. #5715
New and removed platforms:
Support Python 3.14 (beta 1+). #5646
Added support for GraalPy Python implementation (https://github.com/oracle/graalpython). #5380
Support and test iOS in CI. #5705
Support for PyPy 3.11 added. #5508 And test in ci. #5534
Support for PyPy 3.8 and 3.9 was dropped. #5578
Support for Python 3.7 was removed. (Official end-of-life: 2023-06-27). #5191
Support for CMake older than 3.15 removed. CMake 3.15-4.0 supported. #5304 and fix regression #5691.
Use scikit-build-core for the build backend for the PyPI
pybind11
. The CMake generation has been moved to the sdist->wheel step.PYBIND11_GLOBAL_SDIST
has been removed. #5598 and updated docs/ci. #5676clang 20 tested and used for clang-tidy. #5692
Drop testing on MSVC 2019 (as it is being removed from GitHub). #5712
Support Windows C++20 and Linux C++23 in tests. #5707
Full Changelog: pybind/pybind11@v3.0.0rc4...v3.0.0
View the full release notes at https://github.com/pybind/pybind11/releases/tag/v3.0.0.