]> granicus.if.org Git - python/commitdiff
#13842: check whether PyUnicode_FromString succeeded
authorŁukasz Langa <lukasz@langa.pl>
Mon, 12 Mar 2012 21:59:11 +0000 (22:59 +0100)
committerŁukasz Langa <lukasz@langa.pl>
Mon, 12 Mar 2012 21:59:11 +0000 (22:59 +0100)
Modules/_pickle.c

index 4212e7a02fe350742fac854cc4ed1d954a109dc4..36aa9e00a80a5b3a5fda23d0649da8a7716e0776 100644 (file)
@@ -2814,14 +2814,19 @@ save_global(PicklerObject *self, PyObject *obj, PyObject *name)
 static int
 save_ellipsis(PicklerObject *self, PyObject *obj)
 {
-    return save_global(self, Py_Ellipsis, PyUnicode_FromString("Ellipsis"));
+    PyObject *str = PyUnicode_FromString("Ellipsis");
+    if (str == NULL)
+      return -1;
+    return save_global(self, Py_Ellipsis, str);
 }
 
 static int
 save_notimplemented(PicklerObject *self, PyObject *obj)
 {
-    return save_global(self, Py_NotImplemented,
-                       PyUnicode_FromString("NotImplemented"));
+    PyObject *str = PyUnicode_FromString("NotImplemented");
+    if (str == NULL)
+      return -1;
+    return save_global(self, Py_NotImplemented, str);
 }
 
 static int