Another large integer literal fix (indexing).
authorRobert Bradshaw <robertwb@math.washington.edu>
Mon, 7 Jun 2010 18:06:45 +0000 (11:06 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Mon, 7 Jun 2010 18:06:45 +0000 (11:06 -0700)
Cython/Compiler/ExprNodes.py
tests/run/index.pyx

index 4f0129fac6e5b688a506037236435fdb7bf0219f..cdf267018b45f5b2c87bc33238facce8609d1554 100755 (executable)
@@ -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)
index 2e74c1248fbb660d95fc2840d304b404f38fbc47..f829095bf4e6522bbf83a3e7980c2d4270125547 100644 (file)
@@ -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]