Skip to content

traceback.format_exc(e), cant pass e, that will cause exception in exception then crash #1664

@alenwesker

Description

@alenwesker

Before creating a new issue, please check the FAQ to see if your question is answered there.

Environment data

  • debugpy version: newest
  • OS and version: any
  • Python version (& distribution if applicable, e.g. Anaconda): any newer version
  • Using VS Code or Visual Studio:

Actual behavior

I was writing traceback.format_exc(e) in my project as well, as far as I remember, that's the way in the older versions, but any newer document and versions said, traceback.format_exe() does not accept e as the parameter

I am cleaning my code, then found that debugpy also contains lines like that: like eval_condition in breakpoint.py

Can anyone tell me when Python deletes that first parameter? Since there is code in pydebugy like that, we could call it like that once upon a time.

Expected behavior

cause exception in exception then crash

Steps to reproduce:

import sys

def some_function():
    try:
        raise RuntimeError("Some error message")
    except Exception as e:
        import traceback
        sys.stderr.write(traceback.format_exc(e))

if __name__ == '__main__':
    some_function()

Metadata

Metadata

Assignees

Labels

needs reproIssue has not been reproduced yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions