Unverified Kaydet (Commit) ea68d839 authored tarafından Victor Stinner's avatar Victor Stinner Kaydeden (comit) GitHub

bpo-34170: _PyCoreConfig_Read() defaults to argc=0 (GH-8595)

Add unit tests for argc and argv of _PyCoreConfig.
üst 98512273
......@@ -272,6 +272,8 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
'pycache_prefix': '(null)',
'program_name': './_testembed',
'argc': 0,
'argv': '[]',
'program': '(null)',
'isolated': 0,
......
......@@ -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();
}
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment