[Python-checkins] bpo-34062: Add missing launcher argument and make behavior consistent between short and long arguments (GH-8827)

Miss Islington (bot) webhook-mailer at python.org
Fri Aug 31 11:32:27 EDT 2018


https://github.com/python/cpython/commit/5df3658f2db1585607d41c25093a2a7d2a4de347
commit: 5df3658f2db1585607d41c25093a2a7d2a4de347
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-08-31T11:32:22-04:00
summary:

bpo-34062: Add missing launcher argument and make behavior consistent between short and long arguments (GH-8827)


Added previously missing "--list" argument.
Made "--list" and "--list-paths" behavior consistent with the corresponding "-0" and "-0p" arguments.
(cherry picked from commit aada63b20ec64bbfc4f2fb0718fc563eedbdd36a)

Co-authored-by: Brendan Gerrity <brerrity at gmail.com>

files:
A Misc/NEWS.d/next/Windows/2018-08-21-19-28-23.bpo-34062.3gxsA3.rst
M PC/launcher.c

diff --git a/Misc/NEWS.d/next/Windows/2018-08-21-19-28-23.bpo-34062.3gxsA3.rst b/Misc/NEWS.d/next/Windows/2018-08-21-19-28-23.bpo-34062.3gxsA3.rst
new file mode 100644
index 000000000000..ca71945d8797
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2018-08-21-19-28-23.bpo-34062.3gxsA3.rst
@@ -0,0 +1 @@
+Fixed the '--list' and '--list-paths' arguments for the py.exe launcher
diff --git a/PC/launcher.c b/PC/launcher.c
index 417dca7cf032..4a61975b3ccf 100644
--- a/PC/launcher.c
+++ b/PC/launcher.c
@@ -1465,7 +1465,6 @@ process(int argc, wchar_t ** argv)
     wchar_t * p;
     int rc = 0;
     size_t plen;
-    size_t slen;
     INSTALLED_PYTHON * ip;
     BOOL valid;
     DWORD size, attrs;
@@ -1601,10 +1600,11 @@ process(int argc, wchar_t ** argv)
     else {
         p = argv[1];
         plen = wcslen(p);
-        if (argc == 2) {
-            slen = wcslen(L"-0");
-            if(!wcsncmp(p, L"-0", slen)) /* Starts with -0 */
-                valid = show_python_list(argv); /* Check for -0 FIRST */
+        if ((argc == 2) && 
+            (!wcsncmp(p, L"-0", wcslen(L"-0")) || /* Starts with -0 or --list */
+            !wcsncmp(p, L"--list", wcslen(L"--list"))))
+        {
+            valid = show_python_list(argv); /* Check for -0 or --list FIRST */
         }
         valid = valid && (*p == L'-') && validate_version(&p[1]);
         if (valid) {
@@ -1637,10 +1637,13 @@ installed, use -0 for available pythons", &p[1]);
     if (!valid) {
         if ((argc == 2) && (!_wcsicmp(p, L"-h") || !_wcsicmp(p, L"--help")))
             show_help_text(argv);
-        if ((argc == 2) && (!_wcsicmp(p, L"-0") || !_wcsicmp(p, L"-0p")))
-            executable = NULL; /* Info call only */
-        else
+        if ((argc == 2) &&
+            (!_wcsicmp(p, L"-0") || !_wcsicmp(p, L"--list") ||
+            !_wcsicmp(p, L"-0p") || !_wcsicmp(p, L"--list-paths")))
         {
+            executable = NULL; /* Info call only */
+        }
+        else {
             /* Look for an active virtualenv */
             executable = find_python_by_venv();
 



More information about the Python-checkins mailing list