Version 2.6.2
Minor missing functionality added:
- enum: add missing Enum.value property. #2739
- Allow thread termination to be avoided during shutdown for CPython 3.7+ via
.disarmforgil_scoped_acquire/gil_scoped_release. #2657
Fixed or improved behavior in a few special cases:
- Fix bug where the constructor of
objectsubclasses would not throw on being passed a Python object of the wrong type. #2701 - The
type_casterfor integers does not convert Python objects with__int__anymore withnoconvertor during the first round of trying overloads. #2698 - When casting to a C++ integer,
__index__is always called and not considered as conversion, consistent with Python 3.8+. #2801
Build improvements:
- Setup helpers:
extra_compile_argsandextra_link_argsautomatically set by Pybind11Extension are now prepended, which allows them to be overridden by user-setextra_compile_argsandextra_link_args. #2808 - Setup helpers: Don't trigger unused parameter warning. #2735
- CMake: Support running with
--warn-uninitializedactive. #2806 - CMake: Avoid error if included from two submodule directories. #2804
- CMake: Fix
STATIC/SHAREDbeing ignored in FindPython mode. #2796 - CMake: Respect the setting for
CMAKE_CXX_VISIBILITY_PRESETif defined. #2793 - CMake: Fix issue with FindPython2/FindPython3 not working with
pybind11::embed. #2662 - CMake: mixing local and installed pybind11's would prioritize the installed one over the local one (regression in 2.6.0). #2716
Bug fixes:
- Fixed segfault in multithreaded environments when using
scoped_ostream_redirect. #2675 - Leave docstring unset when all docstring-related options are disabled, rather than set an empty string. #2745
- The module key in builtins that pybind11 uses to store its internals changed from std::string to a python str type (more natural on Python 2, no change on Python 3). #2814
- Fixed assertion error related to unhandled (later overwritten) exception in CPython 3.8 and 3.9 debug builds. #2685
- Fix
py::gil_scoped_acquireassert with CPython 3.9 debug build. #2683 - Fix issue with a test failing on PyTest 6.2. #2741
Warning fixes:
- Fix warning modifying constructor parameter 'flag' that shadows a field of 'set_flag'
[-Wshadow-field-in-constructor-modified]. #2780 - Suppressed some deprecation warnings about old-style
__init__/__setstate__in the tests. #2759
Valgrind work:
- Fix invalid access when calling a pybind11
__init__on a non-pybind11 class instance. #2755 - Fixed various minor memory leaks in pybind11's test suite. #2758
- Resolved memory leak in cpp_function initialization when exceptions occurred. #2756
- Added a Valgrind build, checking for leaks and memory-related UB, to CI. #2746
Compiler support: