def get_disassembly(self, func, lasti=-1, wrapper=True):
s = io.StringIO()
save_stdout = sys.stdout
sys.stdout = s
try:
if wrapper:
dis.dis(func)
else:
dis.disassemble(func, lasti)
finally:
sys.stdout = save_stdout
# Trim trailing blanks (if any).
return [line.rstrip() for line in s.getvalue().splitlines()]
评论列表
文章目录