-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add getters for exception type, value and traceback #1641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@martinRenou Shouldn't/couldn't this be |
df66558 to
893a65e
Compare
|
@martinRenou Sorry to bother you again, but before I can rebase and force-push #1651, the methods also need to be |
|
Don't worry :) I'll do it. Do you have an idea why the build is not passing? |
893a65e to
ced5cf9
Compare
|
I'm looking into that now, actually. On Travis, it's got something to do with a dead link, it seems. Nothing in this PR, I'd guess :-) |
|
Although ... the current build failure is also partly due to this PR, I think, since I'm getting error messages on "duplicate const". |
|
Oh yeah sorry... I did that too quickly with vim without really checking what I was doing |
ced5cf9 to
bd21d99
Compare
bd21d99 to
d53b01d
Compare
d53b01d to
e79a53a
Compare
|
Unless someone whats to bikeshed it, I think this is good, because I've started to use it (I thought about letting vcpkg to patch it, at least in our team's vcpkg clone). |
|
Any chance to merge this? |
|
This seems reasonable. However, just a comment regarding the naming: we haven't so far used |
|
actually, scratch that :) -- there are quite a few prefixed |
|
I can change it to |
|
Hm, I think I would prefer them to be named just There is one slight inconsistency with |
2a17a37 to
846ede2
Compare
|
@wjakob Hope it's fine now :) |
846ede2 to
435fe12
Compare
|
Any chance to get this in? @wjakob. I guess the travis job not passing is unrelated. |
|
I am running with this patch locally, works fine so far |
|
Merged, thanks! |
|
Thanks :) |
In order to retrieve the exception
type,valueandtrace, we can usesys.exc_info()in Python. But using pybind11 it's not that easy currently.When an exception occurs in Python code it's directly converted to
py::error_already_setand it holds the error. Which means that if we want to retrieve thetype,valueandtracewe first need to restore the error using the.restore()method, and then callPyErr_Fetch, which is not ideal.I added accessors to objects describing the error in
py::error_already_set.Please tell me what you think :)