mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
bpo-36301: Cleanup preconfig.c and coreconfig.c (GH-12563)
* _PyCoreConfig_Write() now updates _PyRuntime.preconfig * Remove _PyPreCmdline_Copy() * _PyPreCmdline_Read() now accepts _PyPreConfig and _PyCoreConfig optional configurations. * Rename _PyPreConfig_ReadFromArgv() to _PyPreConfig_Read(). Simplify the code. * Calling _PyCoreConfig_Read() no longer adds the warning options twice: don't add a warning option if it's already in the list. * Rename _PyCoreConfig_ReadFromArgv() to _PyCoreConfig_Read(). * Rename config_from_cmdline() to _PyCoreConfig_ReadFromArgv(). * Add more assertions on _PyCoreConfig in _PyCoreConfig_Read(). * Move some functions. * Make some config functions private.
This commit is contained in:
parent
414b1cde93
commit
f8ba6f5afc
9 changed files with 658 additions and 695 deletions
|
@ -289,7 +289,7 @@ pymain_init_preconfig(const _PyArgv *args)
|
|||
|
||||
_PyPreConfig config = _PyPreConfig_INIT;
|
||||
|
||||
err = _PyPreConfig_ReadFromArgv(&config, args);
|
||||
err = _PyPreConfig_Read(&config, args, NULL);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
goto done;
|
||||
}
|
||||
|
@ -306,12 +306,12 @@ static _PyInitError
|
|||
pymain_init_coreconfig(_PyCoreConfig *config, const _PyArgv *args,
|
||||
PyInterpreterState **interp_p)
|
||||
{
|
||||
_PyInitError err = _PyCoreConfig_ReadFromArgv(config, args);
|
||||
_PyInitError err = _PyCoreConfig_Read(config, args);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return _Py_InitializeCore(interp_p, config);
|
||||
return _Py_InitializeCore(config, interp_p);
|
||||
}
|
||||
|
||||
|
||||
|
@ -359,22 +359,18 @@ pymain_init(const _PyArgv *args, PyInterpreterState **interp_p)
|
|||
}
|
||||
|
||||
_PyCoreConfig config = _PyCoreConfig_INIT;
|
||||
|
||||
err = pymain_init_coreconfig(&config, args, interp_p);
|
||||
_PyCoreConfig_Clear(&config);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
goto done;
|
||||
return err;
|
||||
}
|
||||
|
||||
err = pymain_init_python_main(*interp_p);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
goto done;
|
||||
return err;
|
||||
}
|
||||
|
||||
err = _Py_INIT_OK();
|
||||
|
||||
done:
|
||||
_PyCoreConfig_Clear(&config);
|
||||
return err;
|
||||
return _Py_INIT_OK();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue