diff Objects/unicodeobject.c @ 79470:6ea8019307a9 3.3

Fix PyUnicode_Format(): return NULL if PyUnicode_READY(uformat) failed This error cannot occur in practice: PyUnicode_FromObject() always return a "ready" string.
author Victor Stinner <victor.stinner@gmail.com>
date Fri, 05 Oct 2012 00:09:33 +0200
parents 3d9c323711d0
children a1aa13ef00c5 91a796832eb3
line wrap: on
line diff
--- a/Objects/unicodeobject.c	Thu Oct 04 22:50:13 2012 +0300
+++ b/Objects/unicodeobject.c	Fri Oct 05 00:09:33 2012 +0200
@@ -13442,8 +13442,10 @@
     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);