diff Python/traceback.c @ 65331:46956a25c264

Explicitly close some files (from issue #10093)
author Antoine Pitrou <solipsis@pitrou.net>
date Thu, 14 Oct 2010 21:15:17 +0000
parents 907f564476be
children 55ed5c524428
line wrap: on
line diff
--- a/Python/traceback.c	Thu Oct 14 20:56:20 2010 +0000
+++ b/Python/traceback.c	Thu Oct 14 21:15:17 2010 +0000
@@ -208,6 +208,7 @@
     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 @@
             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);