Skip to content

Commit

Permalink
Don't show DuplicateBasesError for attribute access (#4317)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored Apr 8, 2021
1 parent 5540bd4 commit 5e1928b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Release date: Undefined

Closes #3850

* Don't show ``DuplicateBasesError`` for attribute access


What's New in Pylint 2.7.4?
===========================
Expand Down
2 changes: 2 additions & 0 deletions pylint/checkers/typecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,8 @@ def visit_attribute(self, node):
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
Expand Down
5 changes: 4 additions & 1 deletion tests/functional/d/duplicate_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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__)

0 comments on commit 5e1928b

Please sign in to comment.