Manlio Perillo NOmanlio_perilloSPAM at
Sat Sep 25 13:21:21 CEST 2004

Why the sys module does not have a function like getrecursiondepth?
It is very easy to implement:

#include "Python.h"

static PyObject *
getrecursiondepth(PyObject *self, PyObject *args)
	PyThreadState *tstate;

	if (!PyArg_ParseTuple(args, ":recursion_depth"))
		return NULL;

	tstate = PyThreadState_GET();
	return Py_BuildValue("i", tstate->recursion_depth);

Thanks and regards   Manlio Perillo

More information about the Python-list mailing list