Closed powellnorma closed 1 year ago
I think this might be fixable by replacing: https://github.com/lidatong/dataclasses-json/blob/5a1174cec19837219ead1dd87c335f1ee235ff58/dataclasses_json/core.py#L391-L392
with something like:
elif isinstance(obj, Collection) and not isinstance(obj, (str, bytes, int)):
Thanks for pointing this out! I think a better (generic) solution is to test against the Enum class, not to integers specifically (because ints are not collections).
I will have a look later this week.
Apparently, isinstance(<some instance member of IntFlag or Flag>, Collection)
returns True in Python 3.11, but not in 3.9 or 3.8. (Have not tested 3.10). I have opened a PR fixing this #447.
To be released in 0.5.14 end of this week
Description
Code snippet that reproduces the issue
Describe the results you expected
Should have worked
Python version you are using
Python 3.11.3
Environment description
dataclasses-json==0.5.13 marshmallow==3.20.1 mypy-extensions==1.0.0 packaging==23.1 typing-inspect==0.9.0 typing_extensions==4.7.1