[pypy-commit] pypy memoryview-attributes: test, fix missing attributes
mattip
pypy.commits at gmail.com
Sun Aug 21 05:48:49 EDT 2016
Author: Matti Picus <matti.picus at gmail.com>
Branch: memoryview-attributes
Changeset: r86372:75a113a08fd8
Date: 2016-08-21 14:07 +1000
http://bitbucket.org/pypy/pypy/changeset/75a113a08fd8/
Log: test, fix missing attributes
diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py
--- a/pypy/module/cpyext/slotdefs.py
+++ b/pypy/module/cpyext/slotdefs.py
@@ -310,8 +310,12 @@
self.format = format
if not shape:
self.shape = [size]
+ else:
+ self.shape = shape
if not strides:
self.strides = [1]
+ else:
+ self.strides = strides
self.ndim = ndim
self.itemsize = itemsize
self.readonly = readonly
diff --git a/pypy/module/cpyext/test/test_memoryobject.py b/pypy/module/cpyext/test/test_memoryobject.py
--- a/pypy/module/cpyext/test/test_memoryobject.py
+++ b/pypy/module/cpyext/test/test_memoryobject.py
@@ -25,6 +25,7 @@
arr = module.PyMyArray(10)
y = memoryview(arr)
assert y.format == 'i'
+ assert y.shape == (10,)
s = y[3]
assert len(s) == struct.calcsize('i')
assert s == struct.pack('i', 3)
More information about the pypy-commit
mailing list