summaryrefslogtreecommitdiffstats
path: root/Lib/dataclasses.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/dataclasses.py')
-rw-r--r--Lib/dataclasses.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index 84f8d68..31dc6f8 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -1567,15 +1567,15 @@ def _replace(obj, /, **changes):
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
- raise ValueError(f'field {f.name} is declared with '
- 'init=False, it cannot be specified with '
- 'replace()')
+ raise TypeError(f'field {f.name} is declared with '
+ f'init=False, it cannot be specified with '
+ f'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
- raise ValueError(f"InitVar {f.name!r} "
- 'must be specified with replace()')
+ raise TypeError(f"InitVar {f.name!r} "
+ f'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and