Issue #14687: Optimize str%tuple for the "%(name)s" syntax
Avoid an useless and expensive call to PyUnicode_READ().
This commit is contained in:
parent
598b2f6bd0
commit
bff7c96834
|
@ -13737,9 +13737,10 @@ PyUnicode_Format(PyObject *format, PyObject *args)
|
|||
keystart = fmtpos;
|
||||
/* Skip over balanced parentheses */
|
||||
while (pcount > 0 && --fmtcnt >= 0) {
|
||||
if (PyUnicode_READ(fmtkind, fmt, fmtpos) == ')')
|
||||
c = PyUnicode_READ(fmtkind, fmt, fmtpos);
|
||||
if (c == ')')
|
||||
--pcount;
|
||||
else if (PyUnicode_READ(fmtkind, fmt, fmtpos) == '(')
|
||||
else if (c == '(')
|
||||
++pcount;
|
||||
fmtpos++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue