From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29581 invoked by alias); 21 Jul 2016 19:17:02 -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 29567 invoked by uid 89); 21 Jul 2016 19:17:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-HELO:eggs.gnu.org, Hx-spam-relays-external:208.118.235.92, H*RU:208.118.235.92, super X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 21 Jul 2016 19:16:51 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQJSh-0003mv-VP for gdb@sourceware.org; Thu, 21 Jul 2016 15:16:48 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53055) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQJSa-0003l5-06; Thu, 21 Jul 2016 15:16:40 -0400 Received: from [64.238.138.90] (port=59352 helo=pdsdesk) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bQJSY-0003nw-G2; Thu, 21 Jul 2016 15:16:38 -0400 Message-ID: <1469128597.5880.153.camel@gnu.org> Subject: Re: Python gdb.Function is an old-style class? From: Paul Smith Reply-To: psmith@gnu.org To: Phil Muldoon , Paul_Koning@Dell.com Cc: gdb@sourceware.org Date: Thu, 21 Jul 2016 19:17:00 -0000 In-Reply-To: <097e16f3-2cf3-de5a-2440-79e3686d8730@redhat.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> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00021.txt.bz2 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!! > 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. Changing the above to the below works and satisfies Pylint, and for my purposes (so far) it's equivalent, so it's not the end of the world:   class MyStuff(gdb.Function):       def __init__(self):           gdb.Function.__init__(self, "mystuff")       def invoke(self):           do_stuff()