summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-01-27 18:33:47 +0530
committerGitHub <noreply@github.com>2022-01-27 14:03:47 +0100
commitc7f810b34d91a5c2fbe0a8385562015d2dd961f2 (patch)
tree0fcbd6901e212f47e1054a862af4d8ec571ee7c2 /Programs
parentbpo-44791: Fix substitution of ParamSpec in Concatenate with different parame... (diff)
downloadcpython-c7f810b34d91a5c2fbe0a8385562015d2dd961f2.tar.gz
cpython-c7f810b34d91a5c2fbe0a8385562015d2dd961f2.tar.bz2
cpython-c7f810b34d91a5c2fbe0a8385562015d2dd961f2.zip
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 f2103fd5aaa..f4d0167b62e 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 b2f1a24016f..99a1d4dfc26 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;
}
+