Backport fix for s390x failures.
This commit is contained in:
parent
7e10e6850b
commit
4cea0d1bb5
|
@ -0,0 +1,51 @@
|
|||
From af36784b2b38577a87208003d6827d02dc0c0fc2 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Hudson-Doyle <michael.hudson@canonical.com>
|
||||
Date: Thu, 24 Oct 2019 21:46:00 +1300
|
||||
Subject: [PATCH] BUG: fix integer size confusion in handling array's ndmin
|
||||
argument
|
||||
|
||||
The ndmin local variable was changed from an "int" to an "npy_intp" but
|
||||
&ndmin is passed to PyArg_ParseTupleAndKeywords against a "i" argument
|
||||
spec, but these integers have different sizes (well on an LP64 platform
|
||||
anyway). This actually works on a little endian system but fails
|
||||
on a big endian one. Fix this by converting the local back to an int,
|
||||
and being a little careful before assigning the result of PyLong_AsLong to
|
||||
it.
|
||||
|
||||
Fixes #14767
|
||||
---
|
||||
numpy/core/src/multiarray/multiarraymodule.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c
|
||||
index 44156704996..9693275e74d 100644
|
||||
--- a/numpy/core/src/multiarray/multiarraymodule.c
|
||||
+++ b/numpy/core/src/multiarray/multiarraymodule.c
|
||||
@@ -1562,8 +1562,7 @@ _array_fromobject(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kws)
|
||||
PyArrayObject *oparr = NULL, *ret = NULL;
|
||||
npy_bool subok = NPY_FALSE;
|
||||
npy_bool copy = NPY_TRUE;
|
||||
- int nd;
|
||||
- npy_intp ndmin = 0;
|
||||
+ int ndmin = 0, nd;
|
||||
PyArray_Descr *type = NULL;
|
||||
PyArray_Descr *oldtype = NULL;
|
||||
NPY_ORDER order = NPY_KEEPORDER;
|
||||
@@ -1625,13 +1624,14 @@ _array_fromobject(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kws)
|
||||
|
||||
ndmin_obj = PyDict_GetItem(kws, npy_ma_str_ndmin);
|
||||
if (ndmin_obj) {
|
||||
- ndmin = PyLong_AsLong(ndmin_obj);
|
||||
- if (error_converting(ndmin)) {
|
||||
+ long t = PyLong_AsLong(ndmin_obj);
|
||||
+ if (error_converting(t)) {
|
||||
goto clean_type;
|
||||
}
|
||||
- else if (ndmin > NPY_MAXDIMS) {
|
||||
+ else if (t > NPY_MAXDIMS) {
|
||||
goto full_path;
|
||||
}
|
||||
+ ndmin = t;
|
||||
}
|
||||
|
||||
/* copy=False with default dtype, order (any is OK) and ndim */
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
Name: numpy
|
||||
Version: 1.17.4
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Epoch: 1
|
||||
Summary: A fast multidimensional array facility for Python
|
||||
|
||||
|
@ -17,6 +17,8 @@ License: BSD and Python and ASL 2.0
|
|||
URL: http://www.numpy.org/
|
||||
Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
||||
Source1: https://docs.scipy.org/doc/numpy/numpy-html-1.17.0.zip
|
||||
# https://github.com/numpy/numpy/issues/14767
|
||||
Patch0001: https://github.com/numpy/numpy/pull/14769.patch
|
||||
|
||||
|
||||
%description
|
||||
|
@ -149,7 +151,7 @@ ln -s %{python3_sitearch}/%{name}/core/include/numpy/ %{buildroot}%{_includedir}
|
|||
|
||||
%check
|
||||
%if %{with tests}
|
||||
%if %{_arch} != s390x && %{_arch} != ppc64le
|
||||
%if %{_arch} != ppc64le
|
||||
python3 runtests.py
|
||||
%endif
|
||||
%endif
|
||||
|
@ -190,6 +192,9 @@ python3 runtests.py
|
|||
|
||||
|
||||
%changelog
|
||||
* Mon Nov 11 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1:1.17.4-2
|
||||
- Backport patch for s390x failures
|
||||
|
||||
* Mon Nov 11 2019 Gwyn Ciesla <gwync@protonmail.com> - 1:1.17.4-1
|
||||
- 1.17.4
|
||||
|
||||
|
|
Loading…
Reference in New Issue