You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Correct getting code node on mkfunc
This commit is contained in:
@@ -79,14 +79,13 @@ from uncompyle6.semantics import pysource
|
|||||||
from uncompyle6.semantics.check_ast import checker
|
from uncompyle6.semantics.check_ast import checker
|
||||||
from uncompyle6.semantics.consts import (
|
from uncompyle6.semantics.consts import (
|
||||||
INDENT_PER_LEVEL,
|
INDENT_PER_LEVEL,
|
||||||
MAP,
|
|
||||||
NONE,
|
NONE,
|
||||||
PASS,
|
PASS,
|
||||||
PRECEDENCE,
|
PRECEDENCE,
|
||||||
TABLE_DIRECT,
|
TABLE_DIRECT,
|
||||||
TABLE_R,
|
|
||||||
escape,
|
escape,
|
||||||
)
|
)
|
||||||
|
from uncompyle6.semantics.helper import find_code_node
|
||||||
from uncompyle6.semantics.pysource import (
|
from uncompyle6.semantics.pysource import (
|
||||||
DEFAULT_DEBUG_OPTS,
|
DEFAULT_DEBUG_OPTS,
|
||||||
TREE_DEFAULT_DEBUG,
|
TREE_DEFAULT_DEBUG,
|
||||||
@@ -596,17 +595,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
|||||||
def n_mkfunc(self, node):
|
def n_mkfunc(self, node):
|
||||||
start = len(self.f.getvalue())
|
start = len(self.f.getvalue())
|
||||||
|
|
||||||
if self.version >= (3, 3) or node[-2] == "kwargs":
|
code_node = find_code_node(node, -2)
|
||||||
# LOAD_CONST code object ..
|
|
||||||
# LOAD_CONST 'x0' if >= 3.3
|
|
||||||
# MAKE_FUNCTION ..
|
|
||||||
code_node = node[-3]
|
|
||||||
elif node[-2] == "expr":
|
|
||||||
code_node = node[-2][0]
|
|
||||||
else:
|
|
||||||
# LOAD_CONST code object ..
|
|
||||||
# MAKE_FUNCTION ..
|
|
||||||
code_node = node[-2]
|
|
||||||
func_name = code_node.attr.co_name
|
func_name = code_node.attr.co_name
|
||||||
self.write(func_name)
|
self.write(func_name)
|
||||||
self.set_pos_info(code_node, start, len(self.f.getvalue()))
|
self.set_pos_info(code_node, start, len(self.f.getvalue()))
|
||||||
|
Reference in New Issue
Block a user