!82 [sync] PR-79: make the test check
From: @openeuler-sync-bot Reviewed-by: @caodongxia Signed-off-by: @caodongxia
This commit is contained in:
commit
fad7e4a6d7
@ -0,0 +1,64 @@
|
|||||||
|
From 8871c7285fc097fd1bf713aa184cba7e2804f625 Mon Sep 17 00:00:00 2
|
||||||
|
001
|
||||||
|
From: Bas van Beek <b.f.van.beek@vu.nl>
|
||||||
|
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.
|
||||||
|
|
||||||
|
---
|
||||||
|
numpy/typing/_generic_alias.py | 2 ++
|
||||||
|
numpy/typing/tests/test_generic_alias.py | 16 ++++++++++++++++
|
||||||
|
2 files changed, 18 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/numpy/typing/_generic_alias.py b/numpy/typing/_generic_alias.py
|
||||||
|
index 6852382..4195cd9 100644
|
||||||
|
--- a/numpy/typing/_generic_alias.py
|
||||||
|
+++ b/numpy/typing/_generic_alias.py
|
||||||
|
@@ -178,6 +178,8 @@ class _GenericAlias:
|
||||||
|
"__mro_entries__",
|
||||||
|
"__reduce__",
|
||||||
|
"__reduce_ex__",
|
||||||
|
+ "__copy__",
|
||||||
|
+ "__deepcopy__",
|
||||||
|
})
|
||||||
|
|
||||||
|
def __getattribute__(self, name: str) -> Any:
|
||||||
|
diff --git a/numpy/typing/tests/test_generic_alias.py b/numpy/typing/tests/test_generic_alias.py
|
||||||
|
index 5f0ac91..35c0da3 100644
|
||||||
|
--- 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 @@ class TestGenericAlias:
|
||||||
|
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)()
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
10
numpy.spec
10
numpy.spec
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: numpy
|
Name: numpy
|
||||||
Version: 1.21.4
|
Version: 1.21.4
|
||||||
Release: 7
|
Release: 8
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Summary: A fast multidimensional array facility for Python
|
Summary: A fast multidimensional array facility for Python
|
||||||
|
|
||||||
@ -13,6 +13,7 @@ Source0: https://files.pythonhosted.org/packages/fb/48/b0708ebd7718a8933f
|
|||||||
BuildRequires: openblas-devel
|
BuildRequires: openblas-devel
|
||||||
BuildRequires: lapack-devel gcc-gfortran
|
BuildRequires: lapack-devel gcc-gfortran
|
||||||
BuildRequires: python3-Cython >= 0.29.24
|
BuildRequires: python3-Cython >= 0.29.24
|
||||||
|
BuildRequires: python3-hypothesis
|
||||||
|
|
||||||
Patch0: backport-CVE-2021-41496.patch
|
Patch0: backport-CVE-2021-41496.patch
|
||||||
Patch1: backport-CVE-2021-41495.patch
|
Patch1: backport-CVE-2021-41495.patch
|
||||||
@ -20,6 +21,7 @@ Patch2: backport-CVE-2021-34141.patch
|
|||||||
|
|
||||||
Patch1000: numpy-1.21.4-sw.patch
|
Patch1000: numpy-1.21.4-sw.patch
|
||||||
Patch1001: add-loongarch-architecture-support.patch
|
Patch1001: add-loongarch-architecture-support.patch
|
||||||
|
Patch1002: backport-MAINT-Do-not-forward-__-deep-copy__-calls-of-_Gener.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
NumPy is the fundamental package for scientific computing with Python. It contains among other things:
|
NumPy is the fundamental package for scientific computing with Python. It contains among other things:
|
||||||
@ -112,6 +114,12 @@ popd &> /dev/null
|
|||||||
%exclude %{python3_sitearch}/%{name}/f2py/tests/
|
%exclude %{python3_sitearch}/%{name}/f2py/tests/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Feb 29 2024 liyanan <liyanan61@h-partners.com> - 1:1.21.4-8
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:make the test check
|
||||||
|
|
||||||
* Thu Feb 01 2024 shixuantong <shixuantong1@huawei.com> - 1:1.21.4-7
|
* Thu Feb 01 2024 shixuantong <shixuantong1@huawei.com> - 1:1.21.4-7
|
||||||
- Do not pack open-source test case files
|
- Do not pack open-source test case files
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user