-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
When using dataclasses with slots=True, calling a no-arg super() raises a TypeError, the workaround of using the two-arg variant triggers a UP008 rule error. Would be great if the rule took this edge-case into consideration.
From the docs:
Calling no-arg super() in dataclasses using slots=True will result in the following exception being raised: TypeError: super(type, obj): obj must be an instance or subtype of type. The two-arg super() is a valid workaround.
How to reproduce:
@dataclass(slots=True)
class Foo:
bar: str
def __post_init__(self) -> None:
self.bar = "foo"
@dataclass(slots=True)
class Baz(Foo):
def __post_init__(self) -> None:
super(Baz, self).__post_init__() # UP008 Use `super()` instead of `super(__class__, self)`
self.bar = "baz"Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working