mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
This commit is contained in:
parent
fd9a4b19e9
commit
96a8c3954c
26 changed files with 187 additions and 405 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue