-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Segfault accessing frame_locals #118746
Comments
C traceback: https://gist.github.com/ngoldbaum/5da31a3b055a9563d4cb5101516bc8d8
|
@gaogaotiantian Can you submit a PR for this? |
We don't know how to create an unoptimized frame with f_locals == NULL, but they are seen in the wild, and this fixes the crash.
I think the release can continue now, but I'm keeping this open so we can investigate the root cause (and possibly construct a more elegant fix). |
Should we remove the release-blocker tag then? |
@Yhg1s can do that -- I don't know what the policy is. |
Site note for the actual issue: I added |
The frame is apparently from Cython; I made pytest print each frame object before attempting to access its
I was able to reproduce with just Cython. Put this in def f():
raise ValueError Compile it with And in from exc import f
try:
f()
except Exception as e:
tb = e.__traceback__
while tb:
print(tb.tb_frame.f_locals)
tb = tb.tb_next
With about the same C backtrace as @ngoldbaum saw:
I looked in the Cython source code and there are four calls to For now it seems we have to live with the reality that |
Thanks for the investigation, I did not find any way to do it with pure CPython. |
The status of |
Yeah I'm definitely not saying that we should throw Cython under the bus and claim we never supported the function. We should try to clarify on the matter and maybe make it less ambiguous. CPython always sets a |
…ython#118748) We don't know how to create an unoptimized frame with f_locals == NULL, but they are seen in the wild, and this fixes the crash.
Closing as #118748 has been merged, please re-open if needed. |
Bug report
Bug description:
I don't know how to cause this otherwise, but I can reproducibly trigger this segfault running:
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
The text was updated successfully, but these errors were encountered: