Skip to content

Commit aada63b

Browse files
bgerrityzooba
authored andcommitted
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.
1 parent 757b73c commit aada63b

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed the '--list' and '--list-paths' arguments for the py.exe launcher

PC/launcher.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,6 @@ process(int argc, wchar_t ** argv)
14661466
wchar_t * p;
14671467
int rc = 0;
14681468
size_t plen;
1469-
size_t slen;
14701469
INSTALLED_PYTHON * ip;
14711470
BOOL valid;
14721471
DWORD size, attrs;
@@ -1602,10 +1601,11 @@ process(int argc, wchar_t ** argv)
16021601
else {
16031602
p = argv[1];
16041603
plen = wcslen(p);
1605-
if (argc == 2) {
1606-
slen = wcslen(L"-0");
1607-
if(!wcsncmp(p, L"-0", slen)) /* Starts with -0 */
1608-
valid = show_python_list(argv); /* Check for -0 FIRST */
1604+
if ((argc == 2) &&
1605+
(!wcsncmp(p, L"-0", wcslen(L"-0")) || /* Starts with -0 or --list */
1606+
!wcsncmp(p, L"--list", wcslen(L"--list"))))
1607+
{
1608+
valid = show_python_list(argv); /* Check for -0 or --list FIRST */
16091609
}
16101610
valid = valid && (*p == L'-') && validate_version(&p[1]);
16111611
if (valid) {
@@ -1638,10 +1638,13 @@ installed, use -0 for available pythons", &p[1]);
16381638
if (!valid) {
16391639
if ((argc == 2) && (!_wcsicmp(p, L"-h") || !_wcsicmp(p, L"--help")))
16401640
show_help_text(argv);
1641-
if ((argc == 2) && (!_wcsicmp(p, L"-0") || !_wcsicmp(p, L"-0p")))
1642-
executable = NULL; /* Info call only */
1643-
else
1641+
if ((argc == 2) &&
1642+
(!_wcsicmp(p, L"-0") || !_wcsicmp(p, L"--list") ||
1643+
!_wcsicmp(p, L"-0p") || !_wcsicmp(p, L"--list-paths")))
16441644
{
1645+
executable = NULL; /* Info call only */
1646+
}
1647+
else {
16451648
/* Look for an active virtualenv */
16461649
executable = find_python_by_venv();
16471650

0 commit comments

Comments
 (0)