summaryrefslogtreecommitdiff
path: root/protocols.py
diff options
context:
space:
mode:
authorSylvain Thénault <sylvain.thenault@logilab.fr>2010-03-23 09:47:19 +0100
committerSylvain Thénault <sylvain.thenault@logilab.fr>2010-03-23 09:47:19 +0100
commit632f61b2d181dc7e9fe922965ae111f76444f407 (patch)
tree5c1ad8e53b595a312e2cf2c6bbe32ef7407f7268 /protocols.py
parent9fa708f4a0dedbe25474aaba4a4527727a052899 (diff)
downloadastroid-git-632f61b2d181dc7e9fe922965ae111f76444f407.tar.gz
fix #20464: raises “TypeError: '_Yes' object is not iterable” on list inference
Diffstat (limited to 'protocols.py')
-rw-r--r--protocols.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/protocols.py b/protocols.py
index 7d61a3b6..e4e77917 100644
--- a/protocols.py
+++ b/protocols.py
@@ -107,13 +107,16 @@ def tl_infer_binary_op(self, operator, other, context):
for other in other.infer(context):
if isinstance(other, self.__class__) and operator == '+':
node = self.__class__()
- elts = [n for elt in self.elts for n in elt.infer(context)]
- elts += [n for elt in other.elts for n in elt.infer(context)]
+ elts = [n for elt in self.elts for n in elt.infer(context)
+ if not n is YES]
+ elts += [n for elt in other.elts for n in elt.infer(context)
+ if not n is YES]
node.elts = elts
yield node
elif isinstance(other, nodes.Const) and operator == '*':
node = self.__class__()
- elts = [n for elt in self.elts for n in elt.infer(context)] * other.value
+ elts = [n for elt in self.elts for n in elt.infer(context)
+ if not n is YES] * other.value
node.elts = elts
yield node
elif isinstance(other, Instance) and not isinstance(other, nodes.Const):