Skip to content

TypeError when using super() and slots=True #102

Closed
@p-himik

Description

@p-himik

This code

import attr


@attr.s(slots=True)
class A:
    def f(self):
        pass


@attr.s(slots=True)
class B(A):
    def f(self):
        super().f()


B().f()

results in this error

Traceback (most recent call last):
  File "test.py", line 16, in <module>
    B().f()
  File "test.py", line 13, in f
    super().f()
TypeError: super(type, obj): obj must be an instance or subtype of type

If I use super(B, self), everything works just fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions