Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/test/test_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):

'pycache_prefix': None,
'program_name': './_testembed',
'argv': [],
'argv': [""],
'program': None,

'xoptions': [],
Expand Down
7 changes: 7 additions & 0 deletions Python/coreconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,13 @@ _PyCoreConfig_Read(_PyCoreConfig *config, const _PyPreConfig *preconfig)
return err;
}

if (config->argv.length < 1) {
/* Ensure at least one (empty) argument is seen */
if (_PyWstrList_Append(&config->argv, L"") < 0) {
return _Py_INIT_NO_MEMORY();
}
}

assert(config->preconfig.use_environment >= 0);
assert(config->filesystem_encoding != NULL);
assert(config->filesystem_errors != NULL);
Expand Down