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: Fully implement GC protocol for re types by erlend-aasland · Pull Request #26368 · python/cpython

Conversation

@erlend-aasland

@erlend-aasland erlend-aasland commented May 25, 2021 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

https://bugs.python.org/issue42972

Sorry, something went wrong.

Uh oh!

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

All reactions
Erlend E. Aasland
bpo-42972: Fully implement GC protocol for re types
6b6328a
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label May 25, 2021
@bedevere-bot bedevere-bot added the awaiting review label May 25, 2021
@erlend-aasland
erlend-aasland requested a review from pablogsal May 25, 2021 20:40
@erlend-aasland erlend-aasland added the skip news label May 25, 2021
erlend-aasland
erlend-aasland commented May 25, 2021
View reviewed changes
Comment thread Modules/_sre.c
break;
}
}
PyObject_GC_Track(self);

@erlend-aasland erlend-aasland May 25, 2021

Copy link
Copy Markdown
Contributor Author

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.

@pablogsal I'm unsure if this it the correct place to start tracking the newly created pattern object. My reasoning was that AFAICS, it seems to be fully initialised here, unless I've missed something.

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner May 27, 2021

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.

IMO it's the right place.

It must be called before the first DECREF(self), otherwise PyObject_GC_UnTrack() crash in dealloc.

Usually, it's better to only track an object once it's fully initialized, but here it's more convient to do it here to be able to simply call DECREF() on error. The bare minimum is that traverse must be crash when an object started to be tracked. I added a test in debug mode for that: see traverse(visit_validate) in PyObject_GC_Track().

Sorry, something went wrong.

Uh oh!

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

All reactions
@erlend-aasland erlend-aasland added the needs backport to 3.10 label May 25, 2021
vstinner
vstinner reviewed May 27, 2021
View reviewed changes

@vstinner vstinner 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.

I'm not sure that calling PyObject_ClearWeakRefs() in a clear function is safe. What do you think?

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Modules/_sre.c Resolved

Uh oh!

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

Comment thread Modules/_sre.c Resolved

Uh oh!

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

Comment thread Modules/_sre.c Resolved

Uh oh!

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

Comment thread Modules/_sre.c
break;
}
}
PyObject_GC_Track(self);

@vstinner vstinner May 27, 2021

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.

IMO it's the right place.

It must be called before the first DECREF(self), otherwise PyObject_GC_UnTrack() crash in dealloc.

Usually, it's better to only track an object once it's fully initialized, but here it's more convient to do it here to be able to simply call DECREF() on error. The bare minimum is that traverse must be crash when an object started to be tracked. I added a test in debug mode for that: see traverse(visit_validate) in PyObject_GC_Track().

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Modules/_sre.c Resolved

Uh oh!

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

Erlend E. Aasland
Address review: visit members in order, use tp_free, don't clear weak…
8ae8b62
… refs in tp_clear
@erlend-aasland
erlend-aasland requested a review from vstinner May 27, 2021 16:51
@vstinner
vstinner merged commit fba42d1 into python:main May 27, 2021
@miss-islington

miss-islington commented May 27, 2021

Copy link
Copy Markdown
Contributor

Thanks @erlend-aasland for the PR, and @vstinner for merging it 🌮🎉.. 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 awaiting review needs backport to 3.10 labels May 27, 2021
@bedevere-bot

bedevere-bot commented May 27, 2021

Copy link
Copy Markdown

GH-26411 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.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 27, 2021
Erlend Egeberg Aasland @miss-islington
bpo-42972: Fully implement GC protocol for re types (pythonGH-26368)
e269fa1
(cherry picked from commit fba42d1)

Co-authored-by: Erlend Egeberg Aasland <[email protected]>
@erlend-aasland
erlend-aasland deleted the bpo-42972/re branch May 27, 2021 17:41
@vstinner vstinner added the needs backport to 3.10 label May 27, 2021
@miss-islington

miss-islington commented May 27, 2021

Copy link
Copy Markdown
Contributor

Thanks @erlend-aasland for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

All reactions

Sorry, something went wrong.

Uh oh!

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 27, 2021
Erlend Egeberg Aasland @miss-islington
bpo-42972: Fully implement GC protocol for re types (pythonGH-26368)
4507ea9
(cherry picked from commit fba42d1)

Co-authored-by: Erlend Egeberg Aasland <[email protected]>
@bedevere-bot

bedevere-bot commented May 27, 2021

Copy link
Copy Markdown

GH-26414 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 May 27, 2021
vstinner pushed a commit that referenced this pull request May 28, 2021
@miss-islington Erlend Egeberg Aasland
bpo-42972: Fully implement GC protocol for re types (GH-26368) (GH-26414
da9e0cb
)

(cherry picked from commit fba42d1)

Co-authored-by: Erlend Egeberg Aasland <[email protected]>
@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

@pablogsal pablogsal Awaiting requested review from pablogsal
@vstinner vstinner Awaiting requested review from vstinner

Uh oh!

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

Assignees

No one assigned

Labels

skip news

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.

5 participants

@erlend-aasland @miss-islington @bedevere-bot @vstinner @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.