summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-10-14 21:17:39 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-10-14 21:17:39 (GMT)
commit3d400b7a58a9f6e338048593ae19ab3cc92a8cd3 (patch)
tree0eac5be6c10a5c55054461d68fe5f62a35713610 /Python
parent51be0f47fa871a7b45c6407183110fde02a79997 (diff)
downloadcpython-3d400b7a58a9f6e338048593ae19ab3cc92a8cd3.zip
cpython-3d400b7a58a9f6e338048593ae19ab3cc92a8cd3.tar.gz
cpython-3d400b7a58a9f6e338048593ae19ab3cc92a8cd3.tar.bz2
Merged revisions 85497 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r85497 | antoine.pitrou | 2010-10-14 23:15:17 +0200 (jeu., 14 oct. 2010) | 3 lines 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 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);