Skip to content

Commit eb1bb06

Browse files
whitenmsullivan
authored andcommitted
Fix crash in astdiff.py related to ec11a50. (#5126)
This fixes a crash reported in Quip's codebase related to UNBOUND_IMPORTED symbols. Unfortunately we don't have a nice test case.
1 parent 7a4bae6 commit eb1bb06

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mypy/server/aststrip.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ def visit_import(self, node: Import) -> None:
213213
for name, as_name in node.ids:
214214
imported_name = as_name or name
215215
initial = imported_name.split('.')[0]
216-
self.names[initial] = SymbolTableNode(UNBOUND_IMPORTED, None)
216+
if initial in self.names:
217+
self.names[initial] = SymbolTableNode(UNBOUND_IMPORTED, None)
217218

218219
def visit_import_all(self, node: ImportAll) -> None:
219220
# Imports can include both overriding symbols and fresh ones,

0 commit comments

Comments
 (0)