astroid icon indicating copy to clipboard operation
astroid copied to clipboard

Enforce inference strong updates when possible

Open PCManticore opened this issue 6 years ago • 0 comments

Steps to reproduce

Run an inference over the following example:

    options = []
    if len(sys.argv) > 1:
        options = [["Woof!"]]
    else:
        options = [["Barf!"]]

Current behavior

When we try to infer options, we get three results: an empty list and the two values from the if statement.

Expected behavior

We should only infer two lists here from the if statement, since the first empty list is lost after the if statement

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

All versions.

PCManticore avatar Nov 27 '19 08:11 PCManticore