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 60c94b77a9
commit cf86cbf6d0
No known key found for this signature in database
GPG Key ID: BB36BF6584A298FF

View File

@ -203,6 +203,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)