Skip to content

should_hide_frame fails to consider __hide_traceback__ in any frame with a __name__ #387

Description

@millimat

def should_hide_frame(frame):
# type: (Any) -> bool
try:
mod = frame.f_globals["__name__"]
return mod.startswith("sentry_sdk.")
except (AttributeError, KeyError):
pass
for flag_name in "__traceback_hide__", "__tracebackhide__":
try:
if frame.f_locals[flag_name]:
return True
except Exception:
pass
return False

If __name__ is in frame.f_globals and is a string, then no check for __hide_traceback__ is ever performed, which effectively makes that variable unusable to hide a frame from a stacktrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions