diff --git a/mypy/semanal.py b/mypy/semanal.py index f29965f6ff8f..a9226d2cdd0c 100644 --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -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