You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Possibly linemap improvements
This commit is contained in:
@@ -69,7 +69,7 @@ def decompile(
|
||||
code_objects = code_objects,
|
||||
is_pypy = is_pypy,
|
||||
)
|
||||
header_count = 1+len(sys_version_lines)
|
||||
header_count = 3+len(sys_version_lines)
|
||||
linemap = [(line_no, deparsed.source_linemap[line_no]+header_count)
|
||||
for line_no in
|
||||
sorted(deparsed.source_linemap.keys())]
|
||||
|
@@ -27,6 +27,13 @@ class LineMapWalker(SourceWalker):
|
||||
self.source_linemap[self.current_line_number] = node.linestart
|
||||
return super(LineMapWalker, self).default(node)
|
||||
|
||||
def n_LOAD_CONST(self, node):
|
||||
if hasattr(node, 'linestart'):
|
||||
if node.linestart:
|
||||
self.source_linemap[self.current_line_number] = node.linestart
|
||||
return super(LineMapWalker, self).n_LOAD_CONST(node)
|
||||
|
||||
|
||||
class LineMapFragmentWalker(fragments.FragmentsWalker, LineMapWalker):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(LineMapFragmentWalker, self).__init__(*args, **kwargs)
|
||||
|
Reference in New Issue
Block a user