mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-11-26 22:50:40 +00:00
Mis spelling corrections
This commit is contained in:
parent
daf54d2740
commit
b88af23406
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,6 +17,7 @@
|
|||||||
/dist
|
/dist
|
||||||
/how-to-make-a-release.txt
|
/how-to-make-a-release.txt
|
||||||
/nose-*.egg
|
/nose-*.egg
|
||||||
|
/pycharm-venv
|
||||||
/tmp
|
/tmp
|
||||||
/uncompyle6.egg-info
|
/uncompyle6.egg-info
|
||||||
/unpyc
|
/unpyc
|
||||||
|
@ -80,8 +80,8 @@ class Python38Parser(Python37Parser):
|
|||||||
JUMP_BACK COME_FROM_FINALLY
|
JUMP_BACK COME_FROM_FINALLY
|
||||||
END_ASYNC_FOR
|
END_ASYNC_FOR
|
||||||
|
|
||||||
# FIXME: come froms after the else_suite or END_ASYNC_FOR distinguish which of
|
# FIXME: "come_froms" after the "else_suite" or END_ASYNC_FOR distinguish which of
|
||||||
# for / forelse is used. Add come froms and check of add up control-flow detection phase.
|
# for / forelse is used. Add "come_froms" and check of add up control-flow detection phase.
|
||||||
async_forelse_stmt38 ::= expr
|
async_forelse_stmt38 ::= expr
|
||||||
GET_AITER
|
GET_AITER
|
||||||
SETUP_FINALLY
|
SETUP_FINALLY
|
||||||
|
@ -4,7 +4,6 @@ from uncompyle6.scanners.tok import Token
|
|||||||
|
|
||||||
|
|
||||||
def for_block_invalid(self, lhs, n, rule, tree, tokens, first: int, last: int) -> bool:
|
def for_block_invalid(self, lhs, n, rule, tree, tokens, first: int, last: int) -> bool:
|
||||||
|
|
||||||
# print("XXX", first, last)
|
# print("XXX", first, last)
|
||||||
# for t in range(first, last):
|
# for t in range(first, last):
|
||||||
# print(tokens[t])
|
# print(tokens[t])
|
||||||
@ -51,8 +50,8 @@ def for_block_invalid(self, lhs, n, rule, tree, tokens, first: int, last: int) -
|
|||||||
pop_jump_index -= 1
|
pop_jump_index -= 1
|
||||||
|
|
||||||
# FIXME: something is fishy when and EXTENDED ARG is needed before the
|
# FIXME: something is fishy when and EXTENDED ARG is needed before the
|
||||||
# pop_jump_index instruction to get the argment. In this case, the
|
# pop_jump_index instruction to get the argument. In this case, the
|
||||||
# _ifsmtst_jump can jump to a spot beyond the come_froms.
|
# _ifsmtst_jump can jump to a spot beyond the ``come_froms``.
|
||||||
# That is going on in the non-EXTENDED_ARG case is that the POP_JUMP_IF
|
# That is going on in the non-EXTENDED_ARG case is that the POP_JUMP_IF
|
||||||
# jumps to a JUMP_(FORWARD) which is changed into an EXTENDED_ARG POP_JUMP_IF
|
# jumps to a JUMP_(FORWARD) which is changed into an EXTENDED_ARG POP_JUMP_IF
|
||||||
# to the jumped forwarded address
|
# to the jumped forwarded address
|
||||||
|
@ -44,7 +44,6 @@ IFELSE_STMT_RULES = frozenset(
|
|||||||
|
|
||||||
|
|
||||||
def ifelsestmt2(self, lhs, n, rule, tree, tokens, first, last):
|
def ifelsestmt2(self, lhs, n, rule, tree, tokens, first, last):
|
||||||
|
|
||||||
if (last + 1) < n and tokens[last + 1] == "COME_FROM_LOOP" and lhs != "ifelsestmtc":
|
if (last + 1) < n and tokens[last + 1] == "COME_FROM_LOOP" and lhs != "ifelsestmtc":
|
||||||
# ifelsestmt jumped outside of loop. No good.
|
# ifelsestmt jumped outside of loop. No good.
|
||||||
return True
|
return True
|
||||||
@ -66,7 +65,7 @@ def ifelsestmt2(self, lhs, n, rule, tree, tokens, first, last):
|
|||||||
if raise_stmt1 == "raise_stmt1" and raise_stmt1[0] in ("LOAD_ASSERT",):
|
if raise_stmt1 == "raise_stmt1" and raise_stmt1[0] in ("LOAD_ASSERT",):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Make sure all of the "come froms" offset at the
|
# Make sure all of the "come_froms" offset at the
|
||||||
# end of the "if" come from somewhere inside the "if".
|
# end of the "if" come from somewhere inside the "if".
|
||||||
# Since the come_froms are ordered so that lowest
|
# Since the come_froms are ordered so that lowest
|
||||||
# offset COME_FROM is last, it is sufficient to test
|
# offset COME_FROM is last, it is sufficient to test
|
||||||
|
@ -4,7 +4,6 @@ from uncompyle6.scanners.tok import Token
|
|||||||
|
|
||||||
|
|
||||||
def ifstmts_jump(self, lhs, n, rule, ast, tokens, first, last):
|
def ifstmts_jump(self, lhs, n, rule, ast, tokens, first, last):
|
||||||
|
|
||||||
if len(rule[1]) <= 1 or not ast:
|
if len(rule[1]) <= 1 or not ast:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ def ifstmts_jump(self, lhs, n, rule, ast, tokens, first, last):
|
|||||||
pop_jump_index -= 1
|
pop_jump_index -= 1
|
||||||
|
|
||||||
# FIXME: something is fishy when and EXTENDED ARG is needed before the
|
# FIXME: something is fishy when and EXTENDED ARG is needed before the
|
||||||
# pop_jump_index instruction to get the argment. In this case, the
|
# pop_jump_index instruction to get the argument. In this case, the
|
||||||
# _ifsmtst_jump can jump to a spot beyond the come_froms.
|
# _ifsmtst_jump can jump to a spot beyond the come_froms.
|
||||||
# That is going on in the non-EXTENDED_ARG case is that the POP_JUMP_IF
|
# That is going on in the non-EXTENDED_ARG case is that the POP_JUMP_IF
|
||||||
# jumps to a JUMP_(FORWARD) which is changed into an EXTENDED_ARG POP_JUMP_IF
|
# jumps to a JUMP_(FORWARD) which is changed into an EXTENDED_ARG POP_JUMP_IF
|
||||||
@ -34,16 +33,11 @@ def ifstmts_jump(self, lhs, n, rule, ast, tokens, first, last):
|
|||||||
|
|
||||||
pop_jump_offset = tokens[pop_jump_index].off2int(prefer_last=False)
|
pop_jump_offset = tokens[pop_jump_index].off2int(prefer_last=False)
|
||||||
if isinstance(come_froms, Token):
|
if isinstance(come_froms, Token):
|
||||||
if (
|
if tokens[pop_jump_index].attr < pop_jump_offset and ast[0] != "pass":
|
||||||
tokens[pop_jump_index].attr < pop_jump_offset and ast[0] != "pass"
|
|
||||||
):
|
|
||||||
# This is a jump backwards to a loop. All bets are off here when there the
|
# This is a jump backwards to a loop. All bets are off here when there the
|
||||||
# unless statement is "pass" which has no instructions associated with it.
|
# unless statement is "pass" which has no instructions associated with it.
|
||||||
return False
|
return False
|
||||||
return (
|
return come_froms.attr is not None and pop_jump_offset > come_froms.attr
|
||||||
come_froms.attr is not None
|
|
||||||
and pop_jump_offset > come_froms.attr
|
|
||||||
)
|
|
||||||
|
|
||||||
elif len(come_froms) == 0:
|
elif len(come_froms) == 0:
|
||||||
return False
|
return False
|
||||||
|
@ -54,8 +54,13 @@ class Scanner37Base(Scanner):
|
|||||||
super(Scanner37Base, self).__init__(version, show_asm, is_pypy)
|
super(Scanner37Base, self).__init__(version, show_asm, is_pypy)
|
||||||
self.offset2tok_index = None
|
self.offset2tok_index = None
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
|
|
||||||
|
# True is code is from PyPy
|
||||||
self.is_pypy = is_pypy
|
self.is_pypy = is_pypy
|
||||||
|
|
||||||
|
# Bytecode converted into instruction
|
||||||
|
self.insts = []
|
||||||
|
|
||||||
# Create opcode classification sets
|
# Create opcode classification sets
|
||||||
# Note: super initialization above initializes self.opc
|
# Note: super initialization above initializes self.opc
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ class ComprehensionMixin:
|
|||||||
assert store, "Couldn't find store in list/set comprehension"
|
assert store, "Couldn't find store in list/set comprehension"
|
||||||
|
|
||||||
# A problem created with later Python code generation is that there
|
# A problem created with later Python code generation is that there
|
||||||
# is a lamda set up with a dummy argument name that is then called
|
# is a lambda set up with a dummy argument name that is then called
|
||||||
# So we can't just translate that as is but need to replace the
|
# So we can't just translate that as is but need to replace the
|
||||||
# dummy name. Below we are picking out the variable name as seen
|
# dummy name. Below we are picking out the variable name as seen
|
||||||
# in the code. And trying to generate code for the other parts
|
# in the code. And trying to generate code for the other parts
|
||||||
|
@ -43,7 +43,7 @@ def make_function2(self, node, is_lambda, nested=1, code_node=None):
|
|||||||
- handle defaults
|
- handle defaults
|
||||||
- handle format tuple parameters
|
- handle format tuple parameters
|
||||||
"""
|
"""
|
||||||
# if formal parameter is a tuple, the paramater name
|
# if formal parameter is a tuple, the parameter name
|
||||||
# starts with a dot (eg. '.1', '.2')
|
# starts with a dot (eg. '.1', '.2')
|
||||||
if name.startswith("."):
|
if name.startswith("."):
|
||||||
# replace the name with the tuple-string
|
# replace the name with the tuple-string
|
||||||
|
Loading…
Reference in New Issue
Block a user