Make use of METH_O and METH_NOARGS where possible.

Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
This commit is contained in:
Georg Brandl 2006-05-29 21:04:52 +00:00
parent fd9a4b19e9
commit 96a8c3954c
26 changed files with 187 additions and 405 deletions

View file

@ -200,7 +200,7 @@ static PyObject *
sys_exit(PyObject *self, PyObject *args)
{
PyObject *exit_code = 0;
if (!PyArg_ParseTuple(args, "|O:exit", &exit_code))
if (!PyArg_UnpackTuple(args, "exit", 0, 1, &exit_code))
return NULL;
/* Raise SystemExit so callers may catch it or clean up. */
PyErr_SetObject(PyExc_SystemExit, exit_code);
@ -672,7 +672,7 @@ static PyObject *
sys_call_tracing(PyObject *self, PyObject *args)
{
PyObject *func, *funcargs;
if (!PyArg_ParseTuple(args, "OO:call_tracing", &func, &funcargs))
if (!PyArg_UnpackTuple(args, "call_tracing", 2, 2, &func, &funcargs))
return NULL;
return _PyEval_CallTracing(func, funcargs);
}