Commit ab9086bf authored by Stefan Behnel's avatar Stefan Behnel

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

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