summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2022-07-19 18:39:11 (GMT)
committerGitHub <noreply@github.com>2022-07-19 18:39:11 (GMT)
commit49aeff49d71fa4bd935212340410311f13879447 (patch)
treef69091d84944f8754d68ea91f4237cf1139e1a42
parentea11c1774274aa9f4d6eee863d37632aa79a0ace (diff)
downloadcpython-49aeff49d71fa4bd935212340410311f13879447.zip
cpython-49aeff49d71fa4bd935212340410311f13879447.tar.gz
cpython-49aeff49d71fa4bd935212340410311f13879447.tar.bz2
gh-91256: Ensure help text has the program name even before getpath is called (GH-94929)
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2022-07-17-15-54-29.gh-issue-91256.z7i7Q5.rst1
-rw-r--r--Python/initconfig.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-07-17-15-54-29.gh-issue-91256.z7i7Q5.rst b/Misc/NEWS.d/next/Core and Builtins/2022-07-17-15-54-29.gh-issue-91256.z7i7Q5.rst
new file mode 100644
index 0000000..802a614
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2022-07-17-15-54-29.gh-issue-91256.z7i7Q5.rst
@@ -0,0 +1 @@
+Ensures the program name is known for help text during interpreter startup.
diff --git a/Python/initconfig.c b/Python/initconfig.c
index 355f986..d29c693 100644
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -2310,6 +2310,9 @@ config_parse_cmdline(PyConfig *config, PyWideStringList *warnoptions,
const PyWideStringList *argv = &config->argv;
int print_version = 0;
const wchar_t* program = config->program_name;
+ if (!program && argv->length >= 1) {
+ program = argv->items[0];
+ }
_PyOS_ResetGetOpt();
do {