[pypy-commit] pypy object-dtype: Pass space around

rguillebert noreply at buildbot.pypy.org
Fri Jan 16 15:56:16 CET 2015


Author: Romain Guillebert <romain.py at gmail.com>
Branch: object-dtype
Changeset: r75387:3126fa1b95b9
Date: 2015-01-16 15:54 +0100
http://bitbucket.org/pypy/pypy/changeset/3126fa1b95b9/

Log:	Pass space around

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
@@ -254,16 +254,16 @@
     def descr_repr(self, space):
         cache = get_appbridge_cache(space)
         if cache.w_array_repr is None:
-            return space.wrap(self.dump_data())
+            return space.wrap(self.dump_data(space))
         return space.call_function(cache.w_array_repr, self)
 
     def descr_str(self, space):
         cache = get_appbridge_cache(space)
         if cache.w_array_str is None:
-            return space.wrap(self.dump_data(prefix='', separator='', suffix=''))
+            return space.wrap(self.dump_data(space, prefix='', separator='', suffix=''))
         return space.call_function(cache.w_array_str, self)
 
-    def dump_data(self, prefix='array(', separator=',', suffix=')'):
+    def dump_data(self, space, prefix='array(', separator=',', suffix=')'):
         i, state = self.create_iter()
         first = True
         dtype = self.get_dtype()
@@ -280,7 +280,7 @@
             if self.is_scalar() and dtype.is_str():
                 s.append(dtype.itemtype.to_str(i.getitem(state)))
             else:
-                s.append(dtype.itemtype.str_format(i.getitem(state)))
+                s.append(dtype.itemtype.str_format(space, i.getitem(state)))
             state = i.next(state)
         if not self.is_scalar():
             s.append(']')
@@ -1189,7 +1189,7 @@
                         "improper dtype '%R'", dtype)
         self.implementation = W_NDimArray.from_shape_and_storage(
             space, [space.int_w(i) for i in space.listview(shape)],
-            rffi.str2charp(space.str_w(storage), track_allocation=False), 
+            rffi.str2charp(space.str_w(storage), track_allocation=False),
             dtype, storage_bytes=space.len_w(storage), owning=True).implementation
 
     def descr___array_finalize__(self, space, w_obj):
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -1871,7 +1871,7 @@
     def str_format(self, space, box):
         assert isinstance(box, boxes.W_VoidBox)
         arr = self.readarray(box.arr, box.ofs, 0, box.dtype)
-        return arr.dump_data(prefix='', suffix='')
+        return arr.dump_data(space, prefix='', suffix='')
 
     def to_builtin_type(self, space, item):
         ''' From the documentation of ndarray.item():
@@ -1980,7 +1980,7 @@
             else:
                 pieces.append(", ")
             val = tp.read(box.arr, box.ofs, ofs, subdtype)
-            pieces.append(tp.str_format(val))
+            pieces.append(tp.str_format(space, val))
         pieces.append(")")
         return "".join(pieces)
 


More information about the pypy-commit mailing list