Repository navigation
Replies: 2 comments 1 reply
|
Changing to |
0 replies
|
Bump? It's been 3 years. Pointers in C can be null. Seems rather a basic aspect to support. Not to mention Relevant issue: #3175 |
1 reply
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.
I have a function that does some conversion of its input arguments:
The current version works™, but as an empty array is a valid return value from
::internal_fooI'd like to returnbyteson success, butNoneon failure. AFAIC I could usestd::optional<py::bytes>, but this would require at least C++14 (if usingstd::experimental::optional<>), which I'd like to avoid.As far as I understand it right now, I could do this by changing the return type to
py::object, but this would change the generated docstring to indicate the return type asany(???), which is not what I intent for it. On the other hand, if I leave the realms of C++11, I could mark the return value asstd::optional<py::bytes>, which should (in theory???) indicate the return value correctly to bepy::bytesorNone.Is there some way to both properly indicate this
py::bytesvs.Nonereturn value (in the docstring), allowing for empty py::bytes (zero-sized) being returned, and still have a sane/descriptive C++11 return type?NB:
py::bytesis intentional as the internal function operates on binary data blobs.All reactions