diff --git a/test/bytecode_3.6/05_call_function_kw2.pyc b/test/bytecode_3.6/05_call_function_kw2.pyc new file mode 100644 index 00000000..d125ea70 Binary files /dev/null and b/test/bytecode_3.6/05_call_function_kw2.pyc differ diff --git a/test/simple_source/bug36/05_call_function_kw2.py b/test/simple_source/bug36/05_call_function_kw2.py new file mode 100644 index 00000000..d2bc6e43 --- /dev/null +++ b/test/simple_source/bug36/05_call_function_kw2.py @@ -0,0 +1,4 @@ +# From 3.6 _pydecimal. Bug was handling +# keyword args in the return (CALL_FUNCTION_KW_2) +def to_eng_string(self, context=None): + return self.__str__(eng=True, context=context) diff --git a/uncompyle6/semantics/customize.py b/uncompyle6/semantics/customize.py index e53d9063..aa7634d9 100644 --- a/uncompyle6/semantics/customize.py +++ b/uncompyle6/semantics/customize.py @@ -575,7 +575,8 @@ def customize_for_version(self, is_pypy, version): num_kwargs = len(keys) num_posargs = len(node) - (num_kwargs + 1) n = len(node) - assert n >= len(keys)+2 + assert n >= len(keys)+1, \ + 'not enough parameters keyword-tuple values' sep = '' # FIXME: adjust output for line breaks? for i in range(num_posargs): @@ -590,6 +591,7 @@ def customize_for_version(self, is_pypy, version): self.write(sep) self.write(keys[j] + '=') self.preorder(node[i]) + sep=', ' i += 1 j += 1 self.write(')')