From patchwork Mon Feb 22 15:56:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 10987 Received: (qmail 10343 invoked by alias); 22 Feb 2016 15:56:57 -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 10321 invoked by uid 89); 22 Feb 2016 15:56:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:gdb-tes, sk:gdbtes, python3, H*MI:host1 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; Mon, 22 Feb 2016 15:56:55 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 27A5E65409 for ; Mon, 22 Feb 2016 15:56:54 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1MFuofA032660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 22 Feb 2016 10:56:53 -0500 Date: Mon, 22 Feb 2016 16:56:46 +0100 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [rfc patch+7.11] gdb-gdb.py: SyntaxError: Missing parentheses in call to 'print' Message-ID: <20160222155646.GA1869@host1.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes 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. Jan gdb/ChangeLog 2016-02-22 Jan Kratochvil * gdb-gdb.py (class TypeFlagsPrinter): Use parentheses for print. diff --git a/gdb/gdb-gdb.py b/gdb/gdb-gdb.py index 4f3ac1c..9a12baf 100644 --- a/gdb/gdb-gdb.py +++ b/gdb/gdb-gdb.py @@ -88,14 +88,14 @@ class TypeFlagsPrinter: try: flags = gdb.lookup_type("enum type_flag_value") except: - print "Warning: Cannot find enum type_flag_value type." - print " `struct type' pretty-printer will be degraded" + print("Warning: Cannot find enum type_flag_value type.") + print(" `struct type' pretty-printer will be degraded") return try: iflags = gdb.lookup_type("enum type_instance_flag_value") except: - print "Warning: Cannot find enum type_instance_flag_value type." - print " `struct type' pretty-printer will be degraded" + print("Warning: Cannot find enum type_instance_flag_value type.") + print(" `struct type' pretty-printer will be degraded") return # Note: TYPE_FLAG_MIN is a duplicate of TYPE_FLAG_UNSIGNED, # so exclude it from the list we are building.