[pypy-commit] pypy ndarray-sort: fix sorting nan for complex

mattip noreply at buildbot.pypy.org
Thu Oct 10 00:07:02 CEST 2013


Author: Matti Picus <matti.picus at gmail.com>
Branch: ndarray-sort
Changeset: r67264:bde7f67cd9db
Date: 2013-10-09 22:58 +0300
http://bitbucket.org/pypy/pypy/changeset/bde7f67cd9db/

Log:	fix sorting nan for complex

diff --git a/pypy/module/micronumpy/arrayimpl/sort.py b/pypy/module/micronumpy/arrayimpl/sort.py
--- a/pypy/module/micronumpy/arrayimpl/sort.py
+++ b/pypy/module/micronumpy/arrayimpl/sort.py
@@ -253,7 +253,12 @@
     else:
         def arg_lt(a, b):
             for i in range(count):
-                if a[i] < b[i] or b != b and a == a:
+                if b[i] != b[i] and a[i] == a[i]:
+                    return True
+                elif b[i] == b[i] and a[i] != a[i]:
+                    return False
+            for i in range(count):
+                if a[i] < b[i]:
                     return True
                 elif a[i] > b[i]:
                     return False


More information about the pypy-commit mailing list