diff --git a/mypy/lex.py b/mypy/lex.py index 41f426200f1f..3ce69c9f79e7 100644 --- a/mypy/lex.py +++ b/mypy/lex.py @@ -829,7 +829,7 @@ def add_pre_whitespace(self, s: str) -> None: self.pre_whitespace += s self.i += len(s) - type_ignore_exp = re.compile(r'[ \t]*#[ \t]*type:[ \t]*ignore\b') + type_ignore_exp = re.compile(r'[ \t]*#[ \t]*(mypy|type):[ \t]*ignore\b') def add_token(self, tok: Token) -> None: """Store a token. diff --git a/test-data/unit/check-ignore.test b/test-data/unit/check-ignore.test index ecef2e438d3a..0fcd9d0bf29e 100644 --- a/test-data/unit/check-ignore.test +++ b/test-data/unit/check-ignore.test @@ -3,6 +3,10 @@ x = 1 x() # type: ignore x() # E: "int" not callable +[case testMypyIgnore] +x = 1 +x() # mypy: ignore + [case testIgnoreUndefinedName] x = 1 y # type: ignore