Skip to content

Commit

Permalink
Resolve deprecation of NamedTuple._field_types in Python 3.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-gardner1 authored and pengyunie committed Jun 9, 2022
1 parent dead632 commit be938fb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions seutil/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,11 @@ def deserialize(
field_values = {}
for f in clz._fields:
if hasattr(clz, "_field_types"):
# for Python <3.9
t = clz._field_types.get(f)
elif hasattr(clz, '__annotations__'):
# for Python >=3.9
t = clz.__annotations__.get(f)
else:
t = None
if f in data:
Expand Down

0 comments on commit be938fb

Please sign in to comment.