Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 1/2] [gdb/python] Introduce py_none/py_true/py_false functions
Date: Fri, 15 May 2026 12:53:46 +0200	[thread overview]
Message-ID: <3d6a1564-932c-4628-ae32-a7840770d2d6@suse.de> (raw)
In-Reply-To: <87qzndkhpd.fsf@tromey.com>

On 5/14/26 7:46 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
> 
> Tom> +/* The following three functions are refcount-safe wrappers around
> Tom> +   Py_RETURN_{NONE,TRUE,FALSE}.  Starting with python 3.12, None, True and
> Tom> +   False are immortal, and increasing and decreasing refcount for such object
> Tom> +   is a no-op, but while supporting older versions we ignore that aspect
> Tom> +   here.  */
> 
> This comment is mildly incorrect in that using gdbpy_ref<> inherently
> implies a decref.  Immortality of Python objects isn't really a concern
> at the API level.  It's an implementation detail of the Python
> interpreter.
> 

Hi Tom,

thank for the review.

I'm not 100% sure I understand what is mildly incorrect here.  In a v3 
(to be submitted soonish), I've expanded the comment a bit, so hopefully 
it'll be either correct, or it'll be easier to point out which bit is 
incorrect.

> The rest of the patch seems ok to me.  I'm not a huge fan of
> immediately-evaluated lambdas but OTOH it's probably harmless here.
> 

I've fixed that in the v3.

>      +  return gdbpy_ref<> ([] { Py_RETURN_FALSE; } ());
>      +}
>       #endif /* GDB_PYTHON_PYTHON_INTERNAL_H */
> 
> Newline between the closing brace and the #endif please.
> 

Fixed in the v3.

Thanks,
- Tom

> thanks,
> Tom


  reply	other threads:[~2026-05-15 10:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 16:30 [PATCH v2 0/2] [gdb/python] Remove Py_RETURN_{NONE,TRUE,FALSE} Tom de Vries
2026-05-13 16:30 ` [PATCH v2 1/2] [gdb/python] Introduce py_none/py_true/py_false functions Tom de Vries
2026-05-14 17:46   ` Tom Tromey
2026-05-15 10:53     ` Tom de Vries [this message]
2026-05-13 16:30 ` [PATCH v2 2/2] [gdb/python] Remove Py_RETURN_{NONE,TRUE,FALSE} Tom de Vries
2026-05-14 17:47   ` 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=3d6a1564-932c-4628-ae32-a7840770d2d6@suse.de \
    --to=tdevries@suse.de \
    --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