Your message dated Mon, 29 May 2017 18:52:38 +0100
with message-id <[email protected]>
and subject line Re: Bug#863522: unblock: python-numpy/1:1.12.1-3
has caused the Debian Bug report #863522,
regarding unblock: python-numpy/1:1.12.1-3
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
863522: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863522
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
User: [email protected]
Usertags: unblock

Please unblock package python-numpy

This upload fixes a bug when using numpy.abs() on numpy.nan on some
architectures; the bug is minor, but a user noticed nonetheless, the patch comes
directly from upstream and it's just a one-liner with extensive tests.

Source debdiff is attached

unblock python-numpy/1:1.12.1-3

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64
 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru python-numpy-1.12.1/debian/changelog 
python-numpy-1.12.1/debian/changelog
--- python-numpy-1.12.1/debian/changelog        2017-04-05 06:26:43.000000000 
-0400
+++ python-numpy-1.12.1/debian/changelog        2017-05-27 19:44:59.000000000 
-0400
@@ -1,3 +1,10 @@
+python-numpy (1:1.12.1-3) unstable; urgency=medium
+
+  * debian/patches/0007-BUG-Don-t-signal-FP-exceptions-in-np.absolute.patch
+    - fix RuntimeWarning on numpy.abs(numpy.nan) on some archs; Closes: #863192
+
+ -- Sandro Tosi <[email protected]>  Sat, 27 May 2017 19:44:59 -0400
+
 python-numpy (1:1.12.1-2) unstable; urgency=medium
 
   * Team upload
diff -Nru python-numpy-1.12.1/debian/.git-dpm 
python-numpy-1.12.1/debian/.git-dpm
--- python-numpy-1.12.1/debian/.git-dpm 2017-04-04 12:49:56.000000000 -0400
+++ python-numpy-1.12.1/debian/.git-dpm 2017-05-27 19:44:59.000000000 -0400
@@ -1,6 +1,6 @@
 # see git-dpm(1) from git-dpm package
-4b26915f32eec3afa476d678bc7831ab7b1899c1
-4b26915f32eec3afa476d678bc7831ab7b1899c1
+285b463e037cd9aeaf37ccc90ccf3349cc84b88a
+285b463e037cd9aeaf37ccc90ccf3349cc84b88a
 db9ad0d21c51a5a4983387c232c00bd6f844e406
 db9ad0d21c51a5a4983387c232c00bd6f844e406
 python-numpy_1.12.1.orig.tar.gz
diff -Nru 
python-numpy-1.12.1/debian/patches/0007-BUG-Don-t-signal-FP-exceptions-in-np.absolute.patch
 
python-numpy-1.12.1/debian/patches/0007-BUG-Don-t-signal-FP-exceptions-in-np.absolute.patch
--- 
python-numpy-1.12.1/debian/patches/0007-BUG-Don-t-signal-FP-exceptions-in-np.absolute.patch
 1969-12-31 19:00:00.000000000 -0500
+++ 
python-numpy-1.12.1/debian/patches/0007-BUG-Don-t-signal-FP-exceptions-in-np.absolute.patch
 2017-05-27 19:44:59.000000000 -0400
@@ -0,0 +1,89 @@
+From 285b463e037cd9aeaf37ccc90ccf3349cc84b88a Mon Sep 17 00:00:00 2001
+From: James Cowgill <[email protected]>
+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 -Nru python-numpy-1.12.1/debian/patches/series 
python-numpy-1.12.1/debian/patches/series
--- python-numpy-1.12.1/debian/patches/series   2017-04-04 12:49:56.000000000 
-0400
+++ python-numpy-1.12.1/debian/patches/series   2017-05-27 19:44:59.000000000 
-0400
@@ -4,3 +4,4 @@
 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

--- End Message ---
--- Begin Message ---
On Sat, May 27, 2017 at 10:23:24PM -0400, Sandro Tosi wrote:
> This upload fixes a bug when using numpy.abs() on numpy.nan on some
> architectures; the bug is minor, but a user noticed nonetheless, the patch 
> comes
> directly from upstream and it's just a one-liner with extensive tests.

Unblocked (the usual caveats, no precedent, etc, etc)


-- 
Jonathan Wiltshire                                      [email protected]
Debian Developer                         http://people.debian.org/~jmw

4096R: 0xD3524C51 / 0A55 B7C5 1223 3942 86EC  74C3 5394 479D D352 4C51

--- End Message ---

Reply via email to