[pypy-commit] pypy default: refactor ndarray.flags in cpyext

mattip noreply at buildbot.pypy.org
Sat Jun 6 20:46:59 CEST 2015


Author: mattip <matti.picus at gmail.com>
Branch: 
Changeset: r77930:021adba9ebbe
Date: 2015-06-06 21:44 +0300
http://bitbucket.org/pypy/pypy/changeset/021adba9ebbe/

Log:	refactor ndarray.flags in cpyext

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
@@ -65,15 +65,7 @@
 @cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
 def _PyArray_FLAGS(space, w_array):
     assert isinstance(w_array, W_NDimArray)
-    flags = NPY_BEHAVED_NS
-    if isinstance(w_array.implementation, ConcreteArray):
-        flags |= NPY_OWNDATA
-    if len(w_array.get_shape()) < 2:
-        flags |= NPY_CONTIGUOUS
-    elif w_array.implementation.order == 'C':
-        flags |= NPY_C_CONTIGUOUS
-    else:
-        flags |= NPY_F_CONTIGUOUS
+    flags = NPY_BEHAVED_NS | w_array.get_flags()
     return flags
 
 @cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)


More information about the pypy-commit mailing list