ITADN

2.1 changelog is incorrect

#21561Closedmristin 创建于 2026-05-29
bug
M
mristincommented
**Bug Report** Hi! I've just installed mypy 2.1.0 and tried it against the snippet posted for the issue 16093 (https://github.com/python/mypy/issues/16093#issue-1892078601). It seems that the change is still not active in mypy 2.1.0? The changelog states that the fix was implemented in 2.1.0: https://mypy.readthedocs.io/en/stable/changelog.html#other-notable-fixes-and-improvements Notably: https://github.com/python/mypy/pull/21456 **To Reproduce** Here's the content of the exact snippet I ran mypy on, just for reference: ```python from enum import Enum from typing import assert_never class MyEnum(Enum): A = 1 B = 2 C = 3 def my_function(a: MyEnum) -> bool: if a == MyEnum.A: return True elif a in (MyEnum.B, MyEnum.C): return False assert_never(a) my_function(MyEnum.A) ``` **Expected Behavior** I expected no error. **Actual Behavior** I get: ``` scratch_6.py:16: error: Argument 1 to "assert_never" has incompatible type "Literal[MyEnum.B, MyEnum.C]"; expected "Never" [arg-type] Found 1 error in 1 file (checked 1 source file) ``` **Your Environment** ``` $ mypy --version mypy 2.1.0 (compiled: yes) ``` Command line: ``` mypy --strict scratch_6.py ```
关闭于 2026-05-29 4 条评论