* Use pytest.importorskip to get _xxsubinterpreters
* tests: use modern interpreter API
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* tests: try to fix beta2
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* fix: remove debug printout
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* tests: drop useless checks
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* tests: improve check for 3.14.0b3 and b4+
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* style: pre-commit fixes
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add overload to enable `.def(py::init(&rtrn_shcp))`. Also uncomment `.def(py::init(&rtrn_uqcp))` and `.def(py::init(&rtrn_udcp))`, which happen to work already (not sure what change in the past made those work).
* Introduce `construct_from_shared_ptr()` helper for DRY-ness.
* Revert PR #5700 production code change (pybind11/detail/struct_smart_holder.h).
```
git checkout b19489145b2c7a117138632d624809dfb3b380bb~1 include/pybind11/detail/struct_smart_holder.h
```
* Introduce `get_internals().get_memory_guarded_delete()`
* [skip ci] Only pass around `memory::get_guarded_delete` function pointer.
* [skip ci] Change a variable name for internal consistency. Add 3 x NOTE: PYBIND11_INTERNALS_VERSION needs to be bumped if changes are made to this struct.
* Add comment: get_internals().get_memory_guarded_delete does not need with_internals()
* Traverse all DSOs to find memory::guarded_delete with matching RTTI.
* Add nullptr check to dynamic_cast overload.
Suggested by ChatGPT for these reasons:
* Prevents runtime RTTI lookups on nullptr.
* Helps avoid undefined behavior if users pass in nulls from failed casts or optional paths.
* Ensures consistent return value semantics and no accidental access to vtable.
* Improve smart_holder unique_ptr deleter compatibility checks across DSOs:
* Replace RTTI-based detection of std::default_delete<T> with a constexpr check to avoid RTTI reliance
* Add type_info_equal_across_dso_boundaries() fallback using type_info::name() for RTTI equality across macOS DSOs
* Rename related flags and functions for clarity (e.g., builtin → std_default)
* Improves ABI robustness and clarity of ownership checks in smart_holder
* Trivial renaming for internal consistency: builtin_delete → std_default_delete
* Add get_trampoline_self_life_support to detail::type_info (passes local testing).
* Polish previous commit slightly.
* [skip ci] Store memory::get_guarded_delete in `detail::type_info` instead of `detail::internals` (no searching across DSOs required).
* Revert change suggested by ChatGPT. After double-checking, ChatGPT agrees this isn't needed.
* Minor polishing.
* add support for const pointers in smart pointers
* use c++11 compatible code
* add template parameter in test
* Make the const-removal clearly visible. This simplifies the production code changes significantly.
For background see: https://claude.ai/share/4085d9ab-a859-44cc-bb56-450e472f817a
* test without leaks
* add namespace for test
* rename test
* fix test compilation
* using namespace test_const_only_smart_ptr;
* fix smartptr in test
* smaller test body
* move test
* style: pre-commit fixes
---------
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* docs: prepare for RC 3
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* docs: one more rc 3 update
* chore: bump to 3.0.0rc3
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* chore: handle null for `py::scoped_critical_section`
* test: add tests for `py::scoped_critical_section`
* test: use assert instead of REQUIRE
* feat: enable faulthandler for pytest
* chore: use `__has_include(<barrier>)`
* fix: fix segmentation fault in test
* fix: test critical_section for no-gil only
* test: run new tests only
* test: ensure non-empty test selection
* fix: fix test critical_section
* fix: change Python 3.14.0b1/2 xfail tests to non-strict
* test: trigger gc manually
* test: mark xfail to `DynamicClass`
* Use `namespace test_scoped_critical_section_ns` (standard approach to guard against name clashes).
* Simplify changes in pybind11/critical_section.h and add test_nullptr_combinations()
* test: disable Python devmode in pytest
* test: add comprehensive comments for the tests
* test: add a summary comment for tests
* refactor: simpler impl
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
* Refactor internals to use a holder that manages the PP
* Refactor internals to use a holder that manages the PP
* Fix cleanup/destruction issues.
* Fix one more destruction issue
Should now just be able to delete the internals PP on destruction
* Make clang-tidy happy
* Try to fix exception translators issue on certain platforms
Also fix a couple more pedantic warings
* Fix test, after internals is free'd it can come back at the same address
So instead, just make sure it was zero'd and don't try to compare the addresses.
Also a little code cleanup
* Comment tweak [skip ci]
* Switch to ifdef instead of if
* Re-enable subinterpreters in iOS
* style: pre-commit fixes
* Oops, this snuck in on merge
* fix: bump ABI version to 10
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
* test: Added test case for visibility of common symbols across shared libraries
* style: pre-commit fixes
* tests: cmake target name fix
* tests: Added visibility test to ci
* tests: set the default visibility to hidden
* prototype/proof-of-concept fix: PYBIND11_EXPORT_GUARDED_DELETE
* Fix silly oversight: actually use PYBIND11_EXPORT_GUARDED_DELETE
* Update struct_smart_holder.h
* style: pre-commit fixes
* Update include/pybind11/detail/struct_smart_holder.h
* Update struct_smart_holder.h
* ci: fix addition to reusable-standard.yml
* Update CMakeLists.txt
* refactor: rename tests to test_cross_module_rtti
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
* ci: add iOS
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* Update .github/workflows/tests-cibw.yml
* ci: use test groups
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* fix future type hints
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* style: pre-commit fixes
* remove unused var
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* remove union_helper
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* fix speelling error
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* base case for union_concat
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* style: pre-commit fixes
* add case for one descr
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* weakref and final test
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* Add acrpss_version_type_hint_checker
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* cleanup
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* style: pre-commit fixes
* remove test.pyi
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* use new unions and add fixture
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* timohl suggested cleanup
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* style: pre-commit fixes
* add missing auto
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
* style: pre-commit fixes
* move operator| def
---------
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* docs: more warnings about locking and the GIL
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* fix require → reacquire typo
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
* feat: scoped_critical_section
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* refactor: pull out to file
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* style: pre-commit fixes
* fix: GIL code in some compilers
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* fix: move to correct spot
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* refactor: use CPython macros to construct `PYBIND11_VERSION_HEX`
* docs: update release guide
* tests: add test to keep version values in sync
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* style: pre-commit fixes
* test: update version test
* test: update version test
* test: update version test
* chore: update code comments
* Update docs/release.rst
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>