summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1997-01-13 22:57:42 (GMT)
committerBarry Warsaw <barry@python.org>1997-01-13 22:57:42 (GMT)
commit58d40a7400811db24a6fc384651476b4f390d8c0 (patch)
treecd3fff144f3bd6731594af8a1204e08fcd641bb9 /Modules
parent5b456645fb69f63727bc260159bfeb2d8e95ec69 (diff)
downloadcpython-58d40a7400811db24a6fc384651476b4f390d8c0.zip
cpython-58d40a7400811db24a6fc384651476b4f390d8c0.tar.gz
cpython-58d40a7400811db24a6fc384651476b4f390d8c0.tar.bz2
Renamed.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/timingmodule.c94
1 files changed, 45 insertions, 49 deletions
diff --git a/Modules/timingmodule.c b/Modules/timingmodule.c
index f4fd1ab..a07ecef 100644
--- a/Modules/timingmodule.c
+++ b/Modules/timingmodule.c
@@ -2,90 +2,86 @@
* Author: George V. Neville-Neil
*/
-#include "allobjects.h"
-#include "import.h"
-#include "modsupport.h"
-#include "ceval.h"
+#include "Python.h"
/* Our stuff... */
#include "timing.h"
-static object *
+static PyObject *
start_timing(self, args)
- object *self;
- object *args;
+ PyObject *self;
+ PyObject *args;
{
- if (!getargs(args, ""))
- return NULL;
+ if (!PyArg_Parse(args, ""))
+ return NULL;
- INCREF(None);
- BEGINTIMING;
- return None;
+ Py_INCREF(Py_None);
+ BEGINTIMING;
+ return Py_None;
}
-static object *
+static PyObject *
finish_timing(self, args)
- object *self;
- object *args;
+ PyObject *self;
+ PyObject *args;
{
- if (!getargs(args, ""))
- return NULL;
+ if (!PyArg_Parse(args, ""))
+ return NULL;
- ENDTIMING
- INCREF(None);
- return None;
+ ENDTIMING
+ Py_INCREF(Py_None);
+ return Py_None;
}
-static object *
+static PyObject *
seconds(self, args)
- object *self;
- object *args;
+ PyObject *self;
+ PyObject *args;
{
- if (!getargs(args, ""))
- return NULL;
+ if (!PyArg_Parse(args, ""))
+ return NULL;
- return newintobject(TIMINGS);
+ return PyInt_FromLong(TIMINGS);
}
-static object *
+static PyObject *
milli(self, args)
- object *self;
- object *args;
+ PyObject *self;
+ PyObject *args;
{
- if (!getargs(args, ""))
- return NULL;
+ if (!PyArg_Parse(args, ""))
+ return NULL;
- return newintobject(TIMINGMS);
+ return PyInt_FromLong(TIMINGMS);
}
-static object *
+static PyObject *
micro(self, args)
- object *self;
- object *args;
+ PyObject *self;
+ PyObject *args;
{
- if (!getargs(args, ""))
- return NULL;
+ if (!PyArg_Parse(args, ""))
+ return NULL;
- return newintobject(TIMINGUS);
+ return PyInt_FromLong(TIMINGUS);
}
-static struct methodlist timing_methods[] = {
- {"start", start_timing},
- {"finish", finish_timing},
- {"seconds", seconds},
- {"milli", milli},
- {"micro", micro},
- {NULL, NULL}
+static PyMethodDef timing_methods[] = {
+ {"start", start_timing},
+ {"finish", finish_timing},
+ {"seconds", seconds},
+ {"milli", milli},
+ {"micro", micro},
+ {NULL, NULL}
};
void inittiming()
{
- object *m;
-
- m = initmodule("timing", timing_methods);
-
+ (void)Py_InitModule("timing", timing_methods);
+ if (PyErr_Occurred())
+ Py_FatalError("can't initialize module timing");
}