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
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