From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Bem9ExYm+F+2JgAAWB0awg (envelope-from ) for ; Fri, 08 Jan 2021 04:29:58 -0500 Received: by simark.ca (Postfix, from userid 112) id 4260C1E99A; Fri, 8 Jan 2021 04:29:58 -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 D110D1E4F4; Fri, 8 Jan 2021 04:29:57 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D6A2F395C012; Fri, 8 Jan 2021 09:29:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6A2F395C012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610098196; bh=HP5TaUAzITF7XN+uIh8S+1q0zbxU2mry9dUbdqymLiE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ugC57QKKTxr2DgyCN6AAH8algqp7a/7bPQVWCMkgD/Wvq1zhcIxYtxqVwmO1Lk3/n FWt+52LN0jHoNL59MTVCkWJ/ASGBc3FkTZVc0YT5xWFLikQCR1+nYlIL2tQzyVfk/e pXeQqrx7f7FDcUb1TZbjrK4N0cKvUXNNeGFp/4H0= Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 363E7395C012 for ; Fri, 8 Jan 2021 09:29:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 363E7395C012 Received: by mail-wm1-x32a.google.com with SMTP id a6so7240569wmc.2 for ; Fri, 08 Jan 2021 01:29:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HP5TaUAzITF7XN+uIh8S+1q0zbxU2mry9dUbdqymLiE=; b=e6JrJZXuDeJcC2KlWUOe+/Uobl34A4l4thIBcKOn4o8n6/K03Do4YFKPAI6+O2KFWR kgoNHDyYpcauhQRQi0mf9faeQ6E4Nn+QO8mzN0XXYAkpXKtha8IGSwLqzYHMgBRr9Tm1 xHj4NEq2nvBQk2RStgZYHxkThlUaNynp6EwGB6bmSNmmV6GClsd0Upp9Skb8w4XYLLJ+ OhJEqQNx175mY95C5tdyFHltTvoDL1SF95KtpLJR71PipNVPxuiQb8kLTzUlLT5g6NV1 gXKccyc28iFCexFHOeJPUqJNXH81FX+oG64VwCaZLwLItFrblF771l6ovsX4c+Dpk+PB 7ssw== X-Gm-Message-State: AOAM53319yLqjZVtcfsLL1IQ399mAShwy4kt1yvT5w+RgzjzAM20l17x 3erM4u0DXbt4EWLRe7VnuBY3MZHKsHMjINPIIuyhhYf1pC+g72unf1zTNznVvPDOwUR7lFRWo+9 086b7T00jNfkTu5HV/D37+p8FBfL8a7SsFQ7gzM9DmvUHn3ZPD71F8BVQVcYohe0yGZjvWJ7eq8 kI X-Google-Smtp-Source: ABdhPJwoF3IZftkT+WLQAg3KV7J1YGQ0xBsrXQ5cffbGCy60voF95HuBO728PEV3XbVhhJ6WJoHeVA== X-Received: by 2002:a1c:7217:: with SMTP id n23mr2125398wmc.167.1610098192843; Fri, 08 Jan 2021 01:29:52 -0800 (PST) Received: from focaccia.undoers.io (cpc159317-cmbg20-2-0-cust151.5-4.cable.virginm.net. [81.111.29.152]) by smtp.gmail.com with ESMTPSA id n3sm12115474wrw.61.2021.01.08.01.29.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jan 2021 01:29:52 -0800 (PST) To: gdb-patches@sourceware.org Subject: [PATCH] gdb/docs: add parentheses in Python examples using print Date: Fri, 8 Jan 2021 09:29:35 +0000 Message-Id: <20210108092935.92106-1-mbarisione@undo.io> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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" 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