Author: Matti Picus <matti.pi...@gmail.com>
Branch: ndarray-subtype
Changeset: r65175:2f8ce730591a
Date: 2013-07-03 18:48 +0300
http://bitbucket.org/pypy/pypy/changeset/2f8ce730591a/

Log:    pass a test

diff --git a/pypy/module/micronumpy/interp_numarray.py 
b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -903,7 +903,7 @@
     return W_NDimArray.from_shape(shape, dtype)
 
 @unwrap_spec(addr=int)
-def descr__from_shape_and_storage(space, w_cls, w_shape, addr, w_dtype):
+def descr__from_shape_and_storage(space, w_cls, w_shape, addr, w_dtype, 
w_subclass=None):
     """
     Create an array from an existing buffer, given its address as int.
     PyPy-only implementation detail.
@@ -912,9 +912,14 @@
     from rpython.rlib.rawstorage import RAW_STORAGE_PTR
     storage = rffi.cast(RAW_STORAGE_PTR, addr)
     dtype = space.interp_w(interp_dtype.W_Dtype,
-                           
space.call_function(space.gettypefor(interp_dtype.W_Dtype), w_dtype))
+                     
space.call_function(space.gettypefor(interp_dtype.W_Dtype),
+                             w_dtype))
     shape = _find_shape(space, w_shape, dtype)
-    return W_NDimArray.from_shape_and_storage(shape, storage, dtype, (space, 
w_cls))
+    if w_subclass:
+        return W_NDimArray.from_shape_and_storage(shape, storage, dtype, 'C',
+                            False, (w_subclass, space))
+    else:
+        return W_NDimArray.from_shape_and_storage(shape, storage, dtype)
 
 W_NDimArray.typedef = TypeDef(
     "ndarray",
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to