Author: Matti Picus <[email protected]>
Branch: pypy-pyarray
Changeset: r66917:ef2bc6827618
Date: 2013-09-11 21:54 +0300
http://bitbucket.org/pypy/pypy/changeset/ef2bc6827618/
Log: change wrap/unwrap to rffi.cast as per review comments
diff --git a/TODO.txt b/TODO.txt
--- a/TODO.txt
+++ b/TODO.txt
@@ -4,15 +4,6 @@
- why do we need to implement array.nonzero on this branch and it was not done
e.g. on default?
-- def get_shape_and_dtype(space, nd, dims, typenum):
- shape = []
- for i in range(nd):
- # back-and-forth wrapping needed to translate
- shape.append(space.int_w(space.wrap(dims[i])))
-
- this looks very strange: we should probably do a proper rpython cast instead
- of doing this strange wrap/unwrap dance
-
- interp_numarray.py :: descr___array__: the dtype method is ignored: it's
fine to have a half-working implementation, but it should raise an exception
if it's passed
diff --git a/pypy/module/cpyext/ndarrayobject.py
b/pypy/module/cpyext/ndarrayobject.py
--- a/pypy/module/cpyext/ndarrayobject.py
+++ b/pypy/module/cpyext/ndarrayobject.py
@@ -187,8 +187,7 @@
def get_shape_and_dtype(space, nd, dims, typenum):
shape = []
for i in range(nd):
- # back-and-forth wrapping needed to translate
- shape.append(space.int_w(space.wrap(dims[i])))
+ shape.append(rffi.cast(rffi.LONG, dims[i]))
dtype = get_dtype_cache(space).dtypes_by_num[typenum]
return shape, dtype
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit