Index: Objects/stringobject.c =================================================================== --- Objects/stringobject.c (revision 66118) +++ Objects/stringobject.c (working copy) @@ -1638,7 +1638,7 @@ } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(sep_obj)) - return PyUnicode_Partition((PyObject *) self, sep_obj); + return PyUnicode_RPartition((PyObject *) self, sep_obj); #endif else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) return NULL; Index: Lib/test/string_tests.py =================================================================== --- Lib/test/string_tests.py (revision 66118) +++ Lib/test/string_tests.py (working copy) @@ -1117,6 +1117,9 @@ self.checkraises(ValueError, S, 'partition', '') self.checkraises(TypeError, S, 'partition', None) + # mixed use of str and unicode + self.assertEqual('a/b/c'.partition(u'/'), ('a', '/', 'b/c')) + def test_rpartition(self): self.checkequal(('this is the rparti', 'ti', 'on method'), @@ -1132,6 +1135,8 @@ self.checkraises(ValueError, S, 'rpartition', '') self.checkraises(TypeError, S, 'rpartition', None) + # mixed use of str and unicode + self.assertEqual('a/b/c'.rpartition(u'/'), ('a/b', '/', 'c')) class MixinStrStringUserStringTest: # Additional tests for 8bit strings, i.e. str, UserString and Index: Misc/NEWS =================================================================== --- Misc/NEWS (revision 66118) +++ Misc/NEWS (working copy) @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #3751: str.rpartition would perform a left-partition when called with + a unicode argument. + - Issue #3683: Fix compilation when --without-threads is given. - Issue #3668: Fix a memory leak with the "s*" argument parser in