endless recursion checking the bool_value
of a condition with value bool()
#878
Labels
bool_value
of a condition with value bool()
#878
Uh oh!
There was an error while loading. Please reload this page.
I'm facing an endless recursion (apparently, from the trace, not the same as this currently open issue). Consider this snippet:
When I
infer
the value ofv
, the execution gets to a point where it bounces back and forth between def _infer_method_result_truth and def bool_value. Eventually, the maximum recursion limit is reached.I believe that the root cause of the problem is here: due to
bool()
, we have theinferred
object as being the "same" as theinstance
object (an instance of class bool). I suppose that a check* must be added there, for this equality.*I could create a PR, but it seems that
Instance
has no__eq__
method; I could still check withif (str(inferred) == str(instance): return util.Uninferable
but I'm not sure it'd be corred/desired.NOTE: The same issue happens in slight variations, e.g.,
v = w if hasattr(o, 'x') else 1
The text was updated successfully, but these errors were encountered: