From 4114e975d4b655320dacac6e86f20d2b7c6faed1 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sat, 6 Jul 2024 13:11:15 -0700 Subject: [PATCH] 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 SKIPPED [1] test_stl.py:149: no SKIPPED [1] test_smart_ptr.py:301: BAKEIN_EXPECTED: Failed: DID NOT RAISE 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 ================================================ ``` --- include/pybind11/detail/type_caster_base.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h index 3e35f5a87..27432ea10 100644 --- a/include/pybind11/detail/type_caster_base.h +++ b/include/pybind11/detail/type_caster_base.h @@ -965,16 +965,8 @@ struct load_helper : value_and_holder_helper { #endif private: - T *convert_type(void *void_ptr) const { -#ifdef BAKEIN_WIP // Is this needed? implicit_casts - if (void_ptr != nullptr && load_impl.loaded_v_h_cpptype != nullptr - && !load_impl.reinterpret_cast_deemed_ok && !load_impl.implicit_casts.empty()) { - for (auto implicit_cast : load_impl.implicit_casts) { - void_ptr = implicit_cast(void_ptr); - } - } -#endif - return static_cast(void_ptr); + T *convert_type(void *) const { + throw std::runtime_error("BEAKIN_WIP: convert_type() called."); } };