From a4fac36eb3ee70529482d43d2a484d5ff5d18398 Mon Sep 17 00:00:00 2001 From: Eric Smith Date: Thu, 17 Jul 2008 18:30:48 +0000 Subject: Merged revisions 65069 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r65069 | eric.smith | 2008-07-17 13:48:39 -0400 (Thu, 17 Jul 2008) | 1 line Issue 3382: Make '%F' and float.__format__('F') convert results to upper case. ........ --- Objects/stringlib/formatter.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Objects/stringlib') diff --git a/Objects/stringlib/formatter.h b/Objects/stringlib/formatter.h index b964435745..d8cb1715c4 100644 --- a/Objects/stringlib/formatter.h +++ b/Objects/stringlib/formatter.h @@ -741,10 +741,6 @@ format_float_internal(PyObject *value, /* first, do the conversion as 8-bit chars, using the platform's snprintf. then, if needed, convert to unicode. */ - /* 'F' is the same as 'f', per the PEP */ - if (type == 'F') - type = 'f'; - x = PyFloat_AsDouble(value); if (x == -1.0 && PyErr_Occurred()) @@ -758,8 +754,12 @@ format_float_internal(PyObject *value, if (precision < 0) precision = 6; - if (type == 'f' && (fabs(x) / 1e25) >= 1e25) - type = 'g'; + if ((type == 'f' || type == 'F') && (fabs(x) / 1e25) >= 1e25) { + if (type == 'f') + type = 'g'; + else + type = 'G'; + } /* cast "type", because if we're in unicode we need to pass a 8-bit char. this is safe, because we've restricted what "type" -- cgit v1.2.1