
python-checkins at python
May 2, 2012, 4:46 PM
Post #1 of 1
(20 views)
Permalink
|
|
cpython: Issue #14687: Optimize str%tuple for the "%(name)s" syntax
|
|
http://hg.python.org/cpython/rev/90b4c2d7c90d changeset: 76721:90b4c2d7c90d user: Victor Stinner <victor.stinner [at] gmail> date: Thu May 03 01:44:59 2012 +0200 summary: Issue #14687: Optimize str%tuple for the "%(name)s" syntax Avoid an useless and expensive call to PyUnicode_READ(). files: Objects/unicodeobject.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -13737,9 +13737,10 @@ 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++; } -- Repository URL: http://hg.python.org/cpython
|