Mercurial > cpython-lru_cache-weakref
diff Python/traceback.c @ 65332:6296632ad2cb 3.1
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)
........
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Thu, 14 Oct 2010 21:17:39 +0000 |
| parents | fa830371c724 |
| children | 42b84d3188d1 |
line wrap: on
line diff
--- a/Python/traceback.c Thu Oct 14 20:44:58 2010 +0000 +++ b/Python/traceback.c Thu Oct 14 21:17:39 2010 +0000 @@ -209,6 +209,7 @@ 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 @@ 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);
