Skip to content

Commit 4a467fa

Browse files
Delegate to os.fspath for type checking
Co-Authored-By: Avasam <[email protected]>
1 parent 115bb67 commit 4a467fa

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

distutils/extension.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,13 @@ def __init__(
117117

118118
# mow we check if it's iterable and contains valid types
119119
try:
120-
sources = list(sources) # convert to list for consistency
121-
if not all(isinstance(v, (str, os.PathLike)) for v in sources):
122-
raise AssertionError(
123-
"All elements in 'sources' must be strings or PathLike objects"
124-
)
120+
self.sources = list(map(os.fspath, sources))
125121
except TypeError:
126122
raise AssertionError(
127123
"'sources' must be an iterable of strings or PathLike objects"
128124
)
129125

130126
self.name = name
131-
self.sources = list(map(os.fspath, sources))
132127
self.include_dirs = include_dirs or []
133128
self.define_macros = define_macros or []
134129
self.undef_macros = undef_macros or []

0 commit comments

Comments
 (0)