mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Convert from using METH_OLDARGS to METH_NOARGS.
These should be safe.
This commit is contained in:
parent
01b2694acb
commit
50905b557b
3 changed files with 44 additions and 85 deletions
|
|
@ -8,63 +8,46 @@
|
|||
#include "timing.h"
|
||||
|
||||
static PyObject *
|
||||
start_timing(PyObject *self, PyObject *args)
|
||||
start_timing(PyObject *self)
|
||||
{
|
||||
if (!PyArg_Parse(args, ""))
|
||||
return NULL;
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
BEGINTIMING;
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
finish_timing(PyObject *self, PyObject *args)
|
||||
finish_timing(PyObject *self)
|
||||
{
|
||||
if (!PyArg_Parse(args, ""))
|
||||
return NULL;
|
||||
|
||||
ENDTIMING
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
seconds(PyObject *self, PyObject *args)
|
||||
seconds(PyObject *self)
|
||||
{
|
||||
if (!PyArg_Parse(args, ""))
|
||||
return NULL;
|
||||
|
||||
return PyInt_FromLong(TIMINGS);
|
||||
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
milli(PyObject *self, PyObject *args)
|
||||
milli(PyObject *self)
|
||||
{
|
||||
if (!PyArg_Parse(args, ""))
|
||||
return NULL;
|
||||
|
||||
return PyInt_FromLong(TIMINGMS);
|
||||
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
micro(PyObject *self, PyObject *args)
|
||||
micro(PyObject *self)
|
||||
{
|
||||
if (!PyArg_Parse(args, ""))
|
||||
return NULL;
|
||||
|
||||
return PyInt_FromLong(TIMINGUS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static PyMethodDef timing_methods[] = {
|
||||
{"start", start_timing, METH_OLDARGS},
|
||||
{"finish", finish_timing, METH_OLDARGS},
|
||||
{"seconds", seconds, METH_OLDARGS},
|
||||
{"milli", milli, METH_OLDARGS},
|
||||
{"micro", micro, METH_OLDARGS},
|
||||
{"start", (PyCFunction)start_timing, METH_NOARGS},
|
||||
{"finish", (PyCFunction)finish_timing, METH_NOARGS},
|
||||
{"seconds", (PyCFunction)seconds, METH_NOARGS},
|
||||
{"milli", (PyCFunction)milli, METH_NOARGS},
|
||||
{"micro", (PyCFunction)micro, METH_NOARGS},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue