From: Victor Stinner Date: Wed, 3 Oct 2012 21:03:46 +0000 (+0200) Subject: PyUnicode_Format(): disable overallocation when we are writing the last part X-Git-Tag: v3.4.0a1~2392 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a049443fab2442fff090470f8a4ec7a7c79c83ff;p=thirdparty%2FPython%2Fcpython.git PyUnicode_Format(): disable overallocation when we are writing the last part of the output string --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 09067e919c46..53f0fb5a3f10 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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);