diff --git a/test/bytecode_3.4/05_while1_if_continue.pyc b/test/bytecode_3.4/05_while1_if_continue.pyc new file mode 100644 index 00000000..cc21907e Binary files /dev/null and b/test/bytecode_3.4/05_while1_if_continue.pyc differ diff --git a/test/simple_source/bug34/05_while1_if_continue.py b/test/simple_source/bug34/05_while1_if_continue.py new file mode 100644 index 00000000..b0ec4adb --- /dev/null +++ b/test/simple_source/bug34/05_while1_if_continue.py @@ -0,0 +1,16 @@ +# Bug in Python 3.4 somewhere after the first 200 programs +def readline(b): + a = 1 + while True: + if b: + if b[0]: + a = 2 + b = None + continue + b = None + a = 5 + + return a + +assert readline(None) == 1 +assert readline([2]) == 2 diff --git a/uncompyle6/parsers/parse34.py b/uncompyle6/parsers/parse34.py index 1b8cdc8d..df1fb6fa 100644 --- a/uncompyle6/parsers/parse34.py +++ b/uncompyle6/parsers/parse34.py @@ -44,6 +44,8 @@ class Python34Parser(Python33Parser): # Is this 3.4 only? yield_from ::= expr GET_ITER LOAD_CONST YIELD_FROM + + _ifstmts_jump ::= c_stmts_opt JUMP_ABSOLUTE JUMP_FORWARD COME_FROM """ def customize_grammar_rules(self, tokens, customize): diff --git a/uncompyle6/semantics/helper.py b/uncompyle6/semantics/helper.py index 248c0016..297eede4 100644 --- a/uncompyle6/semantics/helper.py +++ b/uncompyle6/semantics/helper.py @@ -13,8 +13,8 @@ else: read_write_global_ops = frozenset(('STORE_GLOBAL', 'DELETE_GLOBAL', 'LOAD_GLOBAL')) read_global_ops = frozenset(('STORE_GLOBAL', 'DELETE_GLOBAL')) -# NOTE: we also need to check that he variable name is a free variable, not a cell variable. -nonglobal_ops = frozenset(('LOAD_DEREF', 'STORE_DEREF', 'DELETE_DEREF')) +# NOTE: we also need to check that the variable name is a free variable, not a cell variable. +nonglobal_ops = frozenset(('STORE_DEREF', 'DELETE_DEREF')) # FIXME: this and find_globals could be paramaterized with one of the # above global ops