Skip to content

Commit

Permalink
Fix crash if "_" is in builtins (#11811)
Browse files Browse the repository at this point in the history
allows the definition of "_" as function in builtins (e.g via typeshed).

fixes #9802
  • Loading branch information
StefanM-TT authored Dec 21, 2021
1 parent e721281 commit 9d5ef72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4296,7 +4296,7 @@ def lookup(self, name: str, ctx: Context,
assert isinstance(b.node, MypyFile)
table = b.node.names
if name in table:
if name[0] == "_" and name[1] != "_":
if len(name) > 1 and name[0] == "_" and name[1] != "_":
if not suppress_errors:
self.name_not_defined(name, ctx)
return None
Expand Down

0 comments on commit 9d5ef72

Please sign in to comment.