Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v2 0/4] gdb/python: more fixes again for Python limited C API support
@ 2026-04-28 16:24 Matthieu Longo
  2026-04-28 16:24 ` [PATCH v2 1/4] gdb/python: add gdbpy_borrowed_ref Matthieu Longo
                   ` (4 more replies)
  0 siblings, 5 replies; 23+ messages in thread
From: Matthieu Longo @ 2026-04-28 16:24 UTC (permalink / raw)
  To: gdb-patches, Tom Tromey; +Cc: Matthieu Longo

This patch series fixes more issues encountered while enabling the Python limited C API in GDB. This is probably the last relatively-small patch series before the Python C extension types migration to the limited API.

Patch 1 reuses a previous patch publised by Tom Tromey [1], with additional modifications that are required for its usage in the Python C extension types migration.
Patch 2 adapts the signature of eval_python_command() to return both the exit code and the result.
Patch 3 migrates Python initialization to use the new config API (PEP 741) introduced by Python 3.14. Old code is preserved for older versions of Python.
Patch 4 proposes a workaround for the missing symbols not yet part of the limited API. Thanks to it, I was able to finish the compilation of GDB using the limited C API and run all the Python tests successfully.

All changes were tested by building GDB against the unlimited API of Python 3.10, 3.11, 3.12, 3.13 and 3.14, and the limited API of Python 3.14 (no build regression), and no regressions were observed in the testsuite.

Diff against v1 (https://inbox.sourceware.org/gdb-patches/20260409105155.1416274-1-matthieu.longo@arm.com/):
- eval_python_command: return pointer to result of evaluation.
- gdbpy_borrowed_ref and ref_ptr: add an implicit cast to bool.
- gdb_PyInitializer: replace throw_error() by error().
- init_done: use exception_print() to print the exception.

Regards,
Matthieu

[1]: https://inbox.sourceware.org/gdb-patches/20260222200759.1587070-2-tom@tromey.com/

Matthieu Longo (3):
  gdb/python: eval_python_command returns result of the evaluation
  gdb/python: migrate Python initialization to use the new config API (PEP 741)
  gdb/python: work around missing symbols not yet part of Python limited API

Tom Tromey (1):
  gdb/python: add gdbpy_borrowed_ref

 gdb/python/py-gdb-readline.c            |   2 +-
 gdb/python/py-ref.h                     | 115 ++++++++++++++
 gdb/python/python-internal.h            |   7 +-
 gdb/python/python-limited-api-missing.h |  62 ++++++++
 gdb/python/python.c                     | 197 +++++++++++++++++++-----
 gdb/varobj.c                            |  11 +-
 gdbsupport/gdb_ref_ptr.h                |   5 +
 7 files changed, 346 insertions(+), 53 deletions(-)
 create mode 100644 gdb/python/python-limited-api-missing.h

-- 
2.54.0


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2026-05-21 23:19 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox