util.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:QTAF 作者: Tencent 项目源码 文件源码
def get_thread_traceback(thread):
    '''????????????

    :param thread: ????????
    :type thread: Thread
    '''
    for thread_id, stack in sys._current_frames().items():
        if thread_id != thread.ident:
            continue
        tb = "Traceback ( thread-%d possibly hold at ):\n" % thread_id
        for filename, lineno, name, line in traceback.extract_stack(stack):
            tb += '  File: "%s", line %d, in %s\n' % (filename, lineno, name)
            if line:
                tb += "    %s\n" % (line.strip())
        return tb
    else:
        raise RuntimeError("thread not found")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号