-
-
Notifications
You must be signed in to change notification settings - Fork 32k
segfault when deleting an object after returning it #133371
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
I also have a segfault on this source code snippet. Moreover, very simplified example like this def create_obj():
obj = [42]
try:
return obj
finally:
del obj
o = create_obj()
print(o) also have a problem (assertion, not crash):
Is it in general correct to delete returned object in finally section? |
Yes, this is correct |
The returned object is being borrowed, so the cc @mpage |
Yes, this problem appears after this PR was being merged: I've checked it with Another important detail I've noticed is that |
Yeah, there's less strong references being formed, so the reference count isn't as high. Is there anything to document? |
I've checked that original code snippet with
Text "one higher than you might expect" is not appropriate for this situation. |
…led by `DELETE_FAST` (#133383) In certain cases it's possible for locals loaded by `LOAD_FAST` instructions to be on the stack when the local is killed by `DEL_FAST`. These `LOAD_FAST` instructions should not be optimized into `LOAD_FAST_BORROW` as the strong reference in the frame is killed while there is still a reference on the stack.
#133383 is merged, can this be closed now? |
yes, I believe it was a 3.14 only issue |
a slightly minimized segfault:
Originally posted by @graingert in #128306 (comment)
Linked PRs
LOAD_FAST
instructions whose local is killed byDELETE_FAST
#133383The text was updated successfully, but these errors were encountered: