summaryrefslogtreecommitdiff
path: root/Modules/main.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-03-26 16:58:50 +0100
committerGitHub <noreply@github.com>2019-03-26 16:58:50 +0100
commitf8ba6f5afc317d1be3025db1be410ac66a7e5a27 (patch)
tree531f75949653a2843d2834f253d26f5d366e6111 /Modules/main.c
parent414b1cde93764cdabb0798b02af4dd7df954424d (diff)
downloadcpython-git-f8ba6f5afc317d1be3025db1be410ac66a7e5a27.tar.gz
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.
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 9fcc76e58a..98a886125c 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -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();
}