antoine.pitrou
2008-09-05 00:03:34 UTC
Author: antoine.pitrou
Date: Fri Sep 5 02:03:33 2008
New Revision: 66227
Log:
Issue #3660 (part of): fix a memory leak in _pickle.
Patch by Amaury Forgeot d'Arc, review by me.
Modified:
python/branches/py3k/Misc/NEWS
python/branches/py3k/Modules/_pickle.c
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Fri Sep 5 02:03:33 2008
@@ -80,6 +80,8 @@
Library
-------
+- Issue #3660: fix a memory leak in the C accelerator of the pickle module.
+
- Issue #3160: the "bdist_wininst" distutils command didn't work.
- Issue #1658: tkinter changes dict size during iteration in both
Modified: python/branches/py3k/Modules/_pickle.c
==============================================================================
--- python/branches/py3k/Modules/_pickle.c (original)
+++ python/branches/py3k/Modules/_pickle.c Fri Sep 5 02:03:33 2008
@@ -3837,13 +3837,17 @@
if (setstate == NULL) {
if (PyErr_ExceptionMatches(PyExc_AttributeError))
PyErr_Clear();
- else
+ else {
+ Py_DECREF(state);
return -1;
+ }
}
else {
PyObject *result;
/* The explicit __setstate__ is responsible for everything. */
+ /* Ugh... this does not leak since unpickler_call() steals the
+ reference to state first. */
result = unpickler_call(self, setstate, state);
Py_DECREF(setstate);
if (result == NULL)
Date: Fri Sep 5 02:03:33 2008
New Revision: 66227
Log:
Issue #3660 (part of): fix a memory leak in _pickle.
Patch by Amaury Forgeot d'Arc, review by me.
Modified:
python/branches/py3k/Misc/NEWS
python/branches/py3k/Modules/_pickle.c
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Fri Sep 5 02:03:33 2008
@@ -80,6 +80,8 @@
Library
-------
+- Issue #3660: fix a memory leak in the C accelerator of the pickle module.
+
- Issue #3160: the "bdist_wininst" distutils command didn't work.
- Issue #1658: tkinter changes dict size during iteration in both
Modified: python/branches/py3k/Modules/_pickle.c
==============================================================================
--- python/branches/py3k/Modules/_pickle.c (original)
+++ python/branches/py3k/Modules/_pickle.c Fri Sep 5 02:03:33 2008
@@ -3837,13 +3837,17 @@
if (setstate == NULL) {
if (PyErr_ExceptionMatches(PyExc_AttributeError))
PyErr_Clear();
- else
+ else {
+ Py_DECREF(state);
return -1;
+ }
}
else {
PyObject *result;
/* The explicit __setstate__ is responsible for everything. */
+ /* Ugh... this does not leak since unpickler_call() steals the
+ reference to state first. */
result = unpickler_call(self, setstate, state);
Py_DECREF(setstate);
if (result == NULL)