This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Update platform.win32_ver() to account for change to #8413
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: brian.curtin Nosy List: benjamin.peterson, brian.curtin, eric.smith, lemburg
Priority: high Keywords: needs review, patch

Created on 2010-07-08 14:52 by brian.curtin, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg109546 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-07-08 14:52
The change to #8413 broke the use of sys.getwindowsversion() in platform.platform() calls on Windows, which subsequently breaks all runs of regrtest (e.g. buildbots) since it outputs platform info at the start.

Now that structseq subclasses tuple, every field of sys.getwindowsversion() is returned, rather than only the specific ones inserted into the structseq (for backwards compatibility). Since platform.py needs to maintain backwards compatibility with older versions, the change will need to handle both the new and old way.
msg109548 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-07-08 15:05
The following little patch could do the trick.


--- platform.py	(revision 82643)
+++ platform.py	(working copy)
@@ -606,7 +606,9 @@
 
     # Find out the registry key and some general version infos
     winver = GetVersionEx()
-    maj,min,buildno,plat,csd = winver
+    # If sys.getwindowsversion in 3.2 gets used, it contains extra fields
+    # which don't get used. Always use slicing in order to stay compatible.
+    maj,min,buildno,plat,csd = winver[:5]
     version = '%i.%i.%i' % (maj,min,buildno & 0xFFFF)
     if hasattr(winver, "service_pack"):
         if winver.service_pack != "":
msg109566 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2010-07-08 18:45
Surely we don't want to find every place that uses structseq and fix them. This will no doubt break user code as well.

I think we'll need to fix structseq to somehow have its old behavior.
msg109581 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-07-08 19:45
Agreed. This started out as a knee-jerk reaction to regrtest not working, but the problem is deeper.

Closing this. The structseq stuff is being dealt with elsewhere.
History
Date User Action Args
2022-04-11 14:57:03adminsetgithub: 53448
2010-07-08 19:45:26brian.curtinsetstatus: open -> closed
resolution: rejected
messages: + msg109581

stage: needs patch -> resolved
2010-07-08 18:45:45eric.smithsetnosy: + eric.smith
messages: + msg109566
2010-07-08 15:05:00brian.curtinsetkeywords: + patch, needs review
messages: + msg109548
components: + Library (Lib), - None
nosy: lemburg, benjamin.peterson, brian.curtin
2010-07-08 14:52:51brian.curtincreate