Skip to content

TypeError when calling super() in decorated method #1038

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.

Activity

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

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