You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Merge branch 'master' into python-2.4
This commit is contained in:
BIN
test/bytecode_3.0/03_if_try_raise.pyc
Normal file
BIN
test/bytecode_3.0/03_if_try_raise.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.0/05_abc_test.pyc
Normal file
BIN
test/bytecode_3.0/05_abc_test.pyc
Normal file
Binary file not shown.
@@ -28,7 +28,8 @@ class Python30Parser(Python31Parser):
|
||||
# Specifically POP_TOP is more prevelant since there is no POP_JUMP_IF_...
|
||||
# instructions
|
||||
|
||||
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_froms POP_TOP COME_FROM
|
||||
_ifstmts_jump ::= c_stmts JUMP_FORWARD _come_froms POP_TOP COME_FROM
|
||||
_ifstmts_jump ::= c_stmts POP_TOP
|
||||
|
||||
# Used to keep index order the same in semantic actions
|
||||
jb_pop_top ::= JUMP_BACK POP_TOP
|
||||
@@ -63,8 +64,11 @@ class Python30Parser(Python31Parser):
|
||||
comp_iter ::= expr expr SET_ADD
|
||||
comp_iter ::= expr expr LIST_APPEND
|
||||
|
||||
jump_forward_else ::= JUMP_FORWARD POP_TOP
|
||||
jump_forward_else ::= JUMP_FORWARD POP_TOP
|
||||
jump_absolute_else ::= JUMP_ABSOLUTE POP_TOP
|
||||
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
|
||||
|
||||
# In many ways 3.0 is like 2.6. The below rules in fact are the same or similar.
|
||||
|
||||
@@ -96,7 +100,7 @@ class Python30Parser(Python31Parser):
|
||||
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
|
||||
except_handler ::= jmp_abs COME_FROM_EXCEPT except_stmts END_FINALLY
|
||||
|
||||
except_suite ::= c_stmts POP_EXCEPT jump_except
|
||||
""")
|
||||
|
||||
return
|
||||
|
@@ -156,6 +156,22 @@ def customize_for_version3(self, version):
|
||||
self.prune()
|
||||
self.n_classdef3 = n_classdef3
|
||||
|
||||
if version == 3.0:
|
||||
# In Python 3.0 there is code to move from _[dd] into
|
||||
# the iteration variable. These rules we can ignore
|
||||
# since we pick up the iteration variable some other way and
|
||||
# we definitely don't include in the source _[dd].
|
||||
def n_comp_iter(node):
|
||||
if node[0] == 'expr':
|
||||
n = node[0][0]
|
||||
if (n == 'LOAD_FAST' and
|
||||
n.pattr[0:2] == '_['):
|
||||
self.prune()
|
||||
pass
|
||||
pass
|
||||
# Not this special case, procede as normal...
|
||||
self.default(node)
|
||||
self.n_comp_iter = n_comp_iter
|
||||
|
||||
if version >= 3.3:
|
||||
def n_yield_from(node):
|
||||
|
Reference in New Issue
Block a user