summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/unicodeobject.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index cf0bab9..e22fcfd 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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++;
}