diff --git a/test/bytecode_3.3/03_ifelse_in_lambda.pyc b/test/bytecode_3.3/03_ifelse_in_lambda.pyc new file mode 100644 index 00000000..7628206f Binary files /dev/null and b/test/bytecode_3.3/03_ifelse_in_lambda.pyc differ diff --git a/test/bytecode_3.4/03_ifelse_in_lambda.pyc b/test/bytecode_3.4/03_ifelse_in_lambda.pyc new file mode 100644 index 00000000..01df985d Binary files /dev/null and b/test/bytecode_3.4/03_ifelse_in_lambda.pyc differ diff --git a/test/bytecode_3.5/03_ifelse_in_lambda.pyc b/test/bytecode_3.5/03_ifelse_in_lambda.pyc new file mode 100644 index 00000000..33b8757f Binary files /dev/null and b/test/bytecode_3.5/03_ifelse_in_lambda.pyc differ diff --git a/test/simple_source/bug34/03_ifelse_in_lambda.py b/test/simple_source/bug34/03_ifelse_in_lambda.py new file mode 100644 index 00000000..b498a009 --- /dev/null +++ b/test/simple_source/bug34/03_ifelse_in_lambda.py @@ -0,0 +1,4 @@ +# Next line is 1164 +def foo(): + name = "bar" + lambda x: compile(x, "" % name, "exec") if x else None diff --git a/uncompyle6/parsers/parse34.py b/uncompyle6/parsers/parse34.py index caae5e2e..a381448a 100644 --- a/uncompyle6/parsers/parse34.py +++ b/uncompyle6/parsers/parse34.py @@ -53,6 +53,10 @@ class Python34Parser(Python33Parser): _ifstmts_jump ::= c_stmts_opt JUMP_ABSOLUTE JUMP_FORWARD COME_FROM genexpr_func ::= LOAD_ARG _come_froms FOR_ITER store comp_iter JUMP_BACK + + if_exp_lambda ::= expr jmp_false expr return_if_lambda return_stmt_lambda LAMBDA_MARKER + return_if_lambda ::= RETURN_END_IF_LAMBDA come_froms + return_if_stmt ::= return_expr RETURN_END_IF POP_BLOCK """ def customize_grammar_rules(self, tokens, customize): diff --git a/uncompyle6/parsers/parse35.py b/uncompyle6/parsers/parse35.py index e5bc9b10..929d920d 100644 --- a/uncompyle6/parsers/parse35.py +++ b/uncompyle6/parsers/parse35.py @@ -108,7 +108,6 @@ class Python35Parser(Python34Parser): # Python 3.5+ does jump optimization # In <.3.5 the below is a JUMP_FORWARD to a JUMP_ABSOLUTE. - return_if_stmt ::= return_expr RETURN_END_IF POP_BLOCK return_if_lambda ::= RETURN_END_IF_LAMBDA COME_FROM return ::= return_expr RETURN_END_IF