From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id I3D0DNvQDmDkAwAAWB0awg (envelope-from ) for ; Mon, 25 Jan 2021 09:08:27 -0500 Received: by simark.ca (Postfix, from userid 112) id 2B7541EF80; Mon, 25 Jan 2021 09:08:27 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C44D01E945 for ; Mon, 25 Jan 2021 09:08:26 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D05743958C12; Mon, 25 Jan 2021 14:08:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D05743958C12 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611583705; bh=bDwPiwylkSJKX68eJcqAa1Yy2wT7ChOFbaAQNKwg73E=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ks11NTMy5M8yxgt/R/wtuvKUeeJ1izgif6byl1nmQDtkPyP0aWp3Iz0XOy5F1tGA/ OyRPRtMnaoKypetpQHGeGkPAsA1E9hv0FfOzjDK7JgbTy8qAXmXqVNdv2JjaTq3mVh hLH/5VCngGhP3wWYocbOJgLnSvwB1IppfUmmRfwI= Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id D51B13857001 for ; Mon, 25 Jan 2021 14:08:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D51B13857001 Received: by mail-ot1-x32b.google.com with SMTP id n42so12800922ota.12 for ; Mon, 25 Jan 2021 06:08:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=bDwPiwylkSJKX68eJcqAa1Yy2wT7ChOFbaAQNKwg73E=; b=T6knKCUtQlRbvu67XpuWX+GaL5TTnnwXSg765mNt3BnowqqcqvHVrF6SBPNgW2XJ5t eEmRg90A/PinLdlNPT/NxB9lQGr9qMHyiywclpC3wWibkHaHE/BlFeWrjw6t9uAG+KBt JMe4hlvR1aV3CU7+u2VnJAxTDWi9JXTki8aJnirE+eRwrJlFF+QS7toHn17iQctIeRZh 5KE0hvV8jR4d8KbrI/utzFhern2n87LV5XlfoksNsCR878sxDYgRtjZyC87Oqh0OrySL Gu8apXg6Pj6UrE0wfhea1j3GQMb4mZLfAmyxlNI5VOTESoWPdpk/CQYSqwr7SmkPrGxv HILQ== X-Gm-Message-State: AOAM532JcWPUrXGZ4JholSjtvbtqrTcmXhZNzG5C6T9zJBJV1hMO+5Q6 73vqtjqp0G0+8SbIauWvAvl8umg7Q+MN0Va/vwWA9kIULAeQVg== X-Google-Smtp-Source: ABdhPJyQFWxTDePWiBWrPsAeklYYChUpRYyPGrbNte2nCeqeOZuou8sTdpOeAWWg5ZZrhOvxmJDrFPf0FI2IWuBIlGY= X-Received: by 2002:a05:6830:2313:: with SMTP id u19mr543015ote.321.1611583700968; Mon, 25 Jan 2021 06:08:20 -0800 (PST) MIME-Version: 1.0 References: <20210108092935.92106-1-mbarisione@undo.io> In-Reply-To: <20210108092935.92106-1-mbarisione@undo.io> Date: Mon, 25 Jan 2021 14:07:44 +0000 Message-ID: Subject: [PING][PATCH] gdb/docs: add parentheses in Python examples using print To: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Marco Barisione via Gdb-patches Reply-To: Marco Barisione Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Ping. On Fri, 8 Jan 2021 at 09:29, Marco Barisione wrote: > > This makes the examples work both in Python 2 and 3. > > gdb/doc/ChangeLog: > > * python.texi: Add parentheses to print statements/functions. > --- > gdb/doc/python.texi | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi > index 0f776f54768..da81906d03d 100644 > --- a/gdb/doc/python.texi > +++ b/gdb/doc/python.texi > @@ -559,7 +559,7 @@ rather recognizes it when thrown from user Python code. Example: > > argv = gdb.string_to_argv (args) > > if len (argv) != 0: > > raise gdb.GdbError ("hello-world takes no arguments") > -> print "Hello, World!" > +> print ("Hello, World!") > >HelloWorld () > >end > (gdb) hello-world 42 > @@ -3100,8 +3100,8 @@ Here is an example: > > @smallexample > def exit_handler (event): > - print "event type: exit" > - print "exit code: %d" % (event.exit_code) > + print ("event type: exit") > + print ("exit code: %d" % (event.exit_code)) > > gdb.events.exited.connect (exit_handler) > @end smallexample > @@ -3921,7 +3921,7 @@ class HelloWorld (gdb.Command): > super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER) > > def invoke (self, arg, from_tty): > - print "Hello, World!" > + print ("Hello, World!") > > HelloWorld () > @end smallexample > @@ -4309,7 +4309,7 @@ def clear_objfiles_handler(event): > event.progspace.expensive_computation = None > def expensive(symbol): > """A mock routine to perform an "expensive" computation on symbol.""" > - print "Computing the answer to the ultimate question ..." > + print ("Computing the answer to the ultimate question ...") > return 42 > def new_objfile_handler(event): > objfile = event.new_objfile > @@ -4654,7 +4654,7 @@ versions. Using it, you could write: > reason = gdb.selected_frame().unwind_stop_reason () > reason_str = gdb.frame_stop_reason_string (reason) > if reason >= gdb.FRAME_UNWIND_FIRST_ERROR: > - print "An error occured: %s" % reason_str > + print ("An error occured: %s" % reason_str) > @end smallexample > @end table > > @@ -5295,7 +5295,7 @@ example illustrating iterating over a line table. > symtab = gdb.selected_frame().find_sal().symtab > linetable = symtab.linetable() > for line in linetable: > - print "Line: "+str(line.line)+" Address: "+hex(line.pc) > + print ("Line: "+str(line.line)+" Address: "+hex(line.pc)) > @end smallexample > > This will have the following output: > @@ -5618,11 +5618,11 @@ method: > @smallexample > class MyFinishBreakpoint (gdb.FinishBreakpoint) > def stop (self): > - print "normal finish" > + print ("normal finish") > return True > > def out_of_scope (): > - print "abnormal finish" > + print ("abnormal finish") > @end smallexample > @end defun > > -- > 2.28.0 >