-
-
Notifications
You must be signed in to change notification settings - Fork 184
Python Issue #26654: Inspect keyword arguments of functools.partial. #328
Conversation
asyncio/events.py
Outdated
|
|
||
| def _format_callback_source(func, args): | ||
| func_repr = _format_callback(func, args) | ||
| func_repr = _format_callback(func, args, {}) |
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.
Pass None instead of {}, it's cheaper.
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.
Done.
|
CPython issue: https://bugs.python.org/issue26654 |
|
Gentle ping. I think the PR is ready. |
|
@hayo can you review and merge this? |
|
sorry, wrong hayo, you probably mean haypo :) |
|
@iceboy-sjtu Could you please sign CPython's contributor agreement? |
|
@1st1 Signed online. Thank you. |
|
@iceboy-sjtu Looking at this PR again -- a quick question: a lot of callable formatting functionality is already implemented as part of |
|
@1st1 This is just a quick fix for the issue that the error message includes positional arguments but it does not include keyword arguments which may be misleading. I agree that the original code looks ugly, but let's leave it as is as it does not cause any problem. btw There are two problems using >>> inspect.signature(print)
ValueError: no signature found for builtin <built-in function print>
>>> inspect.signature(functools.partial(print, 0))
ValueError: no signature found for builtin <built-in function print>Secondly, it does not recognize functools.partial. >>> str(inspect.signature(functools.partial(lambda x: x, 0)))
'()' |
asyncio can't work with them either. Some builtin functions are just not introspectable yet.
It does. In your example it prints |
|
Acknowledged for |
|
Ping. |
|
Will merge this after beta1. |
|
Merged in b100957. Thanks a lot for fixing this! |
No description provided.