You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to deserialize a nullable Dict[T, U] results in get_dict_parser being called anyway and raising an AttributeError due to the target dict being None.
Testing with Python 3.7 and dataclass_factory 2.4.1 the following code will raise:
from typing import Optional, Dict, Any
from dataclass_factory import Factory
@dataclass
class Test:
x: Optional[Dict[str, Any]]
f = Factory()
f.load({"x": None}, Test)
The root issue seems to be that Optional is not being detected correctly as it is indistinguishable from Union[T, NoneType], which ends up in get_dict_parser raising due to the order of the type arguments.
The text was updated successfully, but these errors were encountered:
Trying to deserialize a nullable Dict[T, U] results in get_dict_parser being called anyway and raising an AttributeError due to the target dict being None.
Testing with Python 3.7 and dataclass_factory 2.4.1 the following code will raise:
The root issue seems to be that Optional is not being detected correctly as it is indistinguishable from Union[T, NoneType], which ends up in get_dict_parser raising due to the order of the type arguments.
The text was updated successfully, but these errors were encountered: