diff --git a/CHANGELOG.md b/CHANGELOG.md index ef65c7a78..078a5c050 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Progress track thread is now a daemon thread https://github.com/Textualize/rich/pull/3402 - Fixed cached hash preservation upon clearing meta and links https://github.com/Textualize/rich/issues/2942 - Fixed overriding the `background_color` of `Syntax` not including padding https://github.com/Textualize/rich/issues/3295 +- Fixed pretty printing of dataclasses with a default repr in Python 3.13 https://github.com/Textualize/rich/pull/3455 - Fixed selective enabling of highlighting when disabled in the `Console` https://github.com/Textualize/rich/issues/3419 - Fixed BrokenPipeError writing an error message https://github.com/Textualize/rich/pull/3468 - Fixed superfluous space above Markdown tables https://github.com/Textualize/rich/pull/3469 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index edacc5885..7b95e1484 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -85,3 +85,4 @@ The following people have contributed to the development of Rich: - [Pierro](https://github.com/xpierroz) - [Bernhard Wagner](https://github.com/bwagner) - [Aaron Beaudoin](https://github.com/AaronBeaudoin) +- [Jonathan Helmus](https://github.com/jjhelmus) diff --git a/rich/pretty.py b/rich/pretty.py index fa340212e..e0c78f627 100644 --- a/rich/pretty.py +++ b/rich/pretty.py @@ -3,6 +3,7 @@ import dataclasses import inspect import os +import reprlib import sys from array import array from collections import Counter, UserDict, UserList, defaultdict, deque @@ -78,7 +79,10 @@ def _is_dataclass_repr(obj: object) -> bool: # Digging in to a lot of internals here # Catching all exceptions in case something is missing on a non CPython implementation try: - return obj.__repr__.__code__.co_filename == dataclasses.__file__ + return obj.__repr__.__code__.co_filename in ( + dataclasses.__file__, + reprlib.__file__, + ) except Exception: # pragma: no coverage return False