From dcf4c484539a9ab5fdd0c5ddf43617986480b9bc Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Sun, 10 Nov 2024 14:35:22 +0000 Subject: [PATCH] gdb/python: remove PyObject_IsTrue call in gdbpy_handle_missing_debuginfo In this review: https://inbox.sourceware.org/gdb-patches/87wmirfzih.fsf@tromey.com Tom pointed out that using PyObject_IsTrue as I was doing, though technically fine, at least appears to be missing an error check, and that it would be better to compare to Py_True directly. I made that change in the patch Tom was commenting on, but I'd actually copied that code from elsewhere in python/python.c, so this commit updates the original code inline with Tom's review feedback. There should be no functional change after this commit. Approved-By: Tom Tromey --- gdb/python/python.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/python/python.c b/gdb/python/python.c index b0de48d4e1a..397431a4c84 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1810,7 +1810,9 @@ gdbpy_handle_missing_debuginfo (const struct extension_language_defn *extlang, if (PyBool_Check (pyo_execute_ret.get ())) { - bool try_again = PyObject_IsTrue (pyo_execute_ret.get ()); + /* We know the value is a bool, so it must be either Py_True or + Py_False. Anything else would not get past the above check. */ + bool try_again = pyo_execute_ret.get () == Py_True; return ext_lang_missing_file_result (try_again); }