summaryrefslogtreecommitdiff
path: root/astroid
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2021-09-21 13:34:26 +0200
committerGitHub <noreply@github.com>2021-09-21 13:34:26 +0200
commit4ffdf1108a6084b85e282b5835427c1d747bb22c (patch)
treefdce069b31599471a23e3b4e94324e3449e04d8b /astroid
parent5b516c9001fad3a8060c956821fb8f81f156c961 (diff)
downloadastroid-git-4ffdf1108a6084b85e282b5835427c1d747bb22c.tar.gz
Fix regression on Compare node inference (#1185)
This deals with PyCQA/pylint#5048
Diffstat (limited to 'astroid')
-rw-r--r--astroid/inference.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/astroid/inference.py b/astroid/inference.py
index 4151ec69..df8eff6f 100644
--- a/astroid/inference.py
+++ b/astroid/inference.py
@@ -810,6 +810,7 @@ UNINFERABLE_OPS = {
def _to_literal(node: nodes.NodeNG) -> Any:
# Can raise SyntaxError or ValueError from ast.literal_eval
+ # Can raise AttributeError from node.as_string() as not all nodes have a visitor
# Is this the stupidest idea or the simplest idea?
return ast.literal_eval(node.as_string())
@@ -840,7 +841,7 @@ def _do_compare(
try:
left, right = _to_literal(left), _to_literal(right)
- except (SyntaxError, ValueError):
+ except (SyntaxError, ValueError, AttributeError):
return util.Uninferable
try: