From 4cba5a28ef66cc81c78ffe817b4851af5a5cfdd1 Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 15 May 2016 05:37:44 -0400 Subject: [PATCH] 3.4 if/while bug --- test/bytecode_3.4/12_if_while_bug.pyc | Bin 0 -> 297 bytes test/simple_source/looping/12_if_while_bug.py | 17 +++++++++++++++++ uncompyle6/parsers/parse3.py | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/bytecode_3.4/12_if_while_bug.pyc create mode 100644 test/simple_source/looping/12_if_while_bug.py diff --git a/test/bytecode_3.4/12_if_while_bug.pyc b/test/bytecode_3.4/12_if_while_bug.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f46fc580c1bd72948f848168f7cdcdf3ab5c967 GIT binary patch literal 297 zcmaFI!^@@QY!S}L#K7>F0SN&43=TkCEC3`@fQXTyg@GXo$Y5d!)?`j*0Sbcvhz6;3 z2I67^AW_4_P{YiS&B9Qm!%!j1P{Rlk$!1_E(g3l6#+cVKG8FPNgy#X(G62nD@_We$ z)VGpBljRm;!7b+E)Ph@Vi8&=;I<*2s7lCX56TdWyGjj`aQsayBON)|I^>gy`3o`T4 z^$m^UGt=VBGctivNu}v}1(mlriVJcwOMnLOfSkqwBp4WZ82K3mnTkLhKTSq3jW8R+ WVh76I;;_lhPbtkwwFBz~X$1gry*jl3 literal 0 HcmV?d00001 diff --git a/test/simple_source/looping/12_if_while_bug.py b/test/simple_source/looping/12_if_while_bug.py new file mode 100644 index 00000000..e13ed1a5 --- /dev/null +++ b/test/simple_source/looping/12_if_while_bug.py @@ -0,0 +1,17 @@ +# From genericpath +# Problem on Python 3.4 +# end of if can come from both finishing loop +# and not taking the if. + +# whilestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK \e__come_from +# _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD \e__come_from +# ifstmt ::= testexpr _ifstmts_jump +# _come_from ::= _come_from COME_FROM +# _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_from + +def splitext(p, sep, altsep, extsep): + if altsep > extsep: + while sep < altsep: + sep += 1 + + return p diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index ffbefc5f..0b947ba8 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -243,7 +243,7 @@ class Python3Parser(PythonParser): testtrue ::= expr jmp_true _ifstmts_jump ::= return_if_stmts - _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD COME_FROM + _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_from _ifstmts_jump ::= c_stmts_opt iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE