File: recursive_error.py

package info (click to toggle)
rich 13.9.4-1.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 20,284 kB
  • sloc: python: 29,157; makefile: 29
file content (25 lines) | stat: -rw-r--r-- 324 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""

Demonstrates Rich tracebacks for recursion errors.

Rich can exclude frames in the middle to avoid huge tracebacks.

"""

from rich.console import Console


def foo(n):
    return bar(n)


def bar(n):
    return foo(n)


console = Console()

try:
    foo(1)
except Exception:
    console.print_exception(max_frames=20)