From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9872 invoked by alias); 13 Aug 2008 18:22:24 -0000 Received: (qmail 9857 invoked by uid 22791); 13 Aug 2008 18:22:23 -0000 X-Spam-Check-By: sourceware.org Received: from mtaout4.012.net.il (HELO mtaout4.012.net.il) (84.95.2.10) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 13 Aug 2008 18:21:44 +0000 Received: from HOME-C4E4A596F7 ([84.229.211.50]) by i_mtaout4.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0K5J00EHVXOBF7Z0@i_mtaout4.012.net.il> for gdb-patches@sources.redhat.com; Wed, 13 Aug 2008 21:21:48 +0300 (IDT) Date: Wed, 13 Aug 2008 18:22:00 -0000 From: Eli Zaretskii Subject: Re: Fix python indented multi-line commands In-reply-to: X-012-Sender: halo1@inter.net.il To: Thiago Jung Bauermann Cc: gdb-patches@sources.redhat.com Reply-to: Eli Zaretskii Message-id: References: 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: 2008-08/txt/msg00353.txt.bz2 > From: Thiago Jung Bauermann > Date: Wed, 13 Aug 2008 03:40:03 -0300 > > Today, if you try to use indentation in Python code within GDB you will > get this error: > > (gdb) python > >def foo (): > > print 'hooray' > >end > File "", line 2 > print 'hooray' > ^ > IndentationError: expected an indented block > > The patch below, extracted from the python branch, fixes the problem. Thanks! > /* Read one line from the input stream. If the command is an "else" or > - "end", return such an indication to the caller. */ > + "end", return such an indication to the caller. If SPECIAL_PROCESSING > + is true, strip leading and trailing whitespace in the line and attempt > + to recognize GDB control commands. Otherwise, only "end" is > + recognized. */ > > static enum misc_command_type > -read_next_line (struct command_line **command) > +read_next_line (struct command_line **command, int special_processing) Please don't call variables by mysterious names such as "special_processing". Please give that variable a meaningful name that would explain the purpose of this flag even without reading the code of the callers of this function.