Skip to content

Commit 14f8f02

Browse files
author
Victor Stinner
committed
Fix PyUnicode_Partition(): str_in->str_obj
1 parent 31392e7 commit 14f8f02

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Objects/unicodeobject.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11694,12 +11694,12 @@ PyUnicode_Partition(PyObject *str_in, PyObject *sep_in)
1169411694
return NULL;
1169511695
}
1169611696

11697-
kind1 = PyUnicode_KIND(str_in);
11697+
kind1 = PyUnicode_KIND(str_obj);
1169811698
kind2 = PyUnicode_KIND(sep_obj);
11699-
kind = kind1 > kind2 ? kind1 : kind2;
11700-
buf1 = PyUnicode_DATA(str_in);
11699+
kind = Py_MAX(kind1, kind2);
11700+
buf1 = PyUnicode_DATA(str_obj);
1170111701
if (kind1 != kind)
11702-
buf1 = _PyUnicode_AsKind(str_in, kind);
11702+
buf1 = _PyUnicode_AsKind(str_obj, kind);
1170311703
if (!buf1)
1170411704
goto onError;
1170511705
buf2 = PyUnicode_DATA(sep_obj);
@@ -11710,7 +11710,7 @@ PyUnicode_Partition(PyObject *str_in, PyObject *sep_in)
1171011710
len1 = PyUnicode_GET_LENGTH(str_obj);
1171111711
len2 = PyUnicode_GET_LENGTH(sep_obj);
1171211712

11713-
switch(PyUnicode_KIND(str_in)) {
11713+
switch(PyUnicode_KIND(str_obj)) {
1171411714
case PyUnicode_1BYTE_KIND:
1171511715
out = ucs1lib_partition(str_obj, buf1, len1, sep_obj, buf2, len2);
1171611716
break;

0 commit comments

Comments
 (0)