You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
segfault when deleting an object after returning it #133371
Yes, this problem appears after this PR was being merged: #130708
I've checked it with git bisect.
Another important detail I've noticed is that sys.getrefcount result have changed after this PR.
Maybe this also should be fixed.
Or at least docstring for this method should be adopted.
I've checked that original code snippet with asyncio.Task also works well (no crash) on the last commit before PR #130708.
Yeah, there's less strong references being formed, so the reference count isn't as high. Is there anything to document?
Return the reference count of the object. The count returned is generally one higher than you might expect, because it includes the (temporary) reference as an argument to getrefcount().
Text "one higher than you might expect" is not appropriate for this situation.
Activity
efimov-mikhail commentedon May 4, 2025
I also have a segfault on this source code snippet.
Moreover, very simplified example like this
also have a problem (assertion, not crash):
Is it in general correct to delete returned object in finally section?
[-]asyncio segfault when deleting an eager asyncio.Task[/-][+]segfault when deleting an object after returning it[/+]graingert commentedon May 4, 2025
Yes, this is correct
1 remaining item
ZeroIntensity commentedon May 4, 2025
The returned object is being borrowed, so the
delreleases the caller's strong reference, not its own.cc @mpage
efimov-mikhail commentedon May 4, 2025
Yes, this problem appears after this PR was being merged:
#130708
I've checked it with
git bisect.Another important detail I've noticed is that
sys.getrefcountresult have changed after this PR.Maybe this also should be fixed.
Or at least docstring for this method should be adopted.
ZeroIntensity commentedon May 4, 2025
Yeah, there's less strong references being formed, so the reference count isn't as high. Is there anything to document?
efimov-mikhail commentedon May 4, 2025
I've checked that original code snippet with
asyncio.Taskalso works well (no crash) on the last commit before PR #130708.Text "one higher than you might expect" is not appropriate for this situation.
Merge branch 'main' into pythongh-133371-handle-del-fast
gh-133371: Don't optimize `LOAD_FAST` instructions whose local is kil…
hugovk commentedon May 5, 2025
#133383 is merged, can this be closed now?
graingert commentedon May 5, 2025
yes, I believe it was a 3.14 only issue
pythongh-133371: Don't optimize `LOAD_FAST` instructions whose local …