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

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


https://hg.python.org/cpython/rev/a8dc0b6e2b63
changeset:   98187:a8dc0b6e2b63
branch:      3.4
parent:      98184:2f57270374f7
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
@@ -546,7 +546,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