You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 08:49:51 +08:00
Merge branch 'python-3.3-to-3.5' into python-3.0-to-3.2
This commit is contained in:
30
.github/workflows/osx.yml
vendored
30
.github/workflows/osx.yml
vendored
@@ -1,30 +0,0 @@
|
||||
name: uncompyle6 (osx)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ python-3.3-to-3.5 ]
|
||||
pull_request:
|
||||
branches: [ python-3.3-to-3.5 ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macOS]
|
||||
python-version: [3.5]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
# Until the next xdis release
|
||||
pip install git+https://github.com/rocky/python-xdis@python-3.3-to-3.5#egg=xdis
|
||||
pip install -e .
|
||||
pip install -r requirements-dev.txt
|
||||
- name: Test uncompyle6
|
||||
run: |
|
||||
make check
|
30
.github/workflows/ubuntu.yml
vendored
30
.github/workflows/ubuntu.yml
vendored
@@ -1,30 +0,0 @@
|
||||
name: uncompyle6 (ubuntu)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ python-3.3-to-3.5 ]
|
||||
pull_request:
|
||||
branches: [ python-3.3-to-3.5 ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.5]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
# Until the next xdis release
|
||||
pip install git+https://github.com/rocky/python-xdis@python-3.3-to-3.5#egg=xdis
|
||||
pip install -e .
|
||||
pip install -r requirements-dev.txt
|
||||
- name: Test uncompyle6
|
||||
run: |
|
||||
make check
|
30
.github/workflows/windows.yml
vendored
30
.github/workflows/windows.yml
vendored
@@ -1,30 +0,0 @@
|
||||
name: uncompyle6 (windows)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ python-3.3-to-3.5 ]
|
||||
pull_request:
|
||||
branches: [ python-3.3-to-3.5 ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows]
|
||||
python-version: [3.5]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
# Until the next xdis release
|
||||
pip install git+https://github.com/rocky/python-xdis@python-3.3-to-3.5#egg=xdis
|
||||
pip install -e .
|
||||
pip install -r requirements-dev.txt
|
||||
- name: Test uncompyle6
|
||||
run: |
|
||||
make check
|
24
NEWS.md
24
NEWS.md
@@ -1,4 +1,26 @@
|
||||
3.8.0: 2020-10-29
|
||||
3.9.0: 2022-12-22
|
||||
=================
|
||||
|
||||
* deparse generator expressions for Python 3.0 .. 3.2
|
||||
* Python 3.0 list comprehension.
|
||||
* Fix Issues #310, #344, #377, #391, #409, #414
|
||||
* Limited support for 3.8+ f-string "=" specifier
|
||||
* Correct 2.5-7 relative import formatting
|
||||
* Miscellaneous bug fixing
|
||||
* remove \n in lambda
|
||||
* Python 2.6 gramar cleanup
|
||||
* Correct some Python 2.6 chain compare decompilation
|
||||
* Ensure no parenthesis subscript slices
|
||||
* Correct 2.x formatting "slice2" nonterminal
|
||||
* Correct 3.7 imports
|
||||
* Improve "async for" parsing
|
||||
* Handle BUILD_MAP opcode
|
||||
* match Python AT better
|
||||
* Correct 3.7 positional args
|
||||
* PyPy 3.7 and PyPy 3.8 support
|
||||
* Miscellaneous linting, isorting, blacking
|
||||
|
||||
3.8.0: 2021-10-29
|
||||
=================
|
||||
|
||||
* Better handling of invalid bytecode magic
|
||||
|
27
admin-tools/check-3.3-3.5-versions.sh
Executable file
27
admin-tools/check-3.3-3.5-versions.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
function finish {
|
||||
cd $owd
|
||||
}
|
||||
owd=$(pwd)
|
||||
trap finish EXIT
|
||||
|
||||
cd $(dirname ${BASH_SOURCE[0]})
|
||||
if ! source ./pyenv-3.3-3.5-versions ; then
|
||||
exit $?
|
||||
fi
|
||||
if ! source ./setup-python-3.3.sh ; then
|
||||
exit $?
|
||||
fi
|
||||
|
||||
cd ..
|
||||
for version in $PYVERSIONS; do
|
||||
echo --- $version ---
|
||||
if ! pyenv local $version ; then
|
||||
exit $?
|
||||
fi
|
||||
make clean && python setup.py develop
|
||||
if ! make check ; then
|
||||
exit $?
|
||||
fi
|
||||
echo === $version ===
|
||||
done
|
@@ -5,4 +5,4 @@ if [[ $0 == ${BASH_SOURCE[0]} ]] ; then
|
||||
echo "This script should be *sourced* rather than run directly through bash"
|
||||
exit 1
|
||||
fi
|
||||
export PYVERSIONS='3.6.15 pypy3.6-7.3.1 3.7.14 pypy3.8-7.3.9 pyston-2.3.3 3.8.14'
|
||||
export PYVERSIONS='3.6.15 pypy3.6-7.3.1 3.7.16 pypy3.7-7.3.9 pypy3.8-7.3.10 pyston-2.3.5 3.8.16'
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
PYTHON_VERSION=3.7.14
|
||||
PYTHON_VERSION=3.7.16
|
||||
|
||||
function checkout_version {
|
||||
local repo=$1
|
||||
|
@@ -7,5 +7,5 @@ PYTHON ?= python
|
||||
test check pytest:
|
||||
@PYTHON_VERSION=`$(PYTHON) -V 2>&1 | cut -d ' ' -f 2 | cut -d'.' -f1,2`; \
|
||||
if [[ $$PYTHON_VERSION > 3.2 ]] || [[ $$PYTHON_VERSION == 2.7 ]] || [[ $$PYTHON_VERSION == 2.6 ]]; then \
|
||||
py.test; \
|
||||
$(PYTHON) -m pytest .; \
|
||||
fi
|
||||
|
@@ -6,4 +6,4 @@ pytest
|
||||
Click~=7.0
|
||||
xdis>=6.0.4
|
||||
configobj~=5.0.6
|
||||
setuptools~=65.3.0
|
||||
setuptools~=65.5.1
|
||||
|
BIN
test/bytecode_3.3_run/02_make_closure.pyc
Normal file
BIN
test/bytecode_3.3_run/02_make_closure.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.4_run/02_make_closure.pyc
Normal file
BIN
test/bytecode_3.4_run/02_make_closure.pyc
Normal file
Binary file not shown.
18
test/simple_source/bug34/02_make_closure.py
Normal file
18
test/simple_source/bug34/02_make_closure.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Related to #426
|
||||
|
||||
# This file is RUNNABLE!
|
||||
"""This program is self-checking!"""
|
||||
|
||||
a = 5
|
||||
class MakeClosureTest():
|
||||
# This function uses MAKE_CLOSURE with annotation args
|
||||
def __init__(self, dev: str, b: bool):
|
||||
super().__init__()
|
||||
self.dev = dev
|
||||
self.b = b
|
||||
self.a = a
|
||||
|
||||
x = MakeClosureTest("dev", True)
|
||||
assert x.dev == "dev"
|
||||
assert x.b == True
|
||||
assert x.a == 5
|
@@ -199,7 +199,7 @@ class PythonParser(GenericASTBuilder):
|
||||
if instructions[finish].linestart:
|
||||
break
|
||||
pass
|
||||
if start > 0:
|
||||
if start >= 0:
|
||||
err_token = instructions[index]
|
||||
print("Instruction context:")
|
||||
for i in range(start, finish):
|
||||
|
@@ -1178,7 +1178,9 @@ class Python3Parser(PythonParser):
|
||||
"pos_arg " * args_pos,
|
||||
opname,
|
||||
)
|
||||
elif self.version == (3, 3):
|
||||
self.add_unique_rule(rule, opname, token.attr, customize)
|
||||
|
||||
elif (3, 3) <= self.version < (3, 5):
|
||||
if annotate_args > 0:
|
||||
rule = (
|
||||
"mkfunc_annotate ::= %s%s%sannotate_tuple load_closure LOAD_CODE LOAD_STR %s"
|
||||
@@ -1195,8 +1197,10 @@ class Python3Parser(PythonParser):
|
||||
"pos_arg " * args_pos,
|
||||
opname,
|
||||
)
|
||||
self.add_unique_rule(rule, opname, token.attr, customize)
|
||||
|
||||
elif self.version >= (3, 4):
|
||||
|
||||
if self.version >= (3, 4):
|
||||
if not self.is_pypy:
|
||||
load_op = "LOAD_STR"
|
||||
else:
|
||||
@@ -1221,7 +1225,7 @@ class Python3Parser(PythonParser):
|
||||
opname,
|
||||
)
|
||||
|
||||
self.add_unique_rule(rule, opname, token.attr, customize)
|
||||
self.add_unique_rule(rule, opname, token.attr, customize)
|
||||
|
||||
if args_kw == 0:
|
||||
rule = "mkfunc ::= %sload_closure load_genexpr %s" % (
|
||||
|
@@ -624,10 +624,19 @@ class Scanner3(Scanner):
|
||||
pos_args, name_pair_args, annotate_args = parse_fn_counts(
|
||||
inst.argval
|
||||
)
|
||||
|
||||
correct_annotate_args = annotate_args
|
||||
if opname in ("MAKE_CLOSURE", "MAKE_FUNCTION") and ((3, 4) <= self.version < (3, 6)) and annotate_args > 0:
|
||||
# For some reason that I don't understand, annotate_args is off by one
|
||||
# when there is an EXENDED_ARG instruction from what is documented in
|
||||
# https://docs.python.org/3.4/library/dis.html#opcode-MAKE_CLOSURE
|
||||
# However in parsing rule, we have already adjusted for the one-fewer annotate arg
|
||||
correct_annotate_args -= 1
|
||||
|
||||
pattr = "%d positional, %d keyword only, %d annotated" % (
|
||||
pos_args,
|
||||
name_pair_args,
|
||||
annotate_args,
|
||||
correct_annotate_args,
|
||||
)
|
||||
if name_pair_args > 0:
|
||||
# FIXME: this should probably be K_
|
||||
|
@@ -14,4 +14,4 @@
|
||||
# This file is suitable for sourcing inside POSIX shell as
|
||||
# well as importing into Python
|
||||
# fmt: off
|
||||
__version__="3.9.0a1" # noqa
|
||||
__version__="3.9.1.dev0" # noqa
|
||||
|
Reference in New Issue
Block a user