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.

classification
Title: platform win32_ver produces incorrect value for release on Windows domain controllers
Type: behavior Stage:
Components: Windows Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: jvm3487, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2020-08-12 21:07 by jvm3487, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg375285 - (view) Author: John McCrone (jvm3487) Date: 2020-08-12 21:07
The method platform.win32_ver() produces the client version for the release rather than the server version on a Windows domain controller.

This is easy to recreate on 3.8.5. For example, on a Windows 2012 server running as a domain controller, the method produces the following:

>>> import platform
>>> platform.win32_ver()
('8', '6.2.9200', 'SP0', 'Multiprocessor Free')

The product type is 2:
>>> import sys
>>> sys.getwindowsversion().product_type
2

The correct value should not be '8' but rather '2012Server'. From looking at the source (platform.py), it appears that we determine if we are on a windows server by this check:

if getattr(winver, 'product_type', None) == 3

However, both types 2 (Domain Controller) and 3 (Non-Domain Controller Server) are server types (see the documentation for sys.getwindowsversion() https://docs.python.org/3/library/sys.html). Therefore, it seems likely to me that it should check if the value of product_type is either 2 or 3 instead of just 3.
History
Date User Action Args
2022-04-11 14:59:34adminsetgithub: 85707
2020-08-12 21:07:17jvm3487create