Skip to content

gh-148722: Only track code objects created via Python APIs - #163168

Open
DinoV wants to merge 1 commit into
python:mainfrom
DinoV:gc_track_code
Open

DinoV wants to merge 1 commit into
python:mainfrom
DinoV:gc_track_code

Conversation

@DinoV

@DinoV DinoV commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Following up on #151155 (comment)

This modifies the tracking so that we explicitly only track on replace and code(). CPython will never create code objects which have cycles and this will make replace safe. It would be possible for someone to create a cycle on their own using PyCode_NewWithPosOnlyArgs but they can always track their objects as well if they so choose.

@DinoV DinoV changed the title gh-148722: Only track code objects on replace gh-148722: Only track code objects created via Python APIs Dec 4, 2026
@DinoV
DinoV marked this pull request as ready for review December 4, 2026 21:30
@DinoV
DinoV requested a review from markshannon as a code owner December 4, 2026 21:30
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.

1 participant