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
bpo-29858: inspect.signature for wrappers around decorated bound methods #736
base: main
Are you sure you want to change the base?
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow these steps to rectify the issue:
Thanks again to your contribution and we look forward to looking at it! |
@anton-ryzhov, thanks for your PR! By analyzing the history of the files in this pull request, we identified @1st1, @larryhastings and @zestyping to be potential reviewers. |
@the-knights-who-say-ni Got "Contributor Form Received" |
@@ -2171,7 +2171,8 @@ def _signature_from_callable(obj, *, | |||
|
|||
# Was this function wrapped by a decorator? | |||
if follow_wrapper_chains: | |||
obj = unwrap(obj, stop=(lambda f: hasattr(f, "__signature__"))) |
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.
Need to add a comment here explaining the "or" in unwrap lambda.
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.
If you've missed this change — I've added this in commit below. Should this branch be resolved to continue review of this PR?
@anton-ryzhov Good catch. The code looks OK, just add a comment explaining why your change works in all cases. |
…und decorated bound methods
@1st1 In case you haven't received notification about last push, I'm notifying about this by the comment. |
I removed the " needs backport to 3.6" label, the 3.6 branch no longer accept bugfixes (only security fixes are accepted): https://devguide.python.org/#status-of-python-branches |
@1st1, I believe your requested changes have been made and this is ready for another review. Thanks! |
Closing and reopening to trigger tests. |
Tested as per given test case, result pass.
Module test passed test_inspect.
Noted make failed to build nis module.
Looks ok to me.
This PR is stale because it has been open for 30 days with no activity. |
http://bugs.python.org/issue29858
If we wrap function with bound method, which is also a wrapper around function,
inspect.signature
will not doskip_bound_arg
.It will use
inspect.unwrap
and pass by bound method from outer function to inner one.Reproduce:
https://bugs.python.org/issue29858