diff Python/pythonrun.c @ 41017:1080de49c81e 2.5

Bug #1674503: close the file opened by execfile() in an error condition. (backport)
author Georg Brandl <georg@python.org>
date Tue, 06 Mar 2007 12:16:52 +0000
parents da30a26dfeb3
children 66f265ac4ec4
line wrap: on
line diff
--- a/Python/pythonrun.c	Tue Mar 06 11:52:33 2007 +0000
+++ b/Python/pythonrun.c	Tue Mar 06 12:16:52 2007 +0000
@@ -1244,12 +1244,12 @@
 	
 	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;