[pypy-commit] pypy default: test, fix flags.owndata
mattip
noreply at buildbot.pypy.org
Wed Jun 3 21:15:30 CEST 2015
Author: mattip <matti.picus at gmail.com>
Branch:
Changeset: r77841:ad5bd147db7f
Date: 2015-06-03 20:37 +0300
http://bitbucket.org/pypy/pypy/changeset/ad5bd147db7f/
Log: test, fix flags.owndata
diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py
--- a/pypy/module/micronumpy/concrete.py
+++ b/pypy/module/micronumpy/concrete.py
@@ -438,6 +438,7 @@
def __init__(self, shape, dtype, order, strides, backstrides,
storage=lltype.nullptr(RAW_STORAGE), zero=True):
gcstruct = V_OBJECTSTORE
+ self.flags = NPY.ARRAY_ALIGNED | NPY.ARRAY_WRITEABLE
if storage == lltype.nullptr(RAW_STORAGE):
length = support.product(shape)
if dtype.num == NPY.OBJECT:
@@ -445,11 +446,11 @@
gcstruct = _create_objectstore(storage, length, dtype.elsize)
else:
storage = dtype.itemtype.malloc(length * dtype.elsize, zero=zero)
+ self.flags |= NPY.ARRAY_OWNDATA
start = calc_start(shape, strides)
ConcreteArrayNotOwning.__init__(self, shape, dtype, order, strides, backstrides,
storage, start=start)
self.gcstruct = gcstruct
- self.flags = NPY.ARRAY_ALIGNED | NPY.ARRAY_WRITEABLE
if is_c_contiguous(self):
self.flags |= NPY.ARRAY_C_CONTIGUOUS
if is_f_contiguous(self):
diff --git a/pypy/module/micronumpy/test/test_flagsobj.py b/pypy/module/micronumpy/test/test_flagsobj.py
--- a/pypy/module/micronumpy/test/test_flagsobj.py
+++ b/pypy/module/micronumpy/test/test_flagsobj.py
@@ -13,6 +13,8 @@
assert s == '%s' %(' C_CONTIGUOUS : True\n F_CONTIGUOUS : True'
'\n OWNDATA : True\n WRITEABLE : False'
'\n ALIGNED : True\n UPDATEIFCOPY : False')
+ a = np.array(2)
+ assert a.flags.owndata
def test_repr(self):
import numpy as np
More information about the pypy-commit
mailing list