mirror of https://github.com/python/cpython
PyUnicode_FromObject() ensures that its output is a ready string
This commit is contained in:
parent
67ca64ce54
commit
d3a83d5eb3
|
@ -2068,6 +2068,8 @@ PyUnicode_FromObject(register PyObject *obj)
|
||||||
/* XXX Perhaps we should make this API an alias of
|
/* XXX Perhaps we should make this API an alias of
|
||||||
PyObject_Str() instead ?! */
|
PyObject_Str() instead ?! */
|
||||||
if (PyUnicode_CheckExact(obj)) {
|
if (PyUnicode_CheckExact(obj)) {
|
||||||
|
if (PyUnicode_READY(obj))
|
||||||
|
return NULL;
|
||||||
Py_INCREF(obj);
|
Py_INCREF(obj);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue