[issue35129] Different behaviour comparing versions (distutils.version.LooseVersion) between python2.7 and python3.x

2018-11-01 Thread davide moro

davide moro  added the comment:

Thanks and sorry for the duplicate!

Il giorno gio 1 nov 2018 alle ore 00:53 Éric Araujo 
ha scritto:

>
> Éric Araujo  added the comment:
>
> Please discuss on #14894
>
> --
> resolution:  -> duplicate
> stage:  -> resolved
> status: open -> closed
> superseder:  -> distutils.LooseVersion fails to compare number and a word
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35129] Different behaviour comparing versions (distutils.version.LooseVersion) between python2.7 and python3.x

2018-10-31 Thread Éric Araujo

Éric Araujo  added the comment:

Please discuss on #14894

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> distutils.LooseVersion fails to compare number and a word

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35129] Different behaviour comparing versions (distutils.version.LooseVersion) between python2.7 and python3.x

2018-10-31 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

There is no need to split the relevant code into a third-party website, 
especially when it is so small and can be included in-line here.


Python 2.7:

py> import distutils.version
py> distutils.version.LooseVersion('7') > distutils.version.LooseVersion('XP')
False




Python 3.6:

py> import distutils.version
py> distutils.version.LooseVersion('7') > distutils.version.LooseVersion('XP')
Traceback (most recent call last):
  File "", line 1, in 
  File "/storage/python/Python-3.6.4/Lib/distutils/version.py", line 64, in 
__gt__
c = self._cmp(other)
  File "/storage/python/Python-3.6.4/Lib/distutils/version.py", line 337, in 
_cmp
if self.version < other.version:
TypeError: '<' not supported between instances of 'int' and 'str'



(By the way, you appear to have a bug in your sys.excepthook handler. At least 
I can't reproduce the ModuleNotFoundError you are getting.)

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35129] Different behaviour comparing versions (distutils.version.LooseVersion) between python2.7 and python3.x

2018-10-31 Thread davide moro


New submission from davide moro :

I noticed that with the python2.7 version of distutils.version.LooseVersion let 
you compare '7' with 'xp' without exceptions (e.g., LooseVersion('7') > 
LooseVersion('xp')).

If you do the same with python3.6 or python3.7, you'll get the following 
exception:

*  TypeError: '<' not supported between instances of 'int' and 'str'

You can see the full example with complete traceback and differences between 
python2.x and python3.x here:

* https://pastebin.com/kAwUTihe

Thanks,

davide

--
components: Distutils
messages: 329018
nosy: davide moro, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: Different behaviour comparing versions (distutils.version.LooseVersion) 
between python2.7 and python3.x
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com