A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-June/015184.html below:

[Python-Dev] METH_NOARGS calling convention

[Python-Dev] METH_NOARGS calling convention [Python-Dev] METH_NOARGS calling conventionMartin von Loewis loewis@informatik.hu-berlin.de
Fri, 1 Jun 2001 19:07:52 +0200 (MEST)
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?

Regards,
Martin



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4