diff options
| author | Matthieu Longo <matthieu.longo@arm.com> | 2026-02-26 17:20:20 +0000 |
|---|---|---|
| committer | Matthieu Longo <matthieu.longo@arm.com> | 2026-03-10 12:43:12 +0000 |
| commit | f0cfbf6ceda8396291d736858cfd713cc4a0e0da (patch) | |
| tree | 77a7e0db3cde8d52504f42fb69e4463fa863d49d /gdb/python/py-function.c | |
| parent | 995cf2f8feb57aa564eb4ec1191e3290affc574b (diff) | |
| download | binutils-f0cfbf6ceda8396291d736858cfd713cc4a0e0da.tar.gz binutils-f0cfbf6ceda8396291d736858cfd713cc4a0e0da.tar.bz2 binutils-f0cfbf6ceda8396291d736858cfd713cc4a0e0da.zip | |
gdb/python: allow ref_ptr<T, Policy>::new_reference to accept subclasses of T
When ref_ptr<T,Policy>::new_reference() is specialized for 'PyObject'
(i.e. gdbpy_ref<>), it currently requires the argument type to be exactly
'PyObject *'. As a result, pointers to subclasses of 'PyObject' must be
explicitly cast before being passed, making call sites unnecessarily
verbose.
This patch makes ref_ptr<T,Policy>::new_reference() a template method
that accepts both T and subclasses of T, performing the cast to 'T *'
internally when needed. This removes redundant casts at call sites
without changing behavior.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/python/py-function.c')
0 files changed, 0 insertions, 0 deletions
