Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 48003:5c33009994b4 legacy-trunk
Backed out r65069, pending fixing it in Windows.
| author | Eric Smith <eric@trueblade.com> |
|---|---|
| date | Thu, 17 Jul 2008 19:49:47 +0000 |
| parents | f283e3b5f917 |
| children | c4d24fc8ba8a |
line wrap: on
line diff
--- a/Objects/stringobject.c Thu Jul 17 18:01:57 2008 +0000 +++ b/Objects/stringobject.c Thu Jul 17 19:49:47 2008 +0000 @@ -4320,12 +4320,8 @@ } 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: @@ -4344,8 +4340,7 @@ */ 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; @@ -4915,6 +4910,8 @@ case 'F': case 'g': case 'G': + if (c == 'F') + c = 'f'; pbuf = formatbuf; len = formatfloat(pbuf, sizeof(formatbuf), flags, prec, c, v);
