Add back original copyable_holder_caster check_holder_compat() in the std::shared_ptr specialization and remove pytest.skip("BAKEIN_EXPECTED: ...) in test_smart_ptr.py

This commit is contained in:
Ralf W. Grosse-Kunstleve 2024-07-19 09:00:03 -07:00
parent cc2a428142
commit 6fb8b5157d
2 changed files with 5 additions and 1 deletions

View File

@ -919,6 +919,11 @@ public:
protected: protected:
friend class type_caster_generic; friend class type_caster_generic;
void check_holder_compat() {
if (typeinfo->default_holder) {
throw cast_error("Unable to load a custom holder type from a default-holder instance");
}
}
void load_value(value_and_holder &&v_h) { void load_value(value_and_holder &&v_h) {
if (typeinfo->holder_enum_v == detail::holder_enum_t::smart_holder) { if (typeinfo->holder_enum_v == detail::holder_enum_t::smart_holder) {

View File

@ -298,7 +298,6 @@ def test_move_only_holder_with_addressof_operator():
def test_smart_ptr_from_default(): def test_smart_ptr_from_default():
pytest.skip("BAKEIN_EXPECTED: Failed: DID NOT RAISE <class 'RuntimeError'>")
instance = m.HeldByDefaultHolder() instance = m.HeldByDefaultHolder()
with pytest.raises(RuntimeError) as excinfo: with pytest.raises(RuntimeError) as excinfo:
m.HeldByDefaultHolder.load_shared_ptr(instance) m.HeldByDefaultHolder.load_shared_ptr(instance)