Skip to content

TypeError when calling super() in decorated method #1038

Open
@kdebrab

Description

@kdebrab

Following code:

import attrs


def decorated(method):
    def wrapped(self, *args, **kwargs):
        return method(self, *args, **kwargs)

    return wrapped


@attrs.define()
class A:
    def f(self):
        pass


@attrs.define()
class B(A):
    @decorated
    def f(self):
        super().f()


B().f()

raises following error

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

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions