diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2021-10-13 17:08:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 17:08:19 (GMT) |
commit | db2b6a20cd35781b2f5e798e880e57e6cf9b97aa (patch) | |
tree | 316124de83275184a817e1d543f9b8200c785466 /Programs | |
parent | 1c831353816ff699b54e804047a7242a09e98f5b (diff) | |
download | cpython-db2b6a20cd35781b2f5e798e880e57e6cf9b97aa.zip cpython-db2b6a20cd35781b2f5e798e880e57e6cf9b97aa.tar.gz cpython-db2b6a20cd35781b2f5e798e880e57e6cf9b97aa.tar.bz2 |
bpo-45445: Fail if an invalid X-option is provided in the command line (GH-28823)
Diffstat (limited to 'Programs')
-rw-r--r-- | Programs/_testembed.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c index 7628e1a..fa418e2 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -211,7 +211,7 @@ static int test_pre_initialization_sys_options(void) * relying on the caller to keep the passed in strings alive. */ const wchar_t *static_warnoption = L"once"; - const wchar_t *static_xoption = L"also_not_an_option=2"; + const wchar_t *static_xoption = L"utf8=1"; size_t warnoption_len = wcslen(static_warnoption); size_t xoption_len = wcslen(static_xoption); wchar_t *dynamic_once_warnoption = \ @@ -230,7 +230,7 @@ static int test_pre_initialization_sys_options(void) PySys_AddWarnOption(L"module"); PySys_AddWarnOption(L"default"); _Py_EMBED_PREINIT_CHECK("Checking PySys_AddXOption\n"); - PySys_AddXOption(L"not_an_option=1"); + PySys_AddXOption(L"dev=2"); PySys_AddXOption(dynamic_xoption); /* Delete the dynamic options early */ @@ -548,7 +548,7 @@ static int test_init_from_config(void) L"-W", L"cmdline_warnoption", L"-X", - L"cmdline_xoption", + L"dev", L"-c", L"pass", L"arg2", @@ -556,10 +556,9 @@ static int test_init_from_config(void) config_set_argv(&config, Py_ARRAY_LENGTH(argv), argv); config.parse_argv = 1; - wchar_t* xoptions[3] = { - L"config_xoption1=3", - L"config_xoption2=", - L"config_xoption3", + wchar_t* xoptions[2] = { + L"dev=3", + L"utf8", }; config_set_wide_string_list(&config, &config.xoptions, Py_ARRAY_LENGTH(xoptions), xoptions); @@ -1375,7 +1374,6 @@ fail: static int test_init_sys_add(void) { - PySys_AddXOption(L"sysadd_xoption"); PySys_AddXOption(L"faulthandler"); PySys_AddWarnOption(L"ignore:::sysadd_warnoption"); @@ -1387,14 +1385,14 @@ static int test_init_sys_add(void) L"-W", L"ignore:::cmdline_warnoption", L"-X", - L"cmdline_xoption", + L"utf8", }; config_set_argv(&config, Py_ARRAY_LENGTH(argv), argv); config.parse_argv = 1; PyStatus status; status = PyWideStringList_Append(&config.xoptions, - L"config_xoption"); + L"dev"); if (PyStatus_Exception(status)) { goto fail; } |