Skip to content

Incorrect slot check: typo in __dictoffset__ #123935

Closed
@sobolevn

Description

@sobolevn

Bug report

I made a typo that made it into the final code:

cpython/Lib/dataclasses.py

Lines 1211 to 1212 in 00ffdf2

if getattr(cls, '__dictrefoffset__', -1) != 0:
slots.append('__dict__')

It should had been __dictoffset__ not __dictrefoffset__.

Fixing plan:

  • Add tests for C types with __dictoffset__, so it won't happen again :)
  • Fix the typo

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixesstdlibPython modules in the Lib dirtopic-dataclassestype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions