summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-20 01:05:13 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-20 01:05:13 (GMT)
commita88b2f4e5e8e6b24df47176477cf2415e6a7e686 (patch)
treeb43639212b657e78d467fef9823cb17ba8494e24
parent253021dd945b824097415d76b5925a82b9b3e0bc (diff)
downloadcpython-a88b2f4e5e8e6b24df47176477cf2415e6a7e686.zip
cpython-a88b2f4e5e8e6b24df47176477cf2415e6a7e686.tar.gz
cpython-a88b2f4e5e8e6b24df47176477cf2415e6a7e686.tar.bz2
Fix reference leak in tb_printinternal()
Issue #26823.
-rw-r--r--Python/traceback.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index 15cde44..b33156e 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -435,6 +435,7 @@ tb_printinternal(PyTracebackObject *tb, PyObject *f, long limit)
line = PyUnicode_FromFormat(
" [Previous line repeated %d more times]\n", cnt-3);
err = PyFile_WriteObject(line, f, Py_PRINT_RAW);
+ Py_DECREF(line);
}
last_file = tb->tb_frame->f_code->co_filename;
last_line = tb->tb_lineno;
@@ -456,6 +457,7 @@ tb_printinternal(PyTracebackObject *tb, PyObject *f, long limit)
line = PyUnicode_FromFormat(
" [Previous line repeated %d more times]\n", cnt-3);
err = PyFile_WriteObject(line, f, Py_PRINT_RAW);
+ Py_DECREF(line);
}
return err;
}