diff --git a/admin-tools/setup-master.sh b/admin-tools/setup-master.sh index f0d39adb..9e00863c 100755 --- a/admin-tools/setup-master.sh +++ b/admin-tools/setup-master.sh @@ -1,5 +1,5 @@ #!/bin/bash -PYTHON_VERSION=3.7.14 +PYTHON_VERSION=3.7.16 function checkout_version { local repo=$1 diff --git a/requirements.txt b/requirements.txt index 40a86898..fba9e512 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,4 @@ pytest Click~=7.0 xdis>=6.0.4 configobj~=5.0.6 -setuptools~=65.3.0 +setuptools~=65.5.1 diff --git a/uncompyle6/parser.py b/uncompyle6/parser.py index 016b22de..3ef8a5a0 100644 --- a/uncompyle6/parser.py +++ b/uncompyle6/parser.py @@ -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): diff --git a/uncompyle6/scanners/scanner3.py b/uncompyle6/scanners/scanner3.py index 399e0eb2..8d3b91a0 100644 --- a/uncompyle6/scanners/scanner3.py +++ b/uncompyle6/scanners/scanner3.py @@ -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_ diff --git a/uncompyle6/version.py b/uncompyle6/version.py index e6a3e3c7..03e22cc7 100644 --- a/uncompyle6/version.py +++ b/uncompyle6/version.py @@ -14,4 +14,4 @@ # This file is suitable for sourcing inside POSIX shell as # well as importing into Python # fmt: off -__version__="3.9.0" # noqa +__version__="3.9.1.dev0" # noqa