]> granicus.if.org Git - python/commitdiff
Issue #14687: Cleanup PyUnicode_Format()
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 1 May 2012 22:41:57 +0000 (00:41 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 1 May 2012 22:41:57 +0000 (00:41 +0200)
Objects/unicodeobject.c

index 95993e879fb4f6b8563985bcb5d0f227c2b1384e..1d85d5bef3fc280f72579b6254c8d30dc97ab7c9 100644 (file)
@@ -13719,7 +13719,8 @@ PyUnicode_Format(PyObject *format, PyObject *args)
             PyObject *signobj = NULL, *fillobj = NULL;
 
             fmtpos++;
-            if (PyUnicode_READ(fmtkind, fmt, fmtpos) == '(') {
+            c = PyUnicode_READ(fmtkind, fmt, fmtpos);
+            if (c == '(') {
                 Py_ssize_t keystart;
                 Py_ssize_t keylen;
                 PyObject *key;
@@ -13765,7 +13766,8 @@ PyUnicode_Format(PyObject *format, PyObject *args)
                 argidx = -2;
             }
             while (--fmtcnt >= 0) {
-                switch (c = PyUnicode_READ(fmtkind, fmt, fmtpos++)) {
+                c = PyUnicode_READ(fmtkind, fmt, fmtpos++);
+                switch (c) {
                 case '-': flags |= F_LJUST; continue;
                 case '+': flags |= F_SIGN; continue;
                 case ' ': flags |= F_BLANK; continue;