diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-10-03 21:03:46 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-10-03 21:03:46 (GMT) |
commit | a049443fab2442fff090470f8a4ec7a7c79c83ff (patch) | |
tree | bfbad994a44da4a2c95efafd3108ed60a20752cd /Objects | |
parent | afffce489b369d0237d49fd512219619cfa92965 (diff) | |
download | cpython-a049443fab2442fff090470f8a4ec7a7c79c83ff.zip cpython-a049443fab2442fff090470f8a4ec7a7c79c83ff.tar.gz cpython-a049443fab2442fff090470f8a4ec7a7c79c83ff.tar.bz2 |
PyUnicode_Format(): disable overallocation when we are writing the last part
of the output string
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 09067e9..53f0fb5 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); |