[pypy-svn] r76719 - pypy/branch/micronumpy/pypy/module/micronumpy

dan at codespeak.net dan at codespeak.net
Wed Aug 25 04:02:02 CEST 2010


Author: dan
Date: Wed Aug 25 04:01:59 2010
New Revision: 76719

Modified:
   pypy/branch/micronumpy/pypy/module/micronumpy/array.py
   pypy/branch/micronumpy/pypy/module/micronumpy/dtype.py
   pypy/branch/micronumpy/pypy/module/micronumpy/microarray.py
Log:
Cleaning up. Killed ndarray.py

Modified: pypy/branch/micronumpy/pypy/module/micronumpy/array.py
==============================================================================
--- pypy/branch/micronumpy/pypy/module/micronumpy/array.py	(original)
+++ pypy/branch/micronumpy/pypy/module/micronumpy/array.py	Wed Aug 25 04:01:59 2010
@@ -76,6 +76,12 @@
         suffix = 0
     return suffix
 
+def unpack_shape(space, w_shape):
+    if space.is_true(space.isinstance(w_shape, space.w_int)):
+        return [space.int_w(w_shape)]
+    shape_w = space.fixedview(w_shape)
+    return [space.int_w(w_i) for w_i in shape_w]
+
 def validate_index(array, space, w_i):
     index_dimensionality = space.int_w(space.len(w_i))
     array_dimensionality = len(array.shape)

Modified: pypy/branch/micronumpy/pypy/module/micronumpy/dtype.py
==============================================================================
--- pypy/branch/micronumpy/pypy/module/micronumpy/dtype.py	(original)
+++ pypy/branch/micronumpy/pypy/module/micronumpy/dtype.py	Wed Aug 25 04:01:59 2010
@@ -93,13 +93,13 @@
         def dump(self, data):
             return ', '.join([str(x) for x in self.cast(data)])
 
-        def str(self):
+        def typestr(self):
             if self is float_descr:
                 code = 'f'
             else:
                 code = self.typecode
 
-            return ''.join([byteorder, code, self.itemsize()])
+            return ''.join([byteorder, code, str(self.itemsize())])
 
     for type in [lltype.Signed, lltype.Float]:
         def get_type(self, data, index):

Modified: pypy/branch/micronumpy/pypy/module/micronumpy/microarray.py
==============================================================================
--- pypy/branch/micronumpy/pypy/module/micronumpy/microarray.py	(original)
+++ pypy/branch/micronumpy/pypy/module/micronumpy/microarray.py	Wed Aug 25 04:01:59 2010
@@ -18,6 +18,8 @@
 from pypy.module.micronumpy.array import squeeze_slice, squeeze_shape
 from pypy.module.micronumpy.array import shape_prefix
 
+from pypy.rpython.lltypesystem.lltype import cast_ptr_to_int
+
 class MicroIter(Wrappable):
     _immutable_fields_ = ['step', 'stop', 'ndim'] # XXX: removed array
     def __init__(self, array):
@@ -372,13 +374,13 @@
 def descr_get_shape(space, self):
     return space.newtuple([space.wrap(x) for x in self.shape[self.offset:]])
 
-def descr_array_interface(space, self):
+def descr_get_array_interface(space, self):
     w_dict = space.newdict()
-    data_ptr = space.wrap(lltype.cast_ptr_to_int(self.data))
+    data_ptr = space.wrap(cast_ptr_to_int(self.data))
     data = [data_ptr, space.w_False]
     content = [(space.wrap('shape'), descr_get_shape(space, self)),
                (space.wrap('data'), space.newtuple(data)),
-               (space.wrap('typestr'), space.wrap(self.dtype.dtype.str())),
+               (space.wrap('typestr'), space.wrap(self.dtype.dtype.typestr())),
                (space.wrap('version'), space.wrap(3))]
     w_dict.initialize_content(content)
     return w_dict



More information about the Pypy-commit mailing list