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

Georg Brandl g.brandl at gmx.net
Wed Feb 5 17:04:12 CET 2014

Am 05.02.2014 14:52, schrieb "Martin v. Löwis":
> 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;
> };

Mostly unrelated question while seeing the "char *" here: do we (or do we
want to) support non-ASCII names for functions implemented in C?


More information about the Python-Dev mailing list