[Python-checkins] cpython: Fix PyUnicode_Join() for len==1 and non-exact string

victor.stinner python-checkins at python.org
Thu Oct 6 15:59:00 CEST 2011


http://hg.python.org/cpython/rev/9a91ab415109
changeset:   72753:9a91ab415109
user:        Victor Stinner <vstinner at wyplay.com>
date:        Thu Oct 06 15:58:54 2011 +0200
summary:
  Fix PyUnicode_Join() for len==1 and non-exact string

files:
  Objects/unicodeobject.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -9154,6 +9154,7 @@
             return res;
         }
         sep = NULL;
+        maxchar = 0;
     }
     else {
         /* Set up sep and seplen */
@@ -9203,8 +9204,7 @@
             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) {

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list