-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Add mechanism for getting active exception in a sys.monitoring PY_UNWIND callback (3.12) #106898
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
Comments
This should be doable by simply getting the exceptions from |
Before the callback is called, the current_exception is saved & set to NULL and then it is restored afterwards. It might be in one of the other tstate fields, but using sys.exc_info() doesn't retrieve it. |
Yes the current exception is saved. I meant we can do it otherwise in the instrumentation code to pass it down, it's not rocket science. This would be a design decision and Mark may have other concerns when he implemented this. That's why I said we should wait for his decision. |
It makes sense to pass the exception to the event handler. Should |
I think C_RAISE handlers should get the exception as an argument for consistency sake, if nothing else |
So we need to change the callback signatures. The feature is not even documented though (except for the PEP). That's probably a separate question but - we should have the official documentation for I can work on adding the exception to the callback if no one volunteers. |
…event callback function. (pythonGH-107347)
I couldn't figure out a way get the active exception from a PY_UNWIND event callback -- I was hoping the exception would be passed to the callback but it isn't. This was an issue with the old tracer function debugger / profiler support so it's not really a regression, but I was hoping to avoid the work arounds that we used with it.
I mentioned this in #103082 but was encouraged to create a separate bug for it.
Linked PRs
PY_UNWIND
event callback function. #107347PY_UNWIND
event callback function. (GH-107347) #107382The text was updated successfully, but these errors were encountered: