gh-141510: Use frozendict in the stdlib by vstinner · Pull Request #144909 · python/cpython
If someone really want/need to modify one of the frozendict, it remains possible. Example: platform._ver_stages |= frozendict(final=60)
$ ./python >>> import platform >>> platform._ver_stages frozendict({'dev': 10, 'alpha': 20, 'a': 20, 'beta': 30, ..., 'p': 200}) >>> platform._ver_stages['final']=60 ... TypeError: 'frozendict' object does not support item assignment >>> platform._ver_stages |= frozendict(final=60) >>> platform._ver_stages frozendict({'dev': 10, 'alpha': 20, 'a': 20, 'beta': 30, ..., 'p': 200, 'final': 60})
The purpose of this change is more to catch dictionaries modified by accident.