Skip to content

GH-155728: Untrack const tuples - #156419

Open
sergey-miryanov wants to merge 4 commits into
python:mainfrom
sergey-miryanov:bug/155728-untrack-const-tuples
Open

GH-155728: Untrack const tuples#156419
sergey-miryanov wants to merge 4 commits into
python:mainfrom
sergey-miryanov:bug/155728-untrack-const-tuples

Conversation

@sergey-miryanov

@sergey-miryanov sergey-miryanov commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Comment thread Python/flowgraph.c
}
PyTuple_SET_ITEM(const_tuple, i, element);
}
_PyTuple_MaybeUntrack(const_tuple);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We could avoid a second pass there, just like in marshal, by checking each element. But I'm not sure we should do it, since it adds a bit of complexity.

I'm open to change this, if it is worth.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO, we should do the same logic in each case, because we don't want to expose partially constructed tuples to the GC.
@markshannon, WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, will fix this.

@sergey-miryanov sergey-miryanov added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants