You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Merge branch 'python-3.3-to-3.5' into python-2.4
This commit is contained in:
@@ -473,7 +473,7 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
def is_return_none(self, node):
|
||||
# Is there a better way?
|
||||
ret = (
|
||||
node[0] == "ret_expr"
|
||||
node[0] == "return_expr"
|
||||
and node[0][0] == "expr"
|
||||
and node[0][0][0] == "LOAD_CONST"
|
||||
and node[0][0][0].pattr is None
|
||||
@@ -484,7 +484,7 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
# FIXME: should the SyntaxTree expression be folded into
|
||||
# the global RETURN_NONE constant?
|
||||
return ret or node == SyntaxTree(
|
||||
"return", [SyntaxTree("ret_expr", [NONE]), Token("RETURN_VALUE")]
|
||||
"return", [SyntaxTree("return_expr", [NONE]), Token("RETURN_VALUE")]
|
||||
)
|
||||
|
||||
# Python 3.x can have be dead code as a result of its optimization?
|
||||
@@ -596,7 +596,7 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
self.prec = p
|
||||
self.prune()
|
||||
|
||||
def n_ret_expr(self, node):
|
||||
def n_return_expr(self, node):
|
||||
if len(node) == 1 and node[0] == "expr":
|
||||
# If expr is yield we want parens.
|
||||
self.prec = PRECEDENCE["yield"] - 1
|
||||
@@ -604,7 +604,7 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
else:
|
||||
self.n_expr(node)
|
||||
|
||||
n_ret_expr_or_cond = n_expr
|
||||
n_return_expr_or_cond = n_expr
|
||||
|
||||
def n_bin_op(self, node):
|
||||
"""bin_op (formerly "binary_expr") is the Python AST BinOp"""
|
||||
@@ -1191,7 +1191,7 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
ast = self.build_ast(code._tokens, code._customize, code)
|
||||
self.customize(code._customize)
|
||||
|
||||
# skip over: sstmt, stmt, return, ret_expr
|
||||
# skip over: sstmt, stmt, return, return_expr
|
||||
# and other singleton derivations
|
||||
while len(ast) == 1 or (
|
||||
ast in ("sstmt", "return") and ast[-1] in ("RETURN_LAST", "RETURN_VALUE")
|
||||
|
Reference in New Issue
Block a user