diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-25 01:30:01 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-25 01:30:01 (GMT) |
commit | 39183dfc682568e8a00203c26caee893f49ff390 (patch) | |
tree | 2b4d06b6e406e01b635560336fe38d32e75f8948 /Python | |
parent | 53345a40bcbf6d71705533b658b2940dad31a684 (diff) | |
parent | 81f241ab2e19db9e421a300c00f9fb1c4e0003df (diff) | |
download | cpython-39183dfc682568e8a00203c26caee893f49ff390.zip cpython-39183dfc682568e8a00203c26caee893f49ff390.tar.gz cpython-39183dfc682568e8a00203c26caee893f49ff390.tar.bz2 |
Merge 3.4 (traceback)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/traceback.c | 9 |
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++) { |