summaryrefslogtreecommitdiffstats
path: root/Programs
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-01-27 13:03:47 (GMT)
committerGitHub <noreply@github.com>2022-01-27 13:03:47 (GMT)
commitc7f810b34d91a5c2fbe0a8385562015d2dd961f2 (patch)
tree0fcbd6901e212f47e1054a862af4d8ec571ee7c2 /Programs
parentecfacc362dd7fef7715dcd94f2e2ca6c622ef115 (diff)
downloadcpython-c7f810b34d91a5c2fbe0a8385562015d2dd961f2.zip
cpython-c7f810b34d91a5c2fbe0a8385562015d2dd961f2.tar.gz
cpython-c7f810b34d91a5c2fbe0a8385562015d2dd961f2.tar.bz2
bpo-46476: Fix memory leak in code objects generated by deepfreeze (GH-30853)
Add _Py_Deepfreeze_Fini() and _PyStaticCode_Dealloc() functions.
Diffstat (limited to 'Programs')
-rw-r--r--Programs/_bootstrap_python.c7
-rw-r--r--Programs/_freeze_module.c7
2 files changed, 14 insertions, 0 deletions
diff --git a/Programs/_bootstrap_python.c b/Programs/_bootstrap_python.c
index f2103fd..f4d0167 100644
--- a/Programs/_bootstrap_python.c
+++ b/Programs/_bootstrap_python.c
@@ -14,6 +14,12 @@
#include "Python/frozen_modules/importlib._bootstrap_external.h"
/* End includes */
+/* Empty finalizer for deepfrozen modules*/
+void
+_Py_Deepfreeze_Fini(void)
+{
+}
+
/* Note that a negative size indicates a package. */
static const struct _frozen bootstrap_modules[] = {
@@ -103,3 +109,4 @@ error:
}
Py_ExitStatusException(status);
}
+
diff --git a/Programs/_freeze_module.c b/Programs/_freeze_module.c
index b2f1a24..99a1d4d 100644
--- a/Programs/_freeze_module.c
+++ b/Programs/_freeze_module.c
@@ -22,6 +22,12 @@
#include <unistd.h>
#endif
+/* Empty finalizer for deepfrozen modules */
+void
+_Py_Deepfreeze_Fini(void)
+{
+}
+
/* To avoid a circular dependency on frozen.o, we create our own structure
of frozen modules instead, left deliberately blank so as to avoid
unintentional import of a stale version of _frozen_importlib. */
@@ -235,3 +241,4 @@ error:
Py_Finalize();
return 1;
}
+