-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
Bug: super() call in @dataclass(slots=True) causes TypeError #810
Comments
Gumminess
changed the title
Bug: super() call in @dataclass(slots=True) causes
Bug: super() call in @dataclass(slots=True) causes TypeError
Mar 24, 2023
there's a few duplicates. this isn't a pyupgrade problem but a problem with dataclasses |
h4l
added a commit
to h4l/v8serialize
that referenced
this issue
Sep 14, 2024
Except for super() simplifications, which break dataclasses: asottile/pyupgrade#810
This is a pyupgrade problem. Dataclass with slots creates a new class, because it's required for slots to work. Pyupgrade breaks the required format for datalass super with slots. |
bet. python/cpython#90562 |
Repository owner
locked as off-topic and limited conversation to collaborators
Sep 30, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When running this example you will get
TypeError: super(type, obj): obj must be an instance or subtype of type
The solution is to call
super(Derived, self)
instead ofsuper()
, as explained hereThe problem is that pyupgrade simplifies this to just plain
super()
, which is ok in most cases, but not here. As this is a standard behavior of a standard library, there should be a special case for this in pyupgrade.The text was updated successfully, but these errors were encountered: