From 2e017b86e2f18a6c8a842293b1687f2ce7baa12e Mon Sep 17 00:00:00 2001 From: Piotr Dabkowski Date: Sun, 6 Nov 2022 10:56:37 +0100 Subject: [PATCH] remove template and opname not supported in old python version --- .github/workflows/tests.yml | 4 +--- js2py/utils/injector.py | 7 ++----- setup.py | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 53a13871..0656399b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,14 +11,12 @@ jobs: # disabled windows due node packages issues # os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest] - python-version: [ '2.x', '3.x', '3.5', '3.6', '3.7', '3.8', '3.9', 'pypy-2.7', 'pypy-3.6', 'pypy-3.7' ] + python-version: [ '2.x', '3.x', '3.5', '3.6', '3.7', '3.8', '3.9', 'pypy-2.7', 'pypy-3.6'] exclude: - os: windows-latest python-version: '3.5' - os: macos-latest python-version: 'pypy-3.6' - - os: macos-latest - python-version: 'pypy-3.7' name: ${{ matrix.os }} ${{ matrix.arch }}, Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v2 diff --git a/js2py/utils/injector.py b/js2py/utils/injector.py index 48fe145e..88e0d93e 100644 --- a/js2py/utils/injector.py +++ b/js2py/utils/injector.py @@ -83,7 +83,7 @@ def append_arguments(code_obj, new_locals): modified = [] drop_future_cache = False for inst in instructions(code_obj): - if inst.opname == "CACHE": + if is_new_bytecode and inst.opname == "CACHE": assert inst.arg == 0 if not drop_future_cache: modified.extend(write_instruction(inst.opcode, inst.arg)) @@ -252,9 +252,6 @@ def check(code_obj): 'Your python version made changes to the bytecode') -def pi(ins): - return(f"{ins.opname} {ins.arg} {ins.argval}") - def signature(func): @@ -282,7 +279,7 @@ def compare_func(fake_func, gt_func): else: real = real_ins[pos] fake = e - print(f"POS {pos} OFFSET: {offset} FAKE VS REAL") + print("POS %d OFFSET: %d FAKE VS REAL" % (pos, offset)) print(fake) print(real) assert fake.opcode == real.opcode diff --git a/setup.py b/setup.py index 7cb39fff..b496e614 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ # twine upload dist/* setup( name='Js2Py', - version='0.72', + version='0.74', packages=['js2py', 'js2py.utils', 'js2py.prototypes', 'js2py.translators', 'js2py.constructors', 'js2py.host', 'js2py.es6', 'js2py.internals',