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>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Use the "O!" format more in the Python code
Date: Fri, 27 Feb 2026 19:23:03 +0100	[thread overview]
Message-ID: <c29a0ea6-811f-46a2-a395-46215e4398f3@suse.de> (raw)
In-Reply-To: <20260227164843.2275912-1-tom@tromey.com>

On 2/27/26 5:48 PM, Tom Tromey wrote:
> -  if (!PyArg_ParseTuple (args, "O", &parse_obj))
> +  if (!PyArg_ParseTuple (args, "O!", &recpy_insn_type, &parse_obj))
>       return NULL;
>   
> -  if (Py_TYPE (parse_obj) != &recpy_insn_type)
> -    return PyErr_Format (PyExc_TypeError, _("Argument must be instruction."));

Hi,

I reviewed this patch, and LGTM.

Reviewed-By: Tom de Vries <tdevries@suse.de>

I asked an AI to review this as well, and it mentioned that the piece of 
code above slightly changes semantics because using 'O!' also allows 
subclasses.

I saw other direct comparisons to recpy_insn_type in the code, and 
wondered if those should likewise allow subclasses using PyObject_TypeCheck.

But I suppose we just assume there are no subclasses?

Thanks,
- Tom



  reply	other threads:[~2026-02-27 18:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 16:48 Tom Tromey
2026-02-27 18:23 ` Tom de Vries [this message]
2026-02-27 18:31   ` Tom Tromey
2026-02-27 19:01     ` Tom Tromey
2026-02-27 19:06       ` Tom de Vries
2026-02-27 19:35     ` Paul Koning
2026-02-27 19:58       ` Tom Tromey
2026-02-27 20:24         ` Paul Koning

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=c29a0ea6-811f-46a2-a395-46215e4398f3@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