diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-07-01 17:52:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-01 17:52:45 (GMT) |
commit | 67310023f299b5a2fad71fca449b46d280036690 (patch) | |
tree | 50b2da097996f106b68b802acbd579a41950c3e2 /Modules | |
parent | e6b64b756f940147728ea7808fb686ffcae89176 (diff) | |
download | cpython-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.c | 12 |
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; } |