Message11109

Author stefan.richthofer
Recipients stefan.richthofer
Date 2017-02-22.03:50:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487735444.67.0.379421409003.issue2553@psf.upfronthosting.co.za>
In-reply-to
Content
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\pathlib.py", 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 (https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx), 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.
History
Date User Action Args
2017-02-22 03:50:44stefan.richthofersetrecipients: + stefan.richthofer
2017-02-22 03:50:44stefan.richthofersetmessageid: <1487735444.67.0.379421409003.issue2553@psf.upfronthosting.co.za>
2017-02-22 03:50:44stefan.richthoferlinkissue2553 messages
2017-02-22 03:50:43stefan.richthofercreate