visualstudio_py_launcher_nodebug.py 文件源码

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

项目:pythonVSCode 作者: DonJayamanne 项目源码 文件源码
def handle_exception(exc_type, exc_value, exc_tb):
    # Specifies list of files not to display in stack trace.
    do_not_debug = [__file__, _vspu.__file__]
    if sys.version_info >= (3, 3):
        do_not_debug.append('<frozen importlib._bootstrap>')
    if sys.version_info >= (3, 5):
        do_not_debug.append('<frozen importlib._bootstrap_external>')

    # Remove debugger frames from the top and bottom of the traceback.
    tb = traceback.extract_tb(exc_tb)
    for i in [0, -1]:
        while tb:
            frame_file = path.normcase(tb[i][0])
            if not any(is_same_py_file(frame_file, f) for f in do_not_debug):
                break
            del tb[i]

    # Print the traceback.
    if tb:
        sys.stderr.write('Traceback (most recent call last):')
        for out in traceback.format_list(tb):
            sys.stderr.write(out)
            sys.stderr.flush()

    # Print the exception.
    for out in traceback.format_exception_only(exc_type, exc_value):
        sys.stderr.write(out)
        sys.stderr.flush()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号