Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Matthieu Longo <matthieu.longo@arm.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 1/4] gdb/python: add gdbpy_borrowed_ref
Date: Mon, 18 May 2026 15:25:56 +0100	[thread overview]
Message-ID: <fd480e03-a212-48c4-ad3e-b45602e85b0a@arm.com> (raw)
In-Reply-To: <878q9kipc2.fsf@tromey.com>

On 15/05/2026 17:56, Tom Tromey wrote:
>>>>>> Matthieu Longo <matthieu.longo@arm.com> writes:
> 
>> From: Tom Tromey <tom@tromey.com>
>> This adds a new gdbpy_borrowed_ref class.  This class is primarily for
>> code "documentation" purposes -- it makes it clear to the reader that
>> a given reference is borrowed.  However, it also adds a tiny bit of
>> safety, in that conversion to gdbpy_ref<> will acquire a new
>> reference.
> 
>> +template <class T = PyObject>
>> +class gdbpy_borrowed_ref
>> +{
> 
> On my "safety" branch I ended up rewriting this to have a base class
> that allows NULL and a derived class that does not.
> 
> And my initial review -- the one that didn't get sent -- suggested using
> this.
> 
> But I tend to think this patch isn't needed yet.  It's nice for the
> safety series but in this series it is only used a little in patch 2,
> and not even every spot that could/should use it -- like I noticed:
> 
>         /* PyDict_GetItemWithError returns a borrowed reference.  */
> -      PyObject *found = PyDict_GetItemWithError (d, file.get ());
> +      PyObject *found = PyDict_GetItemWithError (globals, file.get ());
> 

I can replace the raw PyObject * by gdbpy_borrowed_ref<>.

> So on the whole I'd prefer to drop this from this series.  That way it
> won't conflict or cause problems with the stuff I'm planning to send.
> 

A lot of upcoming patches are using gdbpy_borrowed_ref<> because it simplified a lot the code in 
some places.
Dropping it is going to make things definitely more difficult on my side.

> Also you've made this into a template class, which seems alright -- but
> not used in the series.  Maybe there's some later series depending on
> this?  That kind of thing is good to mention if so.

Yes, it is used later.

> 
> Tom

Given those information, do you still want to drop it ?

Matthieu


  reply	other threads:[~2026-05-18 14:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 16:24 [PATCH v2 0/4] gdb/python: more fixes again for Python limited C API support Matthieu Longo
2026-04-28 16:24 ` [PATCH v2 1/4] gdb/python: add gdbpy_borrowed_ref Matthieu Longo
2026-05-15 16:56   ` Tom Tromey
2026-05-18 14:25     ` Matthieu Longo [this message]
2026-05-19 19:25       ` Tom Tromey
2026-05-20 16:04         ` Matthieu Longo
2026-05-21 14:35           ` Tom Tromey
2026-05-21 23:18             ` Tom Tromey
2026-04-28 16:24 ` [PATCH v2 2/4] gdb/python: eval_python_command returns result of the evaluation Matthieu Longo
2026-05-15 16:51   ` Tom Tromey
2026-05-18 14:37     ` Matthieu Longo
2026-05-19 19:24       ` Tom Tromey
2026-05-20 10:07         ` Matthieu Longo
2026-05-20 15:06           ` Tom Tromey
2026-04-28 16:24 ` [PATCH v2 3/4] gdb/python: migrate Python initialization to use the new config API (PEP 741) Matthieu Longo
2026-05-14 19:25   ` Tom Tromey
2026-04-28 16:24 ` [PATCH v2 4/4] gdb/python: work around missing symbols not yet part of Python limited API Matthieu Longo
2026-05-14 19:26   ` Tom Tromey
2026-05-15 10:10     ` Matthieu Longo
2026-05-14 10:23 ` [PATCH v2 0/4] gdb/python: more fixes again for Python limited C API support Matthieu Longo
2026-05-14 19:27   ` Tom Tromey
2026-05-15  9:26     ` Matthieu Longo
2026-05-15 14:48       ` Tom Tromey

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=fd480e03-a212-48c4-ad3e-b45602e85b0a@arm.com \
    --to=matthieu.longo@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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