Skip to content

Commit 7c6df79

Browse files
authored
checkexpr: [minor] move node specific logic into visit (python#9648)
The has_uninhabited_component was formerly there to avoid clobbering the store_type call in find_partial_type_ref_fast_path. But this interaction is avoided by making the store_type call earlier. Co-authored-by: hauntsaninja <>
1 parent f220ce5 commit 7c6df79

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

mypy/checkexpr.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,6 +2849,7 @@ def visit_assignment_expr(self, e: AssignmentExpr) -> Type:
28492849
value = self.accept(e.value)
28502850
self.chk.check_assignment(e.target, e.value)
28512851
self.chk.check_final(e)
2852+
self.chk.store_type(e.target, value)
28522853
self.find_partial_type_ref_fast_path(e.target)
28532854
return value
28542855

@@ -3903,9 +3904,6 @@ def accept(self,
39033904
assert typ is not None
39043905
self.chk.store_type(node, typ)
39053906

3906-
if isinstance(node, AssignmentExpr) and not has_uninhabited_component(typ):
3907-
self.chk.store_type(node.target, typ)
3908-
39093907
if (self.chk.options.disallow_any_expr and
39103908
not always_allow_any and
39113909
not self.chk.is_stub and

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy