Large integer literal type inference test.
authorRobert Bradshaw <robertwb@math.washington.edu>
Mon, 7 Jun 2010 17:50:29 +0000 (10:50 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Mon, 7 Jun 2010 17:50:29 +0000 (10:50 -0700)
tests/run/type_inference.pyx

index 960210753a33aabd528e2f3c2f33947b787a438c..d9d7293d3fd1ce42cd030ad06828e4ff9abb33d3 100644 (file)
@@ -417,3 +417,18 @@ def common_extension_type_base():
     w = A()
     w = CC()
     assert typeof(w) == "Python object", typeof(w)
+
+
+@infer_types(None)
+def large_literals():
+    """
+    >>> large_literals()
+    """
+    # It's only safe to infer small integer literals.
+    a = 10
+    b = 100000000000000000000000000000000
+    assert typeof(a) == "long", typeof(a)
+    assert typeof(b) == "Python object", typeof(b)
+    c, d = 10, 100000000000000000000000000000000
+    assert typeof(c) == "long", typeof(c)
+    assert typeof(d) == "Python object", typeof(d)