Skip to content

Commit b045214

Browse files
committed
mypy: Fix all index
1 parent dad8937 commit b045214

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

distutils/sysconfig.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,16 @@ def customize_compiler(compiler: CCompiler) -> None:
324324
'AR',
325325
'ARFLAGS',
326326
)
327+
assert isinstance(cc, str)
328+
assert isinstance(cxx, str)
329+
assert isinstance(cflags, str)
330+
assert isinstance(ccshared, str)
331+
assert isinstance(ldshared, str)
332+
assert isinstance(ldcxxshared, str)
333+
assert isinstance(shlib_suffix, str)
334+
assert isinstance(ar_flags, str)
335+
ar = os.environ.get('AR', ar)
336+
assert isinstance(ar, str)
327337

328338
cxxflags = cflags
329339

@@ -354,8 +364,6 @@ def customize_compiler(compiler: CCompiler) -> None:
354364
ldshared = _add_flags(ldshared, 'CPP')
355365
ldcxxshared = _add_flags(ldcxxshared, 'CPP')
356366

357-
ar = os.environ.get('AR', ar)
358-
359367
archiver = ar + ' ' + os.environ.get('ARFLAGS', ar_flags)
360368
cc_cmd = cc + ' ' + cflags
361369
cxx_cmd = cxx + ' ' + cxxflags

distutils/util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ def change_root(
151151
if not os.path.isabs(pathname):
152152
return os.path.join(new_root, pathname)
153153
else:
154-
return os.path.join(new_root, pathname[1:])
154+
# type-ignore: This makes absolutes os.Pathlike unsupported in this branch.
155+
# Either this or we don't support bytes-based paths, or we complexify this branch.
156+
return os.path.join(new_root, pathname[1:]) # type: ignore[index]
155157

156158
elif os.name == 'nt':
157159
(drive, path) = os.path.splitdrive(pathname)

mypy.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ disable_error_code =
2727
arg-type,
2828
assignment,
2929
call-overload,
30-
index,
3130
func-returns-value,
3231
union-attr,
3332
str-bytes-safe,

0 commit comments

Comments
 (0)