From aa6aa96b288bf3267e35569606533b188e24a5fa Mon Sep 17 00:00:00 2001 From: Anna Khaitovich Date: Jun 22 2020 13:02:51 +0000 Subject: Update to 0.6.0 --- diff --git a/python-typing-inspect.spec b/python-typing-inspect.spec index 245ad48..f794bef 100644 --- a/python-typing-inspect.spec +++ b/python-typing-inspect.spec @@ -2,8 +2,8 @@ %global pypi_srcname typing_inspect Name: python-%{pypi_name} -Version: 0.5.0 -Release: 3%{?dist} +Version: 0.6.0 +Release: 1%{?dist} Summary: Runtime inspection utilities for typing module License: MIT @@ -16,6 +16,8 @@ BuildRequires: python3dist(mypy-extensions) >= 0.3.0 BuildRequires: python3dist(setuptools) BuildRequires: python3dist(typing-extensions) >= 3.7.4 +Patch000: typing-3_9.patch + %description Typing Inspect The "%{pypi_srcname}" module defines experimental API for runtime inspection of types defined in the standard "typing" module. @@ -53,6 +55,9 @@ rm -rf %{pypi_name}.egg-info %{python3_sitelib}/%{pypi_srcname}-%{version}-py*.egg-info %changelog +* Mon Jun 22 2020 Anna Khaitovich - 0.6.0-1 +- Update to 0.6.0 + * Tue May 26 2020 Miro HronĨok - 0.5.0-3 - Rebuilt for Python 3.9 diff --git a/typing-3_9.patch b/typing-3_9.patch new file mode 100644 index 0000000..32b0045 --- /dev/null +++ b/typing-3_9.patch @@ -0,0 +1,44 @@ +diff --git a/typing_inspect.py b/typing_inspect.py +index 2444027..eee2ed3 100644 +--- a/typing_inspect.py ++++ b/typing_inspect.py +@@ -16,6 +16,7 @@ if NEW_TYPING: + + WITH_LITERAL = True + WITH_CLASSVAR = True ++WITH_TYPING_3_9 = True + LEGACY_TYPING = False + + if NEW_TYPING: +@@ -23,6 +24,12 @@ if NEW_TYPING: + Generic, Callable, Union, TypeVar, ClassVar, Tuple, _GenericAlias, ForwardRef + ) + from typing_extensions import Literal ++ ++ try: # python 3.9 ++ from typing import _SpecialGenericAlias ++ except ImportErrror: ++ WITH_TYPING_3_9 = False ++ + else: + from typing import ( + Callable, CallableMeta, Union, Tuple, TupleMeta, TypeVar, GenericMeta, _ForwardRef +@@ -43,7 +50,6 @@ else: + except ImportError: + WITH_LITERAL = False + +- + def _gorg(cls): + """This function exists for compatibility with old typing versions.""" + assert isinstance(cls, GenericMeta) +@@ -72,6 +78,10 @@ def is_generic_type(tp): + is_generic_type(MutableMapping[T, List[int]]) == True + is_generic_type(Sequence[Union[str, bytes]]) == True + """ ++ if WITH_TYPING_3_9: ++ return (isinstance(tp, type) and issubclass(tp, Generic) or ++ ((isinstance(tp, _GenericAlias) or isinstance(tp, _SpecialGenericAlias)) and ++ tp.__origin__ not in (Union, tuple, ClassVar, collections.abc.Callable))) + if NEW_TYPING: + return (isinstance(tp, type) and issubclass(tp, Generic) or + isinstance(tp, _GenericAlias) and