diff options
author | Alex Waygood <Alex.Waygood@Gmail.com> | 2023-03-23 14:17:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-23 14:17:54 (GMT) |
commit | baf4eb083c09b323cc12b8636c28c14089b87de8 (patch) | |
tree | 1dc001e010df806e7d341d466bb592103be28d64 /Lib/dataclasses.py | |
parent | 08254be6c5324416081cc28a047b377e1f4ed644 (diff) | |
download | cpython-baf4eb083c09b323cc12b8636c28c14089b87de8.zip cpython-baf4eb083c09b323cc12b8636c28c14089b87de8.tar.gz cpython-baf4eb083c09b323cc12b8636c28c14089b87de8.tar.bz2 |
gh-102947: Improve traceback when calling `fields()` on a non-dataclass (#102948)
Diffstat (limited to 'Lib/dataclasses.py')
-rw-r--r-- | Lib/dataclasses.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py index 82b08fc..e3fd0b3 100644 --- a/Lib/dataclasses.py +++ b/Lib/dataclasses.py @@ -1248,7 +1248,7 @@ def fields(class_or_instance): try: fields = getattr(class_or_instance, _FIELDS) except AttributeError: - raise TypeError('must be called with a dataclass type or instance') + raise TypeError('must be called with a dataclass type or instance') from None # Exclude pseudo-fields. Note that fields is sorted by insertion # order, so the order of the tuple is as the fields were defined. |