From: Paul Smith <psmith@gnu.org>
To: Paul_Koning@Dell.com
Cc: gdb@sourceware.org
Subject: Re: Python gdb.Function is an old-style class?
Date: Thu, 21 Jul 2016 18:37:00 -0000 [thread overview]
Message-ID: <1469126239.5880.136.camel@gnu.org> (raw)
In-Reply-To: <442ECA9F-4670-4B4A-8172-8AA7418EF332@dell.com>
On Thu, 2016-07-21 at 17:38 +0000, Paul_Koning@Dell.com wrote:
> >
> > On Jul 21, 2016, at 1:22 PM, Paul Smith <psmith@gnu.org> 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...?
next prev parent reply other threads:[~2016-07-21 18:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 17:22 Paul Smith
2016-07-21 17:38 ` Paul_Koning
2016-07-21 18:06 ` Paul_Koning
2016-07-21 18:37 ` Paul Smith [this message]
2016-07-21 18:50 ` Phil Muldoon
2016-07-21 19:13 ` Paul_Koning
2016-07-21 19:17 ` Paul Smith
2016-07-21 19:20 ` Paul Smith
2016-07-21 19:26 ` Phil Muldoon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1469126239.5880.136.camel@gnu.org \
--to=psmith@gnu.org \
--cc=Paul_Koning@Dell.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox