You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically if one has a dataclass which defines an InitVars with a default value, and then uses dataclasses.replace on an instance without passing the init var as parameter to replace, a ValueError: InitVar '...' must be specified with replace() error is raised.
This is bad, because the InitVar already defines its default value, there's no need to expect a value when using replace().
It makes it impossible to use replace() at the same time as default InitVars.
The fix is trivial and there are already two PRs to upstream cpython dataclasses.
This is the same issue as https://bugs.python.org/issue36470, I open a new issue here for greater visibility.
Basically if one has a dataclass which defines an
InitVars
with a default value, and then usesdataclasses.replace
on an instance without passing the init var as parameter to replace, aValueError: InitVar '...' must be specified with replace()
error is raised.This is bad, because the InitVar already defines its default value, there's no need to expect a value when using replace().
It makes it impossible to use replace() at the same time as default InitVars.
The fix is trivial and there are already two PRs to upstream cpython dataclasses.
python/cpython#17441
python/cpython#20867
The text was updated successfully, but these errors were encountered: