[Python-checkins] gh-93728: fix memory leak in deepfrozen code objects (GH-93729)

Fidget-Spinner webhook-mailer at python.org
Sun Jun 12 10:42:46 EDT 2022


https://github.com/python/cpython/commit/8f728e5baa7a673b83607aaccbd496d77d334ded
commit: 8f728e5baa7a673b83607aaccbd496d77d334ded
branch: main
author: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com>
committer: Fidget-Spinner <kenjin at python.org>
date: 2022-06-12T22:42:18+08:00
summary:

gh-93728: fix memory leak in deepfrozen code objects (GH-93729)

files:
M Objects/codeobject.c

diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index dc6dec1b2a549..2a2f132a6ef62 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -2092,6 +2092,7 @@ _PyStaticCode_Dealloc(PyCodeObject *co)
     deopt_code(_PyCode_CODE(co), Py_SIZE(co));
     co->co_warmup = QUICKENING_INITIAL_WARMUP_VALUE;
     PyMem_Free(co->co_extra);
+    Py_CLEAR(co->_co_code);
     co->co_extra = NULL;
     if (co->co_weakreflist != NULL) {
         PyObject_ClearWeakRefs((PyObject *)co);



More information about the Python-checkins mailing list