From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23043 invoked by alias); 5 Aug 2014 17:30:34 -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 23030 invoked by uid 89); 5 Aug 2014 17:30:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 05 Aug 2014 17:30:32 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E975F116659; Tue, 5 Aug 2014 13:30:30 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bWqYQvjaSoU6; Tue, 5 Aug 2014 13:30:30 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id B8F06116655; Tue, 5 Aug 2014 13:30:30 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 4532A410E3; Tue, 5 Aug 2014 10:30:29 -0700 (PDT) Date: Tue, 05 Aug 2014 17:30:00 -0000 From: Joel Brobecker To: Siva Chandra Cc: gdb-patches Subject: Re: [PATCH] Fix xmethod Python so that it works with Python 3 Message-ID: <20140805173029.GA5204@adacore.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-08/txt/msg00057.txt.bz2 > 2014-08-05 Siva Chandra Reddy > > 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 :' > + print ('From Python :') No space before '(' in Python calls. -- Joel