Bug #1674503: close the file opened by execfile() in an error condition.

This commit is contained in:
Georg Brandl 2007-03-06 12:17:50 +00:00
parent d53d951c24
commit 098cd69ff9
2 changed files with 4 additions and 2 deletions

View File

@ -12,6 +12,8 @@ What's New in Python 2.6 alpha 1?
Core and builtins
-----------------
- Bug #1674503: close the file opened by execfile() in an error condition.
- Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.

View File

@ -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;