Commit Graph

1514 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
eb15f1a384 WIP: remove convert_type() call from loaded_as_shared_ptr() 2024-07-06 14:29:22 -07:00
Ralf W. Grosse-Kunstleve
4114e975d4 throw from convert_type() to expose bug.
```
========================================================= short test summary info ==========================================================
SKIPPED [4] test_class_sh_disowning_mi.py:67: BAKEIN_BREAK: AssertionError
SKIPPED [2] test_class_sh_disowning_mi.py:43: BAKEIN_BREAK: AssertionError
SKIPPED [2] test_class_sh_disowning_mi.py:54: BAKEIN_BREAK: AssertionError
SKIPPED [1] test_class_sh_basic.py:156: unconditional skip
SKIPPED [6] test_class_sh_mi_thunks.py:34: BAKEIN_BREAK: Segmentation fault
SKIPPED [2] test_class_sh_mi_thunks.py:43: BAKEIN_BREAK: AssertionError
SKIPPED [1] test_class_sh_mi_thunks.py:51: BAKEIN_BREAK: Failed: DID NOT RAISE <class 'ValueError'>
SKIPPED [1] test_stl.py:149: no <experimental/optional>
SKIPPED [1] test_smart_ptr.py:301: BAKEIN_EXPECTED: Failed: DID NOT RAISE <class 'RuntimeError'>
FAILED test_class_sh_basic.py::test_load_with_mtxt[pass_shmp-Shmp-pass_shmp:Shmp(_MvCtor)*_MvCtor] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_b - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_unique_ptr_consumer_roundtrip[pass_valu-rtrn_lref-True-False] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_cannot_disown_use_count_ne_1[pass_udcp-rtrn_udcp] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_unique_ptr_roundtrip - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_unique_ptr_consumer_roundtrip[pass_valu-rtrn_cref-True-False] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_load_with_mtxt[pass_uqmp-Uqmp-pass_uqmp:Uqmp(_MvCtor)*_MvCtor] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_load_with_mtxt[pass_uqcp-Uqcp-pass_uqcp:Uqcp(_MvCtor)*_MvCtor] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_load_with_rtrn_f[pass_udmp-rtrn_udmp-pass_udmp:rtrn_udmp] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_load_with_rtrn_f[pass_udcp-rtrn_udcp-pass_udcp:rtrn_udcp] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_deleter_roundtrip[pass_udcp_del-rtrn_udcp_del-pass_udcp_del:rtrn_udcp_del,udcp_deleter(_MvCtorTo)*_MvCtorTo] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_deleter_roundtrip[pass_udmp_del_nd-rtrn_udmp_del_nd-pass_udmp_del_nd:rtrn_udmp_del_nd,udmp_deleter_nd(_MvCtorTo)*_MvCtorTo] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_deleter_roundtrip[pass_udcp_del_nd-rtrn_udcp_del_nd-pass_udcp_del_nd:rtrn_udcp_del_nd,udcp_deleter_nd(_MvCtorTo)*_MvCtorTo] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning.py::test_same_twice - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning.py::test_mixed - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning.py::test_overloaded - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_pass_unique_ptr_disowns[pass_udmp-rtrn_udmp-pass_udmp:rtrn_udmp] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_pass_unique_ptr_disowns[pass_udcp-rtrn_udcp-pass_udcp:rtrn_udcp] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_cannot_disown_use_count_ne_1[pass_uqmp-rtrn_uqmp] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_cannot_disown_use_count_ne_1[pass_uqcp-rtrn_uqcp] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_unique_ptr_consumer_roundtrip[pass_valu-rtrn_valu-True-True] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_pass_unique_ptr_disowns[pass_uqmp-rtrn_uqmp-pass_uqmp:rtrn_uqmp] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base1_first[MI1-1-2-None] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_pure_cpp_sft_raw_ptr[make_pure_cpp_sft_unq_ptr] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_pure_cpp_sft_raw_ptr[make_pure_cpp_sft_shd_ptr] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_basic.py::test_drvd0_add_in_cpp_unique_ptr - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_basic.py::test_drvd1_add_in_cpp_unique_ptr - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_self_life_support.py::test_m_big5 - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_self_life_support.py::test_py_big5[0-Seed_CpCtor] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_virtual_py_cpp_mix.py::test_get_from_cpp_unique_ptr[Base-5101] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_virtual_py_cpp_mix.py::test_get_from_cpp_unique_ptr[PyBase-5323] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base2_first[MI1-1-2-None] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base2_first[MI2-3-4-1] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base2_first[MI3-5-6-1] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base2_first[MI4-7-8-1] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_inheritance.py::test_rtrn_shmp_drvd_pass_shcp_base - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_inheritance.py::test_rtrn_shmp_drvd_up_cast_pass_shcp_drvd - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_std_make_shared_factory - AssertionError: assert 'BEAKIN_WIP: ...ype() called.' == 'smart_holder...ed_from_this.'
FAILED test_class_sh_trampoline_shared_ptr_cpp_arg.py::test_shared_ptr_cpp_arg - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_ptr_cpp_arg.py::test_shared_ptr_cpp_prop - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_ptr_cpp_arg.py::test_shared_ptr_arg_identity - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base2[MI6-12-1] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base2[MI7-13-4] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base2[MI8-14-1] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base2[MI8b-15-3] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_multiple_registered_instances_for_same_pointee - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_multiple_registered_instances_for_same_pointee_leak - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_virtual_py_cpp_mix.py::test_get_from_cpp_unique_ptr[CppDerivedPlain-5202] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_virtual_py_cpp_mix.py::test_get_from_cpp_unique_ptr[CppDerived-5212] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_release_and_stash_leak - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_release_and_stash_via_shared_from_this - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_release_and_stash_via_shared_from_this_leak - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_pass_released_shared_ptr_as_unique_ptr - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_ptr_cpp_arg.py::test_shared_ptr_goaway - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_ptr_cpp_arg.py::test_infinite - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_ptr_cpp_arg.py::test_std_make_shared_factory[pass_through_shd_ptr] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_ptr_cpp_arg.py::test_std_make_shared_factory[pass_through_shd_ptr_release_gil] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_unique_ptr.py::test_m_clone_and_foo - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_unique_ptr_member.py::test_pointee_and_ptr_owner[give_up_ownership_via_unique_ptr] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_self_life_support.py::test_py_big5[2-Seed_OpEqLv] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_self_life_support.py::test_py_big5[3-Seed_OpEqRv] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_release_and_shared_from_this - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_release_and_shared_from_this_leak - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_load_with_mtxt[pass_shcp-Shcp-pass_shcp:Shcp(_MvCtor)*_MvCtor] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base1_first[MI2-3-4-1] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_unique_ptr_consumer_roundtrip[pass_rref-rtrn_valu-True-True] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base1_first[MI3-5-6-1] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base1_first[MI4-7-8-1] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_pass_unique_ptr_disowns[pass_uqcp-rtrn_uqcp-pass_uqcp:rtrn_uqcp] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_cannot_disown_use_count_ne_1[pass_udmp-rtrn_udmp] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_unique_ptr.py::test_m_clone - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base2_first[MI5-10-11-1] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_self_life_support.py::test_py_big5[1-Seed_MvCtor] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_multiple_registered_instances_for_same_pointee_recursive - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_virtual_py_cpp_mix.py::test_get_from_cpp_unique_ptr[PyCppDerived-5434] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_basic.py::test_drvd0_add_in_cpp_shared_ptr - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_release_and_stash - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_basic.py::test_deleter_roundtrip[pass_udmp_del-rtrn_udmp_del-pass_udmp_del:rtrn_udmp_del,udmp_deleter(_MvCtorTo)*_MvCtorTo] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_unique_ptr_member.py::test_pointee_and_ptr_owner[give_up_ownership_via_shared_ptr] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_from_this.py::test_pure_cpp_sft_raw_ptr[make_pure_cpp_sft_raw_ptr] - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_trampoline_shared_ptr_cpp_arg.py::test_shared_ptr_alias_nonpython - RuntimeError: BEAKIN_WIP: convert_type() called.
FAILED test_class_sh_disowning_mi.py::test_disown_base1_first[MI5-10-11-1] - RuntimeError: BEAKIN_WIP: convert_type() called.
================================================ 82 failed, 939 passed, 20 skipped in 4.02s ================================================
```
2024-07-06 13:11:20 -07:00
Ralf W. Grosse-Kunstleve
af467ea1a6 WIP 2024-07-06 11:17:00 -07:00
Ralf W. Grosse-Kunstleve
70ba91f721 Inline smart_holder_type_caster_support, trampoline_self_life_support in type_caster_base.h: the organization of the existing code makes it very difficult to factor the added code properly. 2024-07-06 11:04:25 -07:00
Ralf W. Grosse-Kunstleve
fcc868df59 Add PYBIND11_TYPE_CASTER_BASE_HOLDER(...) (no-op) 2024-07-05 14:37:15 -07:00
Ralf W. Grosse-Kunstleve
46ab14ebb4 Add missing explicit to resolve clang-tidy error. 2024-07-05 12:33:19 -07:00
Ralf W. Grosse-Kunstleve
c84dacc379 Factor out smart_holder_value_and_holder_support.h to avoid code duplication.
All unit tests pass ASAN and MSAN testing with the Google-internal toolchain.
2024-07-05 12:18:11 -07:00
Ralf W. Grosse-Kunstleve
e593589c61 inline unique_ptr_to_python() in cast.h 2024-07-05 10:12:21 -07:00
Ralf W. Grosse-Kunstleve
12c0eb3889 inline shared_ptr_to_python() in cast.h 2024-07-05 10:05:29 -07:00
Ralf W. Grosse-Kunstleve
0b7a628a04 Check for Python instance is uninitialized/disowned in type_caster_base.h. CRUDE intermediate state, needs refactoring.
All 4 remaining BAKEIN_BREAK removed from test_class_sh_basic.py. With that both test_class_sh_basic.cpp and test_class_sh_basic.py are identical to the smart_holder branch.

All unit tests pass ASAN and MSAN testing with the Google-internal toolchain.
2024-07-05 00:28:43 -07:00
Ralf W. Grosse-Kunstleve
fd1afdb2b9 move_only_holder_caster<...unique_ptr...>::load_value(): throw instead of return false (i.e. prefer noisy failure over potentially silent failure). 2024-07-04 23:57:34 -07:00
Ralf W. Grosse-Kunstleve
66fb5c942c
Merge branch 'master' into bakein 2024-07-04 18:21:55 -07:00
Ralf W. Grosse-Kunstleve
874f69d898 Add cast(const std::unique_ptr<type, deleter> &, ...). Remove the last 3 remaining BAKEIN_BREAK in test_class_sh_basic.cpp 2024-07-04 16:09:01 -07:00
Ralf W. Grosse-Kunstleve
ebbe066841 Implement operator std::unique_ptr<type, deleter>(). Resolves all but 1 block of 4 BAKEIN_BREAK in test_class_sh_basic.py 2024-07-04 11:26:43 -07:00
Ralf W. Grosse-Kunstleve
391d7726ad Remove operator type *() unique_ptr, and & (not sure how they would be useful). 2024-07-04 08:25:06 -07:00
Ralf W. Grosse-Kunstleve
d4fc392ebe move_only_holder_caster<type, std::unique_ptr<T, D>>: inherit from type_caster_base<T>
CRUDE INTERMEDIATE STATE, just to see if this builds on all platforms.
2024-07-03 15:16:46 -07:00
Ralf W. Grosse-Kunstleve
224e9343d2 Implement operator std::shared_ptr<type> &(), remove 2 BAKEIN_BREAK: pass_shmp, pass_shcp 2024-07-03 13:51:50 -07:00
Ralf W. Grosse-Kunstleve
af66246fb6 Resolve clang-tidy errors:
```
/__w/pybind11/pybind11/include/pybind11/cast.h:918:44: error: std::move of the variable 'v_h' of the trivially-copyable type 'pybind11::detail::value_and_holder' has no effect [performance-move-const-arg,-warnings-as-errors]
            return load_value_smart_holder(std::move(v_h));
                                           ^
/__w/pybind11/pybind11/include/pybind11/cast.h:911:53: note: consider changing the 1st parameter of 'load_value_smart_holder' from 'pybind11::detail::value_and_holder &&' to 'const pybind11::detail::value_and_holder &'
    bool load_value_smart_holder(value_and_holder &&v_h) {
                                                    ^
/__w/pybind11/pybind11/include/pybind11/cast.h:920:38: error: std::move of the variable 'v_h' of the trivially-copyable type 'pybind11::detail::value_and_holder' has no effect [performance-move-const-arg,-warnings-as-errors]
        return load_value_shared_ptr(std::move(v_h));
                                     ^
/__w/pybind11/pybind11/include/pybind11/cast.h:895:51: note: consider changing the 1st parameter of 'load_value_shared_ptr' from 'pybind11::detail::value_and_holder &&' to 'const pybind11::detail::value_and_holder &'
    bool load_value_shared_ptr(value_and_holder &&v_h) {
                                                  ^
```
2024-07-03 12:54:41 -07:00
Ralf W. Grosse-Kunstleve
fc5678b08b Add value_and_holder loaded_v_h; member (set, but currently unused). 2024-07-03 11:26:04 -07:00
Ralf W. Grosse-Kunstleve
2837df178e Rename holder to shared_ptr_holder to improve readability. No functional changes. 2024-07-03 10:49:17 -07:00
Ralf W. Grosse-Kunstleve
17c0354050 copyable_holder_caster<type, std::shared_ptr<type>>: split load_value_shared_ptr(), load_value_smart_holder() (the latter just throws right now) 2024-07-03 10:30:14 -07:00
Ralf W. Grosse-Kunstleve
556f28a1a4 Add smart_holder_from_shared_ptr() specialization for std::shared_ptr<T const>
Resolves one `// BAKEIN_WIP: Better Const2Mutbl`.
2024-07-03 07:41:48 -07:00
Ralf W. Grosse-Kunstleve
5957133b6e Add smart_holder_from_unique_ptr() specialization for std::unique_ptr<T const, D>
Enables removing:
4 BAKEIN_BREAK in test_class_sh_basic.cpp
2 BAKEIN_BREAK in test_class_sh_basic.py
2024-07-03 07:38:18 -07:00
Ralf W. Grosse-Kunstleve
7a6d30ca58 Fix rtrn_shmp, rtrn_shmp by transferring smart_holder_from_shared_ptr() functionality from smart_holder branch. 2024-07-02 18:25:01 -07:00
Ralf W. Grosse-Kunstleve
12b01305de Add no-op pybind11/smart_holder.h, 21 BAKEIN_BREAK in test_class_sh_basic.cpp, 26 BAKEIN_BREAK in test_class_sh_basic.py
```
========================================================= short test summary info ==========================================================
SKIPPED [1] test_class_sh_basic.py:59: got empty parameter set ('pass_f', 'rtrn_f', 'expected'), function test_load_with_rtrn_f at /usr/local/google/home/rwgk/forked/pybind11/tests/test_class_sh_basic.py:58
SKIPPED [1] test_class_sh_basic.py:70: got empty parameter set ('pass_f', 'rtrn_f', 'regex_expected'), function test_deleter_roundtrip at /usr/local/google/home/rwgk/forked/pybind11/tests/test_class_sh_basic.py:69
SKIPPED [1] test_class_sh_basic.py:99: got empty parameter set ('pass_f', 'rtrn_f', 'expected'), function test_pass_unique_ptr_disowns at /usr/local/google/home/rwgk/forked/pybind11/tests/test_class_sh_basic.py:98
SKIPPED [1] test_class_sh_basic.py:120: got empty parameter set ('pass_f', 'rtrn_f'), function test_cannot_disown_use_count_ne_1 at /usr/local/google/home/rwgk/forked/pybind11/tests/test_class_sh_basic.py:119
SKIPPED [1] test_class_sh_basic.py:145: BAKEIN_BREAK: AttributeError unique_ptr_roundtrip
SKIPPED [1] test_class_sh_basic.py:157: unconditional skip
SKIPPED [1] test_class_sh_basic.py:169: got empty parameter set ('pass_f', 'rtrn_f', 'moved_out', 'moved_in'), function test_unique_ptr_consumer_roundtrip at /usr/local/google/home/rwgk/forked/pybind11/tests/test_class_sh_basic.py:168
SKIPPED [1] test_class_sh_basic.py:210: BAKEIN_BREAK: AttributeError args_unique_ptr
====================================================== 17 passed, 8 skipped in 0.04s =======================================================```
2024-07-02 14:43:23 -07:00
Ralf W. Grosse-Kunstleve
c92b4d86da Insert PYBIND11_SMART_HOLDER_PADDING (with the idea to catch undefined behavior sooner rather than later). 2024-07-02 10:57:25 -07:00
Sam Gross
bb05e0810b
Use PyMutex instead of std::mutex in free-threaded build. (#5219)
* Use PyMutex instead of std::mutex in free-threaded build.

PyMutex is now part of the public C API as of 3.13.0b3 and generally has
slightly less overhead than std::mutex.

* style: pre-commit fixes

* Fix instance_map_shard padding

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-02 09:58:09 -07:00
Ralf W. Grosse-Kunstleve
b0cfeec63c Merge branch 'master' into bakein 2024-07-01 21:51:36 -07:00
Ralf W. Grosse-Kunstleve
ae08f51e38 Start pybind11/detail/smart_holder_type_caster_support.h, move unique_ptr_to_python() there, add smart_holder_from_unique_ptr() 2024-07-01 15:52:50 -07:00
Ralf W. Grosse-Kunstleve
6ff547e18a Introduce type_caster_base<>::unique_ptr_to_python() 2024-07-01 12:39:45 -07:00
Ralf W. Grosse-Kunstleve
5518e01562 Copy-paste-and-specialize copyable_holder_caster<shared_ptr>, move_only_holder_caster<unique_ptr>. No functional changes. 2024-07-01 11:47:34 -07:00
Ralf W. Grosse-Kunstleve
e4d0a55575 Remove is_holder_type<unique_ptr> 2024-07-01 11:18:56 -07:00
Ralf W. Grosse-Kunstleve
381fdc54e9 Bring in smart_holder_from_unique_ptr(), smart_holder_from_shared_ptr() from smart_holder_type_casters.h (with this test_wip builds and runs successfully). 2024-06-30 11:32:10 -07:00
Ralf W. Grosse-Kunstleve
e8cd42953e pybind11/detail/init.h: replace type_uses_smart_holder_type_caster<> with is_same<Holder<Class>, smart_holder> (still does not build). 2024-06-30 11:22:41 -07:00
Ralf W. Grosse-Kunstleve
03e6a93c73 Remove stray line (probably from an accident/oversight a long time ago; harmless). 2024-06-30 10:03:58 -07:00
Ralf W. Grosse-Kunstleve
dfaa49bb21 Bring in pybind11/detail/class.h, init.h as-is from smart_holder branch (does not build). 2024-06-30 10:00:33 -07:00
Michael Carlstrom
d805e9967f
feat(types) Adds special Case for empty C++ tuple type annotation (#5214)
* add special case and unit test

* add newline
2024-06-30 09:52:37 -07:00
Ralf W. Grosse-Kunstleve
144ae8be51 Also bring in try_initialization_using_shared_from_this() from smart_holder_type_casters.h. With this test_wip builds and succeeds. 2024-06-29 14:00:34 -07:00
Ralf W. Grosse-Kunstleve
fbf88cb298 Bring smart_holder init_instance_for_type<> directly into the init_instance() specialization. Also bring in dynamic_raw_ptr_cast_if_possible.h. Does not build because try_initialization_using_shared_from_this() is still missing. 2024-06-29 13:53:50 -07:00
Ralf W. Grosse-Kunstleve
00a91571fb fix build failure by introducing init_instance() specialization for smart_holder (test fails) 2024-06-29 12:13:19 -07:00
Ralf W. Grosse-Kunstleve
97a3a49678 make smart_holder the default holder (baby step; does not build) 2024-06-29 12:07:28 -07:00
Ralf W. Grosse-Kunstleve
8b0b377fc1 Bring in smart_holder_poc.h from smart_holder branch (baby step). 2024-06-28 23:02:14 -07:00
wenqing
51c2aa16de
Fixed a compilation error with gcc 14 (#5208) 2024-06-28 07:12:32 -07:00
Michael Carlstrom
08f946a431
fix: add guard for GCC <10.3 on C++20 (#5205)
* Update CI

* update define guard

* style: pre-commit fixes

* updated define guard

* style: pre-commit fixes

* update guard

* testing new guards

* update guards

* surely this time

* style: pre-commit fixes

* Define PYBIND11_TYPING_H_HAS_STRING_LITERAL to avoid repeating a complex expression.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2024-06-27 22:20:28 -07:00
Michael Carlstrom
4bd538a40a
feat(types): add support for Typing.Callable Special Case (#5202)
* Add special case

* linty
2024-06-26 16:34:06 -04:00
Sam Gross
2e35470cff
fix: use manual padding of instance_map_shard (#5200)
* Use manual padding of instance_map_shard.

The alignas(64) specifier requires aligned allocation, which is not
available on macOS when targeting versions before 10.14.

* Add 'see #5200'

* Update include/pybind11/detail/internals.h

* Update include/pybind11/detail/internals.h

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2024-06-26 15:46:46 -04:00
Henry Schreiner
895e657220
chore: back to work
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-06-26 00:42:54 -04:00
Henry Schreiner
0c69e1eb21
chore: prepare for 2.13.0 (#5198)
* chore: prepare for 2.13.0

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update changelog.rst

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-06-25 23:51:27 -04:00
Michael Carlstrom
2be85c6041
feat(types): adds support for TypeGuard and TypeIs (#5194)
* Adds support for TypeGuard and TypeIs

* style: pre-commit fixes

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-25 22:53:15 -04:00
Michael Carlstrom
26281c7986
feat(types): adds support for Never and NoReturn from python Typing (#5193)
* Adds support for Never and NoReturn

* lint
2024-06-25 21:10:25 -04:00