gh-140232 made frozensets untracked by the GC when none of their elements can be tracked. However, the compiler's fast path for frozenset({...}) and frozenset({... for ...}) freezes the built set in place with _PySet_Freeze() (INTRINSIC_BUILD_FROZENSET), which skips that check, so the result stays tracked:
>>> import gc
>>> s = {1, 2}
>>> gc.is_tracked(frozenset(s))
False
>>> gc.is_tracked(frozenset({1, 2}))
True
I'm preparing a PR for this.
Linked PRs
gh-140232 made frozensets untracked by the GC when none of their elements can be tracked. However, the compiler's fast path for
frozenset({...})andfrozenset({... for ...})freezes the built set in place with_PySet_Freeze()(INTRINSIC_BUILD_FROZENSET), which skips that check, so the result stays tracked:I'm preparing a PR for this.
Linked PRs