classification
Title: distutils.LooseVersion fails to compare two valid versions
Type: behavior Stage:
Components: Distutils Versions: Python 3.2, Python 3.3, Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: distutils.LooseVersion fails to compare number and a word
View: 14894
Assigned To: Nosy List: dstufft, eric.araujo, maethor, vstinner
Priority: normal Keywords:

Created on 2015-01-29 14:42 by maethor, last changed 2015-01-30 21:15 by eric.araujo. This issue is now closed.

Messages (4)
msg234975 - (view) Author: Guillaume (maethor) Date: 2015-01-29 14:42
$ python2.7 -c "from distutils.version import LooseVersion as V; print V('3.16.0-0.bpo.4-amd64') > V('3.16-0.bpo.2-amd64')"
False
$ python3.4 -c "from distutils.version import LooseVersion as V; print(V('3.16.0-0.bpo.4-amd64') > V('3.16-0.bpo.2-amd64'))" 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.4/distutils/version.py", line 70, in __gt__
    c = self._cmp(other)
  File "/usr/lib/python3.4/distutils/version.py", line 343, in _cmp
    if self.version < other.version:
TypeError: unorderable types: int() < str()

Same thing with python3.2 et python3.3.

I find this on Debian. They recently change the numerotation of backported kernels.
msg235039 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2015-01-30 16:06
Thanks for the report.  I think there’s already a long discussion in another ticket but don’t have time to search right now.
msg235043 - (view) Author: Guillaume (maethor) Date: 2015-01-30 17:27
Do you mean http://bugs.python.org/issue14894 ?
msg235054 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2015-01-30 21:15
Yes, thanks. Please weigh in on the other ticket.
History
Date User Action Args
2015-01-30 21:15:48eric.araujosetstatus: open -> closed
superseder: distutils.LooseVersion fails to compare number and a word
messages: + msg235054
2015-01-30 17:27:24maethorsetmessages: + msg235043
2015-01-30 16:06:32eric.araujosetresolution: duplicate
messages: + msg235039
2015-01-29 15:02:04vstinnersetnosy: + vstinner
2015-01-29 14:42:00maethorcreate