[Python-checkins] cpython (merge 3.4 -> default): Merge 3.4 (traceback)

victor.stinner python-checkins at python.org
Wed Mar 25 02:47:33 CET 2015


https://hg.python.org/cpython/rev/033dbab6fe5f
changeset:   95191:033dbab6fe5f
parent:      95189:e9ba95418af8
parent:      95190:004e3870d9e6
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Mar 25 02:30:01 2015 +0100
summary:
  Merge 3.4 (traceback)

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


diff --git a/Python/traceback.c b/Python/traceback.c
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -309,13 +309,20 @@
     }
     fob = _PyObject_CallMethodId(io, &PyId_TextIOWrapper, "Os", binary, encoding);
     Py_DECREF(io);
-    Py_DECREF(binary);
     PyMem_FREE(found_encoding);
 
     if (fob == NULL) {
         PyErr_Clear();
+
+        res = _PyObject_CallMethodId(binary, &PyId_close, "");
+        Py_DECREF(binary);
+        if (res)
+            Py_DECREF(res);
+        else
+            PyErr_Clear();
         return 0;
     }
+    Py_DECREF(binary);
 
     /* get the line number lineno */
     for (i = 0; i < lineno; i++) {

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


More information about the Python-checkins mailing list