diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2017-03-12 14:37:20 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2017-03-12 14:37:20 +0200 |
commit | 57a087f7555dfda286f3bd81c4712d126821306f (patch) | |
tree | 3087db9a5697fa33ce0d340a93aaf6c5682b1be2 /astroid/protocols.py | |
parent | 7feb1df5c9580a54f12f480769626a4e16147ded (diff) | |
download | astroid-git-57a087f7555dfda286f3bd81c4712d126821306f.tar.gz |
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.
Diffstat (limited to 'astroid/protocols.py')
-rw-r--r-- | astroid/protocols.py | 7 |
1 files changed, 5 insertions, 2 deletions
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 |