[Python-Dev] The docstring hack for signature information has to go

"Martin v. Löwis" martin at v.loewis.de
Wed Feb 5 14:52:38 CET 2014

Am 03.02.14 15:43, schrieb Larry Hastings:
> A: We create a PyMethodDefEx structure with an extra field: "const char
> *signature".  We add a new METH_SIGNATURE (maybe just METH_SIG?) flag to
> the flags, indicating that this is an extended structure.  When
> iterating over the PyMethodDefs, we know how far to advance the pointer
> based on this flag.
> B: Same as A, but we add three unused pointers (void *reserved1 etc) to
> PyMethodDefEx to give us some room to grow.
> C: Same as A, but we add two fields to PyMethodDefEx.  The second new
> field identifies the "version" of the structure, telling us its size
> somehow.  Like the lStructSize field of the OPENFILENAME structure in
> Win32.  I suspect YAGNI.

D: Add a new type slot for method signatures. This would be a
tp_signature field, along with a new slot id Py_tp_signature. The
signature field itself could be

struct PyMethodSignature {
   char *method_name;
   char *method_signature;


More information about the Python-Dev mailing list