Skip to content
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

gh-92231: Prevent @dataclass from being used more than once on the same class #92294

Conversation

rohitsanj
Copy link

@rohitsanj rohitsanj commented May 4, 2022

@rohitsanj rohitsanj requested a review from ericvsmith as a code owner May 4, 2022 07:48
@cpython-cla-bot
Copy link

cpython-cla-bot bot commented May 4, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@AlexWaygood AlexWaygood added type-feature A feature request or enhancement stdlib Python modules in the Lib dir labels May 4, 2022
@TeamSpen210
Copy link

Couldn't you just check _FIELDS in vars(cls), to see if this class (not its bases) was modified?

@ericvsmith
Copy link
Member

Couldn't you just check _FIELDS in vars(cls), to see if this class (not its bases) was modified?

Yes, that's what my PR does. I'm going to close this in favor of that approach.

@ericvsmith ericvsmith closed this May 4, 2022
@rohitsanj rohitsanj deleted the prevent-dataclass-decorator-called-twice branch May 4, 2022 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants