Skip to content

Do not eagerly consume all available parameters when unpacking arguments #2468

@FlorianLindinger

Description

@FlorianLindinger

Describe the Bug

Pyrefly gives me an incorrect bad-keyword-argument error (Multiple values for argument b in function fun5). This is only the case if I pass the triggering argument together with an unpacked list and not for unpacked dict or normal other arguements (as expected):

def fun1(a,b):
    return

def fun2(a):
    fun1(a,b=None) # gives no error

#############

def fun3(a,b):
    return

def fun4(**kwargs):
    fun3(**kwargs,b=None) # gives no error

#############

def fun5(a,b):
    return

def fun6():
    fun5(*[""], b=None) # gives Error [bad-keyword-argument]: Multiple values for argument `b` in function `fun5`

fun6() # no crash, as expected

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSImMYABGAK7oCMAFKgDTYCUiAOujUE0ATjAAu9Yen78qtBugBMbHvyF1GrDtgC8AOVzoYXGgGIaAcwgA3eDXS4aMYcNzCZ6U1%2B8-vHuRroAMxsnKoCQqISUv7UgQAsLABUSQDWAO6owhZw4eoKISkZWTmc%2BobGZpY2dg5OLm4evs1esfKMAKyh3HwRglGS0kMBCgBsLHlCCl1JANq8IAsAuuw0ugZGJuZWtnA0AKINwjSz2KiYALSpMKTpbpcl9AC2MOhiS4g0ALL0UGIQxFgNGsqCg9DsYDcNEeLzeNAABth4TQIAIFABjf6GBHTeEeMYTKp1dHCVBwAAWqzJTnwxBgmJgmBA7BA9H%2BUDgJHIiBA5gAquyIGJSIFMRBDHA2nQ3E9UGIAProZ7YZwsfCfVFiEwXAB8NDgYmEvXUAykdAWemVzk%2BwHwAF8FvxmSAyKIwFBSIQxLgnlAKOYAAqkN0e-UYHAEGjowyQCySOXi9CEfjmADKMBgNHJYjExDgiAA9AXXdQPYQ3BYC68C5hcOi4AXo%2BhY-GsegC9LjqgQdBUNggU2W6S2zRcMQ25z%2BGQxOTDBdbMI4ImaDoaAsgoQmIpHegQHaWagxbYAGLQGAUNBYPBEMh7oA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions