python / python/mypy

[1.14 regression] False positive on abstract Enum subclasses in stubs

Open
#18,322 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-enum
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

While updating typeshed to mypy 1.14 (python/typeshed#13272), we got a few false positive errors on abstract enum classes like fpdf.enums.CoerciveEnum. This is due to the changes from #18068.

Perhaps we can throw the #18068 warning only if the enum class contains at least one attribute annotated with PEP 526 syntax. (cc @hauntsaninja as the author of #18068 and @tungol for the typeshed change.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the changes from #18068 and the linked typeshed PR discussion, then reproduce the false positive for abstract enum classes such as fpdf.enums.CoerciveEnum. The work is done when the warning no longer appears for enums without PEP 526 attributes while it remains for enums that have them.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.