[New-bugs-announce] [issue30272] distutils.version.LooseVersion's compare raises exception in corner-case

Oliver Smith report at bugs.python.org
Thu May 4 15:54:49 EDT 2017


New submission from Oliver Smith:

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.

----------
messages: 293009
nosy: ollieparanoid2
priority: normal
severity: normal
status: open
title: distutils.version.LooseVersion's compare raises exception in corner-case
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30272>
_______________________________________


More information about the New-bugs-announce mailing list