Re: [patch] Do not open Python scripts twice #2 [Re: [RFC] Crash sourcing Python script on Windows]

Joel Brobecker
2012-01-26T06:21:36Z

Hi Jan,

> gdb/
> 2012-01-25 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> 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.

The patch looks good to me and I would probably have come up with
the same sort of changes myself. I tested it on x86-windows, and
sourcing Python files still worked perfectly. I also ran it against
AdaCore's testsuite and no regression either.

--
Joel