You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Better simpler fragment fix...
remove hide_internal test. We changed the default and that's what whas causing RETURN_LAST to not get included.
This commit is contained in:
@@ -68,11 +68,6 @@ class Python3Parser(PythonParser):
|
|||||||
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
||||||
JUMP_BACK RETURN_VALUE RETURN_LAST
|
JUMP_BACK RETURN_VALUE RETURN_LAST
|
||||||
|
|
||||||
# FIXME: This is used only in the fragment parser
|
|
||||||
# Fix the fragment parser so that it adds RETURN_LAST
|
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
|
||||||
JUMP_BACK RETURN_VALUE
|
|
||||||
|
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
||||||
COME_FROM JUMP_BACK RETURN_VALUE RETURN_LAST
|
COME_FROM JUMP_BACK RETURN_VALUE RETURN_LAST
|
||||||
|
|
||||||
@@ -346,10 +341,6 @@ class Python3Parser(PythonParser):
|
|||||||
stmt ::= return_closure
|
stmt ::= return_closure
|
||||||
return_closure ::= LOAD_CLOSURE RETURN_VALUE RETURN_LAST
|
return_closure ::= LOAD_CLOSURE RETURN_VALUE RETURN_LAST
|
||||||
|
|
||||||
# FIXME: This is used only in the fragment parser
|
|
||||||
# Fix the fragment parser so that it adds RETURN_LAST
|
|
||||||
return_closure ::= LOAD_CLOSURE RETURN_VALUE
|
|
||||||
|
|
||||||
stmt ::= whileTruestmt
|
stmt ::= whileTruestmt
|
||||||
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite _come_froms
|
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite _come_froms
|
||||||
"""
|
"""
|
||||||
|
@@ -969,7 +969,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
|||||||
if node[0] == "LOAD_LISTCOMP":
|
if node[0] == "LOAD_LISTCOMP":
|
||||||
start = len(self.f.getvalue())
|
start = len(self.f.getvalue())
|
||||||
self.set_pos_info(node[0], start - 1, start)
|
self.set_pos_info(node[0], start - 1, start)
|
||||||
self.comprehension_walk3(node, 1, 0)
|
self.comprehension_walk_newer(node, 1, 0)
|
||||||
self.write("]")
|
self.write("]")
|
||||||
self.prune()
|
self.prune()
|
||||||
|
|
||||||
@@ -1163,7 +1163,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
|||||||
self.p.insts = self.scanner.insts
|
self.p.insts = self.scanner.insts
|
||||||
ast = python_parser.parse(self.p, tokens, customize)
|
ast = python_parser.parse(self.p, tokens, customize)
|
||||||
self.p.insts = p_insts
|
self.p.insts = p_insts
|
||||||
except (parser.ParserError, AssertionError) as e:
|
except (python_parser.ParserError, AssertionError) as e:
|
||||||
raise ParserError(e, tokens)
|
raise ParserError(e, tokens)
|
||||||
maybe_show_tree(self, ast)
|
maybe_show_tree(self, ast)
|
||||||
return ast
|
return ast
|
||||||
@@ -1178,7 +1178,6 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
|||||||
#
|
#
|
||||||
# NOTE: this differs from behavior in pysource.py
|
# NOTE: this differs from behavior in pysource.py
|
||||||
|
|
||||||
if self.hide_internal:
|
|
||||||
if len(tokens) >= 2 and not noneInNames:
|
if len(tokens) >= 2 and not noneInNames:
|
||||||
if tokens[-1].kind in ("RETURN_VALUE", "RETURN_VALUE_LAMBDA"):
|
if tokens[-1].kind in ("RETURN_VALUE", "RETURN_VALUE_LAMBDA"):
|
||||||
# Python 3.4's classes can add a "return None" which is
|
# Python 3.4's classes can add a "return None" which is
|
||||||
|
Reference in New Issue
Block a user