diff options
author | Mark Florisson <markflorisson88@gmail.com> | 2011-12-27 18:55:07 +0100 |
---|---|---|
committer | Mark Florisson <markflorisson88@gmail.com> | 2012-01-22 19:04:20 +0000 |
commit | 52318089d74e90d749de3f6655ad500eeed59995 (patch) | |
tree | 7a6f10e866eb4c25146eeb8afe2629913c2f0dbb /Cython/Compiler/MemoryView.py | |
parent | f37f7bd36764100e219a432113ff21f66e801b8a (diff) | |
download | cython-52318089d74e90d749de3f6655ad500eeed59995.tar.gz |
Support index-slicing indirect dimensions if slice data pointer can be moved
Diffstat (limited to 'Cython/Compiler/MemoryView.py')
-rw-r--r-- | Cython/Compiler/MemoryView.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Cython/Compiler/MemoryView.py b/Cython/Compiler/MemoryView.py index 5bbd865c4..9aa8b0244 100644 --- a/Cython/Compiler/MemoryView.py +++ b/Cython/Compiler/MemoryView.py @@ -305,14 +305,22 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry): if not isinstance(index, ExprNodes.SliceNode): # normal index idx = index.result() - d = locals() + access, packing = self.type.axes[dim] - if access != 'direct': - return error(index.pos, - "Dimension cannot be indexed away, " - "must be direct") + if access == 'direct': + indirect = False + else: + indirect = True + generic = (access == 'full') + if new_ndim != 0: + return error(index.pos, + "All preceding dimensions must be " + "indexed and not sliced") + + d = locals() code.put(load_slice_util("SliceIndex", d)) else: + # slice, unspecified dimension, or part of ellipsis d = locals() for s in "start stop step".split(): |