Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Siva Chandra <sivachandra@google.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix xmethod Python so that it works with Python 3
Date: Tue, 05 Aug 2014 17:30:00 -0000	[thread overview]
Message-ID: <20140805173029.GA5204@adacore.com> (raw)
In-Reply-To: <CAGyQ6gxsj1g_C3f87YJSj7VGZZeuob58qZhTbBXDuD3LB6AgvA@mail.gmail.com>

> 2014-08-05  Siva Chandra Reddy  <sivachandra@google.com>
> 
>     gdb/
> 
>         * python/lib/gdb/command/xmethods.py (set_xm_status1): Use the
>         'items' methods instead of 'iteritems' method on dictionaries.
> 
>     gdb/testsuite/
> 
>         * gdb.python/py-xmethods.py (A_getarrayind)
>         (E_method_char_worker.__call__, E_method_int_worker.__call__):
>         Use 'print' with function call syntax.
>         (E_method_matcher.match): Fix tab vs space indentation mixup.

Perhaps worth porting to the 7.8 branch if approved? I checked
the Python 2.4 documentation, and I think it shows that dict
types support the "items" method, so no backward compatibility
issue with old versions, I think.

One nit (multiple occurences) below:

> diff --git a/gdb/python/lib/gdb/command/xmethods.py b/gdb/python/lib/gdb/command/xmethods.py
> index 55cc81f..206313e 100644
> --- a/gdb/python/lib/gdb/command/xmethods.py
> +++ b/gdb/python/lib/gdb/command/xmethods.py
> @@ -140,7 +140,7 @@ def print_xm_info(xm_dict, name_re):
>  
>  def set_xm_status1(xm_dict, name_re, status):
>      """Set the status (enabled/disabled) of a dictionary of xmethods."""
> -    for locus_str, matchers in xm_dict.iteritems():
> +    for locus_str, matchers in xm_dict.items():
>          for matcher in matchers:
>              if not name_re:
>                  # If the name regex is missing, then set the status of the
> diff --git a/gdb/testsuite/gdb.python/py-xmethods.py b/gdb/testsuite/gdb.python/py-xmethods.py
> index 6fecf2b..26df3de 100644
> --- a/gdb/testsuite/gdb.python/py-xmethods.py
> +++ b/gdb/testsuite/gdb.python/py-xmethods.py
> @@ -40,7 +40,7 @@ def A_geta(obj):
>  
>  
>  def A_getarrayind(obj, index):
> -  print 'From Python <A_getarrayind>:'
> +  print ('From Python <A_getarrayind>:')

No space before '(' in Python calls.

-- 
Joel


      reply	other threads:[~2014-08-05 17:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05 15:43 Siva Chandra
2014-08-05 17:30 ` Joel Brobecker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140805173029.GA5204@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sivachandra@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox