From 0ce949c9e09dbb0635a8c52757c839246499fa4f Mon Sep 17 00:00:00 2001 From: James Abbatiello Date: Mon, 21 Aug 2023 19:39:39 -0400 Subject: [PATCH] Fix calling gdb.Value.__init__ on GDB v12 and later --- boost/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/boost/utils.py b/boost/utils.py index 3771656..a9f3401 100644 --- a/boost/utils.py +++ b/boost/utils.py @@ -518,7 +518,13 @@ def __init__(self, value): # In Python 2 we add a __dict__ attribute explicitly. if have_python_2: self.__dict__ = {} - gdb.Value.__init__(value) + if '__init__' in gdb.Value.__dict__: + # GDB is v12 or newer. + # See https://github.com/bminor/binutils-gdb/commit/2988a36005f2821cee6744473ad8a3ba7638c212 + gdb.Value.__init__(self, value) + else: + # GDB is older than v12. Don't need to do anything. + pass self.qualifiers = get_type_qualifiers(value.type) self.basic_type = get_basic_type(value.type) self.type_name = str(self.basic_type)