Skip to content

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

@jacobtylerwalls

Description

@jacobtylerwalls

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions