[issue19143] Finding the Windows version getting messier (detect windows 8.1?)

Steve Dower report at bugs.python.org
Wed Dec 31 19:59:06 CET 2014


Steve Dower added the comment:

I've attached a replacement for the win32_ver function in platform.py that will get the actual version number from kernel32.dll's resources. Originally I was just writing a helper function, but it seemed easy enough to replace the entire function.

The attached function only really supports Python 3.5 as it assumes that the earliest Windows version will be Vista (6.0). The comments in platform.py suggest backwards compatibility is important for this file, so my win32_ver() may be a better reference for someone who wants to add this functionality in a backwards-compatible way. Though if it's okay for the stdlib platform.py to not support pre-3.5 this should be fine (and I'll do the extra work to make sure).

It's probably also easy to support 3.4 and Windows XP/WS2K3 as well, but I don't have any machines handy to test it.

As part of my patch for #23018, I'll add the manifest required so that GetVersionEx() will recognise 8.1 and 10.

----------
versions: +Python 3.5 -Python 3.3
Added file: http://bugs.python.org/file37578/win32_ver.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19143>
_______________________________________


More information about the Python-bugs-list mailing list