This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steve.dower
Recipients Orbital, bugale bugale, corona10, paul.moore, steve.dower, tim.golden, zach.ware
Date 2021-03-02.23:14:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <abcf82aa-f13e-2531-44f9-36e689173872@python.org>
In-reply-to <1614725087.33.0.391255557263.issue43284@roundup.psfhosted.org>
Content
The reason to avoid the GetVersion API is that certain automatic 
compatibility modes will lie about what the version number is, and 
people complained that it was wrong (kind of like this complaint ;) ). 
Reading the version from a system DLL bypasses that risk.

If your aim is to check the version for API compatibility/behaviour, 
then GetVersion is exactly the right thing to use, because it'll be 
adapted to match any compatibility options that are in effect. However, 
the platform module is not for this purpose, but is for logging system 
information. So we read from kernel32.dll instead (which is, yes, a 
bootleg way of doing it).

Node.js has some fairly horrible ways of doing this stuff on Windows. I 
haven't looked into this one in particular, but if they're not using 
GetVersion it wouldn't surprise me if they're running "cmd /C ver" and 
reading the output (don't even get me started on the security risks of 
that).

The most correct way is to query the system information service via WMI 
(which I'm 99% sure is what msinfo32.exe does). However, that's a _big_ 
step up in complexity, which is why we've avoided doing it to date. It 
might be the only viable option here if Windows is getting this good at 
shipping incremental rebuilds.
History
Date User Action Args
2021-03-02 23:14:30steve.dowersetrecipients: + steve.dower, paul.moore, tim.golden, zach.ware, corona10, bugale bugale, Orbital
2021-03-02 23:14:30steve.dowerlinkissue43284 messages
2021-03-02 23:14:30steve.dowercreate