[Python-checkins] cpython: cleanup Ellipsis and NotImplemented strings after we're done

benjamin.peterson python-checkins at python.org
Sat Mar 17 00:45:41 CET 2012


http://hg.python.org/cpython/rev/9e5fb0b274d8
changeset: 75756:9e5fb0b274d8
user: Benjamin Peterson <benjamin at python.org>
date: Fri Mar 16 18:45:31 2012 -0500
summary:
 cleanup Ellipsis and NotImplemented strings after we're done
files:
 Modules/_pickle.c | 10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -2815,18 +2815,24 @@
 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
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /