[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.176,2.177

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


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

Modified Files:
	bltinmodule.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: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.176
retrieving revision 2.177
diff -C2 -r2.176 -r2.177
*** bltinmodule.c	2000/08/18 05:02:16	2.176
--- bltinmodule.c	2000/08/27 19:21:52	2.177
***************
*** 816,823 ****
  		return NULL;
  	}
! 	res = PyRun_File(fp, filename, Py_file_input, globals, locals);
! 	Py_BEGIN_ALLOW_THREADS
! 	fclose(fp);
! 	Py_END_ALLOW_THREADS
  	return res;
  }
--- 816,820 ----
  		return NULL;
  	}
! 	res = PyRun_FileEx(fp, filename, Py_file_input, globals, locals, 1);
  	return res;
  }