diff options
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-disasm.c | 2 | ||||
-rw-r--r-- | gdb/python/py-value.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/gdb/python/py-disasm.c b/gdb/python/py-disasm.c index 7b64436..58e2efe 100644 --- a/gdb/python/py-disasm.c +++ b/gdb/python/py-disasm.c @@ -650,7 +650,7 @@ disasmpy_set_enabled (PyObject *self, PyObject *args, PyObject *kw) return nullptr; } - python_print_insn_enabled = PyObject_IsTrue (newstate); + python_print_insn_enabled = newstate == Py_True; Py_RETURN_NONE; } diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 119bf9f..eef3841 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -815,7 +815,9 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw) } } - string_file stb (PyObject_IsTrue (styling_obj)); + /* We force styling_obj to be a 'bool' when we parse the args above. */ + gdb_assert (PyBool_Check (styling_obj)); + string_file stb (styling_obj == Py_True); try { @@ -1988,9 +1990,8 @@ convert_value_from_python (PyObject *obj) { if (PyBool_Check (obj)) { - cmp = PyObject_IsTrue (obj); - if (cmp >= 0) - value = value_from_longest (builtin_type_pybool, cmp); + cmp = obj == Py_True ? 1 : 0; + value = value_from_longest (builtin_type_pybool, cmp); } else if (PyLong_Check (obj)) { |