classification
Title: distutils.version.LooseVersion's compare raises exception in corner-case
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: distutils.LooseVersion fails to compare number and a word
View: 14894
Assigned To: Nosy List: berker.peksag, dstufft, eric.araujo, ollieparanoid2
Priority: normal Keywords:

Created on 2017-05-04 19:54 by ollieparanoid2, last changed 2017-05-05 18:26 by berker.peksag. This issue is now closed.

Messages (2)
msg293009 - (view) Author: Oliver Smith (ollieparanoid2) Date: 2017-05-04 19:54
This should return True and not raise an exception:

>>> from distutils.version import LooseVersion
>>> LooseVersion("22.7-r1") < LooseVersion("22.7.3-r1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/distutils/version.py", line 52, in __lt__
    c = self._cmp(other)
  File "/usr/lib/python3.6/distutils/version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
>>>

Tested with Python 3.6.1.
msg293133 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-05-05 18:26
Thanks for the report. This is a duplicate of issue 14894.
History
Date User Action Args
2017-05-05 18:26:05berker.peksagsetstatus: open -> closed

superseder: distutils.LooseVersion fails to compare number and a word

nosy: + berker.peksag
messages: + msg293133
resolution: duplicate
stage: resolved
2017-05-04 19:55:25ollieparanoid2setnosy: + eric.araujo, dstufft
type: behavior
components: + Distutils
2017-05-04 19:54:49ollieparanoid2create