summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-03-16 23:45:31 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-03-16 23:45:31 (GMT)
commite80b29b5b62b264d018260dd19ae9b5ba46d68d4 (patch)
tree34c0cb3d74a33700c1b1d30341b3718b8464747f
parent020bf28200ca0025dd33e9c563df76e39388d832 (diff)
downloadcpython-e80b29b5b62b264d018260dd19ae9b5ba46d68d4.zip
cpython-e80b29b5b62b264d018260dd19ae9b5ba46d68d4.tar.gz
cpython-e80b29b5b62b264d018260dd19ae9b5ba46d68d4.tar.bz2
cleanup Ellipsis and NotImplemented strings after we're done
-rw-r--r--Modules/_pickle.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 9410e52..5ba5599 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -2815,18 +2815,24 @@ static int
save_ellipsis(PicklerObject *self, PyObject *obj)
{
PyObject *str = PyUnicode_FromString("Ellipsis");
+ int res;
if (str == NULL)
return -1;
- return save_global(self, Py_Ellipsis, str);
+ res = save_global(self, Py_Ellipsis, str);
+ Py_DECREF(str);
+ return res;
}
static int
save_notimplemented(PicklerObject *self, PyObject *obj)
{
PyObject *str = PyUnicode_FromString("NotImplemented");
+ int res;
if (str == NULL)
return -1;
- return save_global(self, Py_NotImplemented, str);
+ res = save_global(self, Py_NotImplemented, str);
+ Py_DECREF(str);
+ return res;
}
static int