Author: Ronan Lamy <[email protected]>
Branch: PyBuffer
Changeset: r90808:ea010dd6def5
Date: 2017-03-25 16:45 +0000
http://bitbucket.org/pypy/pypy/changeset/ea010dd6def5/
Log: Fix dimensionality check in memoryview.cast()
diff --git a/pypy/objspace/std/memoryobject.py
b/pypy/objspace/std/memoryobject.py
--- a/pypy/objspace/std/memoryobject.py
+++ b/pypy/objspace/std/memoryobject.py
@@ -552,13 +552,12 @@
raise oefmt(space.w_ValueError, \
"memoryview: number of dimensions must not exceed %d",
ndim)
- # yes access ndim as field
- if self.ndim > 1 and buf.getndim() != 1:
+ if ndim > 1 and buf.getndim() != 1:
raise oefmt(space.w_TypeError,
"memoryview: cast must be 1D -> ND or ND -> 1D")
+ origfmt = self.getformat()
mv = W_MemoryView(buf, self.format, self.itemsize)
- origfmt = mv.getformat()
mv._cast_to_1D(space, origfmt, fmt, itemsize)
if w_shape:
fview = space.fixedview(w_shape)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit