Initializing a Traceback object with a non-default locals_max_length or locals_max_string does not affected the locals when printed. MRE below:
from rich.console import Console
from rich.traceback import Traceback
console = Console()
def bad_func():
# Arbitrary local data which is longer than default max length
from string import ascii_letters
_locals = {k: k * 150 for k in ascii_letters}
try:
1 / 0
except Exception:
tb = Traceback(
show_locals=True,locals_max_length=None, locals_max_string=None,
)
console.print(tb)
bad_func()
Which, according to the docs, setting either limit to None should disable truncation and remove the ... and ... + 42.
The problem is not in the rich.pretty.traverse function, which implements this correctly, as can be seen by calling patching the function to hard-code in a non-default limit, which is then properly applied.
Describe the bug
Initializing a
Traceback
object with a non-defaultlocals_max_length
orlocals_max_string
does not affected the locals when printed. MRE below:This prints the following traceback:
Which, according to the docs, setting either limit to
None
should disable truncation and remove the...
and... + 42
.The problem is not in the
rich.pretty.traverse
function, which implements this correctly, as can be seen by calling patching the function to hard-code in a non-default limit, which is then properly applied.Platform
Click to expand
What platform (Win/Linux/Mac) are you running on? What terminal software are you using? Problem is present on Linux and Mac, `rich==13.7.1` ``` ─────────────────────────