mirror of
https://github.com/python/cpython.git
synced 2025-08-21 17:25:34 +00:00
Bug #1674503: close the file opened by execfile() in an error condition.
(backport)
This commit is contained in:
parent
8da6f1b668
commit
15e138a0dc
2 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue