Skip to content

[WIP] gh-151722: Defer GC tracking of frozendict.fromkeys() as possible#152021

Open
corona10 wants to merge 3 commits into
python:mainfrom
corona10:gh-151722-from-keys
Open

[WIP] gh-151722: Defer GC tracking of frozendict.fromkeys() as possible#152021
corona10 wants to merge 3 commits into
python:mainfrom
corona10:gh-151722-from-keys

Conversation

@corona10

@corona10 corona10 commented Jun 23, 2026

Copy link
Copy Markdown
Member

Co-authored-by: tonghuaroot <tonghuaroot@gmail.com>
@corona10

Copy link
Copy Markdown
Member Author

cc @tonghuaroot (I add you as the co-author), too many things need to be addressed from #151967

Comment thread Objects/dictobject.c
int status;

PyTypeObject *cls_type = _PyType_CAST(cls);
d = _PyObject_CallNoArgs(cls);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If there is a good way to obtain an untracked object here, that would be great, but I think that is a separate topic.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread Objects/dictobject.c
done:
// Built untracked above; GC-track now that it is complete.
if (d != NULL) {
assert(!_PyObject_GC_IS_TRACKED(d));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@tonghuaroot
By this, we don't need additional test code.

@corona10 corona10 changed the title gh-151722: Defer GC tracking of frozendict.fromkeys() as possible [WIP] gh-151722: Defer GC tracking of frozendict.fromkeys() as possible Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review 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.

1 participant