Skip to content

Should __static_attributes__ be set on dataclasses? #135428

Closed as not planned
Closed as not planned
@ariebovenberg

Description

@ariebovenberg

Bug report

Bug description:

I'm aware that __static_attributes__ is only intented to be a heuristic (#123860),
but perhaps dataclasses are common enough to warrant inclusion?

@dataclass
class A:
    x: int


# non-dataclass equivalent
class B:
    x: int

    def __init__(self, x):
        self.x = x


print(A.__static_attributes__)  # (), but expected ('x', )
print(B.__static_attributes__)  # ('x',)

CPython versions tested on:

3.13, 3.14

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions