[Python-Dev] Use of PyArg_NoArgs() (original) (raw)

Neal Norwitz neal@metaslash.com
Mon, 25 Mar 2002 17:50:57 -0500


Guido van Rossum wrote:

> Python/sysmodule.c: {"exit", METHOLDARGS, This one appears tricky. But in fact, changing it to METHVARARGS should work just as well (I think).

The only problem I ran into just using METH_VARARGS is that the parameter is always printed. So I used PyArg_ParseTuple() and passed that object to PyErr_SetObject(PyExc_SystemExit, exit_code). This works as before wrt printing. However, you can no longer pass an arbitrary number of parameters, either 0 or 1. Is this ok?

> On a related note, PyArgGetInt() macro is used exactly one time-- > in socketmodule.c There seem to be many more places where this > could be used. Should I use or remove the macro? Or doc > that it should not be used?

It's deprecated, just as PyArgNoArgs(). Now's a good time to get rid of the last usage instance.

Both PyArg_GetInt() & PyArg_NoArgs() both have comments above them stating they should not be used. There are no more occurances of PyArg_GetInt(). I'm working on reducing METH_OLDARGS, down to 214.

If you want I can remove them from Include/Python.h when done.
If so, should I write up anything in NEWS?

Neal