Closed DMRobertson closed 2 years ago
I think this is particularly confusing because we don't actually require frozendict to work. We just support it if it happens to be available.
I think we should try to import frozendict at import time
frozendict_type: Optional[Type]
try:
from frozendict import frozendict as frozendict_type
except ImportError:
frozendict_type = None
and then only try to support frozendict if it's installed, changing line 26 here
to
if frozendict_type is not None type(obj) is frozendict_type:
maybe with a fallback that returns dict(obj)
if the above fails but isinstance(obj, collections.abc.Mapping)
?
Hi, I'd like to work on this issue. Can you assign me?
somewhat related: https://github.com/Marco-Sulla/python-frozendict/issues/47
andrewsh noticed the following
The above from frozendict 1.2.
This was fine in 3.9, but failed in 3.10. The Python 3.9 docs for the collection module says:
We should support Python 3.10. I'd suggest we ought to raise the required version of frozendict. I don't know if there's a way to make that conditional on 3.10? We should start by finding out the first version of frozendict that is supported by Python 3.10; I'd guess we want the first version where
frozendict
inherits fromdict
.(Though come to think of it, it's odd that a frozendict inherits from dict, because it has a strictly smaller feature set (no-mutability).)