New submission from Larry Hastings <[email protected]>:
The documentation for platform.python_version_tuple() says:
"Returns the Python version as tuple (major, minor, patchlevel) of strings."
In 2.4 and 2.5 it correctly returned a tuple of strings. In 2.6 it
returns a tuple of ints.
In 2.4 and 2.5 the implementation was this:
return string.split(_sys_version()[0], '.')
In 2.6 it changed to this:
if hasattr(sys, 'version_info'):
return sys.version_info[:3]
return tuple(string.split(_sys_version()[1], '.'))
The fields used from sys.version_info are ints, and always have been. I
am mystified as to why the "if hasattr" lines were added; they broke it,
and it's not like that's superior information somehow.
I suggest modernizing it slightly when you fix the bug; use the .split()
method on strings. Like so:
return tuple(_sys_version()[1].split('.'))
----------
components: Library (Lib)
messages: 84161
nosy: Larry Hastings
severity: normal
status: open
title: platform.python_version_tuple returns tuple of ints, should be strings
versions: Python 2.6
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue5561>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com