You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[1.20 regression] incorrect reachability for comparisons between set and frozenset #21143
def foo(x: frozenset[str], y: set[str]):
if x == y:
reveal_type(x)
With --warn-unreachable the reveal_type is marked as unreachable. This relates to new narrowing logic in mypy 1.20. An easy fix could be to mark frozenset as having a custom __eq__.
@hauntsaninja I think a proper fix would be to re-use all the special-casing from dangerous_comparison(). There is a whole bunch of special-casing for builtin/stdlib collections that reflects runtime behavior. Also keeping these two in sync would be generally beneficial.
With
--warn-unreachablethe reveal_type is marked as unreachable. This relates to new narrowing logic in mypy 1.20. An easy fix could be to mark frozenset as having a custom__eq__.