From 5e1928b325bc798f5be1ab94031bf6816d058d9f Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Thu, 8 Apr 2021 13:21:19 +0200 Subject: Don't show DuplicateBasesError for attribute access (#4317) --- ChangeLog | 2 ++ pylint/checkers/typecheck.py | 2 ++ tests/functional/d/duplicate_bases.py | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) 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__) -- cgit v1.2.1