-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Legacy tracing & PY_UNWIND: arg of legacy tracer call should be NULL #110892
Comments
I'm confused. Why do you think the exception is passed to the legacy tracer? Could you share an example code? In |
The arg needs to be NULL and not Py_None when there's an exception. For the legacy tracer 'r' event, the arg is the value returned so arg=Py_None indicates None is returned without an exception. I found this while debugging Wing's debugger which uses a C implemented trace function and I saw the arg was not NULL and didn't look at what the value was or look closely up the stack; sorry. It may be that the trampoline that called a Python implemented trace function passed Py_None when arg was NULL, but it's been years since I worked with a Python implemented trace function. |
Okay I think I understood what you were talking about. |
PR is made to fix this. |
I've verified that the trace function gets a NULL on an UNWIND event with the PR. Thanks! Shouldn't the profile function also get a NULL on an UNWIND event? |
Yes, |
I see the profile change now; LGTM. |
Bug report
Bug description:
When using a legacy tracer with
PyEval_SetTrace
and a function exits with an exception, the arg of the tracer eventPyTrace_RETURN
should be NULL docs. Currently in 3.12 (& 3.13), the arg is set to the exception value because the PY_UNWIND handler is forwarding its arg to the legacy tracer function.CPython versions tested on:
3.12
Operating systems tested on:
No response
Linked PRs
PyTrace_RETURN
events caused by an exception #110909The text was updated successfully, but these errors were encountered: