Skip to content

Commit

Permalink
Catch MRO error when applying missing hints feature. (#4688)
Browse files Browse the repository at this point in the history
* Also catch MroError.

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
  • Loading branch information
doranid and Pierre-Sassoulas committed Jul 8, 2021
1 parent 708527d commit 58d85b2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -508,3 +508,5 @@ contributors:

* Maksym Humetskyi (mhumetskyi): contributor
- Fixed ignored empty functions by similarities checker with "ignore-signatures" option enabled

* Daniel Dorani (doranid): contributor
4 changes: 4 additions & 0 deletions ChangeLog
Expand Up @@ -17,6 +17,10 @@ Release date: TBA
..
Put bug fixes that should not wait for a new minor version here

* Fix hard failure when handling missing attribute in a class with duplicated bases

Closes #4687

* Fix false-positive ``consider-using-with`` (R1732) if a ternary conditional is used together with ``with``

Closes #4676
Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/typecheck.py
Expand Up @@ -185,7 +185,7 @@ def _(node):

try:
mro = node.mro()[1:]
except (NotImplementedError, TypeError):
except (NotImplementedError, TypeError, astroid.MroError):
mro = node.ancestors()

other_values = [value for cls in mro for value in _node_names(cls)]
Expand Down
@@ -0,0 +1,7 @@
# pylint: disable=missing-docstring, pointless-statement, useless-object-inheritance
# pylint: disable=duplicate-bases, too-few-public-methods


class Klass(object, object):
def get(self):
self._non_existent_attribute # [no-member]
@@ -0,0 +1 @@
no-member:7:8:Klass.get:Instance of 'Klass' has no '_non_existent_attribute' member:INFERENCE

0 comments on commit 58d85b2

Please sign in to comment.