Skip to content

Commit 404312c

Browse files
eli-schwartzdcbaker
authored andcommitted
do better sanity check for vs_module_defs input
We allow custom_target() but check for it based on hasattr, ever since the initial implementation way back in the day, in commit 66a6ea9. This is a bit broken because various objects might support that but still aren't supposed to work. We can actually just use isintance checks like we do immediately above, which are more accurate and avoid crashes on things that aren't even targets at all, like run_target(). Although custom_target indexes are actually targets those didn't work either. Fixes mesonbuild#9648
1 parent 1cd16a7 commit 404312c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎mesonbuild/build.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,7 @@ def process_kwargs(self, kwargs):
23832383
elif isinstance(path, File):
23842384
# When passing a generated file.
23852385
self.vs_module_defs = path
2386-
elif hasattr(path, 'get_filename'):
2386+
elif isinstance(path, CustomTarget):
23872387
# When passing output of a Custom Target
23882388
self.vs_module_defs = File.from_built_file(path.subdir, path.get_filename())
23892389
else:

0 commit comments

Comments
 (0)