From c807807c5501c0b2dd91cf651225634486ae1063 Mon Sep 17 00:00:00 2001 From: Jakob Lykke Andersen Date: Wed, 16 Jun 2021 15:42:51 +0200 Subject: [PATCH] Allow copy policy in smart holder caster for shared_ptr --- include/pybind11/detail/smart_holder_type_casters.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/pybind11/detail/smart_holder_type_casters.h b/include/pybind11/detail/smart_holder_type_casters.h index 95bf79086..50c4b64e9 100644 --- a/include/pybind11/detail/smart_holder_type_casters.h +++ b/include/pybind11/detail/smart_holder_type_casters.h @@ -629,6 +629,7 @@ struct smart_holder_type_caster> : smart_holder_type_caster_l static handle cast(const std::shared_ptr &src, return_value_policy policy, handle parent) { if (policy != return_value_policy::automatic && policy != return_value_policy::reference_internal + && policy != return_value_policy::copy && policy != return_value_policy::automatic_reference) { // SMART_HOLDER_WIP: IMPROVABLE: Error message. throw cast_error("Invalid return_value_policy for shared_ptr.");