Skip to content

fix: degrade gracefully when inspect.getframeinfo raises OSError#153

Open
SAY-5 wants to merge 1 commit into
Qix-:masterfrom
SAY-5:fix-graceful-frameinfo-failure
Open

fix: degrade gracefully when inspect.getframeinfo raises OSError#153
SAY-5 wants to merge 1 commit into
Qix-:masterfrom
SAY-5:fix-graceful-frameinfo-failure

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 13, 2026

Copy link
Copy Markdown

get_traceback_information calls inspect.getframeinfo(tb) which can raise OSError (e.g. FileNotFoundError from os.getcwd() when the cwd was removed, as reported on PyPy in #102); the unhandled exception aborts the excepthook entirely and the user sees no traceback at all. This wraps the call and falls back to filename/lineno/function from the traceback's frame and code object when source resolution fails, so the frame is still rendered (without source/locals) instead of crashing.

Closes #102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileNotFoundError on PyPy

1 participant