[Python-checkins] CVS: python/dist/src/Modules main.c,1.41,1.42

Guido van Rossum python-dev@python.org
Sun, 27 Aug 2000 12:21:07 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory slayer.i.sourceforge.net:/tmp/cvs-serv29178

Modified Files:
	main.c 
Log Message:
Add three new APIs: PyRun_AnyFileEx(), PyRun_SimpleFileEx(),
PyRun_FileEx().  These are the same as their non-Ex counterparts but
have an extra argument, a flag telling them to close the file when
done.

Then this is used by Py_Main() and execfile() to close the file after
it is parsed but before it is executed.

Adding APIs seems strange given the feature freeze but it's the only
way I see to close the bug report without incompatible changes.

[ Bug #110616 ] source file stays open after parsing is done (PR#209)


Index: main.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** main.c	2000/07/09 20:42:34	1.41
--- main.c	2000/08/27 19:21:04	1.42
***************
*** 269,277 ****
  			}
  		}
! 		sts = PyRun_AnyFile(
  			fp,
! 			filename == NULL ? "<stdin>" : filename) != 0;
! 		if (filename != NULL)
! 			fclose(fp);
  	}
  
--- 269,276 ----
  			}
  		}
! 		sts = PyRun_AnyFileEx(
  			fp,
! 			filename == NULL ? "<stdin>" : filename,
! 			filename != NULL) != 0;
  	}