Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion rich/pretty.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def to_repr(obj: Any) -> str:
obj_repr = f"{obj[:max_string]!r}+{truncated}"
else:
try:
obj_repr = repr(obj)
obj_repr = get_repr(obj)
except Exception as error:
obj_repr = f"<repr-error {str(error)!r}>"
return obj_repr
Expand Down Expand Up @@ -935,6 +935,11 @@ def pprint(
)


def get_repr(obj: Any) -> str:
# Allow overriding the representation function from the outside.
return repr(obj)


if __name__ == "__main__": # pragma: no cover

class BrokenRepr:
Expand Down