From acdd025162c0d6461a9bb3a354cd4d0b42f058c2 Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 4 Jun 2020 05:34:19 -0400 Subject: [PATCH] ast-check "for" is a loop; sync "withas" test .. with decompyle3. --- test/bytecode_2.6/04_withas.pyc | Bin 946 -> 1366 bytes test/bytecode_2.7/04_withas.pyc | Bin 807 -> 1183 bytes test/bytecode_3.0/04_withas.pyc | Bin 1122 -> 1659 bytes test/bytecode_3.1/04_withas.pyc | Bin 1120 -> 1657 bytes test/bytecode_3.6/04_withas.pyc | Bin 650 -> 937 bytes test/bytecode_3.7/04_withas.pyc | Bin 654 -> 941 bytes test/simple_source/stmts/04_withas.py | 14 ++++++++++++++ uncompyle6/semantics/check_ast.py | 1 + 8 files changed, 15 insertions(+) diff --git a/test/bytecode_2.6/04_withas.pyc b/test/bytecode_2.6/04_withas.pyc index 31d0d29c17963064ca692d6af3d4c4c8961cf200..2c8086aba622eba6fc77623af4a258e950967691 100644 GIT binary patch delta 430 zcmYLEO-jQ+7=2&<#zb4Rs0&LLL6Nu+>IoEd(@ns1p%gTPrbs|4b_OkCaiJHGoJ0@c z9o&cq@C2T~?@I&D@V$BSeQzFb-qlyo{rqhO{g3a<5t>DO9&zb|*KV}&0t{^w4um); zTnu9G?J%@5(Mh>n$D-e5D1gBu;FN$>5}sM|5TGE;fioVSo{J*3Seo!0sA+I)qC1vV#eBJ<>W5EE{kkBzACku=BB)v=uMt#j{)RRheq;NoTXJK>M@z^fdidf zM3@tdL?e!7Eutyht0vd&f(&ADNn)EZ-S!2!ns8!n4VI08vP_ddF+Wlk1Br3~2?j=4 hMs`L4Mn4T^ASZ|wMDT(Lfys=lo*XPdCMPQ=I{?L54`=`Y diff --git a/test/bytecode_2.7/04_withas.pyc b/test/bytecode_2.7/04_withas.pyc index 33c302a28085043c9eedff37b314963077af2e37..1242af29ea50184d15027095473964a195e9f8fd 100644 GIT binary patch delta 383 zcmXX?yGq1R6r7XIbJr*qZedUn6mBCZet?34Y!fgk6hXtXcaeasxc8zKE;jZe`2b66 zD?9xQ5d?oiKfrUcNjQ^X&SQqW_|H+&`i;bC32?;9;jzfd;eJ}misFJ2mW9=~vwgqF)DDd; z%F%WIqSVEBcwQPi?%VQmWV+lnJ_E?5fCjQC$3&`~*O}ZdgN^r3yOMW-VzHqn`#dkQ2lNBDg>V?_@6)PYxC!larN`9ROaR4q^ZR diff --git a/test/bytecode_3.0/04_withas.pyc b/test/bytecode_3.0/04_withas.pyc index 09bda8ad78c96b9012747e8f8bc80f4960ab1521..da571967e2563172d5a40154a512e0936bcc90a8 100644 GIT binary patch delta 487 zcmaKo&q@MO6vn@EXU1_v7m~Si`Z~{3o!|g6DMy_z zGJ`t~D<<3GWKsiz?Y1@qEEGgWQs}8AqK&b=@hdA)e4$PF#81+tN#+|#4VQm*pdEs;%mYPeSPVysvHzxU{meY7yV LwAeeAW6SpeV?SAW delta 90 zcmey(^N2&`!7^9yC^W@#Es*?rT;y74;U6F4j2Fc diff --git a/test/bytecode_3.1/04_withas.pyc b/test/bytecode_3.1/04_withas.pyc index 8259c657c521681b459c2a97d0e83fd8de455f44..c1c0b0a634faa4435ea2c372bb96338fdcab5e27 100644 GIT binary patch delta 487 zcmaKo&q@MO6vn?ZcmAj-5otsuCKybc&|S;GHf@w}Q4}_aBQX+&-q9@77WD!#Pg3oB zi=bt%;jVMWq9W)H-{Jh5kKeuTiFvwEPiImGFK=gU{5Zt<9!pmq3dP(#aH8Owki>*< zq2bz()xJ@eJvjy|!K$+K4hJ7-OaQYBObK1W9Y8lJ_=G8N#N!EJMmRi{O;`S}1r)8R z(u(9mF&+<1j^1gd8C|RL?K&4>M~7a}8?`P1-y3w!104=pVQ|^gt31^<2ariwYJZU_ z?j%_;*)AvJ3K(p^xh-I!ATpAHuCYLLaOEuc49pDX>o3a2vMZJ~R}5pkReZs+0NI;y74;UJ;4j=#k diff --git a/test/bytecode_3.6/04_withas.pyc b/test/bytecode_3.6/04_withas.pyc index 95117e1579700cb983513224d57378263f16afd7..c5f2189abb8f853a12847abbd0c563a702903bb3 100644 GIT binary patch delta 403 zcmYjNu}T9$5S`iF-d)Zl5)3H>twcBwEYesCrm;ED2ue_o!#To%MBH7}!eC<|HVXF< zV(Aa~9g@}`ab~07EHm#h%wlMrlj?s3`<7lIKSz#*J?ma5Ez+%+1XrqCBv3bl%aT@ZZ3^?LCT!g}?o+HA>qtm8<|58*OGtpET3 delta 132 zcmZ3<-o@%-%*)Fau5ke86o#6UDSipiw94Z($~;~ zFW_@XpT?PuZkU}vfBxP1$b0x1XNPH;0I!qppQ|@D&o*&?zSql5{0hSrqs=OJWs(6D zYhTA>oT7wzNtZg}vKem%25<^zaN$)EloYW`k|~fn|Joa*_;tDEYU`?I@-Vt>Ohxs$ zv5rQrxtrK7f46cTP$3|#v$~P1rs4%$0_|t-uz1>jhCW<&U(mr!BRoduOwrQZd(He< zGKU;1f?+75?Gjy!BR989sb`|P@_`=ve;5fyNE@*Dz}bO}w3;_yQ(=abvo4E}LhdAg U!xM9!Rlc|mb~_T+p^oMG1*`x*UH||9 delta 91 zcmZ3>-p9)4#LLUY00aTMZp7s$-XfnopJI3rXE!>pnNe0NEIU+ kBMT!RW04?`?Wf6H#0sQ~_&|i<h($ diff --git a/test/simple_source/stmts/04_withas.py b/test/simple_source/stmts/04_withas.py index b21452db..f3c65a80 100644 --- a/test/simple_source/stmts/04_withas.py +++ b/test/simple_source/stmts/04_withas.py @@ -17,6 +17,20 @@ def withas_bug(self, nested, a, b): with nested(a(), b()) as (x, y): 1 // 0 +# From 3.7.7 test_functools.py +# Bug is a unreachable code after "return" +def test_invalid_registrations(x): + return + with x: + x = 1 + +# From 3.7.7 test_re.py +# Bug was hooking in c_with. +def test_re_tests(tests): + for t in tests: + with a: + continue + # Adapted from 3.8 distutils/command/config.py # In 3.8 the problem was in handling "with .. as" code def _gen_temp_sourcefile(x, a, headers, lang): diff --git a/uncompyle6/semantics/check_ast.py b/uncompyle6/semantics/check_ast.py index 3c5f4b78..203ff0a9 100644 --- a/uncompyle6/semantics/check_ast.py +++ b/uncompyle6/semantics/check_ast.py @@ -14,6 +14,7 @@ def checker(ast, in_loop, errors): return in_loop = ( in_loop + or ast.kind.startswith("for") or ast.kind.startswith("while") or ast.kind.startswith("async_for") )