diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h index c3fa8fa34..3e35f5a87 100644 --- a/include/pybind11/detail/type_caster_base.h +++ b/include/pybind11/detail/type_caster_base.h @@ -1089,6 +1089,8 @@ public: v_h_helper.loaded_v_h = v_h; if (v_h_helper.have_holder()) { v_h_helper.throw_if_uninitialized_or_disowned_holder(typeid(cpptype)); + value = v_h_helper.holder().template as_raw_ptr_unowned(); + return; } } auto *&vptr = v_h.value_ptr();