Skip to content

Commit 0faa2b8

Browse files
author
hauntsaninja
committed
Inline named_type
This gives us better errors for fixtures stuff and helps with Python 2
1 parent e632fea commit 0faa2b8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mypy/semanal.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,12 @@ def add_implicit_module_attrs(self, file_node: MypyFile) -> None:
405405
continue
406406
# Need to construct the type ourselves, to avoid issues with __builtins__.list
407407
# not being subscriptable or typing.List not getting bound
408-
typ = self.named_type("__builtins__.list", [self.str_type()])
408+
sym = self.lookup_qualified("__builtins__.list", Context())
409+
if not sym:
410+
continue
411+
node = sym.node
412+
assert isinstance(node, TypeInfo)
413+
typ = Instance(node, [self.str_type()])
409414
else:
410415
assert t is not None, 'type should be specified for {}'.format(name)
411416
typ = UnboundType(t)

0 commit comments

Comments
 (0)