-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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-90562: Fix super()
without args calls for dataclasses
with slots
#111538
base: main
Are you sure you want to change the base?
Conversation
@ericvsmith friendly ping :) |
super()
without args calls for dataclasses
with slotssuper()
without args calls for dataclasses
with slots
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests for classmethod, staticmethod, property (with and without getter, setter and deleter), cached_property, normal method and method with some common decorator.
if isinstance(item, (classmethod, staticmethod)): | ||
closure_cells = getattr(item.__func__, "__closure__", None) | ||
elif isinstance(item, property): | ||
closure_cells = getattr(item.fget, "__closure__", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if a getter doesn't have a closure, but a setter or deleter does?
if isinstance(item, (classmethod, staticmethod)): | ||
closure_cells = getattr(item.__func__, "__closure__", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
classmethod
and staticmethod
have the __wrapped__
attribute since 3.10, so this code is perhaps dead.
For example Oh, Then |
Thanks a lot to @hynek for the attrs project :)
Credit goes to https://github.com/python-attrs/attrs/blob/52c1cd97d723cde6d75259a22d218f9305ecf8ee/src/attr/_make.py#L884-L912