Remove the sys.version_info shortcut, since they cause the APIs
to return different information than the _sys_version() output
used in previous Python versions.
This also fixes issue5561: platform.python_version_tuple returns tuple of ints, should be strings
Added more tests for the various platform functions.
diff --git a/Lib/platform.py b/Lib/platform.py
index 906d918..35cf8bd 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -1278,10 +1278,10 @@
def _sys_version(sys_version=None):
""" Returns a parsed version of Python's sys.version as tuple
- (name, version, branch, revision, buildno, builddate, compiler)
- referring to the Python implementation name, version, branch,
- revision, build number, build date/time as string and the compiler
- identification string.
+ (name, version, branch, revision, buildno, builddate, compiler)
+ referring to the Python implementation name, version, branch,
+ revision, build number, build date/time as string and the compiler
+ identification string.
Note that unlike the Python sys.version, the returned value
for the Python version will always include the patchlevel (it
@@ -1383,8 +1383,6 @@
will always include the patchlevel (it defaults to 0).
"""
- if hasattr(sys, 'version_info'):
- return '%i.%i.%i' % sys.version_info[:3]
return _sys_version()[1]
def python_version_tuple():
@@ -1396,8 +1394,6 @@
will always include the patchlevel (it defaults to 0).
"""
- if hasattr(sys, 'version_info'):
- return sys.version_info[:3]
return tuple(string.split(_sys_version()[1], '.'))
def python_branch():