Mercurial > cpython-lru_cache-weakref
view Modules/timingmodule.c @ 16798:258dcafe2d0b legacy-trunk
Gustavo Niemeyer <niemeyer@conectiva.com>:
Fixed recno support (keys are integers rather than strings).
Work around DB bug that cause stdin to be closed by rnopen() when the
DB file needed to exist but did not (no longer segfaults).
This closes SF tracker patch #403445.
Also wrapped some long lines and added whitespace around operators -- FLD.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Tue, 27 Feb 2001 18:56:46 +0000 |
| parents | 5397fdf88ec2 |
| children | 40631ae74b17 |
line wrap: on
line source
/* * Author: George V. Neville-Neil */ #include "Python.h" /* Our stuff... */ #include "timing.h" static PyObject * start_timing(PyObject *self, PyObject *args) { if (!PyArg_Parse(args, "")) return NULL; Py_INCREF(Py_None); BEGINTIMING; return Py_None; } static PyObject * finish_timing(PyObject *self, PyObject *args) { if (!PyArg_Parse(args, "")) return NULL; ENDTIMING Py_INCREF(Py_None); return Py_None; } static PyObject * seconds(PyObject *self, PyObject *args) { if (!PyArg_Parse(args, "")) return NULL; return PyInt_FromLong(TIMINGS); } static PyObject * milli(PyObject *self, PyObject *args) { if (!PyArg_Parse(args, "")) return NULL; return PyInt_FromLong(TIMINGMS); } static PyObject * micro(PyObject *self, PyObject *args) { if (!PyArg_Parse(args, "")) return NULL; return PyInt_FromLong(TIMINGUS); } static PyMethodDef timing_methods[] = { {"start", start_timing}, {"finish", finish_timing}, {"seconds", seconds}, {"milli", milli}, {"micro", micro}, {NULL, NULL} }; DL_EXPORT(void) inittiming(void) { (void)Py_InitModule("timing", timing_methods); }
