Skip to content

type caster that turns values into python exceptions? #755

Answered by wjakob
ghorn asked this question in Q&A
Discussion options

You must be logged in to vote

Indeed, type casters can't raise by design. std::expected as a C++23 feature is also beyond what can be handled in nanobind, which is a C++17 library.

You could either handle this on the Python interface or fork nanobind to handle std::expected specially. However, I would be unlikely to merge such a feature here, in case that is relevant.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by ghorn
Comment options

You must be logged in to vote
1 reply
@wjakob
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants