KEMBAR78
Support `_value_` as a fallback for ellipsis Enum members by sterliakov · Pull Request #19352 · python/mypy · GitHub
Skip to content

Conversation

sterliakov
Copy link
Collaborator

@sterliakov sterliakov commented Jun 27, 2025

Fixes #19334.

This does not affect enums with explicit values different from ellipsis and is limited to enums defined in stub files.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@sterliakov sterliakov marked this pull request as ready for review June 28, 2025 12:12
@github-actions

This comment has been minimized.

Copy link
Collaborator

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a couple nitpicks.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2025

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good, except for a nit about cyclic import dependencies. This is good to merge as is, since the issue is pretty minor, but it would be nice you can fix it in a follow-up PR.


import mypy.plugin # To avoid circular imports.
from mypy.nodes import TypeInfo
from mypy.checker import TypeChecker
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit unfortunate that we have another circular import dependency. What about adding adding a helper method for checking whether we are type checking a stub file to the checker api? (It's okay to do this in a follow-up PR.)

@JukkaL JukkaL merged commit 5d59e43 into python:master Jul 9, 2025
19 checks passed
JukkaL pushed a commit that referenced this pull request Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enum types are incorrectly inferred

4 participants