[Python-checkins] cpython: #13842: check whether PyUnicode_FromString succeeded
lukasz.langa
python-checkins at python.org
Mon Mar 12 22:59:54 CET 2012
http://hg.python.org/cpython/rev/5353357382e2
changeset: 75554:5353357382e2
parent: 75551:b154ab2cdb1e
user: Łukasz Langa <lukasz at langa.pl>
date: Mon Mar 12 22:59:11 2012 +0100
summary:
#13842: check whether PyUnicode_FromString succeeded
files:
Modules/_pickle.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -2814,14 +2814,19 @@
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
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list