summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-07-01 17:52:45 (GMT)
committerGitHub <noreply@github.com>2019-07-01 17:52:45 (GMT)
commit67310023f299b5a2fad71fca449b46d280036690 (patch)
tree50b2da097996f106b68b802acbd579a41950c3e2 /Modules
parente6b64b756f940147728ea7808fb686ffcae89176 (diff)
downloadcpython-67310023f299b5a2fad71fca449b46d280036690.zip
cpython-67310023f299b5a2fad71fca449b46d280036690.tar.gz
cpython-67310023f299b5a2fad71fca449b46d280036690.tar.bz2
bpo-36763: Use PyConfig_Clear() (GH-14445)
Stop using "static PyConfig", PyConfig must now always use dynamically allocated strings: use PyConfig_SetString(), PyConfig_SetArgv() and PyConfig_Clear().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/main.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 853afed..b126f45 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -62,7 +62,7 @@ pymain_init(const _PyArgv *args)
PyConfig config;
status = PyConfig_InitPythonConfig(&config);
if (_PyStatus_EXCEPTION(status)) {
- return status;
+ goto done;
}
/* pass NULL as the config: config is read from command line arguments,
@@ -74,14 +74,18 @@ pymain_init(const _PyArgv *args)
status = PyConfig_SetArgv(&config, args->argc, args->wchar_argv);
}
if (_PyStatus_EXCEPTION(status)) {
- return status;
+ goto done;
}
status = Py_InitializeFromConfig(&config);
if (_PyStatus_EXCEPTION(status)) {
- return status;
+ goto done;
}
- return _PyStatus_OK();
+ status = _PyStatus_OK();
+
+done:
+ PyConfig_Clear(&config);
+ return status;
}