diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 412a6e748..34e44f027 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -903,9 +903,10 @@ protected: void load_value(value_and_holder &&v_h) { if (typeinfo->default_holder) { sh_load_helper.loaded_v_h = v_h; - type_caster_generic::load_value(std::move(v_h)); + type_caster_generic::load_value(std::move(v_h)); // NOLINT(performance-move-const-arg) return; - } else if (v_h.holder_constructed()) { + } + if (v_h.holder_constructed()) { value = v_h.value_ptr(); shared_ptr_holder = v_h.template holder>(); return; @@ -1027,7 +1028,7 @@ public: if (typeinfo->default_holder) { sh_load_helper.loaded_v_h = v_h; sh_load_helper.loaded_v_h.type = get_type_info(typeid(type)); - type_caster_generic::load_value(std::move(v_h)); + type_caster_generic::load_value(std::move(v_h)); // NOLINT(performance-move-const-arg) return; } throw std::runtime_error("BAKEIN_WIP: What is the best behavior here (load_value)?"); diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h index b9590670e..3524bc2b5 100644 --- a/include/pybind11/detail/type_caster_base.h +++ b/include/pybind11/detail/type_caster_base.h @@ -611,7 +611,7 @@ struct value_and_holder_helper { // have_holder() must be true or this function will fail. void throw_if_instance_is_currently_owned_by_shared_ptr() const { - auto vptr_gd_ptr = std::get_deleter(holder().vptr); + auto *vptr_gd_ptr = std::get_deleter(holder().vptr); if (vptr_gd_ptr != nullptr && !vptr_gd_ptr->released_ptr.expired()) { throw value_error("Python instance is currently owned by a std::shared_ptr."); }