This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Python API: Fix an exception when registering a global pretty-printer in verbose mode

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/", 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/ Fix exception when registering a global pretty-printer in verbose mode.
> diff --git a/gdb/python/lib/gdb/ b/gdb2/python/lib/gdb/
> index 47742a9..7fa4532 100644
> --- a/gdb/python/lib/gdb/
> +++ b/gdb/python/lib/gdb/
> @@ -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" %
>          obj = gdb
>      else:
>          if gdb.parameter("verbose"):


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 to the next line.

And, yeah, small enough to not need a copyright assignment.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]