Skip to content

Commit 9d5ef72

Browse files
authored
Fix crash if "_" is in builtins (#11811)
allows the definition of "_" as function in builtins (e.g via typeshed). fixes #9802
1 parent e721281 commit 9d5ef72

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/semanal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4296,7 +4296,7 @@ def lookup(self, name: str, ctx: Context,
42964296
assert isinstance(b.node, MypyFile)
42974297
table = b.node.names
42984298
if name in table:
4299-
if name[0] == "_" and name[1] != "_":
4299+
if len(name) > 1 and name[0] == "_" and name[1] != "_":
43004300
if not suppress_errors:
43014301
self.name_not_defined(name, ctx)
43024302
return None

0 commit comments

Comments
 (0)