mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
bpo-36471: Add _Py_RunMain() (GH-12618)
* Add config_read_cmdline() subfunction. Remove _PyCmdline structure. * _PyCoreConfig_Read() now also parses config->argv command line arguments
This commit is contained in:
parent
5f45979b63
commit
2f54908afc
5 changed files with 156 additions and 118 deletions
|
@ -567,20 +567,22 @@ exit_sigint(void)
|
|||
}
|
||||
|
||||
|
||||
static int
|
||||
pymain_main(_PyArgv *args)
|
||||
static void _Py_NO_RETURN
|
||||
pymain_exit_error(_PyInitError err)
|
||||
{
|
||||
_PyInitError err;
|
||||
pymain_free();
|
||||
_Py_ExitInitError(err);
|
||||
}
|
||||
|
||||
err = pymain_init(args);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
goto exit_init_error;
|
||||
}
|
||||
|
||||
int
|
||||
_Py_RunMain(void)
|
||||
{
|
||||
int exitcode = 0;
|
||||
err = pymain_run_python(&exitcode);
|
||||
|
||||
_PyInitError err = pymain_run_python(&exitcode);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
goto exit_init_error;
|
||||
pymain_exit_error(err);
|
||||
}
|
||||
|
||||
if (Py_FinalizeEx() < 0) {
|
||||
|
@ -596,10 +598,18 @@ pymain_main(_PyArgv *args)
|
|||
}
|
||||
|
||||
return exitcode;
|
||||
}
|
||||
|
||||
exit_init_error:
|
||||
pymain_free();
|
||||
_Py_ExitInitError(err);
|
||||
|
||||
static int
|
||||
pymain_main(_PyArgv *args)
|
||||
{
|
||||
_PyInitError err = pymain_init(args);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
pymain_exit_error(err);
|
||||
}
|
||||
|
||||
return _Py_RunMain();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue