From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100731 invoked by alias); 21 Jul 2016 18:50:01 -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 100701 invoked by uid 89); 21 Jul 2016 18:50: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_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1674, phil, our, 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 18:49:50 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (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 97C6BC05AA5B; Thu, 21 Jul 2016 18:49:49 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-18.ams2.redhat.com [10.36.112.18]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6LInkL0015541; Thu, 21 Jul 2016 14:49:47 -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> Cc: gdb@sourceware.org From: Phil Muldoon Message-ID: <097e16f3-2cf3-de5a-2440-79e3686d8730@redhat.com> Date: Thu, 21 Jul 2016 18:50:00 -0000 MIME-Version: 1.0 In-Reply-To: <1469126239.5880.136.camel@gnu.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00019.txt.bz2 On 21/07/16 19:37, Paul Smith wrote: > On Thu, 2016-07-21 at 17:38 +0000, Paul_Koning@Dell.com wrote: >>> >>> On Jul 21, 2016, at 1:22 PM, Paul Smith wrote: >>> >>> Hi all; I am writing some Python functions that subclass from >>> gdb.Function, and I use super() to call the superclass __init__() >>> >>> It works, but pylint is failing with an error "Use of super on an old >>> style class". This is usually shown when a Python2 class does not >>> inherit, ultimately, from the object. >>> >>> Is there something magic that needs to happen to make gdb.Function >>> recognized as a new-style class? >> You could just call gdb.Function.__init__(self) explicitly rather >> than the syntactic sugar of super(). > > Well, super() is not always just syntactic sugar. It actually makes a > big difference in some class hierarchies (it solves the diamond > inheritance problem for example). And, it avoids needing to modify > subclasses if you change the superclass hierarchy which is nice. > However part of our static analysis requires that all Python code added > to the codebase, including local GDB functions, pass Pylint. It's > pylint which is complaining about this, not Python itself. > > I suppose it could be a Pylint problem...? > 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). 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. Cheers Phil