Skip to content

Commit

Permalink
Small reduction in code complexity.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwgk committed Jun 30, 2021
1 parent f128f1b commit 93169cc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions include/pybind11/detail/smart_holder_type_casters.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,9 @@ struct smart_holder_type_caster_load {
pybind11_fail("smart_holder_type_casters loaded_as_shared_ptr failure: "
"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>(
type_raw_ptr,
shared_ptr_trampoline_self_life_support(load_impl.loaded_v_h.inst));
Expand Down

0 comments on commit 93169cc

Please sign in to comment.