From 6be1262cc9693d00b84f66d95691a29adff7b895 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 11 Dec 2023 01:12:22 -0500 Subject: [PATCH] compilers: fix inconsistent None-breaking return value for compile() Since commit abc7e6af01714206100a752898c325282436501f it is not possible for this set of methods to return None, which was an odd thing to return to begin with. Cease to annotate it as such. --- mesonbuild/compilers/compilers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index fbe30f6f0..74cb0bfe4 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -750,7 +750,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): def compile(self, code: 'mesonlib.FileOrString', extra_args: T.Union[None, CompilerArgs, T.List[str]] = None, *, mode: CompileCheckMode = CompileCheckMode.LINK, want_output: bool = False, - temp_dir: T.Optional[str] = None) -> T.Iterator[T.Optional[CompileResult]]: + temp_dir: T.Optional[str] = None) -> T.Iterator[CompileResult]: # TODO: there isn't really any reason for this to be a contextmanager if mode == CompileCheckMode.PREPROCESS: @@ -812,7 +812,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): def cached_compile(self, code: 'mesonlib.FileOrString', cdata: coredata.CoreData, *, extra_args: T.Union[None, T.List[str], CompilerArgs] = None, mode: CompileCheckMode = CompileCheckMode.LINK, - temp_dir: T.Optional[str] = None) -> T.Iterator[T.Optional[CompileResult]]: + temp_dir: T.Optional[str] = None) -> T.Iterator[CompileResult]: # TODO: There's isn't really any reason for this to be a context manager # Calculate the key @@ -1238,7 +1238,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): extra_args: T.Union[None, CompilerArgs, T.List[str], T.Callable[[CompileCheckMode], T.List[str]]] = None, dependencies: T.Optional[T.List['Dependency']] = None, mode: CompileCheckMode = CompileCheckMode.COMPILE, want_output: bool = False, - disable_cache: bool = False) -> T.Iterator[T.Optional[CompileResult]]: + disable_cache: bool = False) -> T.Iterator[CompileResult]: """Helper for getting a cached value when possible. This method isn't meant to be called externally, it's mean to be