summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-10-04 22:09:33 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-10-04 22:09:33 (GMT)
commit1929407406966f9f2093a9e6b421cad39361dbb4 (patch)
treee7328bcbe461e633a2cae12bf34153c088a9a1cb /Objects
parenteb0314f5a80dfcff1f55391a57dde5b1d94487fb (diff)
downloadcpython-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.c4
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);