Skip to content

Commit f60f90f

Browse files
ilevkivskyihauntsaninja
authored andcommitted
Fail on PyPy in main instead of setup.py (#20389)
Follow-up for #20384
1 parent 58d485b commit f60f90f

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

mypy/main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import argparse
66
import os
7+
import platform
78
import subprocess
89
import sys
910
import time
@@ -39,6 +40,13 @@
3940
if TYPE_CHECKING:
4041
from _typeshed import SupportsWrite
4142

43+
if platform.python_implementation() == "PyPy":
44+
sys.stderr.write(
45+
"ERROR: Running mypy on PyPy is not supported yet.\n"
46+
"To type-check a PyPy library please use an equivalent CPython version,\n"
47+
"see https://github.com/mypyc/librt/issues/16 for possible workarounds.\n"
48+
)
49+
sys.exit(2)
4250

4351
orig_stat: Final = os.stat
4452
MEM_PROFILE: Final = False # If True, dump memory profile

setup.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,13 @@
55
import glob
66
import os
77
import os.path
8-
import platform
98
import sys
109
from typing import TYPE_CHECKING, Any
1110

1211
if sys.version_info < (3, 9, 0): # noqa: UP036, RUF100
1312
sys.stderr.write("ERROR: You need Python 3.9 or later to use mypy.\n")
1413
exit(1)
1514

16-
if platform.python_implementation() == "PyPy":
17-
sys.stderr.write(
18-
"ERROR: Running mypy on PyPy is not supported yet.\n"
19-
"To type-check a PyPy library please use an equivalent CPython version,\n"
20-
"see https://github.com/mypyc/librt/issues/16 for possible workarounds.\n"
21-
)
22-
exit(1)
23-
2415
# we'll import stuff from the source tree, let's ensure is on the sys path
2516
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
2617

0 commit comments

Comments
 (0)