Source

pypy / pypy / module / micronumpy / arrayimpl / concrete.py

Diff from to

pypy/module/micronumpy/arrayimpl/concrete.py

     def _prepare_slice_args(self, space, w_idx):
         if space.isinstance_w(w_idx, space.w_str):
             idx = space.str_w(w_idx)
-            dtype = self.find_dtype()
+            dtype = self.dtype
             if not dtype.is_record_type() or idx not in dtype.fields:
                 raise OperationError(space.w_ValueError, space.wrap(
                     "field named %s not defined" % idx))
         return SliceArray(0, strides, backstrides, new_shape, self)
 
 class SliceArray(BaseConcreteArray):
-    def __init__(self, start, strides, backstrides, shape, parent):
+    def __init__(self, start, strides, backstrides, shape, parent, dtype=None):
         self.strides = strides
         self.backstrides = backstrides
         self.shape = shape
         self.parent = parent
         self.storage = parent.storage
         self.order = parent.order
-        self.dtype = parent.dtype
+        if dtype is None:
+            dtype = parent.dtype
+        self.dtype = dtype
         self.size = support.product(shape) * self.dtype.itemtype.get_element_size()
         self.start = start
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.