Commit a88b2f4e authored by Victor Stinner's avatar Victor Stinner

Fix reference leak in tb_printinternal()

Issue #26823.
parent 253021dd
...@@ -435,6 +435,7 @@ tb_printinternal(PyTracebackObject *tb, PyObject *f, long limit) ...@@ -435,6 +435,7 @@ tb_printinternal(PyTracebackObject *tb, PyObject *f, long limit)
line = PyUnicode_FromFormat( line = PyUnicode_FromFormat(
" [Previous line repeated %d more times]\n", cnt-3); " [Previous line repeated %d more times]\n", cnt-3);
err = PyFile_WriteObject(line, f, Py_PRINT_RAW); err = PyFile_WriteObject(line, f, Py_PRINT_RAW);
Py_DECREF(line);
} }
last_file = tb->tb_frame->f_code->co_filename; last_file = tb->tb_frame->f_code->co_filename;
last_line = tb->tb_lineno; last_line = tb->tb_lineno;
...@@ -456,6 +457,7 @@ tb_printinternal(PyTracebackObject *tb, PyObject *f, long limit) ...@@ -456,6 +457,7 @@ tb_printinternal(PyTracebackObject *tb, PyObject *f, long limit)
line = PyUnicode_FromFormat( line = PyUnicode_FromFormat(
" [Previous line repeated %d more times]\n", cnt-3); " [Previous line repeated %d more times]\n", cnt-3);
err = PyFile_WriteObject(line, f, Py_PRINT_RAW); err = PyFile_WriteObject(line, f, Py_PRINT_RAW);
Py_DECREF(line);
} }
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment