mirror of
https://github.com/pybind/pybind11.git
synced 2024-12-01 17:37:15 +00:00
Add return value policy _clif_automatic (#4343)
This commit is contained in:
parent
fcdb9bae21
commit
6d3a0fc319
@ -478,7 +478,16 @@ enum class return_value_policy : uint8_t {
|
|||||||
but the purpose of _return_as_bytes is certain to be orthogonal, because
|
but the purpose of _return_as_bytes is certain to be orthogonal, because
|
||||||
C++ strings are always copied to Python `bytes` or `str`.
|
C++ strings are always copied to Python `bytes` or `str`.
|
||||||
NOTE: This policy is NOT available on master. */
|
NOTE: This policy is NOT available on master. */
|
||||||
_return_as_bytes
|
_return_as_bytes,
|
||||||
|
|
||||||
|
/** This policy should only be used by PyCLIF to automatically select a
|
||||||
|
return value policy. Legacy PyCLIF automatically decides object lifetime
|
||||||
|
management based on their properties:
|
||||||
|
https://github.com/google/clif/tree/main/clif/python#pointers-references-and-object-ownership
|
||||||
|
With this policy, the return value policy selection is consistent with
|
||||||
|
legacy PyCLIF.
|
||||||
|
NOTE: This policy is NOT available on master. */
|
||||||
|
_clif_automatic
|
||||||
};
|
};
|
||||||
|
|
||||||
PYBIND11_NAMESPACE_BEGIN(detail)
|
PYBIND11_NAMESPACE_BEGIN(detail)
|
||||||
|
@ -795,6 +795,7 @@ struct smart_holder_type_caster<std::shared_ptr<T>> : smart_holder_type_caster_l
|
|||||||
break;
|
break;
|
||||||
case return_value_policy::reference_internal:
|
case return_value_policy::reference_internal:
|
||||||
case return_value_policy::_return_as_bytes:
|
case return_value_policy::_return_as_bytes:
|
||||||
|
case return_value_policy::_clif_automatic:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!src) {
|
if (!src) {
|
||||||
|
Loading…
Reference in New Issue
Block a user