New submission from ynyyn <[email protected]>:
I, for interest, read some of source code of Python launcher, and found it used
string comparison function (`wcscmp()`, in function `compare_pythons()`) to
sort Python version in descending order.
It works well currently. But if Python 3.10 or Python 3.xx comes up in the
future, Python 3.xx will be ranked after 3.x.
I modified the Registry and made a fake version Python 3.10, to check the
launcher's behaviour.
```
PS > py -0p
Installed Pythons found by C:\Windows\py.exe Launcher for Windows
-3.8-64 D:\Program Files\Python38\python.exe *
-3.7-64 D:\Program Files\Python37\python.exe
-3.7-32 D:\Program Files (x86)\Python37-32\python.exe
-3.6-32 C:\Program Files (x86)\Python36-32\python.exe
-3.10-64 D:\Program Files\Python37\python.exe
-2.7-64 C:\python27-x64\python.exe
```
The result turned out that Python 3.10 was really ranked after 3.x.
And it seems that Python 3.xx should be a valid (or supported) version
according to the comment from function `validate_version()`.
```
static BOOL
validate_version(wchar_t * p)
{
/*
Version information should start with the major version,
Optionally followed by a period and a minor version,
Optionally followed by a minus and one of 32 or 64.
Valid examples:
...
2.7-32
The intent is to add to the valid patterns:
3.10
3-32
...
*/
I am not sure whether this is a potential defect that had been confirmed
before... But I do not see some relevant comments in the source code.
----------
components: Windows
messages: 354843
nosy: paul.moore, steve.dower, tim.golden, ynyyn, zach.ware
priority: normal
severity: normal
status: open
title: Launcher for Windows (py.exe) may rank Python 3.xx (in the future) after
3.x
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38506>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com