PyUnicode_Format(): disable overallocation when we are writing the last part

of the output string
This commit is contained in:
Victor Stinner 2012-10-03 23:03:46 +02:00
parent afffce489b
commit a049443fab
1 changed files with 3 additions and 1 deletions

View File

@ -13583,8 +13583,10 @@ PyUnicode_Format(PyObject *format, PyObject *args)
fmtpos++;
fmtcnt--;
}
if (fmtcnt < 0)
if (fmtcnt < 0) {
fmtpos--;
writer.overallocate = 0;
}
sublen = fmtpos - nonfmtpos;
maxchar = _PyUnicode_FindMaxChar(uformat,
nonfmtpos, nonfmtpos + sublen);