Skip to content

Commit 9bdcfdf

Browse files
authored
Move PyPy check before mypy imports (#20465)
Fixes #20454
1 parent b69309b commit 9bdcfdf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mypy/main.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
from io import TextIOWrapper
1515
from typing import IO, TYPE_CHECKING, Any, Final, NoReturn, TextIO
1616

17+
if platform.python_implementation() == "PyPy":
18+
sys.stderr.write(
19+
"ERROR: Running mypy on PyPy is not supported yet.\n"
20+
"To type-check a PyPy library please use an equivalent CPython version,\n"
21+
"see https://github.com/mypyc/librt/issues/16 for possible workarounds.\n"
22+
)
23+
sys.exit(2)
24+
1725
from mypy import build, defaults, state, util
1826
from mypy.config_parser import (
1927
get_config_module_names,
@@ -41,14 +49,6 @@
4149
if TYPE_CHECKING:
4250
from _typeshed import SupportsWrite
4351

44-
if platform.python_implementation() == "PyPy":
45-
sys.stderr.write(
46-
"ERROR: Running mypy on PyPy is not supported yet.\n"
47-
"To type-check a PyPy library please use an equivalent CPython version,\n"
48-
"see https://github.com/mypyc/librt/issues/16 for possible workarounds.\n"
49-
)
50-
sys.exit(2)
51-
5252
orig_stat: Final = os.stat
5353
MEM_PROFILE: Final = False # If True, dump memory profile
5454

0 commit comments

Comments
 (0)