From cd30216ce405a565751e71f17ea4f7c1f85d5082 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 18 Feb 2020 14:12:14 -0800 Subject: [PATCH] compilers/compilers: Fix get_linker_id Which could raise an AttributeError when used on languages like Java and C# that don't have separate compilers and linkers. --- mesonbuild/compilers/compilers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index e8e72cfaf..0e52a826e 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -724,7 +724,13 @@ class Compiler: return self.id def get_linker_id(self) -> str: - return self.linker.id + # There is not guarantee that we have a dynamic linker instance, as + # some languages don't have separate linkers and compilers. In those + # cases return the compiler id + try: + return self.linker.id + except AttributeError: + return self.id def get_version_string(self) -> str: details = [self.id, self.version]