diff options
| author | Tom Tromey <tromey@adacore.com> | 2026-02-20 13:34:45 -0700 |
|---|---|---|
| committer | Tom Tromey <tromey@adacore.com> | 2026-02-23 05:29:12 -0700 |
| commit | 7fc4f93e286e4222e03e16491459fdaeeee210be (patch) | |
| tree | 64d614d07cb7c18a0241e6dc19fef6818c526518 /gdb/python/python-internal.h | |
| parent | a93acde059bbdfc038fff232c834a58b3835bdcf (diff) | |
| download | binutils-7fc4f93e286e4222e03e16491459fdaeeee210be.tar.gz binutils-7fc4f93e286e4222e03e16491459fdaeeee210be.tar.bz2 binutils-7fc4f93e286e4222e03e16491459fdaeeee210be.zip | |
Return gdbpy_ref<> from gdbpy_registry::lookup
This changes gdbpy_registry::lookup to return a gdbpy_ref<>, using the
type system to convey that a new reference is always returned.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/python/python-internal.h')
| -rw-r--r-- | gdb/python/python-internal.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 1f0964f24d3..fdd353ffbeb 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -1191,14 +1191,13 @@ public: } /* Lookup pre-existing Python object for given VAL. Return such object - if found, otherwise return NULL. This method always returns new - reference. */ + if found, otherwise return NULL. */ template <typename O> - obj_type *lookup (O *owner, val_type *val) const + gdbpy_ref<> lookup (O *owner, val_type *val) const { obj_type *obj = get_storage (owner)->lookup (val); Py_XINCREF (static_cast<PyObject *> (obj)); - return obj; + return gdbpy_ref<> (obj); } private: |
