From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 097ED3858CDA; Wed, 28 Feb 2024 20:01:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 097ED3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1709150503; bh=Sgm8Ah1rMXEq/gP1hhWJDnEUPpj313ZvJO8teMMzgwc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=u3LTEVnzTHBF28WDWzL0P8fyRNMr4xEy/VgjUtoEQ2ZqLVqJslPLTDsTMHoxebREX Tu8emALkqMnl7v7ckANe6+sdvfwOT/ycSYhil8TDvL5gemtBLASY8pijHxS++UdnWU AoOU3s4jmwQewQUIGJ166EpLO6L1AUe3PVu3yY9s= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug python/31425] [gdb/python, 3.12] FAIL: gdb.python/py-block.exp: check nonexistent variable Date: Wed, 28 Feb 2024 20:01:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31425 --- Comment #7 from Tom de Vries --- Alternatively, this works as well: ... diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c index 9382eb62a5f..50f070ba380 100644 --- a/gdb/python/py-utils.c +++ b/gdb/python/py-utils.c @@ -196,7 +196,15 @@ gdbpy_err_fetch::to_string () const gdb.GdbError ("message"). */ if (m_error_value.get () !=3D nullptr && m_error_value.get () !=3D Py_No= ne) - return gdbpy_obj_to_string (m_error_value.get ()); + { + if ((PyObject *)Py_TYPE (m_error_value.get ()) =3D=3D m_error_type.g= et ()) + { + PyObject *args =3D PyException_GetArgs (m_error_value.get ()); + if (PyTuple_Size (args) =3D=3D 1) + return gdbpy_obj_to_string (PyTuple_GetItem (args, 0)); + } + return gdbpy_obj_to_string (m_error_value.get ()); + } else return gdbpy_obj_to_string (m_error_type.get ()); } ... --=20 You are receiving this mail because: You are on the CC list for the bug.=