public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Python API: Fix an exception when registering a global pretty-printer in verbose mode
@ 2015-03-11 17:37 Martin Galvan
  2015-03-11 17:59 ` Doug Evans
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Galvan @ 2015-03-11 17:37 UTC (permalink / raw)
  To: gdb-patches, dje

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  <martin.galvan@tallertechnologies.com>

	* 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"):

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Python API: Fix an exception when registering a global pretty-printer in verbose mode
  2015-03-11 17:37 [PATCH] Python API: Fix an exception when registering a global pretty-printer in verbose mode Martin Galvan
@ 2015-03-11 17:59 ` Doug Evans
  2015-03-11 18:05   ` Martin Galvan
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Evans @ 2015-03-11 17:59 UTC (permalink / raw)
  To: Martin Galvan; +Cc: gdb-patches

On Wed, Mar 11, 2015 at 10:36 AM, Martin Galvan
<martin.galvan@tallertechnologies.com> 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  <martin.galvan@tallertechnologies.com>
>
>         * 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!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Python API: Fix an exception when registering a global pretty-printer in verbose mode
  2015-03-11 17:59 ` Doug Evans
@ 2015-03-11 18:05   ` Martin Galvan
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Galvan @ 2015-03-11 18:05 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On Wed, Mar 11, 2015 at 2:59 PM, Doug Evans <dje@google.com> wrote:
> 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.

Will do.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-11 18:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-11 17:37 [PATCH] Python API: Fix an exception when registering a global pretty-printer in verbose mode Martin Galvan
2015-03-11 17:59 ` Doug Evans
2015-03-11 18:05   ` Martin Galvan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).