File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -478,7 +478,16 @@ enum class return_value_policy : uint8_t {
478478 but the purpose of _return_as_bytes is certain to be orthogonal, because
479479 C++ strings are always copied to Python `bytes` or `str`.
480480 NOTE: This policy is NOT available on master. */
481- _return_as_bytes
481+ _return_as_bytes,
482+
483+ /* * This policy should only be used by PyCLIF to automatically select a
484+ return value policy. Legacy PyCLIF automatically decides object lifetime
485+ management based on their properties:
486+ https://github.com/google/clif/tree/main/clif/python#pointers-references-and-object-ownership
487+ With this policy, the return value policy selection is consistent with
488+ legacy PyCLIF.
489+ NOTE: This policy is NOT available on master. */
490+ _clif_automatic
482491};
483492
484493PYBIND11_NAMESPACE_BEGIN (detail)
Original file line number Diff line number Diff line change @@ -795,6 +795,7 @@ struct smart_holder_type_caster<std::shared_ptr<T>> : smart_holder_type_caster_l
795795 break ;
796796 case return_value_policy::reference_internal:
797797 case return_value_policy::_return_as_bytes:
798+ case return_value_policy::_clif_automatic:
798799 break ;
799800 }
800801 if (!src) {
You can’t perform that action at this time.
0 commit comments