Message197515
I have a more realistic example of this bug. In the docstring for distutils.LooseVersion, it says '1.5.1' and '3.2.p10' are both valid version numbers. If instead of '3.2.p10', we use '1.5.p10', the following occurs -
>>> v1 = LooseVersion('1.5.1')
>>> v2 = LooseVersion('1.5.p10')
>>> v1>v2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python33\Lib\distutils\version.py", line 70, in __gt__
c = self._cmp(other)
File "C:\Python33\Lib\distutils\version.py", line 343, in _cmp
if self.version < other.version:
TypeError: unorderable types: int() < str()
>>> v1.version
[1, 5, 1]
>>> v2.version
[1, 5, 'p', 10]
The reason it occurs is pretty clear when the .version list is printed. (That's also explains why I had to use 1.5.p10 instead because otherwise the comparison would not proceed past the first element of both lists.)
In my real-life example, I'm trying to compare '1.1.0-3' and '1.1.0-beta-10'.
>>> v3=LooseVersion(ll[0])
>>> v4=LooseVersion(ll[1])
>>> v3>v4
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python33\Lib\distutils\version.py", line 70, in __gt__
c = self._cmp(other)
File "C:\Python33\Lib\distutils\version.py", line 343, in _cmp
if self.version < other.version:
TypeError: unorderable types: int() < str()
>>> v3.version
[1, 1, 0, '-', 3]
>>> v4.version
[1, 1, 0, '-', 'beta', '-', 10] |
|
Date |
User |
Action |
Args |
2013-09-12 07:30:51 | samuel.lai | set | recipients:
+ samuel.lai, barry, pitrou, tarek, eric.araujo, Arfrever, piotr, Natalia, DLitz |
2013-09-12 07:30:51 | samuel.lai | set | messageid: <1378971051.52.0.771088489892.issue14894@psf.upfronthosting.co.za> |
2013-09-12 07:30:51 | samuel.lai | link | issue14894 messages |
2013-09-12 07:30:51 | samuel.lai | create | |
|