From patchwork Sat Aug 15 05:27:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 8227 Received: (qmail 27473 invoked by alias); 15 Aug 2015 05:27:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 26792 invoked by uid 89); 15 Aug 2015 05:27:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 15 Aug 2015 05:27:49 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 0C3838C1DA for ; Sat, 15 Aug 2015 05:27:48 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7F5RiRP012297 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sat, 15 Aug 2015 01:27:47 -0400 Date: Sat, 15 Aug 2015 07:27:44 +0200 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [doc patch] Python3: execfile->exec+open Message-ID: <20150815052744.GA4688@host1.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes 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 * python.texi (Python Commands): Change python execfile to exec+open. diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index a2df254..7231c2c 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -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