-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when subclassing a dataclass with a field that uses a defaultfactory #77077
Comments
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __init__() missing 1 required positional argument: 'x' I understand that this is desired behavior when the subclass contains non-default attributes. But subclasses that define no additional attributes should work just the same as those that define only additional default attributes. A similar issue was raised and dismissed when dataclasses was in development on GitHub: ericvsmith/dataclasses#112, but that only concerned the case of subclasses defining non-default attributes. |
That's a great bug report. Thanks for the tiny code to replicate it. It turns out the code isn't quite doing what I thought. I'll have to give some thought to exactly how I'm going to handle this without breaking other cases, but I should have it fixed soon. Thanks again. |
Thanks again for the bug report. This ended up being a simple fix, but an important one. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: