Skip to content

Need to keep traceback alive in WITH_EXCEPT_START #130595

@DinoV

Description

@DinoV

Bug report

Bug description:

Currently in WITH_EXCEPT_START the interpreter loop gets the traceback from the exception object and then immediately decref's it before calling the __exit__ function. But the __exit__ function may not incref the traceback (if it's not an interpretedPython function) and could cause the traceback to be replaced on the exception, leading it holding onto a freed traceback.

CPython versions tested on:

CPython main branch, 3.12

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions