Skip to content

Commit 261fe71

Browse files
[3.15] Fix mypy bump for Tools/peg_generator/pegen/build.py (GH-159256) (#159298)
Fix mypy bump for Tools/peg_generator/pegen/build.py (GH-159256) (cherry picked from commit ce5c012) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent cc00fe4 commit 261fe71

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎Tools/peg_generator/pegen/build.py‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@ def compile_c_extension(
154154
# HACK: Our output directory for free-threaded builds has moved, and so
155155
# tests running in-tree require our sys.executable directory for libs
156156
library_dirs.append(str(pathlib.Path(sys.executable).parent))
157+
sources = [generated_source_path]
157158
extension = Extension(
158159
extension_name,
159-
sources=[generated_source_path],
160+
sources=sources,
160161
extra_compile_args=extra_compile_args,
161162
extra_link_args=extra_link_args,
162163
)
@@ -214,19 +215,19 @@ def compile_c_extension(
214215
]
215216
)
216217
else:
217-
extension.sources[0:0] = common_sources
218+
sources[0:0] = common_sources
218219

219220
# Compile the source code to object files.
220221
ext_path = cmd.get_ext_fullpath(extension_name)
221-
if newer_group(extension.sources, ext_path, "newer"):
222+
if newer_group(sources, ext_path, "newer"):
222223
objects = compiler.compile(
223-
extension.sources,
224+
sources,
224225
output_dir=cmd.build_temp,
225226
debug=cmd.debug,
226227
extra_postargs=extra_compile_args,
227228
)
228229
else:
229-
objects = compiler.object_filenames(extension.sources, output_dir=cmd.build_temp)
230+
objects = compiler.object_filenames(sources, output_dir=cmd.build_temp)
230231
# The cmd.get_libraries() call needs a valid compiler attribute or we will
231232
# get an incorrect library name on the free-threaded Windows build.
232233
cmd.compiler = compiler

0 commit comments

Comments
 (0)