Skip to content

Commit

Permalink
Fix for Python 3.9+.
Browse files Browse the repository at this point in the history
Fixes <ilevkivskyi#60>.

Based on an idea in
ilevkivskyi#60 (comment).
  • Loading branch information
Apteryks committed Jan 15, 2021
1 parent 0950ff8 commit 16919e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions typing_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

if NEW_TYPING:
from typing import (
Generic, Callable, Union, TypeVar, ClassVar, Tuple, _GenericAlias, ForwardRef
Generic, Callable, Union, TypeVar, ClassVar, Tuple, _GenericAlias, _SpecialGenericAlias, ForwardRef
)
from typing_extensions import Literal
else:
Expand Down Expand Up @@ -75,7 +75,7 @@ def is_generic_type(tp):
"""
if NEW_TYPING:
return (isinstance(tp, type) and issubclass(tp, Generic) or
isinstance(tp, _GenericAlias) and
(isinstance(tp, _GenericAlias) or isinstance(tp, _SpecialGenericAlias)) and
tp.__origin__ not in (Union, tuple, ClassVar, collections.abc.Callable))
return (isinstance(tp, GenericMeta) and not
isinstance(tp, (CallableMeta, TupleMeta)))
Expand Down

0 comments on commit 16919e2

Please sign in to comment.