]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-91256: Ensure help text has the program name even before getpath is called (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 19 Jul 2022 19:03:15 +0000 (12:03 -0700)
committerGitHub <noreply@github.com>
Tue, 19 Jul 2022 19:03:15 +0000 (12:03 -0700)
(cherry picked from commit 49aeff49d71fa4bd935212340410311f13879447)

Co-authored-by: Steve Dower <steve.dower@python.org>
Misc/NEWS.d/next/Core and Builtins/2022-07-17-15-54-29.gh-issue-91256.z7i7Q5.rst [new file with mode: 0644]
Python/initconfig.c

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 (file)
index 0000000..802a614
--- /dev/null
@@ -0,0 +1 @@
+Ensures the program name is known for help text during interpreter startup.
index 86dcdd9a8bd6bb0c06dab832b24a4a595f004531..d31385039932bca628c51e22c6b8a4c020268bc9 100644 (file)
@@ -2295,6 +2295,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 {