Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
195948e753
!81 [sync] PR-79: make the test check
From: @openeuler-sync-bot 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
2024-02-29 09:17:50 +00:00
lyn1001
4f92b15a5c make the test check
(cherry picked from commit cd04272a2edf14cf5a55e94b208ee8eac107451f)
2024-02-29 16:25:19 +08:00
openeuler-ci-bot
627e6cedb8
!71 [sync] PR-69: Do not pack open-source test case files
From: @openeuler-sync-bot 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
2024-02-21 02:07:35 +00:00
shixuantong
9c4807623d Do not pack open-source test case files
(cherry picked from commit 8d9bf895d35942d8ec715f58a6e3590a2196dc3a)
2024-02-20 19:54:06 +08:00
openeuler-ci-bot
b7d402f6d8
!68 [sync] PR-65: 从numpy包中删除f2py目录,这个目录在numpy-f2py包中安装。
From: @openeuler-sync-bot 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
2024-02-20 11:47:30 +00:00
Qwei
7c9ca87da2 Remove f2py from numpy package
It is in separated package numpy-f2py.

Signed-off-by: Qwei <qiang.wei@suse.com>
(cherry picked from commit 2dd6df873733bc3add4ee024a96efa8155841e3b)
2024-02-01 15:23:54 +08:00
openeuler-ci-bot
66030820e9
!63 [sync] PR-62: 增加龙芯申威架构支持
From: @openeuler-sync-bot 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
2023-09-21 12:21:52 +00:00
yangchenguang
1ebfc79508 Add loongarch64 and sw_64 support
Signed-off-by: yangchenguang <yangchenguang@kylinsec.com.cn>
(cherry picked from commit 5a5108aa0f89890cd72f77e86ead7bbf0526f9c8)
2023-09-21 19:17:04 +08:00
openeuler-ci-bot
f3a3b9116f
!46 [sync] PR-45: fix CVE-2021-34141
From: @openeuler-sync-bot 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
2022-06-07 02:13:34 +00:00
rwx403335
5512055ab4 fix CVE-2021-34141
(cherry picked from commit 4cc429f311c39a5a2be24a76bdc038d7245e54ba)
2022-05-31 10:13:18 +08:00
5 changed files with 307 additions and 3 deletions

View File

@ -0,0 +1,46 @@
From ca19adc35b02cff09844228f2562b1d1522e2fe4 Mon Sep 17 00:00:00 2001
From: wang--ge <wang__ge@126.com>
Date: Mon, 25 Apr 2022 09:49:00 +0800
Subject: [PATCH] add loongarch architecture support
---
numpy/core/include/numpy/npy_cpu.h | 3 +++
numpy/core/include/numpy/npy_endian.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/numpy/core/include/numpy/npy_cpu.h b/numpy/core/include/numpy/npy_cpu.h
index bc1fad7..e975b01 100644
--- a/numpy/core/include/numpy/npy_cpu.h
+++ b/numpy/core/include/numpy/npy_cpu.h
@@ -18,6 +18,7 @@
* NPY_CPU_ARCEL
* NPY_CPU_ARCEB
* NPY_CPU_RISCV64
+ * NPY_CPU_LOONGARCH
* NPY_CPU_WASM
*/
#ifndef _NPY_CPUARCH_H_
@@ -103,6 +104,8 @@
#define NPY_CPU_ARCEB
#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
#define NPY_CPU_RISCV64
+#elif defined(__loongarch__)
+ #define NPY_CPU_LOONGARCH
#elif defined(__EMSCRIPTEN__)
/* __EMSCRIPTEN__ is defined by emscripten: an LLVM-to-Web compiler */
#define NPY_CPU_WASM
diff --git a/numpy/core/include/numpy/npy_endian.h b/numpy/core/include/numpy/npy_endian.h
index aa367a0..82609ed 100644
--- a/numpy/core/include/numpy/npy_endian.h
+++ b/numpy/core/include/numpy/npy_endian.h
@@ -49,6 +49,7 @@
|| defined(NPY_CPU_PPC64LE) \
|| defined(NPY_CPU_ARCEL) \
|| defined(NPY_CPU_RISCV64) \
+ || defined(NPY_CPU_LOONGARCH) \
|| defined(NPY_CPU_WASM)
#define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN
#elif defined(NPY_CPU_PPC) \
--
2.27.0

View File

@ -0,0 +1,144 @@
From eeef9d4646103c3b1afd3085f1393f2b3f9575b2 Mon Sep 17 00:00:00 2001
From: NectDz <54990613+NectDz@users.noreply.github.com>
Date: Tue, 10 Aug 2021 18:00:35 -0500
Subject: [PATCH] DEP: Remove deprecated numeric style dtype strings (#19539)
Finishes the deprecation, and effectively closes gh-18993
* Insecure String Comparison
* Finished Deprecations
* Breaks numpy types
* Removed elements in dep_tps
* Delete Typecode Comment
* Deleted for loop
* Fixed 80 characters or more issue
* Expired Release Note
* Updated Release Note
* Update numpy/core/numerictypes.py
* Update numpy/core/tests/test_deprecations.py
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
---
doc/release/upcoming_changes/19539.expired.rst | 2 ++
numpy/core/_type_aliases.py | 9 ---------
numpy/core/src/multiarray/descriptor.c | 16 ----------------
numpy/core/tests/test_deprecations.py | 15 ---------------
numpy/core/tests/test_dtype.py | 9 ++++++---
5 files changed, 8 insertions(+), 43 deletions(-)
create mode 100644 doc/release/upcoming_changes/19539.expired.rst
diff --git a/doc/release/upcoming_changes/19539.expired.rst b/doc/release/upcoming_changes/19539.expired.rst
new file mode 100644
index 0000000..6e94f17
--- /dev/null
+++ b/doc/release/upcoming_changes/19539.expired.rst
@@ -0,0 +1,2 @@
+* Using the strings ``"Bytes0"``, ``"Datetime64"``, ``"Str0"``, ``"Uint32"``,
+ and ``"Uint64"`` as a dtype will now raise a ``TypeError``.
\ No newline at end of file
diff --git a/numpy/core/_type_aliases.py b/numpy/core/_type_aliases.py
index 67addef..3765a0d 100644
--- a/numpy/core/_type_aliases.py
+++ b/numpy/core/_type_aliases.py
@@ -115,15 +115,6 @@ def _add_aliases():
# add forward, reverse, and string mapping to numarray
sctypeDict[char] = info.type
- # Add deprecated numeric-style type aliases manually, at some point
- # we may want to deprecate the lower case "bytes0" version as well.
- for name in ["Bytes0", "Datetime64", "Str0", "Uint32", "Uint64"]:
- if english_lower(name) not in allTypes:
- # Only one of Uint32 or Uint64, aliases of `np.uintp`, was (and is) defined, note that this
- # is not UInt32/UInt64 (capital i), which is removed.
- continue
- allTypes[name] = allTypes[english_lower(name)]
- sctypeDict[name] = sctypeDict[english_lower(name)]
_add_aliases()
diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c
index 50964da..90453e3 100644
--- a/numpy/core/src/multiarray/descriptor.c
+++ b/numpy/core/src/multiarray/descriptor.c
@@ -1723,22 +1723,6 @@ _convert_from_str(PyObject *obj, int align)
goto fail;
}
- /* Check for a deprecated Numeric-style typecode */
- /* `Uint` has deliberately weird uppercasing */
- char *dep_tps[] = {"Bytes", "Datetime64", "Str", "Uint"};
- int ndep_tps = sizeof(dep_tps) / sizeof(dep_tps[0]);
- for (int i = 0; i < ndep_tps; ++i) {
- char *dep_tp = dep_tps[i];
-
- if (strncmp(type, dep_tp, strlen(dep_tp)) == 0) {
- /* Deprecated 2020-06-09, NumPy 1.20 */
- if (DEPRECATE("Numeric-style type codes are "
- "deprecated and will result in "
- "an error in the future.") < 0) {
- goto fail;
- }
- }
- }
/*
* Probably only ever dispatches to `_convert_from_type`, but who
* knows what users are injecting into `np.typeDict`.
diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py
index 42e632e..44a3ed7 100644
--- a/numpy/core/tests/test_deprecations.py
+++ b/numpy/core/tests/test_deprecations.py
@@ -314,21 +314,6 @@ def test_insufficient_width_negative(self):
self.assert_deprecated(np.binary_repr, args=args, kwargs=kwargs)
-class TestNumericStyleTypecodes(_DeprecationTestCase):
- """
- Most numeric style typecodes were previously deprecated (and removed)
- in 1.20. This also deprecates the remaining ones.
- """
- # 2020-06-09, NumPy 1.20
- def test_all_dtypes(self):
- deprecated_types = ['Bytes0', 'Datetime64', 'Str0']
- # Depending on intp size, either Uint32 or Uint64 is defined:
- deprecated_types.append(f"U{np.dtype(np.intp).name}")
- for dt in deprecated_types:
- self.assert_deprecated(np.dtype, exceptions=(TypeError,),
- args=(dt,))
-
-
class TestDTypeAttributeIsDTypeDeprecation(_DeprecationTestCase):
# Deprecated 2021-01-05, NumPy 1.21
message = r".*`.dtype` attribute"
diff --git a/numpy/core/tests/test_dtype.py b/numpy/core/tests/test_dtype.py
index 4f52268..23269f0 100644
--- a/numpy/core/tests/test_dtype.py
+++ b/numpy/core/tests/test_dtype.py
@@ -109,9 +109,12 @@ def test_richcompare_invalid_dtype_comparison(self, operation):
operation(np.dtype(np.int32), 7)
@pytest.mark.parametrize("dtype",
- ['Bool', 'Complex32', 'Complex64', 'Float16', 'Float32', 'Float64',
- 'Int8', 'Int16', 'Int32', 'Int64', 'Object0', 'Timedelta64',
- 'UInt8', 'UInt16', 'UInt32', 'UInt64', 'Void0',
+ ['Bool', 'Bytes0', 'Complex32', 'Complex64',
+ 'Datetime64', 'Float16', 'Float32', 'Float64',
+ 'Int8', 'Int16', 'Int32', 'Int64',
+ 'Object0', 'Str0', 'Timedelta64',
+ 'UInt8', 'UInt16', 'Uint32', 'UInt32',
+ 'Uint64', 'UInt64', 'Void0',
"Float128", "Complex128"])
def test_numeric_style_types_are_invalid(self, dtype):
with assert_raises(TypeError):
--
1.8.3.1

View File

@ -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

23
numpy-1.21.4-sw.patch Normal file
View File

@ -0,0 +1,23 @@
diff -Naur numpy-1.21.4.org/numpy/core/include/numpy/npy_cpu.h numpy-1.21.4.sw/numpy/core/include/numpy/npy_cpu.h
--- numpy-1.21.4.org/numpy/core/include/numpy/npy_cpu.h 2022-02-27 02:48:27.080000000 +0000
+++ numpy-1.21.4.sw/numpy/core/include/numpy/npy_cpu.h 2022-02-28 06:42:23.070000000 +0000
@@ -61,6 +61,8 @@
#define NPY_CPU_IA64
#elif defined(__hppa)
#define NPY_CPU_HPPA
+#elif defined(__sw_64__)
+ #define NPY_CPU_SW_64
#elif defined(__alpha__)
#define NPY_CPU_ALPHA
#elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM64)
diff -Naur numpy-1.21.4.org/numpy/core/include/numpy/npy_endian.h numpy-1.21.4.sw/numpy/core/include/numpy/npy_endian.h
--- numpy-1.21.4.org/numpy/core/include/numpy/npy_endian.h 2022-02-27 02:48:27.080000000 +0000
+++ numpy-1.21.4.sw/numpy/core/include/numpy/npy_endian.h 2022-02-28 06:44:18.830000000 +0000
@@ -41,6 +41,7 @@
|| defined(NPY_CPU_AMD64) \
|| defined(NPY_CPU_IA64) \
|| defined(NPY_CPU_ALPHA) \
+ || defined(NPY_CPU_SW_64) \
|| defined(NPY_CPU_ARMEL) \
|| defined(NPY_CPU_ARMEL_AARCH32) \
|| defined(NPY_CPU_ARMEL_AARCH64) \

View File

@ -2,7 +2,7 @@
Name: numpy
Version: 1.21.4
Release: 3
Release: 8
Epoch: 1
Summary: A fast multidimensional array facility for Python
@ -13,9 +13,15 @@ Source0: https://files.pythonhosted.org/packages/fb/48/b0708ebd7718a8933f
BuildRequires: openblas-devel
BuildRequires: lapack-devel gcc-gfortran
BuildRequires: python3-Cython >= 0.29.24
BuildRequires: python3-hypothesis
Patch0: backport-CVE-2021-41496.patch
Patch1: backport-CVE-2021-41495.patch
Patch2: backport-CVE-2021-34141.patch
Patch1000: numpy-1.21.4-sw.patch
Patch1001: add-loongarch-architecture-support.patch
Patch1002: backport-MAINT-Do-not-forward-__-deep-copy__-calls-of-_Gener.patch
%description
NumPy is the fundamental package for scientific computing with Python. It contains among other things:
@ -96,15 +102,36 @@ popd &> /dev/null
%{python3_sitearch}/%{name}/*
%{python3_sitearch}/%{name}-*.egg-info
%exclude %{python3_sitearch}/%{name}/LICENSE.txt
%exclude %{python3_sitearch}/%{name}/f2py
%exclude %{python3_sitearch}/%{name}/tests/
%exclude %{python3_sitearch}/%{name}/*/tests/
%files -n python3-numpy-f2py
%{_bindir}/f2py
%{_bindir}/f2py3
%{_bindir}/f2py3.*
%{python3_sitearch}/%{name}/f2py
%exclude %{python3_sitearch}/%{name}/f2py/tests/
%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
- Do not pack open-source test case files
* Mon Oct 30 2023 Qiang Wei <qiang.wei@suse.com> - 1:1.21.4-6
- Remove f2py from numpy package. It is in numpy-f2py pakcage.
* Thu Aug 17 2023 yangchenguang <yangchenguang@kylinsec.com.cn> - 1:1.21.4-5
- Add loongarch64 and sw_64 support
* Thu May 26 2022 renhongxun <renhongxun@h-partners.com> - 1.21.4-4
- fix CVE-2021-34141
* Tue Feb 08 2022 renhongxun <renhongxun@h-partners.com> - 1.21.4-3
- fix CVE-2021-41495
@ -114,7 +141,7 @@ popd &> /dev/null
* Fri Dec 24 2021 yuanxin <yuanxin24@huawei.com> - 1.21.4-1
- update version to 1.21.4
* Thu Aug 24 2021 wulei<wulei80@huawei.com> - 1.18.5-1
* Tue Aug 24 2021 wulei<wulei80@huawei.com> - 1.18.5-1
- update to 1.18.5
* Mon Jan 18 2021 tianwei<tianwei12@huawei.com> - 1.16.5-6