You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
3.3-3.4 pos kwargs ordering
This commit is contained in:
@@ -1064,12 +1064,18 @@ class Python3Parser(PythonParser):
|
||||
# Normally we remove EXTENDED_ARG from the opcodes, but in the case of
|
||||
# annotated functions can use the EXTENDED_ARG tuple to signal we have an annotated function.
|
||||
# Yes this is a little hacky
|
||||
if self.version < 3.5:
|
||||
# 3.3 and 3.4 put kwargs before pos_arg
|
||||
pos_kw_tuple = (('kwargs ' * args_kw), ('pos_arg ' * (args_pos)))
|
||||
else:
|
||||
# 3.5 puts pos_arg before kwargs
|
||||
pos_kw_tuple = (('pos_arg ' * (args_pos), ('kwargs ' * args_kw)))
|
||||
rule = ('mkfunc_annotate ::= %s%s%sannotate_tuple LOAD_CONST LOAD_CONST EXTENDED_ARG %s' %
|
||||
(('pos_arg ' * (args_pos), ('kwargs ' * args_kw),
|
||||
('call ' * (annotate_args-1)), opname)))
|
||||
( pos_kw_tuple[0], pos_kw_tuple[1],
|
||||
('call ' * (annotate_args-1)), opname))
|
||||
self.add_unique_rule(rule, opname, token.attr, customize)
|
||||
rule = ('mkfunc_annotate ::= %s%s%sannotate_tuple LOAD_CONST LOAD_CONST EXTENDED_ARG %s' %
|
||||
(('pos_arg ' * (args_pos)), ('kwargs ' * args_kw),
|
||||
( pos_kw_tuple[0], pos_kw_tuple[1],
|
||||
('annotate_arg ' * (annotate_args-1)), opname))
|
||||
else:
|
||||
# See above comment about use of EXTENDED_ARG
|
||||
|
Reference in New Issue
Block a user