summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-03-06 12:17:50 (GMT)
committerGeorg Brandl <georg@python.org>2007-03-06 12:17:50 (GMT)
commit098cd69ff9fe8f78753a86d0c17b0c87b0a13587 (patch)
treeef1a9115db3d9ad3550a8577b5c45729b4a430cb /Python
parentd53d951c240fc070f368c335792a9923e1426c8a (diff)
downloadcpython-098cd69ff9fe8f78753a86d0c17b0c87b0a13587.zip
cpython-098cd69ff9fe8f78753a86d0c17b0c87b0a13587.tar.gz
cpython-098cd69ff9fe8f78753a86d0c17b0c87b0a13587.tar.bz2
Bug #1674503: close the file opened by execfile() in an error condition.
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 98ae115..3d0c68f 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1251,12 +1251,12 @@ PyRun_FileExFlags(FILE *fp, const char *filename, int start, PyObject *globals,
mod = PyParser_ASTFromFile(fp, filename, start, 0, 0,
flags, NULL, arena);
+ if (closeit)
+ fclose(fp);
if (mod == NULL) {
PyArena_Free(arena);
return NULL;
}
- if (closeit)
- fclose(fp);
ret = run_mod(mod, filename, globals, locals, flags, arena);
PyArena_Free(arena);
return ret;