Always check for `__dictrefoffset__` and `__weakoffset__` in `dataclasses` with slots
Open
@sobolevn is already working on this.
Since May 9, 2024.
stdlib
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
Bug report
See https://github.com/python/cpython/pull/118099#discussion_r1575244611 and https://github.com/python/cpython/issues/118033
We now correctly check for __dictoffset__ and __weakoffset__ on C types without __slots__ defined: https://github.com/python/cpython/blob/c68acb1384a51eb745f572687eaf677371b9e765/Lib/dataclasses.py#L1201-L1212
But, not in this case: https://github.com/python/cpython/blob/c68acb1384a51eb745f572687eaf677371b9e765/Lib/dataclasses.py#L1213-L1218
So, in theory there might be C types with __slots__ and __dictoffset__ and __weakoffset__.
I will investigate!
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.