Steve Dower <steve.do...@python.org> added the comment:
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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43284> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com