GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-42972: _thread.RLock type implements tp_traverse by vstinner · Pull Request #26734 · python/cpython

Conversation

@vstinner

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

Uh oh!

There was an error while loading. Please reload this page.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland and corona10 reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Jun 15, 2021
@bedevere-bot bedevere-bot added the awaiting core review label Jun 15, 2021
@vstinner vstinner added needs backport to 3.10 and removed awaiting core review labels Jun 15, 2021
@vstinner vstinner mentioned this pull request Jun 15, 2021
bpo-44422: Fix threading.enumerate() reentrant call #26727
Merged
@vstinner

vstinner commented Jun 15, 2021

Copy link
Copy Markdown
Member Author

Leak discovered by #26727

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
bpo-42972: _thread.RLock type implements tp_traverse
f92a784
The _thread.RLock type now fully implement the GC protocol: add a
traverse function and the Py_TPFLAGS_HAVE_GC flag.
@pitrou

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal 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?

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pablogsal
pablogsal approved these changes Jun 15, 2021
View reviewed changes
@bedevere-bot bedevere-bot added the awaiting merge label Jun 15, 2021
@vstinner

vstinner commented Jun 15, 2021

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

shihai1991
shihai1991 approved these changes Jun 15, 2021
View reviewed changes

@shihai1991 shihai1991 left a comment

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
vstinner merged commit 1cd3d85 into python:main Jun 15, 2021
@miss-islington

miss-islington commented Jun 15, 2021

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the awaiting merge label Jun 15, 2021
@vstinner
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
@vstinner @miss-islington
bpo-42972: _thread.RLock implements the GH protocol (pythonGH-26734)
279caac
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]>
@bedevere-bot

bedevere-bot commented Jun 15, 2021

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 label Jun 15, 2021
miss-islington added a commit that referenced this pull request Jun 15, 2021
@miss-islington @vstinner
bpo-42972: _thread.RLock implements the GH protocol (GH-26734)
e30fe27
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]>
@vstinner

vstinner commented Jun 15, 2021

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jdevries3133 pushed a commit to jdevries3133/cpython that referenced this pull request Jun 19, 2021
@vstinner @jdevries3133
bpo-42972: _thread.RLock implements the GH protocol (pythonGH-26734)
c60a9c6
The _thread.RLock type now fully implement the GC protocol: add a
traverse function and the Py_TPFLAGS_HAVE_GC flag.
@pablogsal pablogsal mentioned this pull request Jul 18, 2021
[3.10] Correct the order of regen-abidump #27228
Closed
@vstinner vstinner mentioned this pull request Jun 9, 2022
[C API] Heap types (PyType_FromSpec) must fully implement the GC protocol #87138
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@shihai1991 shihai1991 shihai1991 approved these changes
@pablogsal pablogsal pablogsal approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@vstinner @pitrou @pablogsal @miss-islington @bedevere-bot @shihai1991 @the-knights-who-say-ni
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.