-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
gc.get_referrers() can be used to see objects before they are fully built #101855
Comments
cc @pablogsal |
The issue here is not with Py_INCREF, but with PySequence_Tuple used to build the tuple from the generator. PySequence_Tuple should untrack the tuple it is building until the build is complete, so the unfinished tuple is not discovered by GC (including gc.get_referrers). |
This is a known issue as evident by https://github.com/python/cpython/blob/main/Lib/test/crashers/gc_inspection.py. I don't see any point is fixing it at all, |
Thanks for the clarification, then I think the issue may can be close. |
Why is this closed? It is an interpreter crash on legal Python with a known cause. Let's fix it. |
Seemed to require testing on the current version. |
The fix doesn't seem to be easy enough:
So I think we should still close this one. Unless someone finds a way to fix it "easily" without breaking the rest of Python. |
Crash report
That the problem is occurring in the Py_INCREF macro, it looks like that the error occurs because the code is trying to increment the reference count of an object that doesnt exist.
Steps to reproduce the behavior:
1.create a sample file that contains:
Error messages
stderr:
gdb:
After run with synthetical sample, binary file aborted with Segfault:
Expected behavior
No assertion failed.
Additional context
For solution this problem added additional checking to ensure that the op argument is not a null pointer before trying to increment its reference count.
(also added in a patch)
Environment
Linked PRs
The text was updated successfully, but these errors were encountered: