diff --git a/test/test_pythonlib.py b/test/test_pythonlib.py index cbef614f..6d06e1d2 100755 --- a/test/test_pythonlib.py +++ b/test/test_pythonlib.py @@ -29,11 +29,18 @@ Step 2: Run the test: from __future__ import print_function -import getopt, os, py_compile, sys, shutil, tempfile, time - +import getopt +import os +import py_compile +import shutil +import sys +import tempfile +import time from fnmatch import fnmatch + +from xdis.version_info import PYTHON_VERSION_TRIPLE + from uncompyle6.main import main -from xdis.version_info import PYTHON_VERSION def get_srcdir(): @@ -164,10 +171,10 @@ def do_tests(src_dir, obj_patterns, target_dir, opts): if opts["do_compile"]: compiled_version = opts["compiled_version"] - if compiled_version and PYTHON_VERSION != compiled_version: + if compiled_version and PYTHON_VERSION_TRIPLE != compiled_version: print( "Not compiling: desired Python version is %s but we are running %s" - % (compiled_version, PYTHON_VERSION), + % (compiled_version, PYTHON_VERSION_TRIPLE), file=sys.stderr, ) else: diff --git a/uncompyle6/util.py b/uncompyle6/util.py index 6f01995b..888ed368 100644 --- a/uncompyle6/util.py +++ b/uncompyle6/util.py @@ -3,7 +3,7 @@ # More could be done here though. from math import copysign -from xdis.version_info import PYTHON_VERSION +from xdis.version_info import PYTHON_VERSION_TRIPLE def is_negative_zero(n): @@ -36,7 +36,7 @@ def better_repr(v, version): if len(v) == 1: return "(%s,)" % better_repr(v[0], version) return "(%s)" % ", ".join(better_repr(i, version) for i in v) - elif PYTHON_VERSION < 3.0 and isinstance(v, long): + elif PYTHON_VERSION_TRIPLE < (3, 0) and isinstance(v, long): s = repr(v) if version >= 3.0 and s[-1] == "L": return s[:-1]