From c03a8186b5414295c35c10bb9888d62ced7e23a7 Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 25 Sep 2016 16:54:46 -0400 Subject: [PATCH] Address whileTrue if cond .. -> while cond .. bug Reinstate Python standard library bisect test --- test/Makefile | 2 +- test/ok_lib3.4/bisect.pyc | Bin 0 -> 2843 bytes uncompyle6/parsers/parse3.py | 13 ++++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 test/ok_lib3.4/bisect.pyc diff --git a/test/Makefile b/test/Makefile index c78e7a5b..00193788 100644 --- a/test/Makefile +++ b/test/Makefile @@ -133,7 +133,7 @@ check-3.2-ok: #: Run longer Python 3.4's lib files known to be okay check-3.4-ok: - $(PYTHON) test_pythonlib.py --ok-3.4 --weak-verify $(COMPILE) + $(PYTHON) test_pythonlib.py --ok-3.4 --verify $(COMPILE) #: PyPy of some sort. E.g. [PyPy 5.0.1 with GCC 4.8.4] # Skip for now diff --git a/test/ok_lib3.4/bisect.pyc b/test/ok_lib3.4/bisect.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a9a6d1b1ad9c4abf918d898baef8747604f2b6bb GIT binary patch literal 2843 zcmds(-EJF26vxl(`rA%YLfh~qG!i#i)Y?d(O0C)osJO^Ykx12oD`btmWA8NMT{E+r z+L42Ra?N}25Ig~Iu(w?00=Vajb7pNPq^Z>C5 z0q`4~c$!%L7?b@Tvk;(*IfKxH(1)-DKYGw*AQ^PgQrOE7R-D}j=|i`)v{xalIXgBe zTGk(1B&U4;ja;!P;Y8tgT|%z-iXRm|W^9CJ5l9bEZTSvg2m5_6$PiBV}Z zw(TRF9o!$3=ntPVCLhy1O!g0OoB-aS0wgWAFom7+ts!ANFcsZa~Ul4&*xY z$u<3iI${IrI9rsraM^DimSFDM&P(tnc{N}Odwp}03Sk+x4n3+o!gxe!@Zye)!&_md2#iqYLftX2a_BM2I^FS(V%3?dn}o!c-xg@Y{&J2E1k5%|Hm=<>X z>zz(!O-HMKXEIBpB>u4dQK#=vX-{T(3nSoO_S`-Y8TK+}P;apfMrnhsvrACN+^nPh zY>>W1&wmIK@m~?&;U;|{)6B%~EL9xJDSsMCBWd4P2mc&ZFGlDA@lizFr;X>zQI-uN z96=zHT5~iaSdVY1uX!Z)CDw1>;nM=vrQe;ic&u)%+T2CJIN!x-5v5B+#bknLSc*t! z689LWT}*v@8t|t|YZq*>nkPhz7^c#=4(<#Kd{;3skdYS!W;kia^Ei);<6d8+`op!E&36tp(apmhViXVZFKvWM>gY96W?$=>9jYPZtB z7s=l5J43Lfbzz|zFGgrtqu*IBW0O4-&}gPBXG zSs_mEQJ3>lwwGk(f+^ce2pfvuzou+`IZQ~sNefqu{!f*yxllG*s3XsPhEEBbgY`A! zGGIA-Kd9%`UN1}ry`K9vcj-2Oz#EdjZlwt5*f!LsTkRF5yty-;U^{n@IH9m~TQE*$ gYq!Tqm}z;J?j25IE8gbon66;Dym{5f>%bcO8_}n;CIA2c literal 0 HcmV?d00001 diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index a17a7715..f9963be0 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -302,16 +302,19 @@ class Python3Parser(PythonParser): stmt ::= whileTruestmt ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite _come_from - forstmt ::= SETUP_LOOP expr _for designator for_block POP_BLOCK opt_come_from_loop - forstmt ::= SETUP_LOOP expr _for designator for_block POP_BLOCK NOP opt_come_from_loop - whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK opt_come_from_loop - whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK NOP opt_come_from_loop + forstmt ::= SETUP_LOOP expr _for designator for_block POP_BLOCK opt_come_from_loop + whilestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK opt_come_from_loop + whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK opt_come_from_loop # Python < 3.5 no POP BLOCK whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK opt_come_from_loop - whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK NOP opt_come_from_loop whileTruestmt ::= SETUP_LOOP return_stmts opt_come_from_loop while1stmt ::= SETUP_LOOP l_stmts _come_from JUMP_BACK opt_come_from_loop + + # FIXME: investigate - can code really produce a NOP? + whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK NOP opt_come_from_loop + whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK NOP opt_come_from_loop + forstmt ::= SETUP_LOOP expr _for designator for_block POP_BLOCK NOP opt_come_from_loop """ def p_genexpr3(self, args):