#13842: check whether PyUnicode_FromString succeeded

This commit is contained in:
Łukasz Langa 2012-03-12 22:59:11 +01:00
parent c1f5d8af57
commit dbd7825d56

View file

@ -2814,14 +2814,19 @@ save_global(PicklerObject *self, PyObject *obj, PyObject *name)
static int static int
save_ellipsis(PicklerObject *self, PyObject *obj) 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 static int
save_notimplemented(PicklerObject *self, PyObject *obj) save_notimplemented(PicklerObject *self, PyObject *obj)
{ {
return save_global(self, Py_NotImplemented, PyObject *str = PyUnicode_FromString("NotImplemented");
PyUnicode_FromString("NotImplemented")); if (str == NULL)
return -1;
return save_global(self, Py_NotImplemented, str);
} }
static int static int