Skip to content

Commit 5c87e97

Browse files
authoredMar 16, 2025··
Fix dict.get issue for typeshed update (#18806)
Fix for issue uncovered in #18803
1 parent bbd7a6c commit 5c87e97

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎mypy/partially_defined.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
from mypy.patterns import AsPattern, StarredPattern
4646
from mypy.reachability import ALWAYS_TRUE, infer_pattern_value
4747
from mypy.traverser import ExtendedTraverserVisitor
48-
from mypy.types import Type, UninhabitedType
48+
from mypy.types import Type, UninhabitedType, get_proper_type
4949

5050

5151
class BranchState:
@@ -507,7 +507,8 @@ def visit_break_stmt(self, o: BreakStmt) -> None:
507507
self.tracker.skip_branch()
508508

509509
def visit_expression_stmt(self, o: ExpressionStmt) -> None:
510-
if isinstance(self.type_map.get(o.expr, None), (UninhabitedType, type(None))):
510+
typ = self.type_map.get(o.expr)
511+
if typ is None or isinstance(get_proper_type(typ), UninhabitedType):
511512
self.tracker.skip_branch()
512513
super().visit_expression_stmt(o)
513514

0 commit comments

Comments
 (0)
Please sign in to comment.