Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r61518:27567bc935f6 Date: 2013-02-20 16:14 -0800 http://bitbucket.org/pypy/pypy/changeset/27567bc935f6/
Log: redo the 'reset to g' from 52765baaf1aa so it actually works this time diff --git a/pypy/objspace/std/newformat.py b/pypy/objspace/std/newformat.py --- a/pypy/objspace/std/newformat.py +++ b/pypy/objspace/std/newformat.py @@ -949,6 +949,8 @@ add_pct = False if self._precision == -1: self._precision = default_precision + elif tp == "r": + tp = "g" result, special = rfloat.double_to_string(value, tp, self._precision, flags) if add_pct: diff --git a/pypy/objspace/std/test/test_floatobject.py b/pypy/objspace/std/test/test_floatobject.py --- a/pypy/objspace/std/test/test_floatobject.py +++ b/pypy/objspace/std/test/test_floatobject.py @@ -444,6 +444,9 @@ def test_format(self): f = 1.1234e200 assert f.__format__("G") == "1.1234E+200" + assert 123.456.__format__('.4') == '123.5' + assert 1234.56.__format__('.4') == '1.235e+03' + assert 12345.6.__format__('.4') == '1.235e+04' def test_float_real(self): class A(float): pass _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit