[Python-checkins] cpython (2.7): Handle calls to win32_ver from non-Windows platform

steve.dower python-checkins at python.org
Wed Sep 23 02:36:55 CEST 2015


https://hg.python.org/cpython/rev/c9db70693f7c
changeset:   98190:c9db70693f7c
branch:      2.7
parent:      98181:d8453733cc0c
user:        Steve Dower <steve.dower at microsoft.com>
date:        Tue Sep 22 17:35:24 2015 -0700
summary:
  Handle calls to win32_ver from non-Windows platform

files:
  Lib/platform.py |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Lib/platform.py b/Lib/platform.py
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -622,7 +622,10 @@
     return maj, min, build
 
 def win32_ver(release='', version='', csd='', ptype=''):
-    from sys import getwindowsversion
+    try:
+        from sys import getwindowsversion
+    except ImportError:
+        return release, version, csd, ptype
     try:
         from winreg import OpenKeyEx, QueryValueEx, CloseKey, HKEY_LOCAL_MACHINE
     except ImportError:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list