diff --git a/Makefile b/Makefile index 9a0dd4cc..e31bf001 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,10 @@ RM ?= rm LINT = flake8 #EXTRA_DIST=ipython/ipy_trepan.py trepan -PHONY=all check clean distcheck pytest check-long dist distclean lint flake8 test rmChangeLog clean_pyc +PHONY=all check check-2.7 check-3.4 \ + clean distcheck pytest check-long check-short \ + dist distclean lint flake8 test rmChangeLog clean_pyc \ + 2.6 5.0 5.3 5.6 5.8 7.2 7.3 check-short TEST_TYPES=check-long check-short check-2.7 check-3.4 @@ -51,8 +54,8 @@ check-3.8: 7.1 pypy-3.2 2.4: $(MAKE) -C test $@ -#:PyPy pypy3-2.4.0 Python 3.6.9: -7.2: +#:PyPy versions +7.2 7.3: $(MAKE) -C test $@ #: Run py.test tests diff --git a/test/add-test.py b/test/add-test.py index ca886d0f..71b9c710 100755 --- a/test/add-test.py +++ b/test/add-test.py @@ -2,6 +2,7 @@ """ Trivial helper program to bytecompile and run an uncompile """ import os, sys, py_compile +from xdis.version_info import version_tuple_to_str, PYTHON_VERSION_TRIPLE assert (2 <= len(sys.argv) <= 4) version = sys.version[0:3] @@ -23,14 +24,17 @@ except: for path in py_source: short = os.path.basename(path) if hasattr(sys, "pypy_version_info"): - cfile = "bytecode_pypy%s%s/%s" % (version, suffix, short) + "c" + version = version_tuple_to_str(end=2, delimiter="") + bytecode = "bytecode_pypy%s%s/%spy%s.pyc" % (version, suffix, short, version) else: - cfile = "bytecode_%s%s/%s" % (version, suffix, short) + "c" - print("byte-compiling %s to %s" % (path, cfile)) - optimize = optimize + version = version_tuple_to_str(end=2) + bytecode = "bytecode_%s%s/%s.pyc" % (version, suffix, short) + + print("byte-compiling %s to %s" % (path, bytecode)) + py_compile.compile(path, bytecode, optimize=optimize) if vers > (3, 1): - py_compile.compile(path, cfile, optimize=optimize) + py_compile.compile(path, bytecode, optimize=optimize) else: - py_compile.compile(path, cfile) - if vers >= (2, 6): - os.system("../bin/uncompyle6 -a -T %s" % cfile) + py_compile.compile(path, bytecode) + if PYTHON_VERSION_TRIPLE >= (2, 6): + os.system("../bin/uncompyle6 -a -t %s" % bytecode) diff --git a/test/bytecode_pypy3.7_run/01_callback.pyc b/test/bytecode_pypy37_run/01_callback.pypy37.pyc similarity index 91% rename from test/bytecode_pypy3.7_run/01_callback.pyc rename to test/bytecode_pypy37_run/01_callback.pypy37.pyc index 399a3c68..f6770e22 100644 Binary files a/test/bytecode_pypy3.7_run/01_callback.pyc and b/test/bytecode_pypy37_run/01_callback.pypy37.pyc differ diff --git a/test/bytecode_pypy38_run/01_callback.pypy38.pyc b/test/bytecode_pypy38_run/01_callback.pypy38.pyc new file mode 100644 index 00000000..4fa1f038 Binary files /dev/null and b/test/bytecode_pypy38_run/01_callback.pypy38.pyc differ diff --git a/test/test_pythonlib.py b/test/test_pythonlib.py index d9e23fdc..cbef614f 100755 --- a/test/test_pythonlib.py +++ b/test/test_pythonlib.py @@ -116,10 +116,12 @@ for vers in ( pythonlib = os.path.join(pythonlib, "__pycache__") test_options[key] = (os.path.join(lib_prefix, pythonlib), PYOC, pythonlib, vers) -vers = 3.7 -bytecode = "bytecode_pypy%s_run" % vers -key = "bytecode-pypy37" -test_options[key] = (bytecode, PYC, bytecode, vers) +for vers, vers_dot in ((37, 3.7), (38, 3.8)): + bytecode = "bytecode_pypy%s_run" % vers + key = "bytecode-pypy%s" % vers + test_options[key] = (bytecode, PYC, bytecode, vers_dot) + key = "bytecode-pypy%s" % vers_dot + test_options[key] = (bytecode, PYC, bytecode, vers_dot) # ----- diff --git a/uncompyle6/scanner.py b/uncompyle6/scanner.py index a19c49e3..bcaea77d 100644 --- a/uncompyle6/scanner.py +++ b/uncompyle6/scanner.py @@ -580,7 +580,7 @@ def get_scanner(version, is_pypy=False, show_asm=None): if __name__ == "__main__": - import inspect, uncompyle6 + import inspect co = inspect.currentframe().f_code # scanner = get_scanner('2.7.13', True)