From: Ɓukasz Langa Date: Mon, 12 Mar 2012 21:59:11 +0000 (+0100) Subject: #13842: check whether PyUnicode_FromString succeeded X-Git-Tag: v3.3.0a2~234^2~8^2^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dbd7825d56339d42abfb21d5360148a1f5258bf3;p=python #13842: check whether PyUnicode_FromString succeeded --- diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 4212e7a02f..36aa9e00a8 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -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