diff options
author | Łukasz Langa <lukasz@langa.pl> | 2012-03-12 21:59:11 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2012-03-12 21:59:11 (GMT) |
commit | dbd7825d56339d42abfb21d5360148a1f5258bf3 (patch) | |
tree | 1ea0988eff1d7be7f98f26172043b8df751c5c20 /Modules/_pickle.c | |
parent | c1f5d8af57f2cabb2eb19f84d6fab2fbdd86293b (diff) | |
download | cpython-dbd7825d56339d42abfb21d5360148a1f5258bf3.zip cpython-dbd7825d56339d42abfb21d5360148a1f5258bf3.tar.gz cpython-dbd7825d56339d42abfb21d5360148a1f5258bf3.tar.bz2 |
#13842: check whether PyUnicode_FromString succeeded
Diffstat (limited to 'Modules/_pickle.c')
-rw-r--r-- | Modules/_pickle.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 4212e7a..36aa9e0 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 |