You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
2.6 and before COME_FROM handling...
also, add in some of the test bytecode from the python-2.4 branch
This commit is contained in:
BIN
test/bytecode_2.5/01_inplace_true_divide.pyc
Normal file
BIN
test/bytecode_2.5/01_inplace_true_divide.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.5/01_ops.pyc
Normal file
BIN
test/bytecode_2.5/01_ops.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.5/02_true_divide.pyc
Normal file
BIN
test/bytecode_2.5/02_true_divide.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.5/08_if_while_else.pyc
Normal file
BIN
test/bytecode_2.5/08_if_while_else.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.5/10_del.pyc
Normal file
BIN
test/bytecode_2.5/10_del.pyc
Normal file
Binary file not shown.
13
test/simple_source/bug25/08_if_while_else.py
Normal file
13
test/simple_source/bug25/08_if_while_else.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# From 2.3 Queue.py
|
||||
# Bug was adding COME_FROM from while
|
||||
# confusing the else
|
||||
def put(item, block=True, timeout=None):
|
||||
if block:
|
||||
if timeout:
|
||||
while True:
|
||||
if item:
|
||||
block = 1
|
||||
else:
|
||||
block = 5
|
||||
elif item:
|
||||
block = False
|
@@ -115,7 +115,6 @@ class Python26Parser(Python2Parser):
|
||||
|
||||
# Semantic actions want else_suitel to be at index 3
|
||||
ifelsestmtl ::= testexpr c_stmts_opt cf_jb_cf_pop else_suitel
|
||||
|
||||
ifelsestmtc ::= testexpr c_stmts_opt ja_cf_pop else_suitec
|
||||
|
||||
# Semantic actions want suite_stmts_opt to be at index 3
|
||||
|
@@ -1127,6 +1127,12 @@ class Scanner2(Scanner):
|
||||
source = self.setup_loops[label]
|
||||
else:
|
||||
source = offset
|
||||
# FIXME: The grammar for 2.6 and before doesn't
|
||||
# handle COME_FROM's from a loop inside if's
|
||||
# It probably should.
|
||||
if (self.version > 2.6 or
|
||||
self.code[source] != self.opc.SETUP_LOOP or
|
||||
self.code[label] != self.opc.JUMP_FORWARD):
|
||||
targets[label] = targets.get(label, []) + [source]
|
||||
pass
|
||||
pass
|
||||
|
Reference in New Issue
Block a user