diff --git a/test/bytecode_3.5/04_CALL_FUNCTION_VAR_KW.pyc b/test/bytecode_3.5/04_CALL_FUNCTION_VAR_KW.pyc new file mode 100644 index 00000000..b9d565a1 Binary files /dev/null and b/test/bytecode_3.5/04_CALL_FUNCTION_VAR_KW.pyc differ diff --git a/test/simple_source/bug35/04_CALL_FUNCTION_VAR_KW.py b/test/simple_source/bug35/04_CALL_FUNCTION_VAR_KW.py new file mode 100644 index 00000000..5def28e7 --- /dev/null +++ b/test/simple_source/bug35/04_CALL_FUNCTION_VAR_KW.py @@ -0,0 +1,7 @@ +# sql/schema.py +def tometadata(self, metadata, schema, Table, args, name=None): + table = Table( + name, metadata, schema=schema, + *args, **self.kwargs + ) + return table diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 4b274e01..bb0471b7 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -483,6 +483,8 @@ class Python3Parser(PythonParser): # high byte number of positional parameters args_pos = token.attr & 0xff args_kw = (token.attr >> 8) & 0xff + args_kw = (token.attr >> 8) & 0xff + # args_ann = (token.attr >> 16) & 0x7FFF # Additional exprs for * and ** args: # 0 if neither @@ -498,7 +500,7 @@ class Python3Parser(PythonParser): # first LOAD_FAST, below are located. # Python 3.6+ replaces CALL_FUNCTION_VAR_KW with CALL_FUNCTION_EX if opname.endswith('KW'): - kw = 'LOAD_FAST ' + kw = 'expr ' else: kw = '' rule = ('call_function ::= expr expr ' +