mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-129033: Remove _Py_InitializeMain() function (#129034)
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
This commit is contained in:
parent
c463270c73
commit
07c3518ffb
7 changed files with 15 additions and 153 deletions
|
@ -1818,7 +1818,6 @@ static int test_init_set_config(void)
|
|||
PyConfig config;
|
||||
PyConfig_InitIsolatedConfig(&config);
|
||||
config_set_string(&config, &config.program_name, PROGRAM_NAME);
|
||||
config._init_main = 0;
|
||||
config.bytes_warning = 0;
|
||||
init_from_config_clear(&config);
|
||||
|
||||
|
@ -1828,12 +1827,6 @@ static int test_init_set_config(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// Finish initialization: main part
|
||||
PyStatus status = _Py_InitializeMain();
|
||||
if (PyStatus_Exception(status)) {
|
||||
Py_ExitStatusException(status);
|
||||
}
|
||||
|
||||
dump_config();
|
||||
Py_Finalize();
|
||||
return 0;
|
||||
|
@ -2089,33 +2082,6 @@ static int test_init_run_main(void)
|
|||
}
|
||||
|
||||
|
||||
static int test_init_main(void)
|
||||
{
|
||||
PyConfig config;
|
||||
PyConfig_InitPythonConfig(&config);
|
||||
|
||||
configure_init_main(&config);
|
||||
config._init_main = 0;
|
||||
init_from_config_clear(&config);
|
||||
|
||||
/* sys.stdout don't exist yet: it is created by _Py_InitializeMain() */
|
||||
int res = PyRun_SimpleString(
|
||||
"import sys; "
|
||||
"print('Run Python code before _Py_InitializeMain', "
|
||||
"file=sys.stderr)");
|
||||
if (res < 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
PyStatus status = _Py_InitializeMain();
|
||||
if (PyStatus_Exception(status)) {
|
||||
Py_ExitStatusException(status);
|
||||
}
|
||||
|
||||
return Py_RunMain();
|
||||
}
|
||||
|
||||
|
||||
static int test_run_main(void)
|
||||
{
|
||||
PyConfig config;
|
||||
|
@ -2473,7 +2439,6 @@ static struct TestCase TestCases[] = {
|
|||
{"test_preinit_dont_parse_argv", test_preinit_dont_parse_argv},
|
||||
{"test_init_read_set", test_init_read_set},
|
||||
{"test_init_run_main", test_init_run_main},
|
||||
{"test_init_main", test_init_main},
|
||||
{"test_init_sys_add", test_init_sys_add},
|
||||
{"test_init_setpath", test_init_setpath},
|
||||
{"test_init_setpath_config", test_init_setpath_config},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue