Accepting request 920368 from home:bnavigator:branches:devel:languages:python:numeric

- Update to 1.21.2
  * #19497: MAINT: set Python version for 1.21.x to <3.11
  * #19533: BUG: Fix an issue wherein importing numpy.typing could raise
  * #19646: MAINT: Update Cython version for Python 3.10.
  * #19648: TST: Bump the python 3.10 test version from beta4 to rc1
  * #19651: TST: avoid distutils.sysconfig in runtests.py
  * #19652: MAINT: add missing dunder method to nditer type hints
  * #19656: BLD, SIMD: Fix testing extra checks when -Werror isn't applicable...
  * #19657: BUG: Remove logical object ufuncs with bool output
  * #19658: MAINT: Include .coveragerc in source distributions to support...
  * #19659: BUG: Fix bad write in masked iterator output copy paths
  * #19660: ENH: Add support for windows on arm targets
  * #19661: BUG: add base to templated arguments for platlib
  * #19662: BUG,DEP: Non-default UFunc signature/dtype usage should be deprecated
  * #19666: MAINT: Add Python 3.10 to supported versions.
  * #19668: TST,BUG: Sanitize path-separators when running runtest.py
  * #19671: BLD: load extra flags when checking for libflame
  * #19676: BLD: update circleCI docker image
  * #19677: REL: Prepare for 1.21.2 release.
- Release 1.21.1
  * #19311: REV,BUG: Replace NotImplemented with typing.Any
  * #19324: MAINT: Fixed the return-dtype of ndarray.real and imag
  * #19330: MAINT: Replace "dtype[Any]" with dtype in the definiton of...
  * #19342: DOC: Fix some docstrings that crash pdf generation.
  * #19343: MAINT: bump scipy-mathjax
  * #19347: BUG: Fix arr.flat.index for large arrays and big-endian machines
  * #19348: ENH: add numpy.f2py.get_include function
  * #19349: BUG: Fix reference count leak in ufunc dtype handling
  * #19350: MAINT: Annotate missing attributes of np.number subclasses
  * #19351: BUG: Fix cast safety and comparisons for zero sized voids

OBS-URL: https://build.opensuse.org/request/show/920368
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-numpy?expand=0&rev=95
This commit is contained in:
Matej Cepl 2021-09-21 09:17:03 +00:00 committed by Git OBS Bridge
parent b54abb607a
commit 0b4f6d23fe
6 changed files with 61 additions and 168 deletions

View File

@ -1,33 +0,0 @@
From 820cb97bcad0d171c9efbb8fb8d7e987a0514aa9 Mon Sep 17 00:00:00 2001
From: Sayed Adel <seiko@imavr.com>
Date: Fri, 2 Jul 2021 04:58:37 +0200
Subject: [PATCH] BUG, SIMD: Fix infinite loop during count non-zero on GCC-11
The issue appears when the compiler miss inlining a function that
returns or accepts a SIMD vector.
---
numpy/core/src/multiarray/item_selection.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c
index fb354ce5473..2b8ea9e79ac 100644
--- a/numpy/core/src/multiarray/item_selection.c
+++ b/numpy/core/src/multiarray/item_selection.c
@@ -2131,7 +2131,7 @@ count_nonzero_bytes_384(const npy_uint64 * w)
#if NPY_SIMD
/* Count the zero bytes between `*d` and `end`, updating `*d` to point to where to keep counting from. */
-static NPY_INLINE NPY_GCC_OPT_3 npyv_u8
+NPY_FINLINE NPY_GCC_OPT_3 npyv_u8
count_zero_bytes_u8(const npy_uint8 **d, const npy_uint8 *end, npy_uint8 max_count)
{
const npyv_u8 vone = npyv_setall_u8(1);
@@ -2150,7 +2150,7 @@ count_zero_bytes_u8(const npy_uint8 **d, const npy_uint8 *end, npy_uint8 max_cou
return vsum8;
}
-static NPY_INLINE NPY_GCC_OPT_3 npyv_u16x2
+NPY_FINLINE NPY_GCC_OPT_3 npyv_u16x2
count_zero_bytes_u16(const npy_uint8 **d, const npy_uint8 *end, npy_uint16 max_count)
{
npyv_u16x2 vsum16;

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e80fe25cba41c124d04c662f33f6364909b985f2eb5998aaa5ae4b9587242cce
size 10252686

3
numpy-1.21.2.zip Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:423216d8afc5923b15df86037c6053bf030d15cc9e3224206ef868c2d63dd6dc
size 10264801

View File

@ -1,125 +0,0 @@
From be09bb6ba4d27fbd1f667d34bb2f11cccb446d65 Mon Sep 17 00:00:00 2001
From: Gregory Lee <grlee77@gmail.com>
Date: Thu, 24 Jun 2021 08:37:01 -0400
Subject: [PATCH 1/4] BUG: protect against access an attribute of a NULL
pointer
Have PyArray_GetCastSafety return -1 if from is NULL
---
numpy/core/src/multiarray/convert_datatype.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/numpy/core/src/multiarray/convert_datatype.c b/numpy/core/src/multiarray/convert_datatype.c
index d197a4bea31..716e5dd3d11 100644
--- a/numpy/core/src/multiarray/convert_datatype.c
+++ b/numpy/core/src/multiarray/convert_datatype.c
@@ -417,6 +417,9 @@ PyArray_GetCastSafety(
if (to != NULL) {
to_dtype = NPY_DTYPE(to);
}
+ if (from == NULL) {
+ return -1;
+ }
PyObject *meth = PyArray_GetCastingImpl(NPY_DTYPE(from), to_dtype);
if (meth == NULL) {
return -1;
@@ -3293,8 +3296,10 @@ void_to_void_resolve_descriptors(
casting = NPY_NO_CASTING | _NPY_CAST_IS_VIEW;
}
}
- NPY_CASTING field_casting = PyArray_GetCastSafety(
- given_descrs[0]->subarray->base, given_descrs[1]->subarray->base, NULL);
+
+ PyArray_Descr *from_base = (from_sub == NULL) ? NULL : from_sub->base;
+ PyArray_Descr *to_base = (to_sub == NULL) ? NULL : to_sub->base;
+ NPY_CASTING field_casting = PyArray_GetCastSafety(from_base, to_base, NULL);
if (field_casting < 0) {
return -1;
}
From 3c901b49bd8715c93824c27682d81434d869498a Mon Sep 17 00:00:00 2001
From: Gregory Lee <grlee77@gmail.com>
Date: Thu, 24 Jun 2021 11:16:22 -0400
Subject: [PATCH 2/4] pass descriptor rather than null
---
numpy/core/src/multiarray/convert_datatype.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/numpy/core/src/multiarray/convert_datatype.c b/numpy/core/src/multiarray/convert_datatype.c
index 716e5dd3d11..1bba276d2d1 100644
--- a/numpy/core/src/multiarray/convert_datatype.c
+++ b/numpy/core/src/multiarray/convert_datatype.c
@@ -417,9 +417,6 @@ PyArray_GetCastSafety(
if (to != NULL) {
to_dtype = NPY_DTYPE(to);
}
- if (from == NULL) {
- return -1;
- }
PyObject *meth = PyArray_GetCastingImpl(NPY_DTYPE(from), to_dtype);
if (meth == NULL) {
return -1;
@@ -3297,8 +3294,8 @@ void_to_void_resolve_descriptors(
}
}
- PyArray_Descr *from_base = (from_sub == NULL) ? NULL : from_sub->base;
- PyArray_Descr *to_base = (to_sub == NULL) ? NULL : to_sub->base;
+ PyArray_Descr *from_base = (from_sub == NULL) ? given_descrs[0] : from_sub->base;
+ PyArray_Descr *to_base = (to_sub == NULL) ? given_descrs[1] : to_sub->base;
NPY_CASTING field_casting = PyArray_GetCastSafety(from_base, to_base, NULL);
if (field_casting < 0) {
return -1;
From 8925fec4721b3a89e94d59b6149884d07fc581f4 Mon Sep 17 00:00:00 2001
From: Gregory Lee <grlee77@gmail.com>
Date: Thu, 24 Jun 2021 11:44:37 -0400
Subject: [PATCH 3/4] TST: test can_cast when only one argument has a subarray
---
numpy/core/tests/test_casting_unittests.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/numpy/core/tests/test_casting_unittests.py b/numpy/core/tests/test_casting_unittests.py
index 2cec1acd349..34f316d5ddc 100644
--- a/numpy/core/tests/test_casting_unittests.py
+++ b/numpy/core/tests/test_casting_unittests.py
@@ -646,3 +646,9 @@ def test_object_to_parametric_internal_error(self):
with pytest.raises(TypeError,
match="casting from object to the parametric DType"):
cast._resolve_descriptors((np.dtype("O"), None))
+
+ def test_void_to_structured_with_subarray(self):
+ # test case corresponding to gh-19325
+ dtype = np.dtype([("foo", "<f4", (3, 2))])
+ assert np.can_cast("V4", dtype, casting="unsafe")
+ assert not np.can_cast("V4", dtype, casting="no")
From 9bf60f5f8c5d0dde78b737932e61dec61b960d53 Mon Sep 17 00:00:00 2001
From: Gregory Lee <grlee77@gmail.com>
Date: Thu, 24 Jun 2021 13:41:03 -0400
Subject: [PATCH 4/4] TST: test both argument orders
---
numpy/core/tests/test_casting_unittests.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/numpy/core/tests/test_casting_unittests.py b/numpy/core/tests/test_casting_unittests.py
index 34f316d5ddc..d1924c1fda1 100644
--- a/numpy/core/tests/test_casting_unittests.py
+++ b/numpy/core/tests/test_casting_unittests.py
@@ -647,8 +647,10 @@ def test_object_to_parametric_internal_error(self):
match="casting from object to the parametric DType"):
cast._resolve_descriptors((np.dtype("O"), None))
- def test_void_to_structured_with_subarray(self):
+ @pytest.mark.parametrize("casting", ["no", "unsafe"])
+ def test_void_and_structured_with_subarray(self, casting):
# test case corresponding to gh-19325
dtype = np.dtype([("foo", "<f4", (3, 2))])
- assert np.can_cast("V4", dtype, casting="unsafe")
- assert not np.can_cast("V4", dtype, casting="no")
+ expected = casting == "unsafe"
+ assert np.can_cast("V4", dtype, casting=casting) == expected
+ assert np.can_cast(dtype, "V4", casting=casting) == expected

View File

@ -1,3 +1,57 @@
-------------------------------------------------------------------
Mon Sep 20 16:51:56 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Update to 1.21.2
* #19497: MAINT: set Python version for 1.21.x to <3.11
* #19533: BUG: Fix an issue wherein importing numpy.typing could raise
* #19646: MAINT: Update Cython version for Python 3.10.
* #19648: TST: Bump the python 3.10 test version from beta4 to rc1
* #19651: TST: avoid distutils.sysconfig in runtests.py
* #19652: MAINT: add missing dunder method to nditer type hints
* #19656: BLD, SIMD: Fix testing extra checks when -Werror isn't applicable...
* #19657: BUG: Remove logical object ufuncs with bool output
* #19658: MAINT: Include .coveragerc in source distributions to support...
* #19659: BUG: Fix bad write in masked iterator output copy paths
* #19660: ENH: Add support for windows on arm targets
* #19661: BUG: add base to templated arguments for platlib
* #19662: BUG,DEP: Non-default UFunc signature/dtype usage should be deprecated
* #19666: MAINT: Add Python 3.10 to supported versions.
* #19668: TST,BUG: Sanitize path-separators when running runtest.py
* #19671: BLD: load extra flags when checking for libflame
* #19676: BLD: update circleCI docker image
* #19677: REL: Prepare for 1.21.2 release.
- Release 1.21.1
* #19311: REV,BUG: Replace NotImplemented with typing.Any
* #19324: MAINT: Fixed the return-dtype of ndarray.real and imag
* #19330: MAINT: Replace "dtype[Any]" with dtype in the definiton of...
* #19342: DOC: Fix some docstrings that crash pdf generation.
* #19343: MAINT: bump scipy-mathjax
* #19347: BUG: Fix arr.flat.index for large arrays and big-endian machines
* #19348: ENH: add numpy.f2py.get_include function
* #19349: BUG: Fix reference count leak in ufunc dtype handling
* #19350: MAINT: Annotate missing attributes of np.number subclasses
* #19351: BUG: Fix cast safety and comparisons for zero sized voids
* #19352: BUG: Correct Cython declaration in random
* #19353: BUG: protect against accessing base attribute of a NULL subarray
* #19365: BUG, SIMD: Fix detecting AVX512 features on Darwin
* #19366: MAINT: remove print()'s in distutils template handling
* #19390: ENH: SIMD architectures to show_config
* #19391: BUG: Do not raise deprecation warning for all nans in unique...
* #19392: BUG: Fix NULL special case in object-to-any cast code
* #19430: MAINT: Use arm64-graviton2 for testing on travis
* #19495: BUILD: update OpenBLAS to v0.3.17
* #19496: MAINT: Avoid unicode characters in division SIMD code comments
* #19499: BUG, SIMD: Fix infinite loop during count non-zero on GCC-11
* #19500: BUG: fix a numpy.npiter leak in npyiter_multi_index_set
* #19501: TST: Fix a GenericAlias test failure for python 3.9.0
* #19502: MAINT: Start testing with Python 3.10.0b3.
* #19503: MAINT: Add missing dtype overloads for object- and ctypes-based...
* #19510: REL: Prepare for NumPy 1.21.1 release.
- Drop 0001-BUG-Fix-infinite-loop-on-gcc11.patch fixed upstream
(by gcc 11.2)
- Drop numpy-pr19326-fix-subarray-segfault.patch merged upstream
(backported)
-------------------------------------------------------------------
Fri Jul 16 15:14:36 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@ -17,8 +17,8 @@
%global flavor @BUILD_FLAVOR@%{nil}
%define ver 1.21.0
%define _ver 1_21_0
%define ver 1.21.2
%define _ver 1_21_2
%define pname python-numpy
%define hpc_upcase_trans_hyph() %(echo %{**} | tr [a-z] [A-Z] | tr '-' '_')
%if "%{flavor}" == ""
@ -77,11 +77,8 @@ Source99: python-numpy-rpmlintrc
Patch0: numpy-buildfix.patch
# PATCH-FIX-OPENSUSE numpy-1.9.0-remove-__declspec.patch -- fix for spurious compiler warnings that cause build failure
Patch1: numpy-1.9.0-remove-__declspec.patch
# PATCH-FIX-UPSTREAM 0001-BUG-Fix-infinite-loop-on-gcc11.patch
Patch2: 0001-BUG-Fix-infinite-loop-on-gcc11.patch
# PATCH-FIX-UPSTREAM numpy-pr19326-fix-subarray-segfault.patch -- gh#numpy/numpy#19326
Patch3: https://github.com/numpy/numpy/pull/19326.patch#/numpy-pr19326-fix-subarray-segfault.patch
BuildRequires: %{python_module Cython >= 0.29.23}
BuildConflicts: gcc11 < 11.2
BuildRequires: %{python_module Cython >= 0.29.24}
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module hypothesis >= 6.12.0}