Skip to content

Commit b0e936a

Browse files
author
Xiaofei Wang
committed
Note this policy experimental
1 parent 3033bca commit b0e936a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

include/pybind11/detail/common.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,16 @@ enum class return_value_policy : uint8_t {
461461
return_value_policy::reference and the keep_alive call policy */
462462
reference_internal,
463463

464-
/** With this policy, C++ string types are converted to Python bytes,
464+
/** This policy is experimental and likely to change in the future. With
465+
this policy, C++ string types are converted to Python bytes,
465466
instead of str. This is most useful when a C++ function returns a
466467
container-like type with nested C++ string types, and py::bytes cannot
467-
be applied easily. Note that this return_value_policy is not concerned
468-
with lifetime/ownership semantics, like the other policies, but the
469-
purpose of return_as_bytes is certain to be orthogonal, because C++
470-
strings are always copied to Python bytes or str. */
468+
be applied easily. Dictionary like types might not work, for example,
469+
`Dict[str, bytes]`, because this policy forces all string return values
470+
to be converted to bytes. Note that this return_value_policy is not
471+
concerned with lifetime/ownership semantics, like the other policies,
472+
but the purpose of return_as_bytes is certain to be orthogonal, because
473+
C++ strings are always copied to Python bytes or str. */
471474
return_as_bytes
472475
};
473476

0 commit comments

Comments
 (0)