diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-05-16 15:02:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-16 15:02:56 (GMT) |
commit | ae239f6b0626e926613a4a1dbafa323bd41fec32 (patch) | |
tree | c811687161a90a5a03dc29b83774b5f9688579d7 /Programs | |
parent | 68b34a720485f399e8699235b8f4e08f227dd43b (diff) | |
download | cpython-ae239f6b0626e926613a4a1dbafa323bd41fec32.zip cpython-ae239f6b0626e926613a4a1dbafa323bd41fec32.tar.gz cpython-ae239f6b0626e926613a4a1dbafa323bd41fec32.tar.bz2 |
bpo-36763: Add _PyCoreConfig.parse_argv (GH-13361)
* _PyCoreConfig_Read() doesn't parse nor update argv
if parse_argv is 0.
* Move path configuration fields in _PyCoreConfig.
* Add an unit test for parse_argv=0.
* Remove unused "done": label in _Py_RunMain().
Diffstat (limited to 'Programs')
-rw-r--r-- | Programs/_testembed.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c index 2560bfc..6eee2e8 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -511,6 +511,37 @@ static int test_init_from_config(void) } +static int test_init_dont_parse_argv(void) +{ + _PyInitError err; + + _PyCoreConfig config = _PyCoreConfig_INIT; + + static wchar_t* argv[] = { + L"-v", + L"-c", + L"arg1", + L"-W", + L"arg2", + }; + + config.program = L"program"; + config.program_name = L"./_testembed"; + + config.argv.length = Py_ARRAY_LENGTH(argv); + config.argv.items = argv; + config.parse_argv = 0; + + err = _Py_InitializeFromConfig(&config); + if (_Py_INIT_FAILED(err)) { + _Py_ExitInitError(err); + } + dump_config(); + Py_Finalize(); + return 0; +} + + static void test_init_env_putenvs(void) { putenv("PYTHONHASHSEED=42"); @@ -797,6 +828,7 @@ static struct TestCase TestCases[] = { { "init_default_config", test_init_default_config }, { "init_global_config", test_init_global_config }, { "init_from_config", test_init_from_config }, + { "init_dont_parse_argv", test_init_dont_parse_argv }, { "init_env", test_init_env }, { "init_env_dev_mode", test_init_env_dev_mode }, { "init_env_dev_mode_alloc", test_init_env_dev_mode_alloc }, |