Commit b8f99d46 authored by scoder's avatar scoder

Merge pull request #367 from richardhansen/memoryview-tobytes-bug-workaround

work around memoryview.tobytes() off-by-one bug with suboffsets
parents 4a978f24 1a82d8bb
......@@ -987,7 +987,11 @@ cdef memoryview_fromslice({{memviewslice_name}} memviewslice,
result.view.shape = <Py_ssize_t *> result.from_slice.shape
result.view.strides = <Py_ssize_t *> result.from_slice.strides
result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
result.view.suboffsets = NULL
for i in range(ndim):
if result.from_slice.suboffsets[i] >= 0:
result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
break
result.view.len = result.view.itemsize
for i in range(ndim):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment