public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.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 11:01:14 +0000 [thread overview] Message-ID: <bug-31425-4717-dMUqjU6RRf@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-31425-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=31425 --- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> --- The following patch avoid the deprecated PyErr_Fetch for python >= 3.12, and makes the FAIL disappear: ... diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index c68aff5340e..3318f8b8c35 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -640,12 +640,31 @@ class gdbpy_err_fetch gdbpy_err_fetch () { +#if PY_VERSION_HEX < 0x030c0000 PyObject *error_type, *error_value, *error_traceback; PyErr_Fetch (&error_type, &error_value, &error_traceback); m_error_type.reset (error_type); m_error_value.reset (error_value); m_error_traceback.reset (error_traceback); +#else + PyObject *ex = PyErr_GetRaisedException (); + if (ex == nullptr) + { + m_error_type.reset (nullptr); + m_error_value.reset (nullptr); + m_error_traceback.reset (nullptr); + } + else + { + m_error_traceback.reset (PyException_GetTraceback (ex)); + m_error_type.reset ((PyObject *)Py_TYPE (ex)); + Py_INCREF (m_error_type.get ()); + PyObject *args = PyException_GetArgs (ex); + m_error_value.reset (PyTuple_GetItem (args, 0)); + Py_INCREF (m_error_value.get ()); + } +#endif } /* Call PyErr_Restore using the values stashed in this object. ... -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2024-02-28 11:01 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-28 9:18 [Bug python/31425] New: " vries at gcc dot gnu.org 2024-02-28 9:27 ` [Bug python/31425] " vries at gcc dot gnu.org 2024-02-28 9:39 ` vries at gcc dot gnu.org 2024-02-28 9:58 ` vries at gcc dot gnu.org 2024-02-28 10:05 ` vries at gcc dot gnu.org 2024-02-28 11:01 ` vries at gcc dot gnu.org [this message] 2024-02-28 15:00 ` tromey at sourceware dot org 2024-02-28 20:01 ` vries at gcc dot gnu.org 2024-03-04 16:05 ` vries at gcc dot gnu.org 2024-03-09 15:15 ` vries at gcc dot gnu.org
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=bug-31425-4717-dMUqjU6RRf@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).