diff options
author | Eric Smith <eric@trueblade.com> | 2008-07-17 19:49:47 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2008-07-17 19:49:47 (GMT) |
commit | d6c393ab2bf239d9f25ceab6f9b3b83e44848343 (patch) | |
tree | e6e475fbc042276a08a4bd9be1f9c3b6217fdcbd /Objects/unicodeobject.c | |
parent | 0c1dbf8792cd1d4a8f97070852a16f4afcd7f466 (diff) | |
download | cpython-d6c393ab2bf239d9f25ceab6f9b3b83e44848343.zip cpython-d6c393ab2bf239d9f25ceab6f9b3b83e44848343.tar.gz cpython-d6c393ab2bf239d9f25ceab6f9b3b83e44848343.tar.bz2 |
Backed out r65069, pending fixing it in Windows.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index a885ff0..a62e929 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -8191,12 +8191,8 @@ formatfloat(Py_UNICODE *buf, return -1; if (prec < 0) prec = 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'; /* Worst case length calc to ensure no buffer overrun: 'g' formats: @@ -8215,8 +8211,7 @@ formatfloat(Py_UNICODE *buf, */ if (((type == 'g' || type == 'G') && buflen <= (size_t)10 + (size_t)prec) || - ((type == 'f' || type == 'F') && - buflen <= (size_t)53 + (size_t)prec)) { + (type == 'f' && buflen <= (size_t)53 + (size_t)prec)) { PyErr_SetString(PyExc_OverflowError, "formatted float is too long (precision too large?)"); return -1; @@ -8709,6 +8704,8 @@ PyObject *PyUnicode_Format(PyObject *format, case 'F': case 'g': case 'G': + if (c == 'F') + c = 'f'; pbuf = formatbuf; len = formatfloat(pbuf, sizeof(formatbuf)/sizeof(Py_UNICODE), flags, prec, c, v); |