Author: Carl Friedrich Bolz <[email protected]>
Branch: 
Changeset: r65449:53e2a91724cf
Date: 2013-07-17 20:45 +0200
http://bitbucket.org/pypy/pypy/changeset/53e2a91724cf/

Log:    use str if fitting into ints

diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -454,11 +454,19 @@
 
     @jit.elidable
     def repr(self):
-        return self.format(BASE10, suffix="L")
+        try:
+            x = self.toint()
+        except OverflowError:
+            return self.format(BASE10, suffix="L")
+        return str(x) + "L"
 
     @jit.elidable
     def str(self):
-        return self.format(BASE10)
+        try:
+            x = self.toint()
+        except OverflowError:
+            return self.format(BASE10)
+        return str(x)
 
     @jit.elidable
     def eq(self, other):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to