Skip to content

Easy Post Mortem Function #1530

@Sharpz7

Description

@Sharpz7

Hey Folks, feel free to close if this is not appropriate.

I am aware this has been brought up in different forms (https://github.com/microsoft/debugpy/issues?q=is%3Aissue+post+mortem+is%3Aclosed), but looking through the solutions, I never saw anything as simple as https://docs.python.org/3/library/pdb.html#pdb.post_mortem

So I created https://github.com/SharpSet/afterthought, which works pretty much as a direct equivalent to pdb.post_mortem, and uses debugpy behind the scenes with less than 30 lines of boilerplate.

import afterthought


def bombs():
    a = []
    print(a[0])


if __name__ == "__main__":
    try:
        bombs()
    except Exception as e:
        afterthought.debug(e)

I think it would make sense for this to exist within debugpy directly. If this is not of interest, I still would like to keep this issue here so people can see how I handled it. To the best of my knowledge I couldn't find anything this simple.

Thanks :))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions