diff options
Diffstat (limited to 'astroid/inference.py')
-rw-r--r-- | astroid/inference.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/astroid/inference.py b/astroid/inference.py index 010607c..16d5311 100644 --- a/astroid/inference.py +++ b/astroid/inference.py @@ -575,18 +575,18 @@ def _infer_binop(self, context): right = self.right op = self.op - for lhs in left.infer(context=context): + # we use two separate contexts for evaluating lhs and rhs because + # 1. evaluating lhs may leave some undesired entries in context.path + # which may not let us infer right value of rhs + lhs_context = context.clone() + rhs_context = context.clone() + + for lhs in left.infer(context=lhs_context): if lhs is util.YES: # Don't know how to process this. yield util.YES return - # TODO(cpopa): if we have A() * A(), trying to infer - # the rhs with the same context will result in an - # inferrence error, so we create another context for it. - # This is a bug which should be fixed in InferenceContext at some point. - rhs_context = context.clone() - rhs_context.path = set() for rhs in right.infer(context=rhs_context): if rhs is util.YES: # Don't know how to process this. |