commit | 3d70f7aef614c396f516b5fccedeebe98598714d | [log] [tgz] |
---|---|---|
author | Dong-hee Na <donghee.na92@gmail.com> | Sat Jun 23 23:46:32 2018 +0900 |
committer | Eric V. Smith <ericvsmith@users.noreply.github.com> | Sat Jun 23 10:46:32 2018 -0400 |
tree | b811dc51f5c680418baa0629eb16fb5b6fca9b94 | |
parent | 66ecefcfe77348ce12d3a951e8e6cd3ad274b24a [diff] [blame] |
bpo-33805: Improve error message of dataclasses.replace() (GH-7580)
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py index 96bf6e1..ad7bf0f 100644 --- a/Lib/dataclasses.py +++ b/Lib/dataclasses.py
@@ -1173,6 +1173,9 @@ continue if f.name not in changes: + if f._field_type is _FIELD_INITVAR: + raise ValueError(f"InitVar {f.name!r} " + 'must be specified with replace()') changes[f.name] = getattr(obj, f.name) # Create the new object, which calls __init__() and