Skip to content

Commit

Permalink
[typedef] fix for 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
autumnjolitz committed Feb 29, 2024
1 parent 1f68ad0 commit 46552e0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions instruct/typedef.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
from .constants import Range
from .exceptions import RangeError

if sys.version_info < (3, 10):
LOWER_THAN_310 = sys.version_info < (3, 10)

if LOWER_THAN_310:
get_origin = _get_origin
else:

Expand Down Expand Up @@ -446,8 +448,9 @@ def is_typing_definition(item):
origin = get_origin(item)
if origin is not None:
return is_typing_definition(origin)
if isinstance(item, (types.UnionType)):
return True
if LOWER_THAN_310:
if isinstance(item, (types.UnionType,)):
return True
return False


Expand Down

0 comments on commit 46552e0

Please sign in to comment.