python / python/cpython

Don't track frozendicts whose contents can never be tracked by the GC

Open
#155,176 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

When a frozendict is created, we can check whether all of its keys and values are objects that can never be tracked by the GC. If so, the frozendict can never be part of a reference cycle, so it can be left untracked, like gh-140232 did for frozenset. Since frozendicts are immutable, checking once at creation time is enough.

I'm preparing a PR for this.

Linked PRs
  • gh-155178

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review linked PR gh-155178 first, then trace frozendict creation and its garbage-collector tracking behavior. Done means frozendicts whose keys and values can never be GC-tracked remain untracked while other frozendicts retain existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.