diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 79622f15945..25593bdf420 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -272,6 +272,8 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): 'pycache_prefix': '(null)', 'program_name': './_testembed', + 'argc': 0, + 'argv': '[]', 'program': '(null)', 'isolated': 0, diff --git a/Modules/main.c b/Modules/main.c index aef821fe93c..664a70ad5eb 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -2294,6 +2294,9 @@ _PyCoreConfig_Read(_PyCoreConfig *config) if (config->_frozen < 0) { config->_frozen = 0; } + if (config->argc < 0) { + config->argc = 0; + } return _Py_INIT_OK(); } diff --git a/Programs/_testembed.c b/Programs/_testembed.c index 1cdc4c3648f..1c72580b9c6 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -335,7 +335,17 @@ dump_config(void) printf("pycache_prefix = %ls\n", config->pycache_prefix); printf("program_name = %ls\n", config->program_name); ASSERT_STR_EQUAL(config->program_name, Py_GetProgramName()); - /* FIXME: test argc/argv */ + + printf("argc = %i\n", config->argc); + printf("argv = ["); + for (int i=0; i < config->argc; i++) { + if (i) { + printf(", "); + } + printf("\"%ls\"", config->argv[i]); + } + printf("]\n"); + printf("program = %ls\n", config->program); /* FIXME: test xoptions */ /* FIXME: test warnoptions */