[pypy-svn] r79967 - in pypy/branch/fast-forward/pypy: objspace/std rlib

afa at codespeak.net afa at codespeak.net
Sat Dec 11 10:33:07 CET 2010


Author: afa
Date: Sat Dec 11 10:33:04 2010
New Revision: 79967

Modified:
   pypy/branch/fast-forward/pypy/objspace/std/formatting.py
   pypy/branch/fast-forward/pypy/rlib/rarithmetic.py
Log:
More fixes


Modified: pypy/branch/fast-forward/pypy/objspace/std/formatting.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/formatting.py	(original)
+++ pypy/branch/fast-forward/pypy/objspace/std/formatting.py	Sat Dec 11 10:33:04 2010
@@ -2,7 +2,8 @@
 String formatting routines.
 """
 from pypy.rlib.unroll import unrolling_iterable
-from pypy.rlib.rarithmetic import ovfcheck, formatd_overflow, isnan, isinf
+from pypy.rlib.rarithmetic import (
+    ovfcheck, formatd_overflow, DTSF_ALT, isnan, isinf)
 from pypy.interpreter.error import OperationError
 from pypy.tool.sourcetools import func_with_new_name
 from pypy.rlib.rstring import StringBuilder, UnicodeBuilder
@@ -138,8 +139,11 @@
                 prec = 6
             if char in 'fF' and x/1e25 > 1e25:
                 char = chr(ord(char) + 1)     # 'f' => 'g'
+            flags = 0
+            if self.f_alt:
+                flags |= DTSF_ALT
             try:
-                r = formatd_overflow(self.f_alt, prec, char, x)
+                r = formatd_overflow(x, char, prec, self.f_alt)
             except OverflowError:
                 raise OperationError(space.w_OverflowError, space.wrap(
                     "formatted float is too long (precision too large?)"))

Modified: pypy/branch/fast-forward/pypy/rlib/rarithmetic.py
==============================================================================
--- pypy/branch/fast-forward/pypy/rlib/rarithmetic.py	(original)
+++ pypy/branch/fast-forward/pypy/rlib/rarithmetic.py	Sat Dec 11 10:33:04 2010
@@ -565,8 +565,6 @@
 DIST_NAN      = 2
 DIST_INFINITY = 3
 
-formatd_ADD_DOT_0 = 0x1
-
 def _formatd(x, code, precision, flags):
     "NOT_RPYTHON"
     if flags & DTSF_ALT:
@@ -580,7 +578,7 @@
         fmt = "%%%s.%d%s" % (alt, precision, code)
     s = fmt % (x,)
 
-    if flags & formatd_ADD_DOT_0:
+    if flags & DTSF_ADD_DOT_0:
         # We want float numbers to be recognizable as such,
         # i.e., they should contain a decimal point or an exponent.
         # However, %g may print the number as an integer;



More information about the Pypy-commit mailing list