[pypy-commit] pypy missing-ndarray-attributes: test differently

mattip noreply at buildbot.pypy.org
Mon Jan 28 19:42:07 CET 2013


Author: Matti Picus <matti.picus at gmail.com>
Branch: missing-ndarray-attributes
Changeset: r60621:76bdd206840c
Date: 2013-01-28 20:41 +0200
http://bitbucket.org/pypy/pypy/changeset/76bdd206840c/

Log:	test differently

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
@@ -82,11 +82,11 @@
 
 def argsort_array(arr, space, w_axis):
     itemtype = arr.dtype.itemtype
-    if (not isinstance(itemtype, types.Float) and
-        not isinstance(itemtype, types.Integer)):
+    if (not arr.dtype.is_int_type() and
+        not arr.dtype.is_float_type()):
         # XXX this should probably be changed
         raise OperationError(space.w_NotImplementedError,
-           space.wrap("sorting of non-numeric types is not implemented"))
+           space.wrap("sorting of non-numeric types '%r' is not implemented" % itemtype ))
     if w_axis is space.w_None:
         # note that it's fine ot pass None here as we're not going
         # to pass the result around (None is the link to base in slices)
diff --git a/pypy/module/micronumpy/interp_dtype.py b/pypy/module/micronumpy/interp_dtype.py
--- a/pypy/module/micronumpy/interp_dtype.py
+++ b/pypy/module/micronumpy/interp_dtype.py
@@ -155,6 +155,9 @@
     def is_complex_type(self):
         return False
 
+    def is_float_type(self):
+        return (self.kind == FLOATINGLTR or self.float_type is not None)
+
     def is_bool_type(self):
         return self.kind == BOOLLTR
 


More information about the pypy-commit mailing list