We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f128f1b commit 93169ccCopy full SHA for 93169cc
include/pybind11/detail/smart_holder_type_casters.h
@@ -422,11 +422,9 @@ struct smart_holder_type_caster_load {
422
pybind11_fail("smart_holder_type_casters loaded_as_shared_ptr failure: "
423
"load_impl.loaded_v_h.inst == sptsls_ptr->self");
424
}
425
- return std::shared_ptr<T>(
426
- type_raw_ptr,
427
- shared_ptr_trampoline_self_life_support(load_impl.loaded_v_h.inst));
428
429
- 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)) {
430
return std::shared_ptr<T>(
431
type_raw_ptr,
432
shared_ptr_trampoline_self_life_support(load_impl.loaded_v_h.inst));
0 commit comments