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] Any is incorrectly narrowed after is comparison #21134
changed the title [-]Any is incorrectly narrowed after `is` comparison[/-][+][1.20 regression] Any is incorrectly narrowed after `is` comparison[/+]on Apr 1, 2026
In general, mypy will narrow away from Any, so that part is expected. That said, this is a reasonable pattern to support. Current solution I'm thinking of is #21142 , let me know if you don't like it
Activity
ilevkivskyi commentedon Apr 1, 2026
cc @hauntsaninja
[-]Any is incorrectly narrowed after `is` comparison[/-][+][1.20 regression] Any is incorrectly narrowed after `is` comparison[/+]ilevkivskyi commentedon Apr 1, 2026
FWIW this looks pretty bad as this is a common pattern.
Allow dangerous identity comparisons to Any typed variables
hauntsaninja commentedon Apr 1, 2026
In general, mypy will narrow away from Any, so that part is expected. That said, this is a reasonable pattern to support. Current solution I'm thinking of is #21142 , let me know if you don't like it
Allow dangerous identity comparisons to Any typed variables (#21142)
Allow dangerous identity comparisons to Any typed variables (#21142)