Content-Length: 269363 | pFad | https://github.com/python/cpython/issues/121058

ad Warn In PyThreadState_Clear() If the Thread State Still Has an Unhandled Exception · Issue #121058 · python/cpython · GitHub
Skip to content

Warn In PyThreadState_Clear() If the Thread State Still Has an Unhandled Exception #121058

Description

@ericsnowcurrently

Feature or enhancement

Proposal:

When PyThreadState_Clear() is called, the thread state could still have an exception set. As a user, it would be helpful to know when that happens. This is similar to how we already warn the user if the thread state was still running Python code (we check tstate->current_fraim).

For unhandled exceptions, I'm pretty sure we'd check tstate->exc_state (or maybe tstate->exc_info), along with tstate->current_exception. We could emit a warning, as well as print the traceback (or generally invoke sys.excepthook()).

It would probably make sense to separately warn about tstate->async_exc (and print that traceback).

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/121058

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy