Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 00/10] Mildly better refcount safety for Python
Date: Fri, 20 Feb 2026 14:03:46 -0700	[thread overview]
Message-ID: <20260220-python-safety-minor-v1-0-4c4b12e445af@adacore.com> (raw)

This series converts a number of gdb-to-Python converion functions to
return a gdbpy_ref<> rather than returning a PyObject* and then simply
documenting that a new reference is returned.

The hope is that this will make refcount mistakes less likely.

Regression tested on x86-64 Fedora 43.

Signed-off-by: Tom Tromey <tromey@adacore.com>
---
Tom Tromey (10):
      Return gdbpy_ref<> from symtab_and_line_to_sal_object
      Return gdbpy_ref<> from symbol_to_symbol_object
      Return gdbpy_ref<> from symtab_to_symtab_object
      Return gdbpy_ref<> from block_to_block_object
      Return gdbpy_ref<> from value_to_value_object
      Return gdbpy_ref<> from type_to_type_object
      Return gdbpy_ref<> from frame_info_to_frame_object
      Return gdbpy_ref<> from symtab_to_linetable_object
      Return gdbpy_ref<> from gdbarch_to_arch_object
      Return gdbpy_ref<> from gdbpy_registry::lookup

 gdb/python/py-arch.c             |  8 ++---
 gdb/python/py-block.c            | 26 ++++++--------
 gdb/python/py-disasm.c           |  2 +-
 gdb/python/py-finishbreakpoint.c |  6 ++--
 gdb/python/py-frame.c            | 47 ++++++++++++-------------
 gdb/python/py-framefilter.c      |  2 +-
 gdb/python/py-function.c         |  2 +-
 gdb/python/py-inferior.c         |  2 +-
 gdb/python/py-infevents.c        |  2 +-
 gdb/python/py-lazy-string.c      |  6 ++--
 gdb/python/py-linetable.c        |  4 +--
 gdb/python/py-objfile.c          |  4 +--
 gdb/python/py-prettyprint.c      |  4 +--
 gdb/python/py-progspace.c        |  6 ++--
 gdb/python/py-record-btrace.c    |  6 ++--
 gdb/python/py-stopevent.c        |  2 +-
 gdb/python/py-symbol.c           | 70 +++++++++++++++++--------------------
 gdb/python/py-symtab.c           | 26 +++++++-------
 gdb/python/py-type.c             | 59 ++++++++++++++++----------------
 gdb/python/py-unwind.c           | 15 ++++----
 gdb/python/py-value.c            | 74 +++++++++++++++++++---------------------
 gdb/python/py-xmethods.c         | 18 +++++-----
 gdb/python/python-internal.h     | 27 +++++++--------
 gdb/python/python.c              | 16 ++++-----
 24 files changed, 207 insertions(+), 227 deletions(-)
---
base-commit: e16c7848007e4faa071a6483556e69f365e9eb69
change-id: 20260220-python-safety-minor-9eeaef26c39a

Best regards,
-- 
Tom Tromey <tromey@adacore.com>


             reply	other threads:[~2026-02-20 21:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20 21:03 Tom Tromey [this message]
2026-02-20 21:03 ` [PATCH 01/10] Return gdbpy_ref<> from symtab_and_line_to_sal_object Tom Tromey
2026-02-21  1:58   ` Simon Marchi
2026-02-21  2:13     ` Simon Marchi
2026-02-21 22:33       ` Tom Tromey
2026-02-23 12:28     ` Tom Tromey
2026-02-20 21:03 ` [PATCH 02/10] Return gdbpy_ref<> from symbol_to_symbol_object Tom Tromey
2026-02-21  2:28   ` Simon Marchi
2026-02-21 22:35     ` Tom Tromey
2026-02-20 21:03 ` [PATCH 03/10] Return gdbpy_ref<> from symtab_to_symtab_object Tom Tromey
2026-02-20 21:03 ` [PATCH 04/10] Return gdbpy_ref<> from block_to_block_object Tom Tromey
2026-02-20 21:03 ` [PATCH 05/10] Return gdbpy_ref<> from value_to_value_object Tom Tromey
2026-02-20 21:03 ` [PATCH 06/10] Return gdbpy_ref<> from type_to_type_object Tom Tromey
2026-02-20 21:03 ` [PATCH 07/10] Return gdbpy_ref<> from frame_info_to_frame_object Tom Tromey
2026-02-20 21:03 ` [PATCH 08/10] Return gdbpy_ref<> from symtab_to_linetable_object Tom Tromey
2026-02-20 21:03 ` [PATCH 09/10] Return gdbpy_ref<> from gdbarch_to_arch_object Tom Tromey
2026-02-20 21:03 ` [PATCH 10/10] Return gdbpy_ref<> from gdbpy_registry::lookup Tom Tromey
2026-02-21  2:31 ` [PATCH 00/10] Mildly better refcount safety for Python Simon Marchi

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=20260220-python-safety-minor-v1-0-4c4b12e445af@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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