Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
Let's land#27678 first to include that change in this PR |
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.
Uh oh!
There was an error while loading.Please reload this page.
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. |
This PR is stale because it has been open for 30 days with no activity. |
This PR is out of date and will not be required ifGH-132280 gets merged. That PR integrates the trashcan mechanism into |
Uh oh!
There was an error while loading.Please reload this page.
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