summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-10-14 21:15:17 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-10-14 21:15:17 (GMT)
commitb86680e299d7429532518a496031cb96aa2ea659 (patch)
treec908511dfb569e7a640ed65cc412f1556f0ecc12 /Python
parentd9f57630fed16bd1e97737f8afc22b5cc6645769 (diff)
downloadcpython-b86680e299d7429532518a496031cb96aa2ea659.zip
cpython-b86680e299d7429532518a496031cb96aa2ea659.tar.gz
cpython-b86680e299d7429532518a496031cb96aa2ea659.tar.bz2
Explicitly close some files (from issue #10093)
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 9c9c357..558755d 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -208,6 +208,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;
@@ -253,6 +254,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);