summaryrefslogtreecommitdiffstats
path: root/Doc/library/sys.rst
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2010-01-27 00:28:29 (GMT)
committerEric Smith <eric@trueblade.com>2010-01-27 00:28:29 (GMT)
commitee931b7253fe332125dad0b7ba1681bdebb0a575 (patch)
tree554ff3645e00dd0d7dcb90992eefd3fcc8d2ab26 /Doc/library/sys.rst
parent92e68af56a2b95627c2220c3e190d7e3c2d4643e (diff)
downloadcpython-ee931b7253fe332125dad0b7ba1681bdebb0a575.zip
cpython-ee931b7253fe332125dad0b7ba1681bdebb0a575.tar.gz
cpython-ee931b7253fe332125dad0b7ba1681bdebb0a575.tar.bz2
Issue #7766: Change sys.getwindowsversion() return value to a named tuple and add the additional members returned in an OSVERSIONINFOEX structure. The new members are service_pack_major, service_pack_minor, suite_mask, and product_type.
Diffstat (limited to 'Doc/library/sys.rst')
-rw-r--r--Doc/library/sys.rst35
1 files changed, 30 insertions, 5 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 5b07f36..94c2956 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -470,9 +470,15 @@ always available.
.. function:: getwindowsversion()
- Return a tuple containing five components, describing the Windows version
- currently running. The elements are *major*, *minor*, *build*, *platform*, and
- *text*. *text* contains a string while all other values are integers.
+ Return a named tuple containing describing the Windows version
+ currently running. The named elements are *major*, *minor*,
+ *build*, *platform*, *service_pack*, *service_pack_minor*,
+ *service_pack_major*, *suite_mask*, and *product_type*.
+ *service_pack* contains a string while all other values are
+ integers. The components can also be accessed by name, so
+ ``sys.getwindowsversion()[0]`` is equivalent to
+ ``sys.getwindowsversion().major``. For compatibility with prior
+ versions, only the first 5 elements are retrievable by indexing.
*platform* may be one of the following values:
@@ -488,12 +494,31 @@ always available.
| :const:`3 (VER_PLATFORM_WIN32_CE)` | Windows CE |
+-----------------------------------------+-------------------------+
- This function wraps the Win32 :cfunc:`GetVersionEx` function; see the Microsoft
- documentation for more information about these fields.
+ *product_type* may be one of the following values:
+
+ +---------------------------------------+---------------------------------+
+ | Constant | Meaning |
+ +=======================================+=================================+
+ | :const:`1 (VER_NT_WORKSTATION)` | The system is a workstation. |
+ +---------------------------------------+---------------------------------+
+ | :const:`2 (VER_NT_DOMAIN_CONTROLLER)` | The system is a domain |
+ | | controller. |
+ +---------------------------------------+---------------------------------+
+ | :const:`3 (VER_NT_SERVER)` | The system is a server, but not |
+ | | a domain controller. |
+ +---------------------------------------+---------------------------------+
+
+
+ This function wraps the Win32 :cfunc:`GetVersionEx` function; see the
+ Microsoft documentation on :cfunc:`OSVERSIONINFOEX` for more information
+ about these fields.
Availability: Windows.
.. versionadded:: 2.3
+ .. versionchanged:: 2.7
+ Changed to a named tuple and added *service_pack_minor*,
+ *service_pack_major*, *suite_mask*, and *product_type*.
.. data:: hexversion