mypy
db440ab0 - Don't consider 'object' always truthy (#14510)

Commit
3 years ago
Don't consider 'object' always truthy (#14510) There are two reasons I'm proposing this change. First, we know that many subclasses of 'object' can be falsy. Second, mypy sometimes simplifies `object | Any` into just `object`. The latter was considered always truthy, while the prior one wasn't. Now both of them are treated consistently. An alternative fix would be to not simplify unions like `object | Any`, but this seems a bit ad hoc. This only has an effect when the `truthy-bool` error code is explicitly enabled. Fixes #14480. This doesn't just fix the regression but fixes a more general issue.
Author
Parents
Loading