From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5834 invoked by alias); 23 Nov 2016 16:59:56 -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 5812 invoked by uid 89); 23 Nov 2016 16:59:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=jonah, Jonah X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Nov 2016 16:59:45 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtp id 1c9atb-0004pe-C2 from Luis_Gustavo@mentor.com ; Wed, 23 Nov 2016 08:59:43 -0800 Received: from [172.30.6.103] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 23 Nov 2016 08:59:40 -0800 Subject: Re: [PATCH] bound_registers.py: Add support for Python 3 References: <20161120204526.7203-1-jonah@kichwacoders.com> To: Jonah Graham , Reply-To: Luis Machado From: Luis Machado Message-ID: Date: Wed, 23 Nov 2016 16:59:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161120204526.7203-1-jonah@kichwacoders.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-04.mgc.mentorg.com (147.34.90.204) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00678.txt.bz2 On 11/20/2016 02:45 PM, Jonah Graham wrote: > gdb/Changelog: > > * python/lib/gdb/printer/bound_registers.py: Add support > for Python 3. > --- > gdb/ChangeLog | 5 +++++ > gdb/python/lib/gdb/printer/bound_registers.py | 5 +++++ > 2 files changed, 10 insertions(+) > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > index 3797e8b..1923888 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,3 +1,8 @@ > +2016-11-20 Jonah Graham > + > + * python/lib/gdb/printer/bound_registers.py: Add support > + for Python 3. > + > 2016-11-19 Joel Brobecker > > * contrib/ari/gdb_ari.sh: Add detection of printf_vma and > diff --git a/gdb/python/lib/gdb/printer/bound_registers.py b/gdb/python/lib/gdb/printer/bound_registers.py > index 9ff94aa..e91cc19 100644 > --- a/gdb/python/lib/gdb/printer/bound_registers.py > +++ b/gdb/python/lib/gdb/printer/bound_registers.py > @@ -16,6 +16,11 @@ > > import gdb.printing > > +if sys.version_info[0] > 2: > + # Python 3 removed basestring and long > + basestring = str > + long = int > + > class MpxBound128Printer: > """Adds size field to a mpx __gdb_builtin_type_bound128 type.""" > > Since this should apply to every python module, maybe this should be defined inside gdb/python/lib/gdb/__init__.py? I'm assuming it gets included by module "gdb" and therefore "long" is defined to be "int" for Python versions > 3. Then we can remove that code from gdb/python/lib/gdb/printing.py (and from other places setting this type of version-specific adjustment). Does that make sense?