Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide frame from tracebacks #2207

Closed
willmcgugan opened this issue Apr 20, 2022 · 3 comments · Fixed by #2226
Closed

Hide frame from tracebacks #2207

willmcgugan opened this issue Apr 20, 2022 · 3 comments · Fixed by #2226
Assignees
Labels
accepted Task was accepted

Comments

@willmcgugan
Copy link
Collaborator

Sometimes it is useful to completely omit a frame from a traceback. Suggest a local variable with a name like _rich_traceback_omit

@olivierphi
Copy link
Contributor

Not sure I understand correctly, sorry... 😅

Do you mean something like this?

@dataclass
class Frame:
    filename: str
    lineno: int
    name: str
    line: str = ""
    locals: Optional[Dict[str, pretty.Node]] = None
    _rich_traceback_omit: bool = False # <-- new opt-in allowing to exclude that frame

...which would be powered behind the scenes by something like the possibility to simply add _rich_traceback_omit = True to the locals of any Python object.
...and that we would detect when we create the Frame object, as we have frame_summary.f_locals at this point?

@willmcgugan
Copy link
Collaborator Author

Essentially that. The idea is that Textual can remove things like descriptors from the traceback, so the user doesn't see noise from the library code.

We do something similar to omit library code (see suppress)

@github-actions
Copy link

Did I solve your problem?

Why not buy the devs a coffee to say thanks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Task was accepted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants