commit:     84cb8926349b289d6886e92d15cf6c355253e555
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 24 01:48:45 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 24 01:48:45 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84cb8926

dev-python/numpy: backport python3.9+ test fix

Possible runtime repercussions so revbumping.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../numpy/files/numpy-1.21.4-copy-python-3.9.patch | 52 ++++++++++++++++++++++
 ...mpy-1.21.4-r1.ebuild => numpy-1.21.4-r2.ebuild} |  1 +
 2 files changed, 53 insertions(+)

diff --git a/dev-python/numpy/files/numpy-1.21.4-copy-python-3.9.patch 
b/dev-python/numpy/files/numpy-1.21.4-copy-python-3.9.patch
new file mode 100644
index 000000000000..81464151e753
--- /dev/null
+++ b/dev-python/numpy/files/numpy-1.21.4-copy-python-3.9.patch
@@ -0,0 +1,52 @@
+https://github.com/numpy/numpy/commit/50823973e857363f7d8052768276c2e86f004d61
+https://github.com/numpy/numpy/pull/20357
+
+From: Bas van Beek <[email protected]>
+Date: Wed, 10 Nov 2021 15:36:00 +0100
+Subject: [PATCH] MAINT: Do not forward `__(deep)copy__` calls of
+ `_GenericAlias` to the wrapped type
+
+Adapt to the python 3.9.8 changes made in bpo-45167.
+--- a/numpy/typing/_generic_alias.py
++++ b/numpy/typing/_generic_alias.py
+@@ -178,6 +178,8 @@ def __eq__(self, value: object) -> bool:
+         "__mro_entries__",
+         "__reduce__",
+         "__reduce_ex__",
++        "__copy__",
++        "__deepcopy__",
+     })
+ 
+     def __getattribute__(self, name: str) -> Any:
+--- a/numpy/typing/tests/test_generic_alias.py
++++ b/numpy/typing/tests/test_generic_alias.py
+@@ -1,6 +1,7 @@
+ from __future__ import annotations
+ 
+ import sys
++import copy
+ import types
+ import pickle
+ import weakref
+@@ -74,6 +75,21 @@ def test_pass(self, name: str, func: FuncType) -> None:
+             value_ref = func(NDArray_ref)
+             assert value == value_ref
+ 
++    @pytest.mark.parametrize("name,func", [
++        ("__copy__", lambda n: n == copy.copy(n)),
++        ("__deepcopy__", lambda n: n == copy.deepcopy(n)),
++    ])
++    def test_copy(self, name: str, func: FuncType) -> None:
++        value = func(NDArray)
++
++        # xref bpo-45167
++        GE_398 = (
++            sys.version_info[:2] == (3, 9) and sys.version_info >= (3, 9, 8)
++        )
++        if GE_398 or sys.version_info >= (3, 10, 1):
++            value_ref = func(NDArray_ref)
++            assert value == value_ref
++
+     def test_weakref(self) -> None:
+         """Test ``__weakref__``."""
+         value = weakref.ref(NDArray)()

diff --git a/dev-python/numpy/numpy-1.21.4-r1.ebuild 
b/dev-python/numpy/numpy-1.21.4-r2.ebuild
similarity index 98%
rename from dev-python/numpy/numpy-1.21.4-r1.ebuild
rename to dev-python/numpy/numpy-1.21.4-r2.ebuild
index 144d2a9d4574..27db26c49415 100644
--- a/dev-python/numpy/numpy-1.21.4-r1.ebuild
+++ b/dev-python/numpy/numpy-1.21.4-r2.ebuild
@@ -46,6 +46,7 @@ BDEPEND="
 PATCHES=(
        "${FILESDIR}"/numpy-1.21.0-no-hardcode-blasv2.patch
        "${FILESDIR}"/numpy-1.21.4-build-compiler-args-ceph.patch
+       "${FILESDIR}"/numpy-1.21.4-copy-python-3.9.patch
 )
 
 distutils_enable_tests pytest

Reply via email to