[doc] Python3: execfile->exec+open
Commit Message
Hi,
https://bugzilla.redhat.com/show_bug.cgi?id=1253590
https://docs.python.org/3.3/whatsnew/3.0.html#builtins
Python 2 had:
gdb -ex 'python execfile("foo.py")'
but Python3 has only:
gdb -ex 'python exec(open("foo.py").read())'
Fortunately the Python3 way works even in Python2.
execfile is used also in 'gdb/contrib/exsummary.py' but I expect there may be
more issues of Python2->3 compatibility than this one, I haven't found it easy
to test it and it was contributed by Tom Tromey who does not contribute
patches here anymore. Given it is in contrib/ I do not find it a problem.
Jan
gdb/doc/ChangeLog
2015-08-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* python.texi (Python Commands): Change python execfile to exec+open.
@@ -114,8 +114,8 @@ The script name must end with @samp{.py} and @value{GDBN} must be configured
to recognize the script language based on filename extension using
the @code{script-extension} setting. @xref{Extending GDB, ,Extending GDB}.
-@item python execfile ("script-name")
-This method is based on the @code{execfile} Python built-in function,
+@item python exec (open ("script-name").read ())
+This method is based on the @code{exec} Python built-in function,
and thus is always available.
@end table