From 73237c54b40c345813fa6b7831a32b10fa4671b5 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 5 May 1997 20:53:25 +0000 Subject: [PATCH] Only use PyCode_Addr2Line to get tb_lineno when Py_OptimizeFlag is set. --- Python/traceback.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Python/traceback.c b/Python/traceback.c index 9633db15d96..14e49052ee1 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -243,8 +243,9 @@ tb_printinternal(tb, f, limit) } while (tb != NULL && !PyOS_InterruptOccurred()) { if (depth <= limit) { - tb->tb_lineno = PyCode_Addr2Line(tb->tb_frame->f_code, - tb->tb_lasti); + if (Py_OptimizeFlag) + tb->tb_lineno = PyCode_Addr2Line( + tb->tb_frame->f_code, tb->tb_lasti); tb_displayline(f, PyString_AsString( tb->tb_frame->f_code->co_filename),