From: Brett Cannon Date: Tue, 30 Sep 2008 17:46:03 +0000 (+0000) Subject: Fix a refleak introduced by r66677. X-Git-Tag: v2.6~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f40200b21475998b262e2aa0ec5b909ddde34be2;p=python Fix a refleak introduced by r66677. Fix suggested by Amaury Forgeot d'Arc. Closes issue #4003. --- diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index 41c477e388..14bb8f93e8 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -150,16 +150,7 @@ static PY_LONG_LONG CallExternalTimer(ProfilerObject *pObj) } Py_DECREF(o); if (PyErr_Occurred()) { - PyObject *context = (PyObject *)pObj; - /* May have been called by profiler_dealloc(). */ - if (Py_REFCNT(context) < 1) { - context = PyString_FromString("profiler calling an " - "external timer"); - if (context == NULL) { - return 0; - } - } - PyErr_WriteUnraisable(context); + PyErr_WriteUnraisable(pObj->externalTimer); return 0; } return result;