A question about return value policies #4367
Unanswered
jonghwanhyeon
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If a return type of a method is
char *
orconst char *
, which policyreturn_value_policy::automatic
does use?return_value_policy::take_ownership
orreturn_value_policy::copy
?If it uses
return_value_policy::take_ownership
, does it mean thatpybind11
tries tofree()
the returnedchar *
?In addition, as I understood,
return_value_policy::automatic
isreturn_value_policy::take_ownership
if the return type is a pointer. So I had some experiments as follows:Case A
Case B
Then, I explicitly added return_value_policy::take_ownership
Beta Was this translation helpful? Give feedback.
All reactions