From 0a5fcc51d8d028c62cbf3fe199b4d277a60b19dd Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 29 Oct 2019 11:43:09 -0400 Subject: [PATCH] Pypy 3.6 fixes and tests --- test/Makefile | 2 +- test/bytecode_3.2/11_classbug.pyc | Bin 658 -> 658 bytes test/bytecode_3.7/04_class_kwargs.pyc | Bin 1747 -> 1747 bytes test/bytecode_pypy3.6/04_class_kwargs.pyc | Bin 0 -> 2388 bytes uncompyle6/semantics/fragments.py | 87 ++++++++++++++++++---- uncompyle6/semantics/pysource.py | 4 +- 6 files changed, 73 insertions(+), 20 deletions(-) create mode 100644 test/bytecode_pypy3.6/04_class_kwargs.pyc diff --git a/test/Makefile b/test/Makefile index c8024f7f..155a28bb 100644 --- a/test/Makefile +++ b/test/Makefile @@ -100,7 +100,7 @@ check-bytecode-3: --bytecode-3.1 --bytecode-3.2 --bytecode-3.3 \ --bytecode-3.4 --bytecode-3.5 --bytecode-3.6 \ --bytecode-3.7 --bytecode-3.8 \ - --bytecode-pypy3.2 + --bytecode-pypy3.2 --bytecode-pypy3.6 #: Check deparsing on selected bytecode 3.x check-bytecode-3-short: diff --git a/test/bytecode_3.2/11_classbug.pyc b/test/bytecode_3.2/11_classbug.pyc index 239bf2fc8d45a3aecabf1b85aab85e00ae647f47..342ee09b3d56c8bbd379bac16d7e803753883c16 100644 GIT binary patch delta 16 XcmbQlI*FA%hliJ|Yk|>5_HHHsBwhq& delta 16 XcmbQlI*FA%hliKzshZ(N_HHHsBl-kJ diff --git a/test/bytecode_3.7/04_class_kwargs.pyc b/test/bytecode_3.7/04_class_kwargs.pyc index 1c095ac61c3515858027ba261cd124bd9c551a77..3cbcb72ead0f0c34f8ac57dc48fc900bef34365d 100644 GIT binary patch delta 20 acmcc2dzqKpiI|4FyL4 diff --git a/test/bytecode_pypy3.6/04_class_kwargs.pyc b/test/bytecode_pypy3.6/04_class_kwargs.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0a42c9e930ec2639ff6c70f84b5cc4fc51915852 GIT binary patch literal 2388 zcmcIl%}>-o6rX9kP!{kzek6Xxi>4eF644VO>Y5N^+yjtcnwX~B8J0qK3p1^Nk<*e8 zZyY>$^uO?L(0|A7-S=L%i@2axu}Np9otZbk_j~XC<`bK&e*E^?ePu8fupb@^#*g9E zHE0AAJYsI%bC)kLVF+`d2~+ZQqiedRuta5_xt8Ed%ozz`4{HP*J9w}M`}F85&`IWU z!CfP_0=pUPvKrYnm|K=QdGfTr5+-ZUJ7KbvHiO95dSJ|iHRJHs;nlOy02nR|1k*M4 z5E?-dBky>^*0~rJwipvtF)k(!&91d)&|#Cu(VGz3o_SXm1-l@Ir9G(|sRmb5R`lk)E$D%0Py1q^_fDFSdQvI&u)1!WW&? z=b%Ygmwn-1fkuMP8;+4xa5CMLD!T|H@Ax^M2P@E}Akx_g^c!@7!?Q73OoYNBmfnMJ z9kw?k>FGFCft+rptp|^$XJ);8QNFXbxvS8gjms&LyeD9M_AJzfU8!Vvtmk$7w)DKL zN+0c5qyXB>Cg^i3^`m^AaAuSAH%}ZHMc^y%?S$CUa5u!vrQzEUv$oBh%CUZmjJg4){xv)bagn+pTQ;ZfLFVBYxFzy`5YkdH?D3v+_M$QWf#q!59%SIPHUyb7nXs@q?ctidNOl4jm@VaOijs z>%Q%mr*pD)@dj|~vhG67LV`eg5WfoWWVdPYDs3= 3.6 and node[0] == "LOAD_CONST": + return + value = self.traverse(node[0]) + self.write("(") + self.write(value) + pass self.write(")") self.set_pos_info(node, start, len(self.f.getvalue())) diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 19e4f37c..4bc8ba8a 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -1566,8 +1566,6 @@ class SourceWalker(GenericASTTraversal, object): assert node[n].kind.startswith("CALL_FUNCTION") if node[n].kind.startswith("CALL_FUNCTION_KW"): - # 3.6+ starts doing this - kwargs = node[n - 1].attr if self.is_pypy: # FIXME: this doesn't handle positional and keyword args # properly. Need to do something more like that below @@ -1575,7 +1573,7 @@ class SourceWalker(GenericASTTraversal, object): self.template_engine(('(%[0]{attr}=%c)', 1), node[n-1]) return else: - kwargs = node[n-1].attr + kwargs = node[n - 1].attr assert isinstance(kwargs, tuple) i = n - (len(kwargs) + 1)