Commit c4b15200 authored by Robert Bradshaw's avatar Robert Bradshaw

Implement wraparound(False) optimization for Python sequences.

parent d9aceb67
...@@ -2348,7 +2348,9 @@ class IndexNode(ExprNode): ...@@ -2348,7 +2348,9 @@ class IndexNode(ExprNode):
if self.index.type.is_int: if self.index.type.is_int:
if (not setting if (not setting
and (base_type in (list_type, tuple_type, unicode_type)) and (base_type in (list_type, tuple_type, unicode_type))
and (not self.index.type.signed or isinstance(self.index, IntNode) and int(self.index.value) >= 0) and (not self.index.type.signed
or not env.directives['wraparound']
or isinstance(self.index, IntNode) and int(self.index.value) >= 0)
and not env.directives['boundscheck']): and not env.directives['boundscheck']):
self.is_temp = 0 self.is_temp = 0
else: else:
......
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