summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mueller <30130371+cdce8p@users.noreply.github.com>2021-04-08 13:21:19 +0200
committerGitHub <noreply@github.com>2021-04-08 13:21:19 +0200
commit5e1928b325bc798f5be1ab94031bf6816d058d9f (patch)
tree746f36b98715a0910235eb7ad8347cbe77d28517
parent5540bd45fcfd3db7ddb9a1b952bd5d327f49c84b (diff)
downloadpylint-git-5e1928b325bc798f5be1ab94031bf6816d058d9f.tar.gz
Don't show DuplicateBasesError for attribute access (#4317)
-rw-r--r--ChangeLog2
-rw-r--r--pylint/checkers/typecheck.py2
-rw-r--r--tests/functional/d/duplicate_bases.py5
3 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index fd6141047..eaf3fb6d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -61,6 +61,8 @@ Release date: Undefined
Closes #3850
+* Don't show ``DuplicateBasesError`` for attribute access
+
What's New in Pylint 2.7.4?
===========================
diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py
index 2da7c6151..e08cf15b7 100644
--- a/pylint/checkers/typecheck.py
+++ b/pylint/checkers/typecheck.py
@@ -985,6 +985,8 @@ accessed. Python regular expressions are accepted.",
continue
except AttributeError:
continue
+ except astroid.DuplicateBasesError:
+ continue
except astroid.NotFoundError:
# This can't be moved before the actual .getattr call,
# because there can be more values inferred and we are
diff --git a/tests/functional/d/duplicate_bases.py b/tests/functional/d/duplicate_bases.py
index 974f97584..51b329a4f 100644
--- a/tests/functional/d/duplicate_bases.py
+++ b/tests/functional/d/duplicate_bases.py
@@ -2,7 +2,7 @@
# pylint: disable=missing-docstring,too-few-public-methods,no-init
-class Duplicates(str, str): # [duplicate-bases]
+class Duplicates(str, str): # [duplicate-bases]
pass
@@ -13,3 +13,6 @@ class Alpha(str):
class NotDuplicates(Alpha, str):
"""The error should not be emitted for this case, since the
other same base comes from the ancestors."""
+
+
+print(Duplicates.__mro__)