Skip to content

platform.release() and sys returns wrong version on Windows 11 #91025

Closed

Description

@Evernow
mannequin
BPO 46869
Nosy @pfmoore, @tjguk, @zware, @eryksun, @zooba, @Evernow
Superseder
  • bpo-45382: platform() is not able to detect windows 11
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-02-27.07:29:28.659>
    created_at = <Date 2022-02-27.00:09:37.836>
    labels = ['type-bug', '3.10', 'OS-windows']
    title = 'platform.release() and sys returns wrong version on Windows 11'
    updated_at = <Date 2022-02-27.07:29:28.655>
    user = 'https://github.com/Evernow'

    bugs.python.org fields:

    activity = <Date 2022-02-27.07:29:28.655>
    actor = 'eryksun'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-02-27.07:29:28.659>
    closer = 'eryksun'
    components = ['Windows']
    creation = <Date 2022-02-27.00:09:37.836>
    creator = 'Evernow'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46869
    keywords = []
    message_count = 2.0
    messages = ['414129', '414143']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'eryksun', 'steve.dower', 'Evernow']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '45382'
    type = 'behavior'
    url = 'https://bugs.python.org/issue46869'
    versions = ['Python 3.10']

    Activity

    1. Evernow commented on Feb 27, 2022

      Evernowmannequin
      MannequinAuthor

      Hello.

      On Windows 11 the platform module returns Windows 10 instead of Windows 11, same for the sys module.

      Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)] on win32
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import platform
      >>> platform.release()
      '10'
      >>> import sys
      >>> sys.getwindowsversion().platform_version
      (10, 0, 22000)
    2. eryksun commented on Feb 27, 2022

      @eryksun
      Contributor

      platform.release() returns platform.uname().release, which comes from platform.win32_ver() in Windows [1]. The issue with Windows 11 is being discussed in bpo-45382, but no PR has been submitted yet to resolve the issue.

      >>> sys.getwindowsversion().platform_version
      (10, 0, 22000)

      This result is correct [2], but you should use platform.version() instead. The major.minor version of Windows 11 is 10.0. The build number for Windows 11 is 22000 and above. The latest build number for Windows 10, in contrast, is 19044.

      The system version number concerns API compatibility, not user-interface updates or marketing names. Windows XP, XP Professional x64 Edition, Vista, 7, 8, and 8.1 correspond respectively to Windows system versions 5.1, 5.2, 6.0, 6.1, 6.2, and 6.3. System versions 7.x, 8.x, and 9.x were skipped. Version 10.0 is the first system version with two client workstation releases, Windows 10 and Windows 11. It's thus the first time that the build number is required to differentiate the release name.

      The platform_version attribute of the sys.getwindowsversion() result is supposed to be the true OS version in case the API is using a compatibility-mode version. It's based on the product version of the system file "kernel32.dll". However, it turns out that this is also not reliably the true OS version. The sys documentation was updated with a note that suggests using the platform module instead [3].

      ---

      [1] https://docs.python.org/3/library/platform.html#platform.win32_ver
      [2] https://en.wikipedia.org/wiki/Windows_11_version_history#Version_history
      [3] https://docs.python.org/3/library/sys.html#sys.getwindowsversion

    3. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions