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
Signature.from_builtin should raise a ValueError when no signature can be provided #64621
Comments
Right now it may return |
A patch is attached, please review. |
This proposal and patch look good to me. The current behaviour definitely isn't desirable: >>> import inspect
>>> inspect.Signature.from_function(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ncoghlan/devel/py3k/Lib/inspect.py", line 1888, in from_function
raise TypeError('{!r} is not a Python function'.format(func))
TypeError: 1 is not a Python function
>>> inspect.Signature.from_builtin(1)
>>> Signature.from_function() and Signature.from_builtin() should both also be documented, but we may want to wait for PEP-457 and bpo-17373 in Python 3.5 before sorting all that out. |
New changeset 9433b380ad33 by Yury Selivanov in branch 'default': |
Nick, thanks for the review. Committed. |
I would like to wait till 3.5 too. Right now both of them are sort of "private" API, so we still have the liberty to adjust their behaviour in 3.5 if needed. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: