mirror of
https://github.com/python/cpython.git
synced 2026-05-18 02:15:28 -04:00
Bug #1674503: close the file opened by execfile() in an error condition.
This commit is contained in:
+2
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user