mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
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().
This commit is contained in:
parent
e6b64b756f
commit
67310023f2
4 changed files with 151 additions and 186 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue