[pypy-svn] r72190 - in pypy/trunk/pypy/objspace/std: . test
fijal at codespeak.net
fijal at codespeak.net
Fri Mar 12 23:10:58 CET 2010
Author: fijal
Date: Fri Mar 12 23:10:57 2010
New Revision: 72190
Modified:
pypy/trunk/pypy/objspace/std/complexobject.py
pypy/trunk/pypy/objspace/std/test/test_complexobject.py
Log:
A test and a fix for complex repr
Modified: pypy/trunk/pypy/objspace/std/complexobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/complexobject.py (original)
+++ pypy/trunk/pypy/objspace/std/complexobject.py Fri Mar 12 23:10:57 2010
@@ -252,9 +252,10 @@
app = gateway.applevel("""
import math
+ import sys
def possint(f):
ff = math.floor(f)
- if f == ff:
+ if f == ff and abs(f) < sys.maxint:
return int(ff)
return f
Modified: pypy/trunk/pypy/objspace/std/test/test_complexobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/test/test_complexobject.py (original)
+++ pypy/trunk/pypy/objspace/std/test/test_complexobject.py Fri Mar 12 23:10:57 2010
@@ -326,6 +326,7 @@
h.assertEqual(repr(1-6j), '(1-6j)')
h.assertNotEqual(repr(-(1+0j)), '(-1+-0j)')
+ assert repr(complex(1e45)) == "(" + repr(1e45) + "+0j)"
def test_neg(self):
h = self.helper
More information about the Pypy-commit
mailing list