[Python-modules-commits] [python-numpy] 02/04: merge patched into master
Sandro Tosi
morph at moszumanska.debian.org
Sun May 28 02:21:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
morph pushed a commit to branch master
in repository python-numpy.
commit 4e04262590369b78612bbe27e7bb0991bbe48cce
Merge: 6b5e307 285b463
Author: Sandro Tosi <morph at debian.org>
Date: Sat May 27 19:42:32 2017 -0400
merge patched into master
debian/.git-dpm | 4 +-
...Don-t-signal-FP-exceptions-in-np.absolute.patch | 89 ++++++++++++++++++++++
debian/patches/series | 1 +
numpy/core/src/umath/loops.c.src | 1 +
numpy/core/tests/test_umath.py | 30 ++++----
5 files changed, 107 insertions(+), 18 deletions(-)
diff --cc debian/.git-dpm
index 44f5fe4,0000000..1cd2655
mode 100644,000000..100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@@ -1,11 -1,0 +1,11 @@@
+# see git-dpm(1) from git-dpm package
- 4b26915f32eec3afa476d678bc7831ab7b1899c1
- 4b26915f32eec3afa476d678bc7831ab7b1899c1
++285b463e037cd9aeaf37ccc90ccf3349cc84b88a
++285b463e037cd9aeaf37ccc90ccf3349cc84b88a
+db9ad0d21c51a5a4983387c232c00bd6f844e406
+db9ad0d21c51a5a4983387c232c00bd6f844e406
+python-numpy_1.12.1.orig.tar.gz
+582568e43126d9e1f57755caa1bb774e3967b960
+4344068
+debianTag="debian/%e%v"
+patchedTag="patched/%e%v"
+upstreamTag="upstream/%e%u"
diff --cc debian/patches/0007-BUG-Don-t-signal-FP-exceptions-in-np.absolute.patch
index 0000000,0000000..fbc3cbc
new file mode 100644
--- /dev/null
+++ b/debian/patches/0007-BUG-Don-t-signal-FP-exceptions-in-np.absolute.patch
@@@ -1,0 -1,0 +1,89 @@@
++From 285b463e037cd9aeaf37ccc90ccf3349cc84b88a Mon Sep 17 00:00:00 2001
++From: James Cowgill <james410 at cowgill.org.uk>
++Date: Tue, 7 Mar 2017 11:39:01 +0000
++Subject: BUG: Don't signal FP exceptions in np.absolute
++
++Fixes #8686
++
++This PR centers around this piece of code in `numpy/core/src/umath/loops.c.src`:
++```c
++UNARY_LOOP {
++ const @type@ in1 = *(@type@ *)ip1;
++ const @type@ tmp = in1 > 0 ? in1 : -in1;
++ /* add 0 to clear -0.0 */
++ *((@type@ *)op1) = tmp + 0;
++}
++```
++
++If in1 is `NaN`, the C99 standard requires that the comparison `in1 > 0`
++signals `FE_INVALID`, but the usual semantics for the absolute function are
++that no FP exceptions should be generated (eg compare to C `fabs` and Python
++`abs`). This was probably never noticed due to a bug in GCC x86 where all
++floating point comparisons do not signal exceptions, however Clang on x86 and
++GCC on other architectures (including ARM and MIPS) do signal an FP exception
++here.
++
++Fix by clearing the floating point exceptions after the loop has
++finished. The alternative of rewriting the loop to use `npy_fabs`
++instead would also work but has performance issues because that function
++is not inlined. The `test_abs_neg_blocked` is adjusted not to ignore
++`FE_INVALID` errors because now both absolute and negate should never
++produce an FP exceptions.
++---
++ numpy/core/src/umath/loops.c.src | 1 +
++ numpy/core/tests/test_umath.py | 30 ++++++++++++++----------------
++ 2 files changed, 15 insertions(+), 16 deletions(-)
++
++diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src
++index 3c11908..7e683ab 100644
++--- a/numpy/core/src/umath/loops.c.src
+++++ b/numpy/core/src/umath/loops.c.src
++@@ -1840,6 +1840,7 @@ NPY_NO_EXPORT void
++ *((@type@ *)op1) = tmp + 0;
++ }
++ }
+++ npy_clear_floatstatus();
++ }
++
++ NPY_NO_EXPORT void
++diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
++index 6fea832..fad75cd 100644
++--- a/numpy/core/tests/test_umath.py
+++++ b/numpy/core/tests/test_umath.py
++@@ -1226,22 +1226,20 @@ class TestAbsoluteNegative(TestCase):
++ np.negative(inp, out=out)
++ assert_equal(out, tgt, err_msg=msg)
++
++- # will throw invalid flag depending on compiler optimizations
++- with np.errstate(invalid='ignore'):
++- for v in [np.nan, -np.inf, np.inf]:
++- for i in range(inp.size):
++- d = np.arange(inp.size, dtype=dt)
++- inp[:] = -d
++- inp[i] = v
++- d[i] = -v if v == -np.inf else v
++- assert_array_equal(np.abs(inp), d, err_msg=msg)
++- np.abs(inp, out=out)
++- assert_array_equal(out, d, err_msg=msg)
++-
++- assert_array_equal(-inp, -1*inp, err_msg=msg)
++- d = -1 * inp
++- np.negative(inp, out=out)
++- assert_array_equal(out, d, err_msg=msg)
+++ for v in [np.nan, -np.inf, np.inf]:
+++ for i in range(inp.size):
+++ d = np.arange(inp.size, dtype=dt)
+++ inp[:] = -d
+++ inp[i] = v
+++ d[i] = -v if v == -np.inf else v
+++ assert_array_equal(np.abs(inp), d, err_msg=msg)
+++ np.abs(inp, out=out)
+++ assert_array_equal(out, d, err_msg=msg)
+++
+++ assert_array_equal(-inp, -1*inp, err_msg=msg)
+++ d = -1 * inp
+++ np.negative(inp, out=out)
+++ assert_array_equal(out, d, err_msg=msg)
++
++ def test_lower_align(self):
++ # check data that is not aligned to element size
diff --cc debian/patches/series
index 3e2b507,0000000..1c0859b
mode 100644,000000..100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@@ -1,6 -1,0 +1,7 @@@
+03_force_f2py_version.patch
+10_use_local_python.org_object.inv_sphinx.diff
+python3-soabi.patch
+adapt_swig_docs_to_debian.patch
+0005-Dont-fail-if-we-cant-import-mingw32.patch
+0006-disable-asserts-on-ppc-with-broken-malloc-only-longd.patch
++0007-BUG-Don-t-signal-FP-exceptions-in-np.absolute.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-numpy.git
More information about the Python-modules-commits
mailing list