summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-02-24 16:54:06 (GMT)
committerGitHub <noreply@github.com>2022-02-24 16:54:06 (GMT)
commit4dc746310bd37ad6b381f9176acd167d445f4385 (patch)
tree414abfb60866c640ea403888d9c7356e2e120f4b /Python
parent042f31da552c19054acd3ef7bb6cfd857bce172b (diff)
downloadcpython-4dc746310bd37ad6b381f9176acd167d445f4385.zip
cpython-4dc746310bd37ad6b381f9176acd167d445f4385.tar.gz
cpython-4dc746310bd37ad6b381f9176acd167d445f4385.tar.bz2
bpo-46430: Fix memory leak in interned strings of deep-frozen modules (GH-31549)
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index b6310c9..9dd769a 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -754,7 +754,6 @@ pycore_init_types(PyInterpreterState *interp)
if (_PyStatus_EXCEPTION(status)) {
return status;
}
-
return _PyStatus_OK();
}
@@ -827,7 +826,10 @@ pycore_interp_init(PyThreadState *tstate)
if (_PyStatus_EXCEPTION(status)) {
return status;
}
-
+ // Intern strings in deep-frozen modules first so that others
+ // can use it instead of creating a heap allocated string.
+ _Py_Deepfreeze_Init();
+
status = pycore_init_types(interp);
if (_PyStatus_EXCEPTION(status)) {
goto done;