
Martin von Loewis wrote:
The patch
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=427190&group_id=5470
introduces two new calling conventions, METH_O and METH_NOARGS. The rationale for METH_O has been discussed already; the rationale for METH_NOARGS is that it allows a convient simplification (plus a marginal speed-up) of functions which do either PyArg_NoArgs(args) or PyArg_ParseTuple(args, ":function_name").
Now, one open issue is whether the METH_NOARGS functions should have a signature of
PyObject * (*unaryfunc)(PyObject *);
or of
PyObject *(*PyCFunction)(PyObject *, PyObject *);
which then would be called with a NULL second argument; the first argument would be self in either case.
IMO, the advantage of passing the NULL argument is that NOARGS methods don't need to be cast into PyCFunction in the method table; the advantage of the second approach is that it is clearer in the function implementation.
Any opinions which signature to use?
The second... I'm not sure how you will get extension writers who have to maintain packages for all three Python versions to ever change their code to use the new style calling scheme: there simply is no clean way to use the same code base unless you are willing to add tons of #ifdefs. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.lemburg.com/python/