diff options
author | Victor Stinner <vstinner@wyplay.com> | 2011-10-06 13:58:54 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@wyplay.com> | 2011-10-06 13:58:54 (GMT) |
commit | c6f0df7b2095eaf0a6d5914a043f9062f66d19f7 (patch) | |
tree | fc183d7c26da01cd251e54e766ce27c1e6e93cf0 | |
parent | b066cc6aba07a118c89f2a127560858051af4814 (diff) | |
download | cpython-c6f0df7b2095eaf0a6d5914a043f9062f66d19f7.zip cpython-c6f0df7b2095eaf0a6d5914a043f9062f66d19f7.tar.gz cpython-c6f0df7b2095eaf0a6d5914a043f9062f66d19f7.tar.bz2 |
Fix PyUnicode_Join() for len==1 and non-exact string
-rw-r--r-- | Objects/unicodeobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 2c38ed0..75fc23c 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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) { |