From 00faff4a5869dbd8e77ea3c7e64df257495fc79b Mon Sep 17 00:00:00 2001 From: Peter McCormick Date: Fri, 3 Jun 2016 18:52:42 -0400 Subject: [PATCH] If even just one test has `Any` type then the whole expression will be `Any` --- mypy/checker.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mypy/checker.py b/mypy/checker.py index d2f8ebeb3093..aa5569d01b19 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -1833,8 +1833,7 @@ def visit_except_handler_test(self, n: Node) -> Type: for ttype in test_types: if isinstance(ttype, AnyType): - all_types.append(ttype) - continue + return AnyType() if not isinstance(ttype, FunctionLike): self.fail(messages.INVALID_EXCEPTION_TYPE, n)