[Python-checkins] r54159 - in python/trunk: Misc/NEWS Python/pythonrun.c

georg.brandl python-checkins at python.org
Tue Mar 6 13:17:51 CET 2007


Author: georg.brandl
Date: Tue Mar  6 13:17:50 2007
New Revision: 54159

Modified:
   python/trunk/Misc/NEWS
   python/trunk/Python/pythonrun.c
Log:
Bug #1674503: close the file opened by execfile() in an error condition.

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Tue Mar  6 13:17:50 2007
@@ -12,6 +12,8 @@
 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.
 

Modified: python/trunk/Python/pythonrun.c
==============================================================================
--- python/trunk/Python/pythonrun.c	(original)
+++ python/trunk/Python/pythonrun.c	Tue Mar  6 13:17:50 2007
@@ -1251,12 +1251,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;


More information about the Python-checkins mailing list