diff options
author | Georg Brandl <georg@python.org> | 2006-05-29 21:04:52 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-05-29 21:04:52 (GMT) |
commit | 96a8c3954cbdb186bc567a490dad8987508ce268 (patch) | |
tree | 4d6516790abcd566c43418e4c9b02e9c52cf9f2f /Modules/_hotshot.c | |
parent | fd9a4b19e9c77e9ccc3e7fcb57051cf160c0df6d (diff) | |
download | cpython-96a8c3954cbdb186bc567a490dad8987508ce268.zip cpython-96a8c3954cbdb186bc567a490dad8987508ce268.tar.gz cpython-96a8c3954cbdb186bc567a490dad8987508ce268.tar.bz2 |
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
Diffstat (limited to 'Modules/_hotshot.c')
-rw-r--r-- | Modules/_hotshot.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c index 3ad0a9e..5a81bfb 100644 --- a/Modules/_hotshot.c +++ b/Modules/_hotshot.c @@ -1058,7 +1058,7 @@ profiler_runcall(ProfilerObject *self, PyObject *args) PyObject *callkw = NULL; PyObject *callable; - if (PyArg_ParseTuple(args, "O|OO:runcall", + if (PyArg_UnpackTuple(args, "runcall", 1, 3, &callable, &callargs, &callkw)) { if (is_available(self)) { do_start(self); @@ -1575,23 +1575,18 @@ PyDoc_STR( ; static PyObject * -hotshot_resolution(PyObject *unused, PyObject *args) +hotshot_resolution(PyObject *self, PyObject *unused) { - PyObject *result = NULL; - - if (PyArg_ParseTuple(args, ":resolution")) { - if (timeofday_diff == 0) { - calibrate(); - calibrate(); - calibrate(); - } + if (timeofday_diff == 0) { + calibrate(); + calibrate(); + calibrate(); + } #ifdef MS_WINDOWS - result = Py_BuildValue("ii", timeofday_diff, frequency.LowPart); + return Py_BuildValue("ii", timeofday_diff, frequency.LowPart); #else - result = Py_BuildValue("ii", timeofday_diff, rusage_diff); + return Py_BuildValue("ii", timeofday_diff, rusage_diff); #endif - } - return result; } @@ -1599,7 +1594,7 @@ static PyMethodDef functions[] = { {"coverage", hotshot_coverage, METH_VARARGS, coverage__doc__}, {"profiler", hotshot_profiler, METH_VARARGS, profiler__doc__}, {"logreader", hotshot_logreader, METH_VARARGS, logreader__doc__}, - {"resolution", hotshot_resolution, METH_VARARGS, resolution__doc__}, + {"resolution", hotshot_resolution, METH_NOARGS, resolution__doc__}, {NULL, NULL} }; |