diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-10-04 22:09:33 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-10-04 22:09:33 (GMT) |
commit | 1929407406966f9f2093a9e6b421cad39361dbb4 (patch) | |
tree | e7328bcbe461e633a2cae12bf34153c088a9a1cb /Objects | |
parent | eb0314f5a80dfcff1f55391a57dde5b1d94487fb (diff) | |
download | cpython-1929407406966f9f2093a9e6b421cad39361dbb4.zip cpython-1929407406966f9f2093a9e6b421cad39361dbb4.tar.gz cpython-1929407406966f9f2093a9e6b421cad39361dbb4.tar.bz2 |
Fix PyUnicode_Format(): return NULL if PyUnicode_READY(uformat) failed
This error cannot occur in practice: PyUnicode_FromObject() always return
a "ready" string.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 0da565a..87ac044 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); |