1 |
commit: 84cb8926349b289d6886e92d15cf6c355253e555 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Nov 24 01:48:45 2021 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 24 01:48:45 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84cb8926 |
7 |
|
8 |
dev-python/numpy: backport python3.9+ test fix |
9 |
|
10 |
Possible runtime repercussions so revbumping. |
11 |
|
12 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
13 |
|
14 |
.../numpy/files/numpy-1.21.4-copy-python-3.9.patch | 52 ++++++++++++++++++++++ |
15 |
...mpy-1.21.4-r1.ebuild => numpy-1.21.4-r2.ebuild} | 1 + |
16 |
2 files changed, 53 insertions(+) |
17 |
|
18 |
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 |
19 |
new file mode 100644 |
20 |
index 000000000000..81464151e753 |
21 |
--- /dev/null |
22 |
+++ b/dev-python/numpy/files/numpy-1.21.4-copy-python-3.9.patch |
23 |
@@ -0,0 +1,52 @@ |
24 |
+https://github.com/numpy/numpy/commit/50823973e857363f7d8052768276c2e86f004d61 |
25 |
+https://github.com/numpy/numpy/pull/20357 |
26 |
+ |
27 |
+From: Bas van Beek <b.f.van.beek@××.nl> |
28 |
+Date: Wed, 10 Nov 2021 15:36:00 +0100 |
29 |
+Subject: [PATCH] MAINT: Do not forward `__(deep)copy__` calls of |
30 |
+ `_GenericAlias` to the wrapped type |
31 |
+ |
32 |
+Adapt to the python 3.9.8 changes made in bpo-45167. |
33 |
+--- a/numpy/typing/_generic_alias.py |
34 |
++++ b/numpy/typing/_generic_alias.py |
35 |
+@@ -178,6 +178,8 @@ def __eq__(self, value: object) -> bool: |
36 |
+ "__mro_entries__", |
37 |
+ "__reduce__", |
38 |
+ "__reduce_ex__", |
39 |
++ "__copy__", |
40 |
++ "__deepcopy__", |
41 |
+ }) |
42 |
+ |
43 |
+ def __getattribute__(self, name: str) -> Any: |
44 |
+--- a/numpy/typing/tests/test_generic_alias.py |
45 |
++++ b/numpy/typing/tests/test_generic_alias.py |
46 |
+@@ -1,6 +1,7 @@ |
47 |
+ from __future__ import annotations |
48 |
+ |
49 |
+ import sys |
50 |
++import copy |
51 |
+ import types |
52 |
+ import pickle |
53 |
+ import weakref |
54 |
+@@ -74,6 +75,21 @@ def test_pass(self, name: str, func: FuncType) -> None: |
55 |
+ value_ref = func(NDArray_ref) |
56 |
+ assert value == value_ref |
57 |
+ |
58 |
++ @pytest.mark.parametrize("name,func", [ |
59 |
++ ("__copy__", lambda n: n == copy.copy(n)), |
60 |
++ ("__deepcopy__", lambda n: n == copy.deepcopy(n)), |
61 |
++ ]) |
62 |
++ def test_copy(self, name: str, func: FuncType) -> None: |
63 |
++ value = func(NDArray) |
64 |
++ |
65 |
++ # xref bpo-45167 |
66 |
++ GE_398 = ( |
67 |
++ sys.version_info[:2] == (3, 9) and sys.version_info >= (3, 9, 8) |
68 |
++ ) |
69 |
++ if GE_398 or sys.version_info >= (3, 10, 1): |
70 |
++ value_ref = func(NDArray_ref) |
71 |
++ assert value == value_ref |
72 |
++ |
73 |
+ def test_weakref(self) -> None: |
74 |
+ """Test ``__weakref__``.""" |
75 |
+ value = weakref.ref(NDArray)() |
76 |
|
77 |
diff --git a/dev-python/numpy/numpy-1.21.4-r1.ebuild b/dev-python/numpy/numpy-1.21.4-r2.ebuild |
78 |
similarity index 98% |
79 |
rename from dev-python/numpy/numpy-1.21.4-r1.ebuild |
80 |
rename to dev-python/numpy/numpy-1.21.4-r2.ebuild |
81 |
index 144d2a9d4574..27db26c49415 100644 |
82 |
--- a/dev-python/numpy/numpy-1.21.4-r1.ebuild |
83 |
+++ b/dev-python/numpy/numpy-1.21.4-r2.ebuild |
84 |
@@ -46,6 +46,7 @@ BDEPEND=" |
85 |
PATCHES=( |
86 |
"${FILESDIR}"/numpy-1.21.0-no-hardcode-blasv2.patch |
87 |
"${FILESDIR}"/numpy-1.21.4-build-compiler-args-ceph.patch |
88 |
+ "${FILESDIR}"/numpy-1.21.4-copy-python-3.9.patch |
89 |
) |
90 |
|
91 |
distutils_enable_tests pytest |