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): ...@@ -291,7 +291,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
...@@ -308,6 +307,7 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry): ...@@ -308,6 +307,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:
...@@ -325,8 +325,10 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry): ...@@ -325,8 +325,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