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-90562: Fix super() without args calls for dataclasses with slots #111538

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Oct 31, 2023

@sobolevn
Copy link
Member Author

@ericvsmith friendly ping :)

@JelleZijlstra JelleZijlstra changed the title gh-111500: Fix super() without args calls for dataclasses with slots gh-90562: Fix super() without args calls for dataclasses with slots Mar 12, 2024
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a 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)
Copy link
Member

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?

Comment on lines +1238 to +1239
if isinstance(item, (classmethod, staticmethod)):
closure_cells = getattr(item.__func__, "__closure__", None)
Copy link
Member

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.

@serhiy-storchaka
Copy link
Member

and method with some common decorator.

For example partialmethod, singledispatchmethod and recursive_repr.

Oh, singledispatchmethod should be handled explicitly because, like property, it refers to multiple methods and closures should be fixed in all of them.

Then partial and singledispatch should probably also be supported, for static methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants