From: Tom Tromey <tromey@redhat.com>
To: pmuldoon@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] [python] Implement Inferior.current_inferior
Date: Tue, 28 Jun 2011 20:30:00 -0000 [thread overview]
Message-ID: <m3fwmt66nz.fsf@fleche.redhat.com> (raw)
In-Reply-To: <m3fwmve55u.fsf@redhat.com> (Phil Muldoon's message of "Mon, 27 Jun 2011 15:10:37 +0100")
>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
Phil> -/* Return a borrowed reference to the Python object of type Inferior
Phil> +/* Return a reference to the Python object of type Inferior
Phil> representing INFERIOR. If the object has already been created,
Phil> - return it, otherwise, create it. Return NULL on failure. */
Phil> + return it and increment the reference count, otherwise, create it.
Phil> + Return NULL on failure. */
Phil> PyObject *
Phil> inferior_to_inferior_object (struct inferior *inferior)
Phil> {
Phil> @@ -154,13 +155,14 @@ inferior_to_inferior_object (struct inferior *inferior)
Phil> do_cleanups (cleanup);
Phil> }
Phil> + else
Phil> + Py_INCREF ((PyObject *)inf_obj);
I don't really follow this.
I think the best model would be that the 'struct inferior' owns a
reference to the gdb.Inferior object, and then
inferior_to_inferior_object is consistent: it either always returns a
new reference or a borrowed reference.
For a borrowed reference, I think you can leave this function as-is.
For a new reference, I think you need to remove the 'else' from your
patch, and update infpy_dealloc to decref.
Tom
next prev parent reply other threads:[~2011-06-28 20:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-27 14:11 Phil Muldoon
2011-06-27 17:35 ` Kevin Pouget
2011-06-27 19:30 ` Phil Muldoon
2011-06-27 20:13 ` Joel Brobecker
2011-06-27 20:27 ` Phil Muldoon
2011-06-28 7:47 ` Kevin Pouget
2011-06-28 8:20 ` Phil Muldoon
2011-06-28 20:31 ` Tom Tromey
2011-06-28 20:30 ` Tom Tromey [this message]
2011-06-28 22:14 ` 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=m3fwmt66nz.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@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