Adding a decorator to a dataclass breaks the signature
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
**Describe the bug**
Adding a decorator on top of `@dataclasses.dataclass` messes up the class's call signature.
**Code or Screenshots**
```python
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
```
Contributor guide
Research direction
Start with the supplied Python reproducer and trace how Pyright analyzes a dataclass wrapped by a generic decorator. Look for the existing handling of synthesized dataclass call signatures and verify the behavior with MyClass('hello'). Done means the example no longer reports an incorrect zero-argument signature.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100