[ python-Bugs-945665 ] platform.system() Windows inconsistency

SourceForge.net noreply at sourceforge.net
Fri Jun 18 19:57:52 EDT 2004


Bugs item #945665, was opened at 2004-04-30 16:19
Message generated for change (Settings changed) made by bcannon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=945665&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Guido van Rossum (gvanrossum)
>Assigned to: M.-A. Lemburg (lemburg)
Summary: platform.system() Windows inconsistency

Initial Comment:
On Windows, platform.system() (and platform.uname()
[0]) return 'Windows' or 'Microsoft Windows' depending 
on whether win32api is available or not. This is 
confusing and can lead to hard-to-find bugs where 
testing in one environment doesn't reveal a bug that 
only occurs in another environment.

I believe this hasn't been fixed in Python 2.4 yet  (only 
the XP recognition has been fixed, it is also broken in 
2.3 when win32api was available).

----------------------------------------------------------------------

Comment By: Paul Moore (pmoore)
Date: 2004-06-05 09:30

Message:
Logged In: YES 
user_id=113328

Looks OK to me. Not sure where you found docs which specify
the behaviour, but I'm OK with "Windows".

There's a very small risk of compatibility issues, but as
the module was new in 2.3, and the behaviour was
inconsistent before, I see no reason why this should be an
issue.

I'd recommend committing this.

----------------------------------------------------------------------

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-06-05 07:38

Message:
Logged In: YES 
user_id=469548

New patch, the docs say we should use 'Windows' instead of
'Microsoft Windows', so we do:

Index: platform.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v
retrieving revision 1.13
diff -u -r1.13 platform.py
--- platform.py	4 May 2004 18:18:59 -0000	1.13
+++ platform.py	5 Jun 2004 13:39:10 -0000
@@ -957,6 +957,8 @@
         # platforms
         if use_syscmd_ver:
             system,release,version = _syscmd_ver(system)
+            if string.find(system, 'Microsoft Windows') != -1:
+                system = 'Windows'
 
         # In case we still don't know anything useful,
we'll try to
         # help ourselves

----------------------------------------------------------------------

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-06-05 07:07

Message:
Logged In: YES 
user_id=469548

Yep, _syscmd_ver() returns 'Microsoft Windows' while the
default is 'Windows'. Setting the default to Microsoft
Windows seems the easiest way here (putting patch inline
because I can't attach it):

Index: platform.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v
retrieving revision 1.13
diff -u -r1.13 platform.py
--- platform.py	4 May 2004 18:18:59 -0000	1.13
+++ platform.py	5 Jun 2004 13:07:45 -0000
@@ -966,7 +966,7 @@
                     version = '32bit'
                 else:
                     version = '16bit'
-            system = 'Windows'
+            system = 'Microsoft Windows'
 
         elif system[:4] == 'java':
             release,vendor,vminfo,osinfo = java_ver()

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=945665&group_id=5470



More information about the Python-bugs-list mailing list