]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix PyUnicode_Join() for len==1 and non-exact string
authorVictor Stinner <vstinner@wyplay.com>
Thu, 6 Oct 2011 13:58:54 +0000 (15:58 +0200)
committerVictor Stinner <vstinner@wyplay.com>
Thu, 6 Oct 2011 13:58:54 +0000 (15:58 +0200)
Objects/unicodeobject.c

index 2c38ed0a6d5762fef0b8d8132277d7ad76ae1e7f..75fc23c795b042d5a8ffaf275659e3559ee50728 100644 (file)
@@ -9154,6 +9154,7 @@ PyUnicode_Join(PyObject *separator, PyObject *seq)
             return res;
         }
         sep = NULL;
+        maxchar = 0;
     }
     else {
         /* Set up sep and seplen */
@@ -9203,8 +9204,7 @@ PyUnicode_Join(PyObject *separator, PyObject *seq)
             goto onError;
         sz += PyUnicode_GET_LENGTH(item);
         item_maxchar = PyUnicode_MAX_CHAR_VALUE(item);
-        if (item_maxchar > maxchar)
-            maxchar = item_maxchar;
+        maxchar = Py_MAX(maxchar, item_maxchar);
         if (i != 0)
             sz += seplen;
         if (sz < old_sz || sz > PY_SSIZE_T_MAX) {