diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-12-05 15:39:54 +0100 |
---|---|---|
committer | Michael Hirsch, Ph.D <10931741+scivision@users.noreply.github.com> | 2019-12-05 11:08:12 -0500 |
commit | 62efc37da13653686d5017e5b3a773196951315f (patch) | |
tree | ef46e195aa660cc17cfa99eeb7e688480046d085 /mesonbuild/compilers/compilers.py | |
parent | 0cf31e2340c20ecac7934a504be5f2989e90edb4 (diff) | |
download | meson-62efc37da13653686d5017e5b3a773196951315f.zip meson-62efc37da13653686d5017e5b3a773196951315f.tar.gz meson-62efc37da13653686d5017e5b3a773196951315f.tar.bz2 |
lgtm: fix __eq__ not overridden when adding attributes
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 90a2b81..d4dedce 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -645,6 +645,16 @@ class CompilerArgs(list): new += self return new + def __eq__(self, other: object) -> bool: + ''' + Only checks for equalety of self.compilers if the attribute is present. + Use the default list equalety for the compiler args. + ''' + comp_eq = True + if hasattr(other, 'compiler'): + comp_eq = self.compiler == other.compiler + return comp_eq and super().__eq__(other) + def __mul__(self, args): # lgtm[py/unexpected-raise-in-special-method] raise TypeError("can't multiply compiler arguments") |