summaryrefslogtreecommitdiffstats
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-25 01:30:01 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-03-25 01:30:01 (GMT)
commit39183dfc682568e8a00203c26caee893f49ff390 (patch)
tree2b4d06b6e406e01b635560336fe38d32e75f8948 /Python/traceback.c
parent53345a40bcbf6d71705533b658b2940dad31a684 (diff)
parent81f241ab2e19db9e421a300c00f9fb1c4e0003df (diff)
downloadcpython-39183dfc682568e8a00203c26caee893f49ff390.zip
cpython-39183dfc682568e8a00203c26caee893f49ff390.tar.gz
cpython-39183dfc682568e8a00203c26caee893f49ff390.tar.bz2
Merge 3.4 (traceback)
Diffstat (limited to 'Python/traceback.c')
-rw-r--r--Python/traceback.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index e3adc96..ef7b9f5 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -309,13 +309,20 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent)
}
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++) {