From 56146a34af2fc9eaee9ac4dc0f3058e427f8c052 Mon Sep 17 00:00:00 2001 From: "roberto@natty32" Date: Thu, 5 May 2011 02:40:53 +0200 Subject: [PATCH] python get line number/profier fix --- plugins/python/profiler.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/python/profiler.c b/plugins/python/profiler.c index 992c1f40..20a9c7ff 100644 --- a/plugins/python/profiler.c +++ b/plugins/python/profiler.c @@ -3,8 +3,13 @@ extern struct uwsgi_server uwsgi; #ifndef PyFrame_GetLineNumber -static int PyFrame_GetLineNumber(PyFrameObject *frame) { - return frame->f_lineno; +int PyFrame_GetLineNumber(PyFrameObject *frame) { + if (frame->f_trace) { + return frame->f_lineno; + } + else { + return PyCode_Addr2Line(frame->f_code, frame->f_lasti); + } } #endif