[issue17159] Remove explicit type check from inspect.Signature.from_function()

Stefan Behnel report at bugs.python.org
Sun Feb 2 12:42:14 CET 2014


Stefan Behnel added the comment:

Ok, I think I figured it out now.

Essentially, Cython's functions type, despite starting with the same struct layout as PyCFunction, must not visibly inherit from PyCFunction. Consequently, inspect.isbuiltin() returns False, as does inspect.isfunction() - sadly.

With Yury's changes that are currently committed, this triggers the fallback that checks for the function-like signature, which in turn makes Signature.from_function() properly analyse the signature, including default arguments, annotations, etc.

So, nothing left to change on CPython side for this ticket. And thanks again for the help. Closing as fixed.

----------
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17159>
_______________________________________


More information about the Python-bugs-list mailing list