From 79c38441b50b7a21da02149e6c9b71f784cd18e4 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 10 Dec 2019 10:39:43 -0500 Subject: [PATCH] Better "assert" transformation. More 3.8 tests --- test/bytecode_3.8/03_pop_top.pyc | Bin 0 -> 557 bytes test/bytecode_3.8_run/04_and_del.pyc | Bin 0 -> 787 bytes test/simple_source/bug30/04_and_del.py | 2 ++ uncompyle6/semantics/transform.py | 8 +++++--- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 test/bytecode_3.8/03_pop_top.pyc create mode 100644 test/bytecode_3.8_run/04_and_del.pyc diff --git a/test/bytecode_3.8/03_pop_top.pyc b/test/bytecode_3.8/03_pop_top.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5bd124b1842d5ef25e07a9ec656a2a5a5ae062af GIT binary patch literal 557 zcmZWmO;5rw7;d|PWQb7@8a&nL!5st=uEv;nGA6r#mzlVfwZP)O=sE=h7sH?NFYW4y zzu?KYGXlmZ>HFC}ef#vG(XbHU^5X2VNf7$f$uu8jv3(uP8e@bJ)x)<#7an+r-}|kHliw_eVGgG$LvMW zOfjjvSiE{_ECu6KvLF){1>B3-AYqcUY6w27wthl>UP?lu9qgMr;@al&WgSD%q6?lC#!-%hKZ|&G$C5) z)bVxr3mxlgN>R=sm=j6oAWaj^@iUSq3Zy+o3o?P)!k9oGWFpQ=D`{ibhyre#1!e`F z79>mxG7dI#OFczVAAmT%@FkgB&%IT O3C}}uT|Q9PYmILo#d@d! literal 0 HcmV?d00001 diff --git a/test/bytecode_3.8_run/04_and_del.pyc b/test/bytecode_3.8_run/04_and_del.pyc new file mode 100644 index 0000000000000000000000000000000000000000..35c02993290e4b978aecfc284d9d0b9a59fe3233 GIT binary patch literal 787 zcmYjPF^|(Q82vumP15#yDmTD!0|M!mF1-^latMS#OcfHaR6Gf4acegOZ$E7MKvH}RadceUlu{@(NR_w3|#tJNU1=fD5G`6G$`x@5cgNFHJ2 zzYsKO{zQEWNsEY=98oOtgMvRY5UG`}MRLhnMhyJ!7Vc?3QjWnMKayZyY_URvht^x| zhy?h|@jB3T)Dxl54fN(x=3gqE&`pOdrTKc90|Eb|((SyYPHV)lylDaph4BO<|Bj$} z!6g?|(vo8`-%2X^ChiprbLiG5^iHiY_%*s@&9TA^POE*w-dgNm`)URq0nMxc7VKFiDoX7oyuecUS2MO9tPFOwDC%WfIN+)<)?x%PmiS zlBt8axRXz&SrQKNbZ$oB(dj(8cYJhwe=wZsfew>y_Q3|T)J(HsF?L7g*Aa*n@1O^K z$a~yC3`B!X6O3_>XL)G(^s2t)(a4$EH21j9W%a;qEJ`v#$yuWm3t38BiF=j3jxSB2oxT*LhARj(r}hj#aIo``&T-FTs>6Z@(^Sus@L_dv=QG&d<9)uxw^g9p+~)sxFrmo+ literal 0 HcmV?d00001 diff --git a/test/simple_source/bug30/04_and_del.py b/test/simple_source/bug30/04_and_del.py index 51b452e6..b161026f 100644 --- a/test/simple_source/bug30/04_and_del.py +++ b/test/simple_source/bug30/04_and_del.py @@ -1,5 +1,7 @@ # From 2.5.6 osxemxpath.py # Bug is in getting "and" and "del" correct + +# This is RUNNABLE! def normpath(comps): i = 0 while i < len(comps): diff --git a/uncompyle6/semantics/transform.py b/uncompyle6/semantics/transform.py index 63d1755d..d8c98902 100644 --- a/uncompyle6/semantics/transform.py +++ b/uncompyle6/semantics/transform.py @@ -75,9 +75,11 @@ class TreeTransform(GenericASTTraversal, object): if testexpr.kind != "testexpr": return node - if node.kind == "ifstmt": + if node.kind in ("ifstmt", "ifstmtl"): ifstmts_jump = node[1] - if node[1] != "_ifstmts_jump": + if ifstmts_jump == "_ifstmts_jumpl" and ifstmts_jump[0] == "_ifstmts_jump": + ifstmts_jump = ifstmts_jump[0] + elif ifstmts_jump != "_ifstmts_jump": return node stmts = ifstmts_jump[0] else: @@ -156,7 +158,7 @@ class TreeTransform(GenericASTTraversal, object): pass return node - n_iflaststmtl = n_ifstmt + n_ifstmtl = n_iflaststmtl = n_ifstmt # preprocess is used for handling chains of # if elif elif