Bug report
frozendict cannot be pickled with protocols 0 and 1, while frozenset can:
>>> import pickle
>>> pickle.dumps(frozendict(a=1), 0)
Traceback (most recent call last):
...
TypeError: cannot pickle 'frozendict' object
>>> pickle.dumps(frozenset({1}), 0) # works
Protocols 2 through 5 already work. frozendict only defines __getnewargs__,
a protocol-2-and-later mechanism, while frozenset defines __reduce__, which
works at every protocol.
CPython versions tested on:
3.16 (main)
Operating systems tested on:
Linux, macOS
Linked PRs
Bug report
frozendictcannot be pickled with protocols 0 and 1, whilefrozensetcan:Protocols 2 through 5 already work.
frozendictonly defines__getnewargs__,a protocol-2-and-later mechanism, while
frozensetdefines__reduce__, whichworks at every protocol.
CPython versions tested on:
3.16 (main)
Operating systems tested on:
Linux, macOS
Linked PRs