Defining *class* methods on C code
Thomas Heller
theller at python.net
Mon Feb 9 05:37:26 EST 2004
Thomas Heller <theller at python.net> writes:
> Michael Hudson <mwh at python.net> writes:
>
>> Thomas Heller <theller at python.net> writes:
>>
>>> >> if (somecondition) {
>>> >> PyObject *func;
>>> >> PyObject *meth;
>>> >> PyMethodDef *ml = my_methods;
>>> >>
>>> >> for (; ml->ml_name; ++ml) {
>>> >> func = PyCFunction_New(ml, NULL);
>>> >> if (!func)
>>> >> return NULL;
>>> >> meth = PyClassMethod_New(func);
>>> >
>>> > How about "meth = PyDescr_NewClassMethod(result, ml);" here?
>>> >
>>>
>>> Yes, that works. But it's not in Python 2.2, which is required ;-(
>>
>> Arghl. I guess you can just steal the relavent code... wasn't it your
>> patch in the first place that implemented all this?
>
> No, it was my feature request. IIRC, it was implemented by Fred Drake.
Guess I'm getting old. It *was* my patch ;-)
Thomas
More information about the Python-list
mailing list