Skip to content

Commit 82d56e4

Browse files
authored
[3.14] Fix mypy bump for Tools/peg_generator/pegen/build.py (GH-159256) (#159300)
(cherry picked from commit ce5c012)
1 parent 1d0f58b commit 82d56e4

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
@@ -149,9 +149,10 @@ def compile_c_extension(
149149
# HACK: The location of pyconfig.h has moved within our build, and
150150
# setuptools hasn't updated for it yet. So add the path manually for now
151151
include_dirs.append(pathlib.Path(sysconfig.get_config_h_filename()).parent)
152+
sources = [generated_source_path]
152153
extension = Extension(
153154
extension_name,
154-
sources=[generated_source_path],
155+
sources=sources,
155156
extra_compile_args=extra_compile_args,
156157
extra_link_args=extra_link_args,
157158
)
@@ -208,19 +209,19 @@ def compile_c_extension(
208209
]
209210
)
210211
else:
211-
extension.sources[0:0] = common_sources
212+
sources[0:0] = common_sources
212213

213214
# Compile the source code to object files.
214215
ext_path = cmd.get_ext_fullpath(extension_name)
215-
if newer_group(extension.sources, ext_path, "newer"):
216+
if newer_group(sources, ext_path, "newer"):
216217
objects = compiler.compile(
217-
extension.sources,
218+
sources,
218219
output_dir=cmd.build_temp,
219220
debug=cmd.debug,
220221
extra_postargs=extra_compile_args,
221222
)
222223
else:
223-
objects = compiler.object_filenames(extension.sources, output_dir=cmd.build_temp)
224+
objects = compiler.object_filenames(sources, output_dir=cmd.build_temp)
224225
# The cmd.get_libraries() call needs a valid compiler attribute or we will
225226
# get an incorrect library name on the free-threaded Windows build.
226227
cmd.compiler = compiler

0 commit comments

Comments
 (0)