summaryrefslogtreecommitdiffstats
path: root/Objects/stringlib
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2008-07-17 19:49:47 (GMT)
committerEric Smith <eric@trueblade.com>2008-07-17 19:49:47 (GMT)
commitd6c393ab2bf239d9f25ceab6f9b3b83e44848343 (patch)
treee6e475fbc042276a08a4bd9be1f9c3b6217fdcbd /Objects/stringlib
parent0c1dbf8792cd1d4a8f97070852a16f4afcd7f466 (diff)
downloadcpython-d6c393ab2bf239d9f25ceab6f9b3b83e44848343.zip
cpython-d6c393ab2bf239d9f25ceab6f9b3b83e44848343.tar.gz
cpython-d6c393ab2bf239d9f25ceab6f9b3b83e44848343.tar.bz2
Backed out r65069, pending fixing it in Windows.
Diffstat (limited to 'Objects/stringlib')
-rw-r--r--Objects/stringlib/formatter.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/Objects/stringlib/formatter.h b/Objects/stringlib/formatter.h
index d8cb171..b964435 100644
--- a/Objects/stringlib/formatter.h
+++ b/Objects/stringlib/formatter.h
@@ -741,6 +741,10 @@ 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())
@@ -754,12 +758,8 @@ format_float_internal(PyObject *value,
if (precision < 0)
precision = 6;
- if ((type == 'f' || type == 'F') && (fabs(x) / 1e25) >= 1e25) {
- if (type == 'f')
- type = 'g';
- else
- type = 'G';
- }
+ if (type == 'f' && (fabs(x) / 1e25) >= 1e25)
+ 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"