summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2013-12-14 12:43:10 (GMT)
committerStefan Krah <skrah@bytereef.org>2013-12-14 12:43:10 (GMT)
commitf483b0f3a92d1414efac102d8210dbfd307d037c (patch)
treec4c036a3915863e21a4fb455e95a577a13e3dafc /Modules
parent7ab9f7251916ae8d90eaea9ca9496cb2f355e12d (diff)
downloadcpython-f483b0f3a92d1414efac102d8210dbfd307d037c.zip
cpython-f483b0f3a92d1414efac102d8210dbfd307d037c.tar.gz
cpython-f483b0f3a92d1414efac102d8210dbfd307d037c.tar.bz2
Issue #19972: Add rarely used freefunc. This fixes a leak if sys.exit()
is used in a program.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_pickle.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index d61c8ab..c52f945 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -7464,6 +7464,12 @@ pickle_clear(PyObject *m)
return 0;
}
+static void
+pickle_free(PyObject *m)
+{
+ _Pickle_ClearState(_Pickle_GetState(m));
+}
+
static int
pickle_traverse(PyObject *m, visitproc visit, void *arg)
{
@@ -7485,14 +7491,14 @@ pickle_traverse(PyObject *m, visitproc visit, void *arg)
static struct PyModuleDef _picklemodule = {
PyModuleDef_HEAD_INIT,
- "_pickle", /* m_name */
- pickle_module_doc, /* m_doc */
- sizeof(PickleState), /* m_size */
- pickle_methods, /* m_methods */
- NULL, /* m_reload */
- pickle_traverse, /* m_traverse */
- pickle_clear, /* m_clear */
- NULL /* m_free */
+ "_pickle", /* m_name */
+ pickle_module_doc, /* m_doc */
+ sizeof(PickleState), /* m_size */
+ pickle_methods, /* m_methods */
+ NULL, /* m_reload */
+ pickle_traverse, /* m_traverse */
+ pickle_clear, /* m_clear */
+ (freefunc)pickle_free /* m_free */
};
PyMODINIT_FUNC