3
5
Fork 0
mirror of git://git.savannah.gnu.org/guix.git synced 2023-12-14 03:33:07 +01:00
guix/gnu/packages/patches/python-typing-inspect-fix.patch

39 lines
1.4 KiB
Diff
Raw Normal View History

From 16919e21936179e53df2f376c8b59b5fc44bd2dd Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 15 Jan 2021 09:22:52 -0500
Subject: [PATCH] Fix for Python 3.9+.
Fixes <https://github.com/ilevkivskyi/typing_inspect/issues/60>.
Based on an idea in
https://github.com/ilevkivskyi/typing_inspect/issues/60#issuecomment-683187584.
---
typing_inspect.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/typing_inspect.py b/typing_inspect.py
index 1ca68ed..31d05ee 100644
--- a/typing_inspect.py
+++ b/typing_inspect.py
@@ -21,7 +21,7 @@ LEGACY_TYPING = False
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:
@@ -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)))
--
2.29.2