feat: Traceback - Expose more locals rendering options#3906
Merged
willmcgugan merged 2 commits intoTextualize:masterfrom Jan 22, 2026
Merged
feat: Traceback - Expose more locals rendering options#3906willmcgugan merged 2 commits intoTextualize:masterfrom
willmcgugan merged 2 commits intoTextualize:masterfrom
Conversation
| almost made an exactly the same PR, haha
def test_locals_max_depth(): console = Console(width=80, file=io.StringIO(), color_system=None) try: data = {"a": {"b": {"c": 1}}} 1 / 0 except Exception: exc_type, exc_value, tb = sys.exc_info() traceback = Traceback.from_exception( exc_type, exc_value, tb, show_locals=True, locals_max_depth=1, ) console.print(traceback) exception_text = console.file.getvalue() assert "data = {'a': {...}}" in exception_textI can help to add those changes, but I'm not sure what's the best way to do it, I guess i need to create a new PR based on this one? |
willmcgugan approved these changes Jan 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of changes
AI?
AI generated PRs may be accepted, but only if @willmcgugan has responded on an issue or discussion.
Checklist
Description
Hi! I ran into an issue where rich tracebacks were spamming my logs with deeply nested items & found no way to reduce this.
This PR is a simple re-implementation of the accepted PR #3415 where the author did not respond to fix merge conflicts :)
Please see the above mentioned PR for information & background.
I simply moved over the changes