From a2450c6f4e2532bd3846a3e12872db3b1f896008 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sun, 11 Sep 2022 16:47:07 -0400 Subject: [PATCH] fixup! Fix ``unhashable-member`` crash --- pylint/checkers/utils.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 780806c770..f0b0de75ca 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -19,7 +19,7 @@ import _string import astroid.objects -from astroid import TooManyLevelsError, bases, nodes +from astroid import TooManyLevelsError, nodes from astroid.context import InferenceContext from astroid.exceptions import AstroidError from astroid.nodes._base_nodes import ImportNode @@ -38,15 +38,6 @@ nodes.DictComp, nodes.GeneratorExp, ) -WITH_IGETATTR = ( - nodes.Module, - nodes.ClassDef, - nodes.FunctionDef, - astroid.objects.Super, - nodes.Slice, - bases.UnboundMethod, - bases.BaseInstance, -) EXCEPTIONS_MODULE = "builtins" ABC_MODULES = {"abc", "_py_abc"} ABC_METHODS = { @@ -1959,7 +1950,7 @@ def is_hashable(node: nodes.NodeNG) -> bool: for inferred in node.infer(): if inferred is astroid.Uninferable: return True - if not isinstance(inferred, WITH_IGETATTR): + if not hasattr(inferred, "igetattr"): return True hash_fn = next(inferred.igetattr("__hash__")) if hash_fn.parent is inferred: