Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-44881: Integrate GC untrack into trashcan begin.#27718

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

nascheme
Copy link
Member

@naschemenascheme commentedAug 10, 2021
edited by bedevere-bot
Loading

For subtle reasons, PyObject_GC_UnTrack() function must be called before
Py_TRASHCAN_BEGIN(). There have been a number of bugs over the years
related to not doing this particular dance just right. Integrating
the PyObject_GC_UnTrack() call makes it harder to do things incorrectly.
That avoids some hard to find bugs (e.g. only triggered when object
nesting gets deep enough).

Extensions that still call PyObject_GC_UnTrack() explictly will
work correctly but the call is unneeded after this change. It would
still be needed for the extension to work correctly with older versions
of Python.

https://bugs.python.org/issue44881

For subtle reasons, PyObject_GC_UnTrack() function must be called beforePy_TRASHCAN_BEGIN().  There have been a number of bugs over the yearsrelated to not doing this particular dance just right.  Integratingthe PyObject_GC_UnTrack() call makes it harder to do things incorrectly.That avoids some hard to find bugs (e.g. only triggered when objectnesting gets deep enough).Extensions that still call PyObject_GC_UnTrack() explictly will stillwork correctly but the call is unneeded after this change.  It wouldstill be needed for the extension to work correctly with older versionsof Python.
@pablogsal
Copy link
Member

Let's land#27678 first to include that change in this PR

nascheme reacted with thumbs up emoji

@nascheme
Copy link
MemberAuthor

Just to be clear, I don't consider this PR a bugfix and it would not be appropriate to include in 3.10.

ambv reacted with thumbs up emoji

@pablogsal
Copy link
Member

Just to be clear, I don't consider this PR a bugfix and it would not be appropriate to include in 3.10.

Yep, we are on the same page :)

It seems slightly cleaner to have the BEGIN/END macros at the start andend of the dealloc function body.
@ambv
Copy link
Contributor

We won't be merging this as of yet because an alternative solution is evaluated inGH-27738. I added the assert Victor wanted so that the benchmarks are fairer between the two approaches.

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the staleStale PR or inactive for long period of time. labelSep 16, 2021
@rhettingerrhettinger removed their request for reviewMay 3, 2022 06:19
@github-actionsgithub-actionsbot removed the staleStale PR or inactive for long period of time. labelAug 11, 2022
@nascheme
Copy link
MemberAuthor

This PR is out of date and will not be required ifGH-132280 gets merged. That PR integrates the trashcan mechanism intoPy_Dealloc and also stops using the GC next/prev pointers to store the queue of trash. So, it removes the need to callPyObject_GC_UnTrack() at the exact right time.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner left review comments

@pablogsalpablogsalpablogsal approved these changes

@1st11st1Awaiting requested review from 1st11st1 is a code owner

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

@methanemethaneAwaiting requested review from methanemethane is a code owner

@tim-onetim-oneAwaiting requested review from tim-one

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

7 participants
@nascheme@pablogsal@ambv@vstinner@the-knights-who-say-ni@ezio-melotti@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp