[issue17159] Remove explicit type check from inspect.Signature.from_function()
Stefan Behnel
report at bugs.python.org
Thu Feb 13 22:37:41 CET 2014
Stefan Behnel added the comment:
>>> inspect.isbuiltin() returns False
>> Are you absolutely sure about this?
> Yes.
Oh, well...
isbuiltin(cyfunction) *does* return False. However, ismethoddescriptor(cyfunction) returns True, because Cython's functions bind as methods and thus have a "__get__()" (but no __set__()). Therefore, _signature_is_builtin(cyfunction) returns True, and the Signature.from_builtin(cyfunction) code path is taken and fails.
So, once again:
If the intention is to test that a callable has a "__text_signature__", then the code should test for the existance of "__text_signature__". It should *not* try to test for types that may or may not have such an attribute, and then just fail if it surprisingly does not find it.
----------
status: closed -> open
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17159>
_______________________________________
More information about the Python-bugs-list
mailing list