Title: win32_ver raises exception (breaks test_platform 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-03-03.13:27:27 by stefan.richthofer, last changed 2017-03-28.05:28:48 by zyasoft.

msg11164 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-03-03.13:27:26
Jython 2.7.1rc1 (, Mär 3 2017, 13:27:02)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.win32_ver()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\workspace\linux\Jython\ssh\jython\dist\Lib\", line 600, in win32_ver
    import _winreg
ImportError: No module named _winreg

This is 'caused' by the fix for #2553. However win32_ver also wasn't workable before that. Only difference was that it didn't raise an exception but returned empty strings instead.
Looking at what CPython says, win32_ver would return:

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.win32_ver()
('10', '10.0.14393', '', u'Multiprocessor Free')

We can easily emulate the first two values. Only the build-type would be hairy to get. It's only reachable via API command, or rather invonveniently via systeminfo cmd-call (hardly possible to parse, because line-captions are localized). So I' suggest to just fill in the first two entries - better than exception or all strings empty.

In long term we might be able to improve this using JNR or by supporting the win32api extension.
msg11169 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-03-03.17:51:31
Fixed as of
Date User Action Args
2017-03-28 05:28:48zyasoftsetstatus: pending -> closed
2017-03-03 17:51:49stefan.richthofersetstatus: open -> pending
2017-03-03 17:51:32stefan.richthofersettitle: win32_ver raises exception -> win32_ver raises exception (breaks test_platform on windows)
resolution: fixed
messages: + msg11169
assignee: stefan.richthofer
milestone: Jython 2.7.1
type: security -> behaviour
2017-03-03 13:27:46stefan.richthofersetpriority: normal
type: security
versions: + Jython 2.7
2017-03-03 13:27:27stefan.richthofercreate