Fix string formatting for string enums by roberfi · Pull Request #16555 · python/mypy

@roberfi

Fixes #7563

Inside check_str_format_call method, it checks if expression of format method call is an Enum member and it takes Literal value of that Enum member to check the format call arguments, if so.

@roberfi

@github-actions

Diff from mypy_primer, showing the effect of this PR on open source code:

discord.py (https://github.com/Rapptz/discord.py): typechecking got 1.09x faster (194.1s -> 178.0s)
(Performance measurements are based on a single noisy sample)

hauntsaninja

Choose a reason for hiding this comment

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

Thanks for the fix!

@roberfi roberfi deleted the fix-string-enums-formatting branch

April 10, 2024 12:29