@@ -461,13 +461,16 @@ enum class return_value_policy : uint8_t {
461
461
return_value_policy::reference and the keep_alive call policy */
462
462
reference_internal,
463
463
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,
465
466
instead of str. This is most useful when a C++ function returns a
466
467
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. */
471
474
return_as_bytes
472
475
};
473
476
0 commit comments