Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-139716: MakePyStackRef_FromPyObjectSteal function very lightweight for GIL build as on FT build#143024
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
base:main
Are you sure you want to change the base?
Conversation
efimov-mikhail commentedDec 20, 2025
efimov-mikhail commentedDec 20, 2025
If this PR will be merged we can remove |
Fidget-Spinner commentedDec 20, 2025
We can't rely on Py_DECREF to do the immortal check, as that is more expensive than simply checking a bit on a pointer. You have to do an atomic read of memory now. |
efimov-mikhail commentedDec 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
It seems that I'm not quite understand, when we will do additional atomic reads. |
Fidget-Spinner commentedDec 20, 2025
Sorry I think I'm misunderstanding. This PR moves the immortal check from the stackref to the Py_DECREF right? |
efimov-mikhail commentedDec 20, 2025
Yes. If we steal stack reference from the immortal object then there will be no actual decrefing at |
Uh oh!
There was an error while loading.Please reload this page.
This is another attempt to provide the same StackRef flagging scheme for all builds (GIL, FT, STACKREF_DEBUG).
Instead of adding
_Py_IsImmortalcheck toPyStackRef_FromPyObjectStealfor FT builds as in#141675, we make no checks at all in this function.As a result, immortal objects will be DECREF'ed with no effect at reference closing.
PyStackReffunctions #139716