From 2c4acecc9d2286a925b3b17c912c1126defba285 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 23 Nov 2021 16:38:30 -0500 Subject: [PATCH] Start PyPy 3.8 support --- Makefile | 9 +++++--- test/add-test.py | 20 +++++++++++------- .../01_callback.pypy37.pyc} | Bin 748 -> 748 bytes .../01_callback.pypy38.pyc | Bin 0 -> 764 bytes test/test_pythonlib.py | 10 +++++---- uncompyle6/scanner.py | 2 +- 6 files changed, 25 insertions(+), 16 deletions(-) rename test/{bytecode_pypy3.7_run/01_callback.pyc => bytecode_pypy37_run/01_callback.pypy37.pyc} (91%) create mode 100644 test/bytecode_pypy38_run/01_callback.pypy38.pyc 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 399a3c68935ad409f6c35d700f737aa3f481c052..f6770e220b13cd2ca7d15d0c70cc5c063b5c99f6 100644 GIT binary patch delta 22 ccmaFE`i7PF0|PG?0}zPcpObiYBkz4C08qRKRsaA1 delta 22 ccmaFE`i7PF0|PG?0}!z8os)QJBkz4C08b+aCjbBd 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 0000000000000000000000000000000000000000..4fa1f03870fb149695b7504f77a8055705c52d3b GIT binary patch literal 764 zcmb7Cy-ve05I);!8-B`!#3LXtErT+oC-0p)Y8Rw$=!F~eV4~(a~JR&eSgGX3?QN4@2O*Ojpi=!aSs|aTcFK(7c|#m z0bOQb4qdJTT^sPOFnk#pq3ed}#!4{I;RDE>1hIb)`Fs<(Lv#$HXoeUSqR@afK~z#= zCkZyGbdg^}>!7&q6q-&^x)tTUxRe`pHHN-A}keUZW1yC&`X z2C1bsB@K#+sy~(>AwQ<|j@k~Pn@%B0RyOI#{ha4XyGC8x