Fix PyUnicode_Format(): return NULL if PyUnicode_READY(uformat) failed

This error cannot occur in practice: PyUnicode_FromObject() always return
a "ready" string.
This commit is contained in:
Victor Stinner 2012-10-05 00:09:33 +02:00
parent eb0314f5a8
commit 1929407406
1 changed files with 3 additions and 1 deletions

View File

@ -13442,8 +13442,10 @@ PyUnicode_Format(PyObject *format, PyObject *args)
uformat = PyUnicode_FromObject(format);
if (uformat == NULL)
return NULL;
if (PyUnicode_READY(uformat) == -1)
if (PyUnicode_READY(uformat) == -1) {
Py_DECREF(uformat);
return NULL;
}
fmt = PyUnicode_DATA(uformat);
fmtkind = PyUnicode_KIND(uformat);