FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-42972: _thread.RLock type implements tp_traverse by vstinner · Pull Request #26734 · python/cpython · GitHub

/ cpython Public

bpo-42972: _thread.RLock type implements tp_traverse - #26734

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:rlock_traverse
Jun 15, 2021
Merged

bpo-42972: _thread.RLock type implements tp_traverse#26734
vstinner merged 1 commit into
python:mainfrom
vstinner:rlock_traverse

Conversation

vstinner commented Jun 15, 2021
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member Author

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.

pitrou commented Jun 15, 2021

Copy link
Copy Markdown
Member

Don't we have a warning for when heap types don't implement a tp_traverse?

Copy link
Copy Markdown
Member

Don't we have a warning for when heap types don't implement a tp_traverse?

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

Copy link
Copy Markdown
Member Author

Don't we have a warning for when heap types don't implement a tp_traverse?

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.

shihai1991 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM.

vstinner merged commit 1cd3d85 into python:main Jun 15, 2021

Copy link
Copy Markdown
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

vstinner deleted the rlock_traverse branch June 15, 2021 13:09
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 15, 2021
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 <vstinner@python.org>

Copy link
Copy Markdown

GH-26735 is a backport of this pull request to the 3.10 branch.

bedevere-bot removed the needs backport to 3.10 only security fixes label Jun 15, 2021
miss-islington added a commit that referenced this pull request Jun 15, 2021
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 <vstinner@python.org>

Copy link
Copy Markdown
Member Author

Thanks for your reviews @pablogsal and @shihai1991 ;-)

jdevries3133 pushed a commit to jdevries3133/cpython that referenced this pull request Jun 19, 2021
The _thread.RLock type now fully implement the GC protocol: add a
traverse function and the Py_TPFLAGS_HAVE_GC flag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL