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
I'm not sure if the new behavior is better or not, but I suspect that the change in behavior may have been an unintended consequence of #16237, so it seems worth investigating what is going on.
This is actually intentional. For my len() PR I needed to disable the len() check if a tuple subclass has a custom (i.e. user-defined) __len__() (and/or a user-defined __bool__() for cases like assert some_tuple). But then it turned out the existing helper custom_special_method() didn't work, because it considered special methods defined in typing as user-defined (it only allowed builtins as not user-defined), and tuple gets its __len__() from typing. But also it turns out dict gets its __eq__() from typing as well, so we actually never checked unsafe overlap for dictionaries/mappings (because we always considered equality as user-defined there).
FWIW I think the new behavior is consistent with how we handle e.g. lists etc where we get
When using mypy 1.6, this example produces no errors:
However, after #16237, it started generating these errors:
I'm not sure if the new behavior is better or not, but I suspect that the change in behavior may have been an unintended consequence of #16237, so it seems worth investigating what is going on.
cc @ilevkivskyi
The text was updated successfully, but these errors were encountered: