Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
gh-90501: Add PyErr_GetHandledException and PyErr_SetHandledException#30531
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
a562251
toe76ac6a
Compare3fce147
to20fa421
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Victor Stinner <vstinner@python.org>
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Cython defines |
Is it clear (judging by name only) which exception is the "active" one? Raised/in-flight or caught? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Since this function is an unusal use case, maybe give it an even more explicit name? PyErr_GetCaughtException()?
Uh oh!
There was an error while loading.Please reload this page.
Would it be possible to use the same wording in the documentation of functions added by this PR, in PyErr_GetExcInfo() and in sys.exception() documentation? My remark is about "the exception instance that is currently being handled" in sys.exception() doc: Maybe add also a link from PyErr_GetExcInfo() to PyErr_GetActiveException() in the doc. |
Co-authored-by: Victor Stinner <vstinner@python.org>
How about GetHandledException()? (I'm not sure Caught accurately describes the timeframe in which an exception is "active"). |
sys.exception is in python space, where you don't have access to any other exception so I think the c-level wording might just add confusion. I agree though that the current wording is not great, in particular I'm not sure we need to talk about the frame stack. How about I reword the sys.exception() doc like this:
Sure. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
…leak in test_set_exception. Use METH_O in test_set_exception
I made all the changes suggested in reviews so far (thanks!) except the name change. I propose SetHandledException/GetHandledException. Does this sound good? |
IMO , that's easier to understand. +1 |
@vstinner@encukou@markshannon Any last thoughts on this? Should we include this in 3.11? @pablogsal FYI. |
1 similar comment
@vstinner@encukou@markshannon Any last thoughts on this? Should we include this in 3.11? @pablogsal FYI. |
I'm fine including this into 3.11, but please merge it at least one week before the beta to allow to test it a bit. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Now that exc_info was replace by just the exception, we can have simpler versions of the get/set c-api functions.
https://bugs.python.org/issue46343