[Python-ideas] Determine Windows version in platform module

Andrew Barnert abarnert at yahoo.com
Sat Dec 28 04:38:09 CET 2013


On Dec 27, 2013, at 13:09, Andrew Barnert <abarnert at yahoo.com> wrote:

> Meanwhile, Microsoft's suggested solution is that you not check for version numbers at runtime, but instead check for features. And there are good reasons for that--for example, XPSP3 N has exactly the same version numbers as XPSP3 normal, but if you try to use the new Windows Media APIs, you'll crash.

Also, in forgot to mention that there are features added to Windows versions discontinuously. For example, there are features that are in XPSP3 (5.1.2600) and 2003R2SP2 (5.2.3790) but not original 2003 (5.2.3376). So, a check for >= 5, 1, 2600 would give you the wrong information anyway.

And that's not even considering the fact that some kernels are used for multiple different Windows versions with different features (e.g., that 5.2.3790 is also the kernel for 64-bit XP). To make things even more fun, 2003SP2 originally had the same 3376 kernel as stock 2003, then got bumped to the same 3790 kernel as 2003R2SP2 in a non-service-pack update.

These aren't anomalies; this is the way Windows versioning works. The kernel build number is useless as an indication of anything but kernel features that Python code isn't going to care about; the major.minor can be useful in a few cases, but usually even that doesn't tell you as much as you probably expect.

Any change to make it easier to write misleadingly broken code is probably not a good change.


More information about the Python-ideas mailing list