-
-
Notifications
You must be signed in to change notification settings - Fork 309
Open
Labels
Bug 🪳Needs PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Got the unexpected result: default value of function argument is treated as the 'only' value.
Minimal example:
from astroid import extract_node
bad, good = extract_node("""
def bad(foo: str | None = None):
a = 1 if foo else "" #@
def good(foo: str):
a = 1 if foo else "" #@
""")
print(bad.value.inferred())
print(good.value.inferred())Result:
[<Const.str l.3 at 0x27945e7eae0>]
[<Const.int l.6 at 0x27945e7ec90>, <Const.str l.6 at 0x27945e7ecc0>]I expected the first .inferred to return two results. The second one is ok.
Astroid version: 4.0.2
Metadata
Metadata
Assignees
Labels
Bug 🪳Needs PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation