Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 48523:3d526525b3e8
Backed out r65073, pending fixing it in Windows.
| author | Eric Smith <eric@trueblade.com> |
|---|---|
| date | Thu, 17 Jul 2008 19:18:29 +0000 |
| parents | 83d0d4cb7a66 |
| children | 862c0eab1c50 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Thu Jul 17 18:30:48 2008 +0000 +++ b/Objects/unicodeobject.c Thu Jul 17 19:18:29 2008 +0000 @@ -8588,12 +8588,8 @@ 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: @@ -8612,8 +8608,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; @@ -9096,6 +9091,8 @@ 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);
