Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stubtest invents _DT attribute on dataclasses #18811

Open
srittau opened this issue Mar 17, 2025 · 2 comments · May be fixed by #18846
Open

stubtest invents _DT attribute on dataclasses #18811

srittau opened this issue Mar 17, 2025 · 2 comments · May be fixed by #18846
Labels
bug mypy got something wrong topic-stubtest

Comments

@srittau
Copy link
Contributor

srittau commented Mar 17, 2025

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
@guitvcer
Copy link

Hello. Can I work on this?

@sobolevn
Copy link
Member

@guitvcer please, feel free :)

@guitvcer guitvcer linked a pull request Mar 27, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-stubtest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants