`abc.ABC.__slots__` should be marked with `ClassVar`
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
According to the python official documentation, slots are class variables. Therefore, in the class abc.ABC, the variable __slots__ should be annotated as ClassVar[Sequence[str]]. There is currently no annotation. It means that in all subclasses of abc.ABC, the variable __slots__ is considered as an instance variable.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the typeshed stub defining abc.ABC and inspect how slots is currently declared. Mark it as ClassVar[Sequence[str]], then verify that subclasses no longer treat slots as an instance variable using the repository's relevant type-checking tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100