Commit 456458ab authored by Robert Bradshaw's avatar Robert Bradshaw

Another large integer literal fix (indexing).

parent 0e032cc2
...@@ -18,6 +18,7 @@ from Builtin import list_type, tuple_type, set_type, dict_type, \ ...@@ -18,6 +18,7 @@ from Builtin import list_type, tuple_type, set_type, dict_type, \
import Builtin import Builtin
import Symtab import Symtab
import Options import Options
from Cython import Utils
from Annotate import AnnotationItem from Annotate import AnnotationItem
from Cython.Debugging import print_call_chain from Cython.Debugging import print_call_chain
...@@ -1945,6 +1946,9 @@ class IndexNode(ExprNode): ...@@ -1945,6 +1946,9 @@ class IndexNode(ExprNode):
self.type = PyrexTypes.error_type self.type = PyrexTypes.error_type
return return
if isinstance(self.index, IntNode) and Utils.long_literal(self.index.value):
self.index = self.index.coerce_to_pyobject(env)
# Handle the case where base is a literal char* (and we expect a string, not an int) # Handle the case where base is a literal char* (and we expect a string, not an int)
if isinstance(self.base, BytesNode): if isinstance(self.base, BytesNode):
self.base = self.base.coerce_to_pyobject(env) self.base = self.base.coerce_to_pyobject(env)
......
...@@ -129,6 +129,7 @@ def test_boundscheck(list L, tuple t, object o, unsigned long ix): ...@@ -129,6 +129,7 @@ def test_boundscheck(list L, tuple t, object o, unsigned long ix):
def large_literal_index(object o): def large_literal_index(object o):
""" """
>>> large_literal_index({1000000000000000000000000000000: "yes"}) >>> large_literal_index({1000000000000000000000000000000: True})
True
""" """
return o[1000000000000000000000000000000] return o[1000000000000000000000000000000]
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