diff --git a/uncompyle6/parsers/parse30.py b/uncompyle6/parsers/parse30.py index 93a47ebd..13fdb280 100644 --- a/uncompyle6/parsers/parse30.py +++ b/uncompyle6/parsers/parse30.py @@ -115,11 +115,13 @@ class Python30Parser(Python31Parser): # From Python 2.6 - list_iter ::= list_if JUMP_BACK - list_iter ::= list_if JUMP_BACK _come_froms POP_TOP - lc_body ::= LOAD_NAME expr LIST_APPEND - lc_body ::= LOAD_FAST expr LIST_APPEND - list_if ::= expr jmp_false_then list_iter + lc_body ::= LOAD_FAST expr LIST_APPEND + lc_body ::= LOAD_NAME expr LIST_APPEND + list_if ::= expr jmp_false_then list_iter + list_if_not ::= expr jmp_true list_iter JUMP_BACK come_froms POP_TOP + list_iter ::= list_if JUMP_BACK + list_iter ::= list_if JUMP_BACK _come_froms POP_TOP + ############# dict_comp_iter ::= expr expr ROT_TWO expr STORE_SUBSCR diff --git a/uncompyle6/semantics/gencomp.py b/uncompyle6/semantics/gencomp.py index b4295727..1115d316 100644 --- a/uncompyle6/semantics/gencomp.py +++ b/uncompyle6/semantics/gencomp.py @@ -661,7 +661,10 @@ class ComprehensionMixin: list_ifs.append(n) else: list_ifs.append([1]) - n = n[-2] if n[-1] == "come_from_opt" else n[-1] + if self.version[:2] == (3, 0) and n[2] == "list_iter": + n = n[2] + else: + n = n[-2] if n[-1] == "come_from_opt" else n[-1] pass elif n == "list_if37": list_ifs.append(n)