diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2025-11-03 11:04:35 -0800 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-11-12 08:14:37 -0800 |
| commit | 176c6d27e3e84f884df42cff6813cc5ca77f91c8 (patch) | |
| tree | 04ce87d3666b01ec8d949e5d4c3d0d0446ee51e2 /mesonbuild/interpreter/interpreter.py | |
| parent | 4f1c618392972c935d83eb7939234b3b90479df5 (diff) | |
| download | meson-176c6d27e3e84f884df42cff6813cc5ca77f91c8.tar.gz | |
build: Use a tuple for pch data
This really isn't a list because it's not homogenous data, it's really
`tuple[str, str | None] | None`, but we're using list length to decide
what to do with it, and that makes for strict null issues, as an
accurate annotation would be `list[str | None]`, which would require a
lot of `is not None` checking. By using a tuple we don't need to keep
checking length, which is more expensive than null checking.
To ensure correctness I annotated some things in the VS backend
Diffstat (limited to 'mesonbuild/interpreter/interpreter.py')
| -rw-r--r-- | mesonbuild/interpreter/interpreter.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 36647f32c..a3cdde04a 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -3479,7 +3479,7 @@ class Interpreter(InterpreterBase, HoldableObject): self.check_for_jar_sources(sources, targetclass) kwargs['d_import_dirs'] = self.extract_incdirs(kwargs, 'd_import_dirs') missing: T.List[str] = [] - for each in itertools.chain(kwargs['c_pch'], kwargs['cpp_pch']): + for each in itertools.chain(kwargs['c_pch'] or [], kwargs['cpp_pch'] or []): if each is not None: if not os.path.isfile(os.path.join(self.environment.source_dir, self.subdir, each)): missing.append(os.path.join(self.subdir, each)) |
