Add PyUnicode_Copy() function, include it to the public API

This commit is contained in:
Victor Stinner 2011-09-30 02:26:44 +02:00
parent b153615008
commit 034f6cf10c
3 changed files with 27 additions and 21 deletions

View file

@ -729,8 +729,7 @@ convert_to_unicode(PyObject **param)
else if (PyUnicode_Check(*param))
/* For a Unicode subtype that's not a Unicode object,
return a true Unicode object with the same data. */
*param = PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(*param),
PyUnicode_GET_SIZE(*param));
*param = PyUnicode_Copy(*param);
else
*param = PyUnicode_FromEncodedObject(*param,
Py_FileSystemDefaultEncoding,