mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Allow printing a leading '-' and the maximum number of exponent digits
rather than raising RuntimeError (allocated space is sufficient for the additional character).
This commit is contained in:
parent
0774e9b9f5
commit
ff3eca0cc3
2 changed files with 50 additions and 2 deletions
|
@ -2435,8 +2435,8 @@ dectuple_as_str(PyObject *dectuple)
|
|||
if (sign_special[1] == '\0') {
|
||||
/* not a special number */
|
||||
*cp++ = 'E';
|
||||
n = snprintf(cp, MPD_EXPDIGITS+1, "%" PRI_mpd_ssize_t, exp);
|
||||
if (n < 0 || n >= MPD_EXPDIGITS+1) {
|
||||
n = snprintf(cp, MPD_EXPDIGITS+2, "%" PRI_mpd_ssize_t, exp);
|
||||
if (n < 0 || n >= MPD_EXPDIGITS+2) {
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
"internal error in dec_sequence_as_str");
|
||||
goto error;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue