From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122918 invoked by alias); 22 Feb 2016 16:12:47 -0000 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 Received: (qmail 122788 invoked by uid 89); 22 Feb 2016 16:12:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=Goodbye, goodbye, UD:gdb X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 22 Feb 2016 16:12:45 +0000 Received: from EUSAAHC003.ericsson.se (Unknown_Domain [147.117.188.81]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id 7A.17.32102.2633BC65; Mon, 22 Feb 2016 17:12:18 +0100 (CET) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.83) with Microsoft SMTP Server id 14.3.248.2; Mon, 22 Feb 2016 11:12:43 -0500 Subject: Re: [rfc patch+7.11] gdb-gdb.py: SyntaxError: Missing parentheses in call to 'print' To: Jan Kratochvil , References: <20160222155646.GA1869@host1.jankratochvil.net> From: Simon Marchi Message-ID: <56CB337B.3060606@ericsson.com> Date: Mon, 22 Feb 2016 16:12:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160222155646.GA1869@host1.jankratochvil.net> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00656.txt.bz2 On 16-02-22 10:56 AM, Jan Kratochvil wrote: > Hi, > > after build GDB > --with-python=/usr/bin/python3 > and for example stripping ./gdb and running: > ./gdb -data-directory data-directory/ -iex "add-auto-load-safe-path $PWD/gdb-gdb.gdb" -iex "add-auto-load-safe-path $PWD/gdb-gdb.py" ./gdb > I get: > Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal] > File "/home/jkratoch/redhat/gdb-test-python3/gdb/gdb-gdb.py", line 91 > print "Warning: Cannot find enum type_flag_value type." > ^ > SyntaxError: Missing parentheses in call to 'print' > (top-gdb) q > > The fix would be obvious: > s/print \(".*"\)/print (\1) > > But then I was curious I do not see the warning messsage anyway. > So I tried to append \n to that string but I still do not see the warning. > But I do not know why. This patch is probably right and it could be checked > in as "obvious" but given the warning still is not seen who knows. Are you sure that the execution really goes through that line? When I run this with Python 3: if 1 == 2: print "Hello" print("Goodbye") I get: File "test.py", line 2 print "Hello" ^ SyntaxError: Missing parentheses in call to 'print' That means Python notices the error at parse time, not execution time. It could very well be that you don't see the warning because that line is not actually executed.