Do not open script filenames twice.
	* cli/cli-cmds.c (source_script_from_stream): Pass to
	source_python_script also STREAM.
	* python/py-auto-load.c (source_section_scripts): Pass to
	source_python_script_for_objfile also STREAM.
	(auto_load_objfile_script): Pass to source_python_script_for_objfile
	also INPUT.
	* python/python-internal.h (source_python_script_for_objfile): New
	parameter file, rename parameter file to filename.
	* python/python.c (python_run_simple_file): Call PyRun_SimpleFile
	instead if !_WIN32.  Update the function comment.
	(source_python_script, source_python_script_for_objfile)
	(source_python_script): New parameter file, rename parameter file to
	filename.  Pass FILENAME to python_run_simple_file.
	* python/python.h (source_python_script): New parameter file, rename
	parameter file to filename.
This commit is contained in:
Jan Kratochvil 2012-01-26 21:54:45 +00:00
parent 88f38a0478
commit 4c63965b8a
6 changed files with 56 additions and 39 deletions

View file

@ -312,7 +312,7 @@ Use `info auto-load-scripts [REGEXP]' to list them."),
{
/* If this file is not currently loaded, load it. */
if (! in_hash_table)
source_python_script_for_objfile (objfile, full_path);
source_python_script_for_objfile (objfile, stream, full_path);
fclose (stream);
xfree (full_path);
}
@ -431,7 +431,7 @@ auto_load_objfile_script (struct objfile *objfile, const char *suffix)
It's highly unlikely that we'd ever load it twice,
and these scripts are required to be idempotent under multiple
loads anyway. */
source_python_script_for_objfile (objfile, debugfile);
source_python_script_for_objfile (objfile, input, debugfile);
fclose (input);
}