From 31de0d2af56608a969bcbdc77f8783b30a5f7863 Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 26 Feb 2018 07:44:37 -0500 Subject: [PATCH] 3.6 keyword args bugs in CALL_FUNCTION_KW --- test/bytecode_3.6/05_call_function_kw2.pyc | Bin 0 -> 271 bytes test/simple_source/bug36/05_call_function_kw2.py | 4 ++++ uncompyle6/semantics/customize.py | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 test/bytecode_3.6/05_call_function_kw2.pyc create mode 100644 test/simple_source/bug36/05_call_function_kw2.py 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 0000000000000000000000000000000000000000..d125ea709a34152f957d9358681e9467cf03a237 GIT binary patch literal 271 zcmXr!<>d-xm=d*xfq~&M5W@j8kmUfx#e6^_g*k;Wg{g%xiXnv|m_d`pFPRA_3IZUS z1&E!27_790A&Vh}u?DETmkFqp*)K$sDT+BYFZ~vKa(-S(YDI}A<1P01_~MeH_;^jG zTP($?IcY_VK0^JDor;w(>E}UPfpCqiBBudOD@UG z&x_A4H_|Jpyv19R9}hGfWL#!mI>^z*V5cz_u>skdjDDIB7T9Pcf)yxxi^C>2KczG$ L)efu=D8c{$b~!ow literal 0 HcmV?d00001 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(')')