Issue #26588: add debug traces

Try to debug random failure on buildbots.
This commit is contained in:
Victor Stinner 2016-03-22 16:13:31 +01:00
parent 24f949e10c
commit 84aab09421
3 changed files with 59 additions and 5 deletions

View file

@ -3747,6 +3747,19 @@ tracemalloc_get_traceback(PyObject *self, PyObject *args)
return _PyTraceMalloc_GetTraceback(domain, (Py_uintptr_t)ptr);
}
PyObject*
tracemalloc_set_debug(PyObject *self, PyObject *args)
{
int debug;
extern int tracemalloc_debug;
if (!PyArg_ParseTuple(args, "i", &debug))
return NULL;
tracemalloc_debug = debug;
Py_RETURN_NONE;
}
static PyMethodDef TestMethods[] = {
{"raise_exception", raise_exception, METH_VARARGS},
@ -3936,6 +3949,7 @@ static PyMethodDef TestMethods[] = {
{"tracemalloc_track", tracemalloc_track, METH_VARARGS},
{"tracemalloc_untrack", tracemalloc_untrack, METH_VARARGS},
{"tracemalloc_get_traceback", tracemalloc_get_traceback, METH_VARARGS},
{"tracemalloc_set_debug", tracemalloc_set_debug, METH_VARARGS},
{NULL, NULL} /* sentinel */
};