Skip to content

stubtest invents _DT attribute on dataclasses #18811

Open
@srittau

Description

@srittau

Bug Report

Cf. python/typeshed#13645 and https://github.com/python/typeshed/actions/runs/13905970431/job/38908976156

When comparing dataclass with @dataclass(order=True) using stubtest, stubtest complains that X._DT is not present at runtime (where X is the dataclass).

This is probably due to synthesizing a TypeVar:

SELF_TVAR_NAME: Final = "_DT"

(Thanks, @AlexWaygood.)

Your Environment

  • Mypy version used: 1.15.0
  • Python version used: 3.12.9

Command run was:

/tmp/stubtest-1u57o6se/bin/pip install fpdf2[]==2.8.2 mypy==1.15.0 Pillow>=10.3.0 cryptography
MYPYPATH=stubs/fpdf2 /tmp/stubtest-1u57o6se/bin/python -m mypy.stubtest --custom-typeshed-dir . fpdf --allowlist stubs/fpdf2/@tests/stubtest_allowlist.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions