diff --git a/include/pybind11/type_caster_pyobject_ptr.h b/include/pybind11/type_caster_pyobject_ptr.h index aa914f9e1..7789c0401 100644 --- a/include/pybind11/type_caster_pyobject_ptr.h +++ b/include/pybind11/type_caster_pyobject_ptr.h @@ -32,7 +32,8 @@ public: raise_from(PyExc_SystemError, "src != nullptr but PyErr_Occurred()"); throw error_already_set(); } - if (policy == return_value_policy::take_ownership) { + if (policy == return_value_policy::take_ownership + || policy == return_value_policy::_clif_automatic) { return src; } if (policy == return_value_policy::reference