Strings and integers are not comparable under Python 3

This commit is contained in:
Pedro Algarvio 2019-04-11 17:26:30 +01:00
parent d308dce3f5
commit 9fef3859cf
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF

View file

@ -204,6 +204,11 @@ def _check_ver(pyver, op, wanted):
'''
pyver = distutils.version.LooseVersion(pyver)
wanted = distutils.version.LooseVersion(wanted)
if IS_PY3:
if not isinstance(pyver, str):
pyver = str(pyver)
if not isinstance(wanted, str):
wanted = str(wanted)
return getattr(operator, '__{}__'.format(op))(pyver, wanted)