From: Paul Smith <psmith@gnu.org>
To: Phil Muldoon <pmuldoon@redhat.com>, Paul_Koning@Dell.com
Cc: gdb@sourceware.org
Subject: Re: Python gdb.Function is an old-style class?
Date: Thu, 21 Jul 2016 19:17:00 -0000 [thread overview]
Message-ID: <1469128597.5880.153.camel@gnu.org> (raw)
In-Reply-To: <097e16f3-2cf3-de5a-2440-79e3686d8730@redhat.com>
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()
next prev parent reply other threads:[~2016-07-21 19:17 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
2016-07-21 18:50 ` Phil Muldoon
2016-07-21 19:13 ` Paul_Koning
2016-07-21 19:17 ` Paul Smith [this message]
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=1469128597.5880.153.camel@gnu.org \
--to=psmith@gnu.org \
--cc=Paul_Koning@Dell.com \
--cc=gdb@sourceware.org \
--cc=pmuldoon@redhat.com \
/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