Defining *class* methods on C code
Michael Hudson
mwh at python.net
Sat Feb 7 09:14:48 EST 2004
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?
Cheers,
mwh
--
$ head -n 2 src/bash/bash-2.04/unwind_prot.c
/* I can't stand it anymore! Please can't we just write the
whole Unix system in lisp or something? */
-- spotted by Rich van der Hoff
More information about the Python-list
mailing list