diff -r 51e906518606 Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py Sat Mar 28 20:38:37 2015 +0200 +++ b/Lib/test/test_unicode.py Sun Mar 29 14:16:40 2015 +0300 @@ -375,6 +375,7 @@ class UnicodeTest(string_tests.CommonTes def test_partition(self): string_tests.MixinStrUnicodeUserStringTest.test_partition(self) # test mixed kinds + self.checkequal(('ABCDEFGH', '', ''), 'ABCDEFGH', 'partition', '\u4200') for left, right in ('ba', '\u0101\u0100', '\U00010301\U00010300'): left *= 9 right *= 9 @@ -391,6 +392,7 @@ class UnicodeTest(string_tests.CommonTes def test_rpartition(self): string_tests.MixinStrUnicodeUserStringTest.test_rpartition(self) # test mixed kinds + self.checkequal(('', '', 'ABCDEFGH'), 'ABCDEFGH', 'rpartition', '\u4200') for left, right in ('ba', '\u0101\u0100', '\U00010301\U00010300'): left *= 9 right *= 9 diff -r 51e906518606 Objects/unicodeobject.c --- a/Objects/unicodeobject.c Sat Mar 28 20:38:37 2015 +0200 +++ b/Objects/unicodeobject.c Sun Mar 29 14:16:40 2015 +0300 @@ -12681,7 +12681,7 @@ PyUnicode_Partition(PyObject *str_in, Py len1 = PyUnicode_GET_LENGTH(str_obj); len2 = PyUnicode_GET_LENGTH(sep_obj); - switch (PyUnicode_KIND(str_obj)) { + switch (kind) { case PyUnicode_1BYTE_KIND: if (PyUnicode_IS_ASCII(str_obj) && PyUnicode_IS_ASCII(sep_obj)) out = asciilib_partition(str_obj, buf1, len1, sep_obj, buf2, len2); @@ -12737,12 +12737,12 @@ PyUnicode_RPartition(PyObject *str_in, P return NULL; } - kind1 = PyUnicode_KIND(str_in); + kind1 = PyUnicode_KIND(str_obj); kind2 = PyUnicode_KIND(sep_obj); kind = Py_MAX(kind1, kind2); - buf1 = PyUnicode_DATA(str_in); + buf1 = PyUnicode_DATA(str_obj); if (kind1 != kind) - buf1 = _PyUnicode_AsKind(str_in, kind); + buf1 = _PyUnicode_AsKind(str_obj, kind); if (!buf1) goto onError; buf2 = PyUnicode_DATA(sep_obj); @@ -12753,7 +12753,7 @@ PyUnicode_RPartition(PyObject *str_in, P len1 = PyUnicode_GET_LENGTH(str_obj); len2 = PyUnicode_GET_LENGTH(sep_obj); - switch (PyUnicode_KIND(str_in)) { + switch (kind) { case PyUnicode_1BYTE_KIND: if (PyUnicode_IS_ASCII(str_obj) && PyUnicode_IS_ASCII(sep_obj)) out = asciilib_rpartition(str_obj, buf1, len1, sep_obj, buf2, len2);