Staging
v0.5.1
https://github.com/python/cpython
Revision 0e42f0e7991e0ae7484ea7cdc339e6293a5fd169 authored by Gregory P. Smith on 19 January 2008, 22:35:09 UTC, committed by Gregory P. Smith on 19 January 2008, 22:35:09 UTC
- Issue #1336: fix a race condition in subprocess.Popen if the garbage
  collector kicked in at the wrong time that would cause the process
  to hang when the child wrote to stderr.
1 parent 80ebe95
Raw File
Tip revision: 0e42f0e7991e0ae7484ea7cdc339e6293a5fd169 authored by Gregory P. Smith on 19 January 2008, 22:35:09 UTC
Backport r60104 + r60111 from trunk.
Tip revision: 0e42f0e
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