Skip to content

Commit 9066b1c

Browse files
authored
Don't ever return None for the type of an Instance (#2568)
Don't ever return None for the str() of an Instance
1 parent 2013112 commit 9066b1c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mypy/types.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,10 @@ def visit_deleted_type(self, t: DeletedType) -> str:
13321332
return "<Deleted '{}'>".format(t.source)
13331333

13341334
def visit_instance(self, t: Instance) -> str:
1335-
s = t.type.fullname() if t.type is not None else '<?>'
1335+
if t.type is not None:
1336+
s = t.type.fullname() or t.type.name() or '<???>'
1337+
else:
1338+
s = '<?>'
13361339
if t.erased:
13371340
s += '*'
13381341
if t.args != []:

0 commit comments

Comments
 (0)