Skip to content

Conversation

@efimov-mikhail
Copy link
Member

@efimov-mikhail efimov-mikhail commented Nov 17, 2025

@efimov-mikhail
Copy link
Member Author

I propose to merge #139717 first and then merge this PR with a proper test change.
IMO, it'd be better to have exactly the same stackref flags on 3 different builds (GIL, FT, STACKREF_DEBUG) to reduce cognitive load.

@Fidget-Spinner
Copy link
Member

We'll need to benchmark this, as it may cause a slowdown with the extra check.

assert(((uintptr_t)obj & Py_TAG_BITS) == 0);
assert(obj != NULL);
if (_PyObject_HasDeferredRefcount(obj)) {
if (_PyObject_HasDeferredRefcount(obj) || _Py_IsImmortal(obj)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just set immortal objects as having deferred refcount too in _Py_SetImmortal, that way this iwll just be a single check. Though it's been some time since I worked on FT so I don't know the implications of that (I think there should be none?)

@Fidget-Spinner
Copy link
Member

We'll need to benchmark this, as it may cause a slowdown with the extra check.

I'll run a benchmark eventually, before we merge.

Copy link
Contributor

@colesbury colesbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scheme slows things down. See:

@bedevere-app
Copy link

bedevere-app bot commented Dec 8, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@efimov-mikhail
Copy link
Member Author

Ok, I've got it.
What do you think about going in the opposite direction?
#143024

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants