diff options
author | Georg Brandl <georg@python.org> | 2007-03-06 12:16:52 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-03-06 12:16:52 +0000 |
commit | 15e138a0dc9a8e405cd9be260c2dd12aeb3f4aea (patch) | |
tree | 3a52b65d0d50fa54ee3cdcacef2f1deff1c1c4e7 /Python | |
parent | 8da6f1b66811f6cf680dd0bd5762ff051e42d034 (diff) | |
download | cpython-git-15e138a0dc9a8e405cd9be260c2dd12aeb3f4aea.tar.gz |
Bug #1674503: close the file opened by execfile() in an error condition.
(backport)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pythonrun.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index e83c4cb423..3b5307c7fb 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1244,12 +1244,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; |