From: Robert Bradshaw Date: Mon, 7 Jun 2010 18:06:45 +0000 (-0700) Subject: Another large integer literal fix (indexing). X-Git-Tag: 0.13.beta0~49 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=456458ab8d094a4213976e89fbccf59e0c3aaa2d;p=cython.git Another large integer literal fix (indexing). --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 4f0129fa..cdf26701 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -18,6 +18,7 @@ from Builtin import list_type, tuple_type, set_type, dict_type, \ import Builtin import Symtab import Options +from Cython import Utils from Annotate import AnnotationItem from Cython.Debugging import print_call_chain @@ -1945,6 +1946,9 @@ class IndexNode(ExprNode): self.type = PyrexTypes.error_type 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) if isinstance(self.base, BytesNode): self.base = self.base.coerce_to_pyobject(env) diff --git a/tests/run/index.pyx b/tests/run/index.pyx index 2e74c124..f829095b 100644 --- a/tests/run/index.pyx +++ b/tests/run/index.pyx @@ -129,6 +129,7 @@ def test_boundscheck(list L, tuple t, object o, unsigned long ix): def large_literal_index(object o): """ - >>> large_literal_index({1000000000000000000000000000000: "yes"}) + >>> large_literal_index({1000000000000000000000000000000: True}) + True """ return o[1000000000000000000000000000000]