You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
3.4-3.5 MAKE_CLOSURE with annotate
Docs lie about annnotation args. Slight adjustment here. More is probably needed.
This commit is contained in:
@@ -199,7 +199,7 @@ class PythonParser(GenericASTBuilder):
|
|||||||
if instructions[finish].linestart:
|
if instructions[finish].linestart:
|
||||||
break
|
break
|
||||||
pass
|
pass
|
||||||
if start > 0:
|
if start >= 0:
|
||||||
err_token = instructions[index]
|
err_token = instructions[index]
|
||||||
print("Instruction context:")
|
print("Instruction context:")
|
||||||
for i in range(start, finish):
|
for i in range(start, finish):
|
||||||
|
@@ -626,10 +626,19 @@ class Scanner3(Scanner):
|
|||||||
pos_args, name_pair_args, annotate_args = parse_fn_counts(
|
pos_args, name_pair_args, annotate_args = parse_fn_counts(
|
||||||
inst.argval
|
inst.argval
|
||||||
)
|
)
|
||||||
|
|
||||||
|
correct_annotate_args = annotate_args
|
||||||
|
if opname == "MAKE_CLOSURE" 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
|
||||||
|
# here 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" % (
|
pattr = "%d positional, %d keyword only, %d annotated" % (
|
||||||
pos_args,
|
pos_args,
|
||||||
name_pair_args,
|
name_pair_args,
|
||||||
annotate_args,
|
correct_annotate_args,
|
||||||
)
|
)
|
||||||
if name_pair_args > 0:
|
if name_pair_args > 0:
|
||||||
# FIXME: this should probably be K_
|
# FIXME: this should probably be K_
|
||||||
|
Reference in New Issue
Block a user