From 7f176cba55122b248fbf927432465f3b2a2d276d Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" <rwgk@google.com> Date: Tue, 9 Feb 2021 09:02:00 -0800 Subject: [PATCH] Adding return_value_policy::move to permissible policies for unique_ptr returns. New stats for all tests combined: 3 failed, 467 passed. --- include/pybind11/cast.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 7cdd9b574..6dc2520ce 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -1565,7 +1565,8 @@ struct smart_holder_type_caster<std::unique_ptr<T, D>> : smart_holder_type_caste static handle cast(std::unique_ptr<T, D> &&src, return_value_policy policy, handle parent) { if (policy != return_value_policy::automatic - && policy != return_value_policy::reference_internal) { + && policy != return_value_policy::reference_internal + && policy != return_value_policy::move) { // IMPROVABLE: Error message. throw cast_error("Invalid return_value_policy for unique_ptr."); }