Wouldn't ref-counting CPython already know that a has a single reference, allowing this optimization without needing any particular smart JIT?
There are also potentially other optimizations that could be applied (not specific to dict/frozendict) to reduce the memory overhead on operations like "a = f(a)" for selected values of "f".
But actually, I suspect it can't do this optimization simply because the name `frozendict` could be shadowed.