Small reduction in code complexity.

This commit is contained in:
Ralf W. Grosse-Kunstleve 2021-06-29 16:00:27 -07:00 committed by Ralf W. Grosse-Kunstleve
parent f128f1b6db
commit 93169cc907

View File

@ -422,11 +422,9 @@ struct smart_holder_type_caster_load {
pybind11_fail("smart_holder_type_casters loaded_as_shared_ptr failure: " pybind11_fail("smart_holder_type_casters loaded_as_shared_ptr failure: "
"load_impl.loaded_v_h.inst == sptsls_ptr->self"); "load_impl.loaded_v_h.inst == sptsls_ptr->self");
} }
return std::shared_ptr<T>(
type_raw_ptr,
shared_ptr_trampoline_self_life_support(load_impl.loaded_v_h.inst));
} }
if (!pybindit::memory::type_has_shared_from_this(type_raw_ptr)) { if (sptsls_ptr != nullptr
|| !pybindit::memory::type_has_shared_from_this(type_raw_ptr)) {
return std::shared_ptr<T>( return std::shared_ptr<T>(
type_raw_ptr, type_raw_ptr,
shared_ptr_trampoline_self_life_support(load_impl.loaded_v_h.inst)); shared_ptr_trampoline_self_life_support(load_impl.loaded_v_h.inst));