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.

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.

3 participants