From 57a087f7555dfda286f3bd81c4712d126821306f Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Sun, 12 Mar 2017 14:37:20 +0200 Subject: Use nodes.Unknown instead of Uninferable for specifying unknown inference results In the context of binop inference for lists and tuples, we were rebuilding a collection with the inferred elements. We were using Uninferable for specifying inference failures, but this leads to having non-AST nodes in collection's elts attribute, which should not happen. Instead, we replaced Uninferable with Unknown, meaning now we have an AST object. --- astroid/protocols.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'astroid/protocols.py') diff --git a/astroid/protocols.py b/astroid/protocols.py index d1abdea0..605ae1ce 100644 --- a/astroid/protocols.py +++ b/astroid/protocols.py @@ -147,10 +147,13 @@ def _multiply_seq_by_int(self, opnode, other, context): def _filter_uninferable_nodes(elts, context): for elt in elts: if elt is util.Uninferable: - yield elt + yield nodes.Unknown() else: for inferred in elt.infer(context): - yield inferred + if inferred is not util.Uninferable: + yield inferred + else: + yield nodes.Unknown() @decorators.yes_if_nothing_inferred -- cgit v1.2.1