Larry Hastings added the comment:

Yyou have just answered the question "How do you determine signature 
information for functions written in Python?".  A shorter way to express this 
answer: functions written in Python are implemented as a "function object" (in 
C, PyFunctionObject), which internally has a reference to a "code object" 
(PyCodeObject).  These two objects collectively contain all the information 
you'd need to determine the function's signature in Python.

However, builtin functions don't use either of these objects.  Builtin 
functions are implemented with a "builtin code object" (PyCFunctionObject) 
which doesn't have any of the metadata you cited.  So that doesn't answer my 
question.  Nor is it practical to implement a builtin function using a 
"function object" and a "code object".

So I'll ask you again:

> Be specific.  Let's say we remove __text_signature__.  How do we
> now write a C extension in a way that we can have introspection
> information for its callables?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17159>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to