[pypy-svn] pypy default: Fix another typo in %#f (%f with the 'alternate' flag)

amauryfa commits-noreply at bitbucket.org
Tue Jan 25 18:01:09 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r41322:5c3ca05aa26c
Date: 2011-01-25 17:58 +0100
http://bitbucket.org/pypy/pypy/changeset/5c3ca05aa26c/

Log:	Fix another typo in %#f (%f with the 'alternate' flag)

diff --git a/pypy/objspace/std/formatting.py b/pypy/objspace/std/formatting.py
--- a/pypy/objspace/std/formatting.py
+++ b/pypy/objspace/std/formatting.py
@@ -143,7 +143,7 @@
             if self.f_alt:
                 flags |= DTSF_ALT
             try:
-                r = formatd_overflow(x, char, prec, self.f_alt)
+                r = formatd_overflow(x, char, prec, flags)
             except OverflowError:
                 raise OperationError(space.w_OverflowError, space.wrap(
                     "formatted float is too long (precision too large?)"))

diff --git a/pypy/objspace/std/test/test_stringformat.py b/pypy/objspace/std/test/test_stringformat.py
--- a/pypy/objspace/std/test/test_stringformat.py
+++ b/pypy/objspace/std/test/test_stringformat.py
@@ -89,6 +89,8 @@
         big = 1E200
         assert '   inf' == '%6g' % (big * big)
 
+        assert '0.' == '%#.0f' % 0.0
+
     def test_format_int(self):
         import sys
         n = 23


More information about the Pypy-commit mailing list