diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 05aef0e99..802fb845a 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -1028,8 +1028,7 @@ public: } if (parent) { - return type_caster_base::cast( - srcs, return_value_policy::reference_internal, parent); + return type_caster_base::cast(srcs, policy, parent); } throw cast_error("Unable to convert std::shared_ptr to Python when the bound type "