commit:     3aa2bfc2456e536d5471bb223754e872ccb8027d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon May 23 16:18:04 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon May 23 16:47:52 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3aa2bfc2

dev-python/typeguard: Fix py3.10 test failures

Closes: https://bugs.gentoo.org/834957
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../typeguard/files/typeguard-2.13.3-test.patch    | 44 ++++++++++++++++++++++
 dev-python/typeguard/typeguard-2.13.3-r1.ebuild    |  5 +++
 2 files changed, 49 insertions(+)

diff --git a/dev-python/typeguard/files/typeguard-2.13.3-test.patch 
b/dev-python/typeguard/files/typeguard-2.13.3-test.patch
new file mode 100644
index 000000000000..3c01c018ea86
--- /dev/null
+++ b/dev-python/typeguard/files/typeguard-2.13.3-test.patch
@@ -0,0 +1,44 @@
+diff --git a/src/typeguard/__init__.py b/src/typeguard/__init__.py
+index 5684d63..27fa30b 100644
+--- a/src/typeguard/__init__.py
++++ b/src/typeguard/__init__.py
+@@ -61,22 +61,25 @@ except ImportError:
+     from typing import _ForwardRef as ForwardRef
+     evaluate_forwardref = ForwardRef._eval_type
+ 
+-if sys.version_info >= (3, 10):
+-    from typing import is_typeddict
+-else:
+-    _typed_dict_meta_types = ()
+-    if sys.version_info >= (3, 8):
+-        from typing import _TypedDictMeta
+-        _typed_dict_meta_types += (_TypedDictMeta,)
++try:
++    from typing_extensions import is_typeddict
++except ImportError:
++    if sys.version_info >= (3, 10):
++        from typing import is_typeddict
++    else:
++        _typed_dict_meta_types = ()
++        if sys.version_info >= (3, 8):
++            from typing import _TypedDictMeta
++            _typed_dict_meta_types += (_TypedDictMeta,)
+ 
+-    try:
+-        from typing_extensions import _TypedDictMeta
+-        _typed_dict_meta_types += (_TypedDictMeta,)
+-    except ImportError:
+-        pass
++        try:
++            from typing_extensions import _TypedDictMeta
++            _typed_dict_meta_types += (_TypedDictMeta,)
++        except ImportError:
++            pass
+ 
+-    def is_typeddict(tp) -> bool:
+-        return isinstance(tp, _typed_dict_meta_types)
++        def is_typeddict(tp) -> bool:
++            return isinstance(tp, _typed_dict_meta_types)
+ 
+ 
+ if TYPE_CHECKING:

diff --git a/dev-python/typeguard/typeguard-2.13.3-r1.ebuild 
b/dev-python/typeguard/typeguard-2.13.3-r1.ebuild
index b4cdda966b33..232c7feab833 100644
--- a/dev-python/typeguard/typeguard-2.13.3-r1.ebuild
+++ b/dev-python/typeguard/typeguard-2.13.3-r1.ebuild
@@ -33,6 +33,11 @@ distutils_enable_tests pytest
 
 export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
 
+PATCHES=(
+       # backport from https://github.com/agronholm/typeguard/pull/243
+       "${FILESDIR}"/${P}-test.patch
+)
+
 python_test() {
        local EPYTEST_IGNORE=(
                # mypy changes results from version to version

Reply via email to