pylint-dev/astroid

Should infer more values for `== __name__` (possibly other dunders)

jacobtylerwalls opened this issue · 0 comments

Steps to reproduce

>>> n = extract_node("if __name__ == '__main__':  ...")
>>> n.test.inferred()
[<Const.bool l.None at 0x10baadf90>]
>>> n.test.inferred()[0]
<Const.bool l.None at 0x10c71eb50>
>>> n.test.inferred()[0].value
False

Current behavior

1 inferred value

Expected behavior

2 inferred values (True, False)

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

2.16.0dev0

More info

Inspired by pylint-dev/pylint#8167