Title: sys.getwindowsversion not implemented (breaks pathlib on Windows)
Type: behaviour Severity: normal
Components: Versions: Jython 2.7
Milestone: Jython 2.7.1
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: stefan.richthofer Nosy List: stefan.richthofer
Priority: normal Keywords:

Created on 2017-02-22.03:50:44 by stefan.richthofer, last changed 2017-03-28.05:27:20 by zyasoft.

msg11109 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-02-22.03:50:43
Jython 2.7.1b3
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121
Type "help", "copyright", "credits" or "license" for more information.
>>> import pathlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\workspace\linux\Jython\installer_test\2.7.1\Lib\site-packages\", line 36, in <module>
    if sys.getwindowsversion()[:2] >= (6, 0) and sys.version_info >= (3, 2):
AttributeError: '<reflected field public org.python.core.PyObject o' object has no attribute 'getwindowsversion'
>>> exit()

Tested on Windows 10 using Java 8 + current Jython trunk version.
I think it is feasible with minor effort to implement a rudimentary fake-variant of getwindowsversion (leaving out the servicepack entry).

Looking into CPython source, it turns out getwindowsversion is backed by the Windows library function GetVersionEx.
According to GetVersionEx doc (, GetVersionEx is somewhat deprecated and reports version 6.2 even for Windows > 6.2.
We could do an actual call to GetVersionEx via JNR, but I would rather just fake it based on what I already did in os.uname and platform.uname implementation. Should be sufficient for most use-cases, in particular also for pathlib.
msg11121 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-02-24.10:55:22
Fixed as of
Date User Action Args
2017-03-28 05:27:20zyasoftsetstatus: pending -> closed
2017-02-24 10:55:23stefan.richthofersetstatus: open -> pending
versions: + Jython 2.7
resolution: fixed
messages: + msg11121
milestone: Jython 2.7.1
type: behaviour
2017-02-22 03:50:44stefan.richthofercreate