[Python-checkins] cpython: Fix reference leak in tb_printinternal()

victor.stinner python-checkins at python.org
Fri Aug 19 21:06:50 EDT 2016


https://hg.python.org/cpython/rev/a7f3678f9509
changeset:   102790:a7f3678f9509
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Aug 20 03:05:13 2016 +0200
summary:
  Fix reference leak in tb_printinternal()

Issue #26823.

files:
  Python/traceback.c |  2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/Python/traceback.c b/Python/traceback.c
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -435,6 +435,7 @@
                         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 @@
         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;
 }

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list