From: Victor Stinner Date: Thu, 4 Oct 2012 22:09:33 +0000 (+0200) Subject: Fix PyUnicode_Format(): return NULL if PyUnicode_READY(uformat) failed X-Git-Tag: v3.4.0a1~2374^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1929407406966f9f2093a9e6b421cad39361dbb4;p=thirdparty%2FPython%2Fcpython.git Fix PyUnicode_Format(): return NULL if PyUnicode_READY(uformat) failed This error cannot occur in practice: PyUnicode_FromObject() always return a "ready" string. --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 0da565a612b3..87ac044e1c43 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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);