-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-42972: _thread.RLock type implements tp_traverse #26734
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
Conversation
Leak discovered by #26727 |
The _thread.RLock type now fully implement the GC protocol: add a traverse function and the Py_TPFLAGS_HAVE_GC flag.
Don't we have a warning for when heap types don't implement a |
No, the warning is when a heap type has the GC flags but don't have tp_traverse. in this case we were missing the GC flags so the check failed to raise the warning |
I agree that a warning should be emitted at runtime when a heap type doesn't have the Py_TPFLAGS_HAVE_GC or doesn't implement tp_traverse. I suggest to discuss this idea in https://bugs.python.org/issue42972 It's super hard to discover such very tricky bug if you don't have a very deep understanding of GC internals and how Python works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
The _thread.RLock type now fully implement the GC protocol: add a traverse function and the Py_TPFLAGS_HAVE_GC flag. (cherry picked from commit 1cd3d85) Co-authored-by: Victor Stinner <[email protected]>
GH-26735 is a backport of this pull request to the 3.10 branch. |
The _thread.RLock type now fully implement the GC protocol: add a traverse function and the Py_TPFLAGS_HAVE_GC flag. (cherry picked from commit 1cd3d85) Co-authored-by: Victor Stinner <[email protected]>
Thanks for your reviews @pablogsal and @shihai1991 ;-) |
The _thread.RLock type now fully implement the GC protocol: add a traverse function and the Py_TPFLAGS_HAVE_GC flag.
The _thread.RLock type now fully implement the GC protocol: add a
traverse function and the the Py_TPFLAGS_HAVE_GC flag.
https://bugs.python.org/issue42972