Skip to content

Commit

Permalink
smart_holder_from_unique_ptr: also accept `return_value_policy::tak…
Browse files Browse the repository at this point in the history
…e_ownership`

There are no strong reasons for accepting or rejecting `return_value_policy::take_ownership`.

Accepting to accommodate existing use cases in the wild.
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Jul 15, 2024
1 parent 12f384b commit ecd01da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/pybind11/detail/type_caster_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,8 @@ handle smart_holder_from_unique_ptr(std::unique_ptr<T, D> &&src,
const std::pair<const void *, const type_info *> &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.");
Expand Down

0 comments on commit ecd01da

Please sign in to comment.