You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Small grammar isolation bugs
This commit is contained in:
@@ -82,8 +82,6 @@ class Python2Parser(PythonParser):
|
|||||||
raise_stmt2 ::= expr expr RAISE_VARARGS_2
|
raise_stmt2 ::= expr expr RAISE_VARARGS_2
|
||||||
raise_stmt3 ::= expr expr expr RAISE_VARARGS_3
|
raise_stmt3 ::= expr expr expr RAISE_VARARGS_3
|
||||||
|
|
||||||
stmt ::= exec_stmt
|
|
||||||
|
|
||||||
del_stmt ::= expr DELETE_SLICE+0
|
del_stmt ::= expr DELETE_SLICE+0
|
||||||
del_stmt ::= expr expr DELETE_SLICE+2
|
del_stmt ::= expr expr DELETE_SLICE+2
|
||||||
del_stmt ::= expr expr expr DELETE_SLICE+3
|
del_stmt ::= expr expr expr DELETE_SLICE+3
|
||||||
@@ -336,9 +334,10 @@ class Python2Parser(PythonParser):
|
|||||||
continue
|
continue
|
||||||
elif opname == 'EXEC_STMT':
|
elif opname == 'EXEC_STMT':
|
||||||
self.addRule("""
|
self.addRule("""
|
||||||
exprlist ::= expr+
|
stmt ::= exec_stmt
|
||||||
exec_stmt ::= expr exprlist DUP_TOP EXEC_STMT
|
exec_stmt ::= expr exprlist DUP_TOP EXEC_STMT
|
||||||
exec_stmt ::= expr exprlist EXEC_STMT
|
exec_stmt ::= expr exprlist EXEC_STMT
|
||||||
|
exprlist ::= expr+
|
||||||
""", nop_func)
|
""", nop_func)
|
||||||
continue
|
continue
|
||||||
elif opname == 'JUMP_IF_NOT_DEBUG':
|
elif opname == 'JUMP_IF_NOT_DEBUG':
|
||||||
|
@@ -1041,15 +1041,10 @@ class Scanner2(Scanner):
|
|||||||
# or:
|
# or:
|
||||||
# RETURN_VALUE POP_TOP .. POP_TOP END_FINALLY
|
# RETURN_VALUE POP_TOP .. POP_TOP END_FINALLY
|
||||||
skip_come_from = False
|
skip_come_from = False
|
||||||
if self.version <= 2.5:
|
if self.version <= 2.6:
|
||||||
skip_come_from = (code[offset+3] == self.opc.END_FINALLY or
|
skip_come_from = (code[offset+3] == self.opc.END_FINALLY or
|
||||||
(code[offset+3] == self.opc.POP_TOP
|
(code[offset+3] == self.opc.POP_TOP
|
||||||
and code[offset+4] == self.opc.END_FINALLY))
|
and code[offset+4] == self.opc.END_FINALLY))
|
||||||
else:
|
|
||||||
skip_come_from = (code[offset+3] == self.opc.END_FINALLY or
|
|
||||||
(op != self.opc.JUMP_FORWARD
|
|
||||||
and code[offset+3] == self.opc.POP_TOP
|
|
||||||
and code[offset+4] == self.opc.END_FINALLY))
|
|
||||||
if not skip_come_from:
|
if not skip_come_from:
|
||||||
# FIXME: rocky: I think we need something like this...
|
# FIXME: rocky: I think we need something like this...
|
||||||
if offset not in set(self.ignore_if):
|
if offset not in set(self.ignore_if):
|
||||||
|
Reference in New Issue
Block a user