dataclass with slots=True, init=False raises AttributeError
Open
@ericvsmith is already working on this.
Since Oct 30, 2022.
stdlib
topic-dataclasses
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
Python 3.10.4
dataclass with slots=True, init=False raises AttributeError on attribute access
from dataclasses import dataclass
@dataclass(slots=True, init=False)
class WorldState:
is_mission_running: bool = False
w = WorldState()
w.is_mission_running
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'WorldState' object has no attribute 'is_mission_running'
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.
Assessment
This issue has not been assessed yet.