From 08c7966ef9028cd70dabeee4884b3c3e0c959719 Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 18 Feb 2018 09:13:22 -0500 Subject: [PATCH] 2.7 for .. try-else bug --- test/bytecode_2.7/05_for_try_else.pyc | Bin 0 -> 507 bytes test/simple_source/bug27+/05_for_try_else.py | 20 +++++++++++++++++++ uncompyle6/parsers/parse27.py | 10 +++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 test/bytecode_2.7/05_for_try_else.pyc create mode 100644 test/simple_source/bug27+/05_for_try_else.py diff --git a/test/bytecode_2.7/05_for_try_else.pyc b/test/bytecode_2.7/05_for_try_else.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e93eff4f5d937aab4cecc01f7a5e65cf69a6dabe GIT binary patch literal 507 zcmb79O-sW-5S`gX(Mn1c5xnWC>j$kC#ETU{d+ot0m4bvc*~Dntq`RBah&|Oyf3JVQ z*|gx6q^+H6zYv&c5FH# zgooDym?L}vywebaz=8z>oK&DcYeQhKdRj1NP*g!vCxZn7_Q$(mYX%<`kk5dKlLow) zEi?}_-+(@O>G2H`>uRI#4gJ`7iH$3DXxL|*xk);XgwniD_4@fyIBj2^aGR=nhrm-x zNZpy_UZPD>Oo?n0c`7o|kusHKI`ra%85Jwtk6PDf&5J8HOr@)3;fh3wMpo#W*-8do<92Pf{K1~tXVq|j(?W+?SVaeI*5&4p Yk6Q$Pg8x@F^Eab3$P;l}s?i&M0gnG # Copyright (c) 2000-2002 by hartmut Goebel @@ -17,9 +17,11 @@ class Python27Parser(Python2Parser): list_for ::= expr for_iter store list_iter JUMP_BACK list_comp ::= BUILD_LIST_0 list_iter lc_body ::= expr LIST_APPEND + for_iter ::= GET_ITER COME_FROM FOR_ITER stmt ::= setcomp_func + # Dictionary and set comprehensions were added in Python 2.7 expr ::= dict_comp dict_comp ::= LOAD_DICTCOMP MAKE_FUNCTION_0 expr GET_ITER CALL_FUNCTION_1 @@ -53,6 +55,9 @@ class Python27Parser(Python2Parser): tryelsestmtl ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK except_handler else_suitel JUMP_BACK COME_FROM + tryelsestmtl ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK + except_handler else_suitel + except_stmt ::= except_cond2 except_suite except_cond1 ::= DUP_TOP expr COMPARE_OP @@ -60,6 +65,9 @@ class Python27Parser(Python2Parser): except_cond2 ::= DUP_TOP expr COMPARE_OP jmp_false POP_TOP store POP_TOP + + for_block ::= l_stmts_opt JUMP_BACK + """ def p_jump27(self, args):