-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-87106: Fix inspect.signature.bind
handling of positional-only arguments with **kwargs
#103404
Conversation
…nly arguments with `**kwargs`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
👋 @sobolevn would you be interested to take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the fix in general. However, there are still some things to polish and improve :)
Thanks a lot for your work!
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Thanks for your suggestions, @sobolevn. Should I move some of the new cases to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@serhiy-storchaka do you have any additional feedback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks @jacobtylerwalls for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Thanks @jacobtylerwalls for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…nly arguments with **kwargs (pythonGH-103404) (cherry picked from commit 9c15202) Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
…nly arguments with **kwargs (pythonGH-103404) (cherry picked from commit 9c15202) Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
GH-118984 is a backport of this pull request to the 3.12 branch. |
GH-118985 is a backport of this pull request to the 3.13 branch. |
…nly arguments with **kwargs (pythonGH-103404)
gh-87106
Closes #87106
If a function signature has a variadic keyword argument (like
**kwargs
), then providing a keyword with the same name as a positional-only argument will still succeed, and become available onkwargs
.Before
inspect.signature(f).bind(pos_only='val')
might either:Now
These are fixed.
Prior related work
#16800