diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h index 04e87c24c..3341a1b94 100644 --- a/include/pybind11/detail/type_caster_base.h +++ b/include/pybind11/detail/type_caster_base.h @@ -635,7 +635,8 @@ handle smart_holder_from_unique_ptr(std::unique_ptr &&src, const std::pair &st) { if (policy != return_value_policy::automatic && policy != return_value_policy::automatic_reference - && policy != return_value_policy::move && policy != return_value_policy::reference + && policy != return_value_policy::take_ownership && policy != return_value_policy::move + && policy != return_value_policy::reference && policy != return_value_policy::reference_internal) { // SMART_HOLDER_WIP: IMPROVABLE: Error message. throw cast_error("Invalid return_value_policy for unique_ptr.");