Skip to content

Commit 698f231

Browse files
committed
fix readonly __args__
1 parent 6e7f676 commit 698f231

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dacite/generics.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ def __concretize(
5656
hint_origin = get_origin(hint)
5757
hint_args = get_args(hint)
5858
if hint_origin and hint_args and hint_origin is not Literal:
59-
concretized = tuple(__concretize(a, generics, data_class) for a in hint_args)
60-
if concretized != hint_args:
59+
concrete_hint_args = tuple(__concretize(a, generics, data_class) for a in hint_args)
60+
if concrete_hint_args != hint_args:
61+
if sys.version_info.minor >= 9:
62+
return hint_origin[concrete_hint_args]
6163
try:
62-
hint.__args__ = concretized
64+
hint.__args__ = concrete_hint_args
6365
except AttributeError as err:
6466
raise DaciteError(f"Could not set __args__ on {hint} [original error: {err}]") from None
6567

0 commit comments

Comments
 (0)