Commit 794d21d9 authored by Stefan Behnel's avatar Stefan Behnel

Avoid unnecessary generation of unused error handling code in memory view slicing code.

parent 399a72d7
...@@ -292,7 +292,6 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry): ...@@ -292,7 +292,6 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry):
dim += 1 dim += 1
access, packing = self.type.axes[dim] access, packing = self.type.axes[dim]
error_goto = code.error_goto(index.pos)
if isinstance(index, ExprNodes.SliceNode): if isinstance(index, ExprNodes.SliceNode):
# slice, unspecified dimension, or part of ellipsis # slice, unspecified dimension, or part of ellipsis
...@@ -309,6 +308,7 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry): ...@@ -309,6 +308,7 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry):
util_name = "SimpleSlice" util_name = "SimpleSlice"
else: else:
util_name = "ToughSlice" util_name = "ToughSlice"
d['error_goto'] = code.error_goto(index.pos)
new_ndim += 1 new_ndim += 1
else: else:
...@@ -326,8 +326,10 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry): ...@@ -326,8 +326,10 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry):
d = dict( d = dict(
locals(), locals(),
wraparound=int(directives['wraparound']), wraparound=int(directives['wraparound']),
boundscheck=int(directives['boundscheck']) boundscheck=int(directives['boundscheck']),
) )
if d['boundscheck']:
d['error_goto'] = code.error_goto(index.pos)
util_name = "SliceIndex" util_name = "SliceIndex"
_, impl = TempitaUtilityCode.load_as_string(util_name, "MemoryView_C.c", context=d) _, impl = TempitaUtilityCode.load_as_string(util_name, "MemoryView_C.c", context=d)
......
...@@ -878,9 +878,6 @@ if (unlikely(__pyx_memoryview_slice_memviewslice( ...@@ -878,9 +878,6 @@ if (unlikely(__pyx_memoryview_slice_memviewslice(
{{error_goto}} {{error_goto}}
} }
{{else}}
// make sure label is not un-used
if ((0)) {{error_goto}}
{{endif}} {{endif}}
{{if all_dimensions_direct}} {{if all_dimensions_direct}}
......
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