From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3840 invoked by alias); 6 Feb 2012 20:13:41 -0000 Received: (qmail 3817 invoked by uid 22791); 6 Feb 2012 20:13:37 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ausc60ps301.us.dell.com (HELO ausc60ps301.us.dell.com) (143.166.148.206) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Feb 2012 20:13:20 +0000 X-Loopcount0: from 10.175.216.251 From: To: , CC: , Date: Mon, 06 Feb 2012 20:13:00 -0000 Subject: RE: Make the "python" command resemble the standard Python interpreter Message-ID: <09787EF419216C41A903FD14EE5506DD0310E29D2F@AUSX7MCPC103.AMER.DELL.COM> References: <09787EF419216C41A903FD14EE5506DD030F1EB39B@AUSX7MCPC103.AMER.DELL.COM> <09787EF419216C41A903FD14EE5506DD030F1EB45D@AUSX7MCPC103.AMER.DELL.COM> In-Reply-To: Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00065.txt.bz2 I'm confused. "Python's repl expects a blank line to end a block"? I'm no= t sure what a repl is, but Python doesn't require blank lines for anything.= End of block is defined by smaller indent. I don't understand that error message at all. paul -----Original Message----- From: Doug Evans [mailto:dje@google.com]=20 Sent: Monday, February 06, 2012 3:09 PM To: Khoo Yit Phang Cc: Tom Tromey; Koning, Paul; gdb-patches@sourceware.org Subject: Re: Make the "python" command resemble the standard Python interpr= eter On Mon, Jan 30, 2012 at 9:25 AM, Doug Evans wrote: > On Mon, Jan 30, 2012 at 9:18 AM, Doug Evans wrote: >> Plus, with some playing around I found this: >> >> --- foo.gdb - snip --- >> python >> if 0 =3D=3D 1: >> =A0print "foo" >> print "bar" >> end >> --- snip --- >> >> (gdb) source foo.gdb >> bar >> (gdb) >> >> But cut-n-paste that script into gdb and I get this: >> >> (gdb) python >> if 0 =3D=3D 1: >> =A0print "foo" >> print "bar" >> end >>>>> ... ... =A0 File "", line 3 >> =A0 =A0print "bar" >> =A0 =A0 =A0 =A0^ >> SyntaxError: invalid syntax >>>>> >> (gdb) >> >> [For reference sake, here's how I cut-n-pasted it in emacs: >> C-x C-f foo.gdb RET C-space C-x ] C-b M-w C-x b RET C-y RET I hope I=20 >> transcribed that right.] >> >> Python's repl expects a blank line to end the block. >> I don't know if there's a way to work around this. =A0Maybe there is. >> So now I'm even less comfortable. > > btw, that's with the latest python-interactive script (that I could > find) applied (+ the sigint patch too). > > For grin's sake, there's another example: > > --- snip --- > python > if 0 =3D=3D 1: > =A0print "foo" > end > --- > > If I cut-n-paste that into gdb the "end" terminates the "if" block=20 > (heh, didn't expect that :-)), and afterwards I'm still in python. > Maybe this can be fixed too. btw, in an effort to keep things moving along, to repeat something I mentio= ned earlier, If you, for example, add a new command, say, "python-block" ('= tis the best I could come up with :-() that always behaved like python...en= d in scripts, then I think that would be ok: Users that want the existing s= cript-like behaviour can switch to and use it instead of "python". IOW, "py= thon-block" always behaves like the existing "python" command without argum= ents. E.g., python-block if 0 =3D=3D 1: print "foo" end