From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122555 invoked by alias); 21 Jul 2016 18:37:55 -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 122545 invoked by uid 89); 21 Jul 2016 18:37:54 -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=Paul_Koning@Dell.com, D*Dell.com, Paul_KoningDellcom, HX-HELO:eggs.gnu.org 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 18:37:44 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQIqn-0003GD-F4 for gdb@sourceware.org; Thu, 21 Jul 2016 14:37:42 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQIqa-0003Cd-0Y; Thu, 21 Jul 2016 14:37:24 -0400 Received: from [64.238.138.90] (port=58890 helo=pdsdesk) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bQIqX-0002uy-Fv; Thu, 21 Jul 2016 14:37:21 -0400 Message-ID: <1469126239.5880.136.camel@gnu.org> Subject: Re: Python gdb.Function is an old-style class? From: Paul Smith Reply-To: psmith@gnu.org To: Paul_Koning@Dell.com Cc: gdb@sourceware.org Date: Thu, 21 Jul 2016 18:37:00 -0000 In-Reply-To: <442ECA9F-4670-4B4A-8172-8AA7418EF332@dell.com> References: <1469121732.5880.128.camel@gnu.org> <442ECA9F-4670-4B4A-8172-8AA7418EF332@dell.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/msg00018.txt.bz2 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, in my specific situation they are equivalent and that's definitely the approach I'll take, if there's no other straightforward solution. > I just tried the example shown in the manual, and it runs without > errors.  I don't get the error message you quoted, and the resulting > function works correctly. Sorry I was unclear.  The warning isn't generated by Python, and indeed using super() appears to work fine in my code as well. 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...?