[pypy-commit] pypy object-dtype2: fix logic

mattip noreply at buildbot.pypy.org
Thu Apr 9 15:58:42 CEST 2015


Author: mattip <matti.picus at gmail.com>
Branch: object-dtype2
Changeset: r76763:fc9ba3c58dda
Date: 2015-04-09 12:26 +0300
http://bitbucket.org/pypy/pypy/changeset/fc9ba3c58dda/

Log:	fix logic

diff --git a/pypy/module/micronumpy/base.py b/pypy/module/micronumpy/base.py
--- a/pypy/module/micronumpy/base.py
+++ b/pypy/module/micronumpy/base.py
@@ -125,7 +125,7 @@
     def get_shape(self):
         return self.implementation.get_shape()
 
-    def get_dtype(self):
+    def get_dtype(self, space=None):
         return self.implementation.dtype
 
     def get_order(self):
diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
--- a/pypy/module/micronumpy/ndarray.py
+++ b/pypy/module/micronumpy/ndarray.py
@@ -203,10 +203,11 @@
         elif isinstance(w_idx, W_NDimArray) and w_idx.get_dtype().is_bool() \
                 and w_idx.ndims() > 0:
             w_res = self.getitem_filter(space, w_idx)
-        try:
-            w_res = self.implementation.descr_getitem(space, self, w_idx)
-        except ArrayArgumentException:
-            w_res = self.getitem_array_int(space, w_idx)
+        else:
+            try:
+                w_res = self.implementation.descr_getitem(space, self, w_idx)
+            except ArrayArgumentException:
+                w_res = self.getitem_array_int(space, w_idx)
         if w_res.is_scalar() and w_res.get_dtype(space).is_object():
             return w_res.get_dtype(space).itemtype.unbox(w_res)
         return w_res


More information about the pypy-commit mailing list