Skip to content

Commit 0428b7d

Browse files
committed
Handle also MS_WINDOWS_GAMES use case
1 parent ce0d374 commit 0428b7d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Python/sysmodule.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,7 @@ static PyStructSequence_Field windows_version_fields[] = {
16331633
{"suite_mask", "Bit mask identifying available product suites"},
16341634
{"product_type", "System product type"},
16351635
{"platform_version", "Diagnostic version number"},
1636-
{"device_family", "Desktop or UWP"},
1636+
{"device_family", "'Desktop', 'Xbox' or 'UWP'"},
16371637
{0}
16381638
};
16391639

@@ -1755,12 +1755,11 @@ sys_getwindowsversion_impl(PyObject *module)
17551755
SET_VERSION_INFO(PyLong_FromLong(ver.wSuiteMask));
17561756
SET_VERSION_INFO(PyLong_FromLong(ver.wProductType));
17571757

1758-
#ifdef MS_WINDOWS_DESKTOP
1758+
#if defined(MS_WINDOWS_DESKTOP)
17591759
// GetVersion will lie if we are running in a compatibility mode.
17601760
// We need to read the version info from a system file resource
17611761
// to accurately identify the OS version. If we fail for any reason,
17621762
// just return whatever GetVersion said.
1763-
// UWP return correct version from GetVersionExW, this is not necessary.
17641763
PyObject *realVersion = _sys_getwindowsversion_from_kernel32();
17651764
if (!realVersion) {
17661765
if (!PyErr_ExceptionMatches(PyExc_WindowsError)) {
@@ -1777,6 +1776,9 @@ sys_getwindowsversion_impl(PyObject *module)
17771776

17781777
SET_VERSION_INFO(realVersion);
17791778
SET_VERSION_INFO(PyUnicode_FromString("Desktop"));
1779+
#elif defined (MS_WINDOWS_GAMES)
1780+
SET_VERSION_INFO(Py_BuildValue("(kkk)", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber));
1781+
SET_VERSION_INFO(PyUnicode_FromString("Xbox"));
17801782
#else
17811783
SET_VERSION_INFO(Py_BuildValue("(kkk)", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber));
17821784
SET_VERSION_INFO(PyUnicode_FromString("UWP"));

0 commit comments

Comments
 (0)