Skip to content

Minor mistake in dataclasses documentation update #108267

Closed
@FrozenBob

Description

@FrozenBob

An update to the dataclasses docs, intended to make magic method names link to the relevant data model documentation, accidentally changed a line that shouldn't have been changed.

The docs used to say

There is a tiny performance penalty when using frozen=True: __init__() cannot use simple assignment to initialize fields, and must use object.__setattr__().

The documentation update accidentally changed object.__setattr__ to just __setattr__ here, so now it reads

There is a tiny performance penalty when using frozen=True: __init__() cannot use simple assignment to initialize fields, and must use __setattr__().

This line was specifically meant to refer to object.__setattr__, the __setattr__ method of the base object class, as simple attribute assignment would hit the frozen dataclass's __setattr__ override.

This part of the documentation should be reverted. I think it should just take a 1-character change, simply removing a tilde.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12bugs and security fixes3.13bugs and security fixesdocsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions