You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Another python 3 ELSE fixes and ...
Makefile: - test python 3.0 bytecode - turn full --verify back on Python 3.x
This commit is contained in:
@@ -22,29 +22,29 @@ check:
|
|||||||
#: Run working tests from Python 2.6 or 2.7
|
#: Run working tests from Python 2.6 or 2.7
|
||||||
check-2.6 check-2.7: check-bytecode-2 check-bytecode-3 check-bytecode-1 check-2.7-ok
|
check-2.6 check-2.7: check-bytecode-2 check-bytecode-3 check-bytecode-1 check-2.7-ok
|
||||||
|
|
||||||
#: Run working tests from Python 3.1
|
#: Run working tests from Python 3.0
|
||||||
check-3.0: check-bytecode
|
check-3.0: check-bytecode
|
||||||
@echo Python 3.0 testing not done yet
|
$(PYTHON) test_pythonlib.py --bytecode-3.0 --verify $(COMPILE)
|
||||||
|
|
||||||
#: Run working tests from Python 3.1
|
#: Run working tests from Python 3.1
|
||||||
check-3.1: check-bytecode
|
check-3.1: check-bytecode
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-3.1 --weak-verify $(COMPILE)
|
$(PYTHON) test_pythonlib.py --bytecode-3.1 --verify $(COMPILE)
|
||||||
|
|
||||||
#: Run working tests from Python 3.2
|
#: Run working tests from Python 3.2
|
||||||
check-3.2: check-bytecode
|
check-3.2: check-bytecode
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-3.2 --weak-verify $(COMPILE)
|
$(PYTHON) test_pythonlib.py --bytecode-3.2 --verify $(COMPILE)
|
||||||
|
|
||||||
#: Run working tests from Python 3.3
|
#: Run working tests from Python 3.3
|
||||||
check-3.3: check-bytecode
|
check-3.3: check-bytecode
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-3.3 --weak-verify $(COMPILE)
|
$(PYTHON) test_pythonlib.py --bytecode-3.3 --verify $(COMPILE)
|
||||||
|
|
||||||
#: Run working tests from Python 3.4
|
#: Run working tests from Python 3.4
|
||||||
check-3.4: check-bytecode check-3.4-ok check-2.7-ok
|
check-3.4: check-bytecode check-3.4-ok check-2.7-ok
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-3.4 --weak-verify $(COMPILE)
|
$(PYTHON) test_pythonlib.py --bytecode-3.4 --verify $(COMPILE)
|
||||||
|
|
||||||
#: Run working tests from Python 3.5
|
#: Run working tests from Python 3.5
|
||||||
check-3.5: check-bytecode
|
check-3.5: check-bytecode
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-3.5 --weak-verify $(COMPILE)
|
$(PYTHON) test_pythonlib.py --bytecode-3.5 --verify $(COMPILE)
|
||||||
|
|
||||||
#: Run working tests from Python 3.6
|
#: Run working tests from Python 3.6
|
||||||
check-3.6: check-bytecode
|
check-3.6: check-bytecode
|
||||||
|
@@ -142,6 +142,10 @@ class Python3Parser(PythonParser):
|
|||||||
jf_else ::= JUMP_FORWARD ELSE
|
jf_else ::= JUMP_FORWARD ELSE
|
||||||
ja_else ::= JUMP_ABSOLUTE ELSE
|
ja_else ::= JUMP_ABSOLUTE ELSE
|
||||||
|
|
||||||
|
# Note: in if/else kinds of statements, we err on the side
|
||||||
|
# of missing "else" clauses. Therefore we include grammar
|
||||||
|
# rules with and without ELSE.
|
||||||
|
|
||||||
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite COME_FROM
|
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite COME_FROM
|
||||||
ifelsestmt ::= testexpr c_stmts_opt jf_else else_suite _come_from
|
ifelsestmt ::= testexpr c_stmts_opt jf_else else_suite _come_from
|
||||||
|
|
||||||
@@ -152,7 +156,6 @@ class Python3Parser(PythonParser):
|
|||||||
|
|
||||||
ifelsestmtl ::= testexpr c_stmts_opt JUMP_BACK else_suitel
|
ifelsestmtl ::= testexpr c_stmts_opt JUMP_BACK else_suitel
|
||||||
|
|
||||||
|
|
||||||
# FIXME: this feels like a hack. Is it just 1 or two
|
# FIXME: this feels like a hack. Is it just 1 or two
|
||||||
# COME_FROMs? the parsed tree for this and even with just the
|
# COME_FROMs? the parsed tree for this and even with just the
|
||||||
# one COME_FROM for Python 2.7 seems to associate the
|
# one COME_FROM for Python 2.7 seems to associate the
|
||||||
@@ -373,7 +376,10 @@ class Python3Parser(PythonParser):
|
|||||||
|
|
||||||
def p_expr3(self, args):
|
def p_expr3(self, args):
|
||||||
"""
|
"""
|
||||||
conditional ::= expr jmp_false expr jf_else expr COME_FROM
|
conditional ::= expr jmp_false expr jf_else expr COME_FROM
|
||||||
|
conditionalnot ::= expr jmp_true expr jf_else expr COME_FROM
|
||||||
|
|
||||||
|
|
||||||
expr ::= LOAD_CLASSNAME
|
expr ::= LOAD_CLASSNAME
|
||||||
|
|
||||||
# Python 3.4+
|
# Python 3.4+
|
||||||
|
@@ -799,9 +799,10 @@ class Scanner3(Scanner):
|
|||||||
self.not_continue.add(prev_op[rtarget])
|
self.not_continue.add(prev_op[rtarget])
|
||||||
|
|
||||||
if rtarget < end and (
|
if rtarget < end and (
|
||||||
code[rtarget] != self.opc.END_FINALLY
|
code[rtarget] not in (self.opc.END_FINALLY,
|
||||||
and code[prev_op[rrtarget]] not in (self.opc.POP_EXCEPT,
|
self.opc.JUMP_ABSOLUTE) and
|
||||||
self.opc.END_FINALLY)):
|
code[prev_op[rrtarget]] not in (self.opc.POP_EXCEPT,
|
||||||
|
self.opc.END_FINALLY)):
|
||||||
self.structs.append({'type': 'else',
|
self.structs.append({'type': 'else',
|
||||||
'start': rtarget,
|
'start': rtarget,
|
||||||
'end': end})
|
'end': end})
|
||||||
|
Reference in New Issue
Block a user