From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92506 invoked by alias); 21 Jul 2016 19:26:50 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 92494 invoked by uid 89); 21 Jul 2016 19:26:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1648, H*M:0192, H*M:8306, super X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 21 Jul 2016 19:26:30 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B19F61A0D; Thu, 21 Jul 2016 19:26:29 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-18.ams2.redhat.com [10.36.112.18]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6LJQR32018109; Thu, 21 Jul 2016 15:26:28 -0400 Subject: Re: Python gdb.Function is an old-style class? To: psmith@gnu.org, Paul_Koning@Dell.com References: <1469121732.5880.128.camel@gnu.org> <442ECA9F-4670-4B4A-8172-8AA7418EF332@dell.com> <1469126239.5880.136.camel@gnu.org> <097e16f3-2cf3-de5a-2440-79e3686d8730@redhat.com> <1469128597.5880.153.camel@gnu.org> Cc: gdb@sourceware.org From: Phil Muldoon Message-ID: Date: Thu, 21 Jul 2016 19:26:00 -0000 MIME-Version: 1.0 In-Reply-To: <1469128597.5880.153.camel@gnu.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00023.txt.bz2 On 21/07/16 20:16, Paul Smith wrote: > On Thu, 2016-07-21 at 19:49 +0100, Phil Muldoon wrote: >> Does calling the super __init__ function solve the PyLint issue? >> >> super(self).__init__() >> >> The old style/new style classes were introduced, I think, in Python >> 2.2 (I have not checked). > > Yes, I believe you're right. I assume GDB doesn't try to support any > Python API older than 2.2!! It's ambivalent in my opinion. It works with Python 3. But I think the case here is that nobody has run the PyLint over GDB Python API script usage to check for these scenarios. >> I'll check what we are doing in gdb.Function. But I've never linted >> the Python bindings so there might be other areas where the linting >> function flags usage requirements. > > I really must have fubar'ed my email to cause so much confusion :). > > I have a set of functions in my own source directory like this: > > $ cat mystuff.py > > class MyStuff(gdb.Function): > def __init__(self): > super(MyStuff, self).__init__("mystuff") > > def invoke(self): > do_stuff() > > This works great, I can source these from within GDB then call > $mystuff() etc. > > But when I run Pylint on "mystuff.py", I get an error because Pylint > thinks that I'm not inheriting from object. > > I suspect a Pylint problem, where it can't grok that gdb.Function is a > new-style class (through the C API?), because the super() code actually > works. Yes, in the source tree see gdb/python/py-function.c. I've not had a chance to check it yet or if, in fact, there is something we could tweak. It's never come up before ;) Cheers Phil