Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 1/2] [gdb/python] Introduce py_none/py_true/py_false functions
Date: Thu, 14 May 2026 11:46:06 -0600	[thread overview]
Message-ID: <87qzndkhpd.fsf@tromey.com> (raw)
In-Reply-To: <20260513163005.3997485-2-tdevries@suse.de> (Tom de Vries's message of "Wed, 13 May 2026 18:30:04 +0200")

>>>>> "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.

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.

    +  return gdbpy_ref<> ([] { Py_RETURN_FALSE; } ());
    +}
     #endif /* GDB_PYTHON_PYTHON_INTERNAL_H */

Newline between the closing brace and the #endif please.

thanks,
Tom

  reply	other threads:[~2026-05-14 17:46 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 [this message]
2026-05-15 10:53     ` Tom de Vries
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=87qzndkhpd.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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