Skip to content

Commit e47d0b6

Browse files
committed
Fail on PyPy in main instead of setup.py
1 parent 9526211 commit e47d0b6

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
@@ -40,6 +41,13 @@
4041
if TYPE_CHECKING:
4142
from _typeshed import SupportsWrite
4243

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)
4351

4452
orig_stat: Final = os.stat
4553
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, 10, 0): # noqa: UP036, RUF100
1312
sys.stderr.write("ERROR: You need Python 3.10 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)