From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18765 invoked by alias); 11 Mar 2015 17:59:07 -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 18754 invoked by uid 89); 11 Mar 2015 17:59:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-oi0-f43.google.com Received: from mail-oi0-f43.google.com (HELO mail-oi0-f43.google.com) (209.85.218.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 11 Mar 2015 17:59:05 +0000 Received: by oigh136 with SMTP id h136so9401949oig.1 for ; Wed, 11 Mar 2015 10:59:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=nseAP8ATKgvTM9S6bwa+/9ZXC/XnLsUNZ5hBdNa8NRY=; b=DpFxqYi75WcJ6DWs2YECjpAVogFNwy6iDoeUES92f2AI8ehrR/RFAIPj0DrqUy3wWA pdSCh3jBdTDYzNnmUPxd+Ve9K+VkNbZ/2HpaNOwxuNY20UWfmwgBjzlmh2OQ7Pf9cERX V50hlfPp1OB/mPRjDfSSXw6Vt+9y/wz99cFXJMBEIaVt21Go95/AmMFiLhzdg4S8rDpP KU+7vv+ngld+wA2Rzj1EVAdC/Wsgg1+diV/CAXvNxZO1goyLeSkIr+WBkr3Ty0yHi9oz LYQjk6OXLtAGywi+ASUDoYl5RSjWDPNrzqnetQEwKCY0IRRw1wvyjn0YfUZx5EL8lyfL AIUA== X-Gm-Message-State: ALoCoQnVQ40M/2TynIP2FregmP4RQM8ODKHOCApdDBWv8/rPC4eut3B81TSfOzfV2Hydehoym8pI MIME-Version: 1.0 X-Received: by 10.202.219.215 with SMTP id s206mr28994523oig.114.1426096743494; Wed, 11 Mar 2015 10:59:03 -0700 (PDT) Received: by 10.182.142.226 with HTTP; Wed, 11 Mar 2015 10:59:03 -0700 (PDT) In-Reply-To: <1426095417-22764-1-git-send-email-martin.galvan@tallertechnologies.com> References: <1426095417-22764-1-git-send-email-martin.galvan@tallertechnologies.com> Date: Wed, 11 Mar 2015 17:59:00 -0000 Message-ID: Subject: Re: [PATCH] Python API: Fix an exception when registering a global pretty-printer in verbose mode From: Doug Evans To: Martin Galvan Cc: gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00307.txt.bz2 On Wed, Mar 11, 2015 at 10:36 AM, Martin Galvan wrote: > This patch fixes a Python exception that was being thrown when trying to register a global pretty-printer with verbose mode on: > > File "/usr/share/gdb/python/gdb/printing.py", line 119, in register_pretty_printer > gdb.write("Registering global %s pretty-printer ...\n" % name) > NameError: name 'name' is not defined > > My copyright assignment is on the works, but since this is a small patch I don't think it's necessary. > > -- > > Changelog: > > 2015-03-11 Martin Galvan > > * python/lib/gdb/printing.py: Fix exception when registering a global pretty-printer in verbose mode. > > diff --git a/gdb/python/lib/gdb/printing.py b/gdb2/python/lib/gdb/printing.py > index 47742a9..7fa4532 100644 > --- a/gdb/python/lib/gdb/printing.py > +++ b/gdb/python/lib/gdb/printing.py > @@ -116,7 +116,7 @@ def register_pretty_printer(obj, printer, replace=False): > > if obj is None: > if gdb.parameter("verbose"): > - gdb.write("Registering global %s pretty-printer ...\n" % name) > + gdb.write("Registering global %s pretty-printer ...\n" % printer.name) > obj = gdb > else: > if gdb.parameter("verbose"): Hi. LGTM with one nit: I suspect the patch as is will go past our 80 character hard limit. [Though PEP008 has a 79 character limit ... yay.] While in C we would put the '%' on the next line, I think we follow the opposite convention in python. That's what the surrounding code does anyway, so move printer.name to the next line. And, yeah, small enough to not need a copyright assignment. Thanks!