Staging
v0.5.1
https://github.com/python/cpython
Revision 70cea58c84165460683b12e60331b4a90550e313 authored by Neal Norwitz on 28 March 2008, 06:34:03 UTC, committed by Neal Norwitz on 28 March 2008, 06:34:03 UTC
reliable, but I'm not convinced it is the right solution.  We need
to determine if this causes the test to hang on any platforms or do
other bad things.

Even if it gets the test to pass reliably, it might be that we want
to fix this in socket.  The socket returned from accept() is different
on different platforms (inheriting attributes or not) and we might
want to ensure that the attributes (at least blocking) is the same
across all platforms.
1 parent 9fdfaaf
Raw File
Tip revision: 70cea58c84165460683b12e60331b4a90550e313 authored by Neal Norwitz on 28 March 2008, 06:34:03 UTC
Bug 1503: Get the test to pass on OSX. This should make the test more
Tip revision: 70cea58
timingmodule.c
/*
 * Author: George V. Neville-Neil
 */

#include "Python.h"

/* Our stuff... */
#include "timing.h"

static PyObject *
start_timing(PyObject *self)
{
	Py_INCREF(Py_None);
	BEGINTIMING;
	return Py_None;
}

static PyObject *
finish_timing(PyObject *self)
{
	ENDTIMING    
	Py_INCREF(Py_None);
	return Py_None;
}

static PyObject *
seconds(PyObject *self)
{
	return PyInt_FromLong(TIMINGS);
}

static PyObject *
milli(PyObject *self)
{
	return PyInt_FromLong(TIMINGMS);
}

static PyObject *
micro(PyObject *self)
{
	return PyInt_FromLong(TIMINGUS);
}


static PyMethodDef timing_methods[] = {
	{"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}
};


PyMODINIT_FUNC inittiming(void)
{
	(void)Py_InitModule("timing", timing_methods);
}
back to top