Skip to content

Adding a decorator to a dataclass breaks the signature #11162

@Triconsult

Description

@Triconsult

Describe the bug
Adding a decorator on top of @dataclasses.dataclass messes up the class's call signature.

Code or Screenshots

import dataclasses
import typing as t


def some_decorator[**P, R](func: t.Callable[P, R]) -> t.Callable[P, R]:
    return func


@some_decorator
@dataclasses.dataclass
class MyClass:
    foo: str


MyClass('hello')  # Error: Expected 0 positional arguments

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions