You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Python 3 COME_FROM -> COME_FROM_WITH appropriately
This commit is contained in:
@@ -33,7 +33,7 @@ def test_grammar():
|
|||||||
ignore_set = set(
|
ignore_set = set(
|
||||||
"""
|
"""
|
||||||
JUMP_BACK CONTINUE RETURN_END_IF
|
JUMP_BACK CONTINUE RETURN_END_IF
|
||||||
COME_FROM COME_FROM_EXCEPT COME_FROM_LOOP
|
COME_FROM COME_FROM_EXCEPT COME_FROM_LOOP COME_FROM_WITH
|
||||||
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP
|
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP
|
||||||
LAMBDA_MARKER RETURN_LAST
|
LAMBDA_MARKER RETURN_LAST
|
||||||
""".split())
|
""".split())
|
||||||
|
@@ -242,11 +242,11 @@ class Python3Parser(PythonParser):
|
|||||||
jmp_abs ::= JUMP_BACK
|
jmp_abs ::= JUMP_BACK
|
||||||
|
|
||||||
withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt
|
withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt
|
||||||
POP_BLOCK LOAD_CONST COME_FROM
|
POP_BLOCK LOAD_CONST COME_FROM_WITH
|
||||||
WITH_CLEANUP END_FINALLY
|
WITH_CLEANUP END_FINALLY
|
||||||
|
|
||||||
withasstmt ::= expr SETUP_WITH designator suite_stmts_opt
|
withasstmt ::= expr SETUP_WITH designator suite_stmts_opt
|
||||||
POP_BLOCK LOAD_CONST COME_FROM
|
POP_BLOCK LOAD_CONST COME_FROM_WITH
|
||||||
WITH_CLEANUP END_FINALLY
|
WITH_CLEANUP END_FINALLY
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
@@ -19,15 +19,15 @@ class Python35Parser(Python3Parser):
|
|||||||
# Python 3.5+ has WITH_CLEANUP_START/FINISH
|
# Python 3.5+ has WITH_CLEANUP_START/FINISH
|
||||||
|
|
||||||
withstmt ::= expr SETUP_WITH exprlist suite_stmts_opt
|
withstmt ::= expr SETUP_WITH exprlist suite_stmts_opt
|
||||||
POP_BLOCK LOAD_CONST COME_FROM
|
POP_BLOCK LOAD_CONST COME_FROM_WITH
|
||||||
WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY
|
WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY
|
||||||
|
|
||||||
withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt
|
withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt
|
||||||
POP_BLOCK LOAD_CONST COME_FROM
|
POP_BLOCK LOAD_CONST COME_FROM_WITH
|
||||||
WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY
|
WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY
|
||||||
|
|
||||||
withasstmt ::= expr SETUP_WITH designator suite_stmts_opt
|
withasstmt ::= expr SETUP_WITH designator suite_stmts_opt
|
||||||
POP_BLOCK LOAD_CONST COME_FROM
|
POP_BLOCK LOAD_CONST COME_FROM_WITH
|
||||||
WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY
|
WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY
|
||||||
|
|
||||||
inplace_op ::= INPLACE_MATRIX_MULTIPLY
|
inplace_op ::= INPLACE_MATRIX_MULTIPLY
|
||||||
|
@@ -9,8 +9,6 @@ from xdis.bytecode import Bytecode
|
|||||||
|
|
||||||
control_flow_start = namedtuple('control_flow_start', ['name', 'type', 'offset'])
|
control_flow_start = namedtuple('control_flow_start', ['name', 'type', 'offset'])
|
||||||
control_flow_end = namedtuple('control_flow_end', ['name', 'type', 'offset'])
|
control_flow_end = namedtuple('control_flow_end', ['name', 'type', 'offset'])
|
||||||
control_flow_pair = namedtuple('control_flow_pair', ['name', 'start_offset', 'end_offset'])
|
|
||||||
|
|
||||||
|
|
||||||
class ControlFlow():
|
class ControlFlow():
|
||||||
def __init__(self, scanner):
|
def __init__(self, scanner):
|
||||||
|
@@ -206,7 +206,7 @@ class Scanner3(Scanner):
|
|||||||
# Adjust the grammar and remove the below
|
# Adjust the grammar and remove the below
|
||||||
and (self.opName(jump_offset)[len('SETUP_'):]
|
and (self.opName(jump_offset)[len('SETUP_'):]
|
||||||
== action.name)
|
== action.name)
|
||||||
and action.name in ['EXCEPT', 'LOOP']):
|
and action.name in ['EXCEPT', 'LOOP', 'WITH']):
|
||||||
come_from_name = '%s_%s' % (
|
come_from_name = '%s_%s' % (
|
||||||
(come_from_name, action.name))
|
(come_from_name, action.name))
|
||||||
pass
|
pass
|
||||||
|
Reference in New Issue
Block a user