From: Tom Tromey <tom@tromey.com>
To: Matthieu Longo <matthieu.longo@arm.com>
Cc: <gdb-patches@sourceware.org>, Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH v3 3/7] gdb: add new helpers for retrieving a type's fully qualified name
Date: Tue, 24 Mar 2026 12:44:09 -0600 [thread overview]
Message-ID: <87o6kd5apy.fsf@tromey.com> (raw)
In-Reply-To: <20260309175624.236491-4-matthieu.longo@arm.com> (Matthieu Longo's message of "Mon, 9 Mar 2026 17:56:20 +0000")
>>>>> Matthieu Longo <matthieu.longo@arm.com> writes:
> Py_TYPE (self)->tp_name is the traditional idiomatic way to get a Python
> type's fully qualified name. However, in the context of the Python
> limited API, PyTypeObject is opaque, so the 'tp_name' attribute is no
> longer accessible. Additionally, retrieving the type of a Python object
> requires Py_TYPE, which is only available as part of the stable API
> starting with Python 3.14.
> This patch increases minimal Python limited API version from 3.11 to 3.14.
> It also introduces two new helpers to retrieve a type's fully qualified
> name: gdb_py_tp_name() and gdbpy_py_obj_tp_name(), which extract the fully
> qualified name from a PyTypeObject and a PyObject, respectively. Ifdefery
> allows these wrappers to select the appropriate API depending on the Python
> version and whether the Python limited API is enabled. For any Python
> version less than 3.13, gdb_py_tp_name() fallbacks using __qualname__
> instead. However, the result may differ slightly in some cases, e.g. the
> module name may be missing.
> Finally, this patch adapts the existing code to use these wrappers, and
> adjusts some test expectations to use the fully qualified name (or
> __qualname__ for versions <= 3.13) where it was not previously used.
> Note that the corner case where the module name would be missing does not
> appear in the testsuite.
Thanks, this looks good to me.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
next prev parent reply other threads:[~2026-03-24 18:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 17:56 [PATCH v3 0/7] gdb: more fixes for Python limited C API support Matthieu Longo
2026-03-09 17:56 ` [PATCH v3 1/7] gdb: introduce rgb_color type to simplify existing code Matthieu Longo
2026-03-09 19:22 ` Tom Tromey
2026-03-11 15:03 ` Simon Marchi
2026-03-11 17:55 ` Matthieu Longo
2026-03-11 18:04 ` Simon Marchi
2026-03-11 18:16 ` Tom Tromey
2026-03-09 17:56 ` [PATCH v3 2/7] gdb: fail configure if Python version is too old for limited API Matthieu Longo
2026-03-24 18:53 ` Tom Tromey
2026-03-31 10:16 ` Matthieu Longo
2026-04-07 13:36 ` Matthieu Longo
2026-04-07 20:39 ` Tom Tromey
2026-03-09 17:56 ` [PATCH v3 3/7] gdb: add new helpers for retrieving a type's fully qualified name Matthieu Longo
2026-03-24 18:44 ` Tom Tromey [this message]
2026-03-09 17:56 ` [PATCH v3 4/7] gdb/python: allow ref_ptr<T, Policy>::new_reference to accept subclasses of T Matthieu Longo
2026-03-09 19:40 ` Tom Tromey
2026-03-10 12:26 ` Matthieu Longo
2026-03-09 17:56 ` [PATCH v3 5/7] gdb/python: flatten functions calling PyObject_New and use gdbpy_ref Matthieu Longo
2026-03-09 20:07 ` Tom Tromey
2026-03-09 17:56 ` [PATCH v3 6/7] gdb/python: add gdbpy_dict_wrapper:allocate_dict helper Matthieu Longo
2026-03-09 20:09 ` Tom Tromey
2026-03-10 12:26 ` Matthieu Longo
2026-03-09 17:56 ` [PATCH v3 7/7] gdb/python: add accessor helpers for __dict__ in Python extension objects Matthieu Longo
2026-03-13 18:09 ` Tom Tromey
2026-03-23 10:28 ` [PATCH v3 0/7] gdb: more fixes for Python limited C API support Matthieu Longo
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=87o6kd5apy.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=matthieu.longo@arm.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