You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Two 3.4 fixes..
* LOAD_DEREF does not signal "nonlocal" variables * Add rule for "if" with a "continue" and "return"
This commit is contained in:
BIN
test/bytecode_3.4/05_while1_if_continue.pyc
Normal file
BIN
test/bytecode_3.4/05_while1_if_continue.pyc
Normal file
Binary file not shown.
16
test/simple_source/bug34/05_while1_if_continue.py
Normal file
16
test/simple_source/bug34/05_while1_if_continue.py
Normal file
@@ -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
|
@@ -44,6 +44,8 @@ class Python34Parser(Python33Parser):
|
|||||||
|
|
||||||
# Is this 3.4 only?
|
# Is this 3.4 only?
|
||||||
yield_from ::= expr GET_ITER LOAD_CONST YIELD_FROM
|
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):
|
def customize_grammar_rules(self, tokens, customize):
|
||||||
|
@@ -13,8 +13,8 @@ else:
|
|||||||
read_write_global_ops = frozenset(('STORE_GLOBAL', 'DELETE_GLOBAL', 'LOAD_GLOBAL'))
|
read_write_global_ops = frozenset(('STORE_GLOBAL', 'DELETE_GLOBAL', 'LOAD_GLOBAL'))
|
||||||
read_global_ops = frozenset(('STORE_GLOBAL', 'DELETE_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.
|
# NOTE: we also need to check that the variable name is a free variable, not a cell variable.
|
||||||
nonglobal_ops = frozenset(('LOAD_DEREF', 'STORE_DEREF', 'DELETE_DEREF'))
|
nonglobal_ops = frozenset(('STORE_DEREF', 'DELETE_DEREF'))
|
||||||
|
|
||||||
# FIXME: this and find_globals could be paramaterized with one of the
|
# FIXME: this and find_globals could be paramaterized with one of the
|
||||||
# above global ops
|
# above global ops
|
||||||
|
Reference in New Issue
Block a user