diff options
Diffstat (limited to 'Programs/_testembed.c')
-rw-r--r-- | Programs/_testembed.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c index 38730095da..c3ccc0ec32 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -1375,6 +1375,54 @@ fail: } +static int test_init_sys_add(void) +{ + PySys_AddXOption(L"sysadd_xoption"); + PySys_AddXOption(L"faulthandler"); + PySys_AddWarnOption(L"ignore:::sysadd_warnoption"); + + PyConfig config; + PyStatus status; + status = PyConfig_InitPythonConfig(&config); + if (PyStatus_Exception(status)) { + goto fail; + } + + wchar_t* argv[] = { + L"python3", + L"-W", + L"ignore:::cmdline_warnoption", + L"-X", + L"cmdline_xoption", + }; + config_set_argv(&config, Py_ARRAY_LENGTH(argv), argv); + config.parse_argv = 1; + + status = PyWideStringList_Append(&config.xoptions, + L"config_xoption"); + if (PyStatus_Exception(status)) { + goto fail; + } + + status = PyWideStringList_Append(&config.warnoptions, + L"ignore:::config_warnoption"); + if (PyStatus_Exception(status)) { + goto fail; + } + + config_set_program_name(&config); + init_from_config_clear(&config); + + dump_config(); + Py_Finalize(); + return 0; + +fail: + PyConfig_Clear(&config); + Py_ExitStatusException(status); +} + + static void configure_init_main(PyConfig *config) { wchar_t* argv[] = { @@ -1510,6 +1558,7 @@ static struct TestCase TestCases[] = { {"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_run_main", test_run_main}, {"test_open_code_hook", test_open_code_hook}, {"test_audit", test_audit}, |