Skip to content

Commit 0ce45ae

Browse files
committed
make mypyc happy
1 parent 067b1b8 commit 0ce45ae

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

mypy_self_check.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pretty = True
88
always_false = MYPYC
99
plugins = mypy.plugins.proper_plugin
1010
python_version = 3.9
11-
exclude = mypy/typeshed/|mypyc/test-data/|mypyc/lib-rt/
11+
exclude = mypy/typeshed/|mypyc/test-data/
1212
enable_error_code = ignore-without-code,redundant-expr
1313
enable_incomplete_feature = PreciseTupleTypes
1414
show_error_code_links = True

mypyc/build.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222

2323
import hashlib
2424
import os.path
25+
from os import PathLike
2526
import re
2627
import sys
2728
import time
28-
from collections.abc import Iterable
29+
from collections.abc import Iterable, MutableSequence
2930
from typing import TYPE_CHECKING, Any, NamedTuple, NoReturn, Union, cast
3031

3132
from mypy.build import BuildSource
@@ -139,7 +140,8 @@ class ModDesc(NamedTuple):
139140

140141
__spawn = ccompiler.CCompiler.spawn
141142

142-
def spawn(self: ccompiler.CCompiler, cmd: Iterable[str], **kwargs: Any) -> None:
143+
144+
def spawn(self: ccompiler.CCompiler, cmd: MutableSequence[bytes | str | PathLike[str]], **kwargs: Any) -> None:
143145
compiler_type: str = self.compiler_type # type: ignore[attr-defined]
144146
extra_options = EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT[compiler_type]
145147
new_cmd = list(cmd)

mypyc/lib-rt/setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def spawn(self: ccompiler.CCompiler, cmd: Iterable[str], **kwargs: Any) -> None:
6868
break
6969
__spawn(self, new_cmd, **kwargs)
7070

71+
7172
ccompiler.CCompiler.spawn = spawn # type: ignore[method-assign]
7273

7374

@@ -123,9 +124,9 @@ def run(self) -> None:
123124
compiler = ccompiler.new_compiler()
124125
sysconfig.customize_compiler(compiler)
125126
cflags: list[str] = []
126-
if compiler.compiler_type == "unix":
127+
if compiler.compiler_type == "unix": # type: ignore[attr-defined]
127128
cflags += ["-O3"]
128-
elif compiler.compiler_type == "msvc":
129+
elif compiler.compiler_type == "msvc": # type: ignore[attr-defined]
129130
cflags += ["/O2"]
130131

131132
setup(

0 commit comments

Comments
 (0)