summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/traceback.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index c101933..e74d442 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -209,6 +209,7 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent)
PyObject *binary;
PyObject *fob = NULL;
PyObject *lineobj = NULL;
+ PyObject *res;
char buf[MAXPATHLEN+1];
Py_UNICODE *u, *p;
Py_ssize_t len;
@@ -254,6 +255,11 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent)
break;
}
}
+ res = PyObject_CallMethod(fob, "close", "");
+ if (res)
+ Py_DECREF(res);
+ else
+ PyErr_Clear();
Py_DECREF(fob);
if (!lineobj || !PyUnicode_Check(lineobj)) {
Py_XDECREF(lineobj);