You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Merge branch 'master' into python-2.4
This commit is contained in:
@@ -46,11 +46,11 @@ def test_grammar():
|
||||
unused_rhs.add("mkfunc_annotate")
|
||||
unused_rhs.add("dict_comp")
|
||||
unused_rhs.add("classdefdeco1")
|
||||
if PYTHON_VERSION in (3.5, 3.6, 3.7):
|
||||
if PYTHON_VERSION >= 3.5:
|
||||
expect_right_recursive.add((('l_stmts',
|
||||
('lastl_stmt', 'come_froms', 'l_stmts'))))
|
||||
pass
|
||||
else:
|
||||
elif 3.0 < PYTHON_VERSION < 3.3:
|
||||
expect_right_recursive.add((('l_stmts',
|
||||
('lastl_stmt', 'COME_FROM', 'l_stmts'))))
|
||||
pass
|
||||
|
BIN
test/bytecode_3.0/02_try_except_except.pyc
Normal file
BIN
test/bytecode_3.0/02_try_except_except.pyc
Normal file
Binary file not shown.
9
test/simple_source/bug30/02_try_except_except.py
Normal file
9
test/simple_source/bug30/02_try_except_except.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# From 3.0.1/lib/python3.0/_dummy_thread.py
|
||||
|
||||
def start_new_thread(function, args, kwargs={}):
|
||||
try:
|
||||
function()
|
||||
except SystemExit:
|
||||
pass
|
||||
except:
|
||||
args()
|
@@ -69,6 +69,7 @@ class Python30Parser(Python31Parser):
|
||||
except_suite ::= c_stmts POP_EXCEPT jump_except POP_TOP
|
||||
except_suite_finalize ::= SETUP_FINALLY c_stmts_opt except_var_finalize END_FINALLY
|
||||
_jump POP_TOP
|
||||
jump_except ::= JUMP_FORWARD POP_TOP
|
||||
|
||||
# In many ways 3.0 is like 2.6. The below rules in fact are the same or similar.
|
||||
|
||||
@@ -83,6 +84,8 @@ class Python30Parser(Python31Parser):
|
||||
and ::= expr JUMP_IF_FALSE POP_TOP expr COME_FROM
|
||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt
|
||||
JUMP_BACK POP_TOP POP_BLOCK COME_FROM_LOOP
|
||||
whilestmt ::= SETUP_LOOP testexpr returns
|
||||
POP_TOP POP_BLOCK COME_FROM_LOOP
|
||||
"""
|
||||
|
||||
def customize_grammar_rules(self, tokens, customize):
|
||||
@@ -96,6 +99,8 @@ class Python30Parser(Python31Parser):
|
||||
jump_absolute_else ::= JUMP_ABSOLUTE ELSE
|
||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt COME_FROM JUMP_BACK POP_BLOCK
|
||||
COME_FROM_LOOP
|
||||
whilestmt ::= SETUP_LOOP testexpr returns
|
||||
POP_BLOCK COME_FROM_LOOP
|
||||
assert ::= assert_expr jmp_true LOAD_ASSERT RAISE_VARARGS_1
|
||||
return_if_lambda ::= RETURN_END_IF_LAMBDA
|
||||
compare_chained1 ::= expr DUP_TOP ROT_THREE COMPARE_OP JUMP_IF_FALSE_OR_POP compare_chained2 COME_FROM
|
||||
|
@@ -317,6 +317,13 @@ class Scanner30(Scanner3):
|
||||
pass
|
||||
pass
|
||||
if code[pre_rtarget] == self.opc.RETURN_VALUE:
|
||||
if self.version == 3.0:
|
||||
next_op = rtarget
|
||||
if code[next_op] == self.opc.POP_TOP:
|
||||
next_op = rtarget
|
||||
next_op += instruction_size(self.code[next_op], self.opc)
|
||||
if code[next_op] == self.opc.POP_BLOCK:
|
||||
return
|
||||
self.return_end_ifs.add(pre_rtarget)
|
||||
else:
|
||||
self.fixed_jumps[offset] = rtarget
|
||||
|
Reference in New Issue
Block a user