Skip to content

Commit 73237c5

Browse files
committed
Only use PyCode_Addr2Line to get tb_lineno when Py_OptimizeFlag is set.
1 parent d3d6f8f commit 73237c5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Python/traceback.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ tb_printinternal(tb, f, limit)
243243
}
244244
while (tb != NULL && !PyOS_InterruptOccurred()) {
245245
if (depth <= limit) {
246-
tb->tb_lineno = PyCode_Addr2Line(tb->tb_frame->f_code,
247-
tb->tb_lasti);
246+
if (Py_OptimizeFlag)
247+
tb->tb_lineno = PyCode_Addr2Line(
248+
tb->tb_frame->f_code, tb->tb_lasti);
248249
tb_displayline(f,
249250
PyString_AsString(
250251
tb->tb_frame->f_code->co_filename),

0 commit comments

Comments
 (0)