gdb
* python/python-frame.c (frapy_richcompare): Return Py_NotImplemented, not an error. Handle Py_NE as well. gdb/testsuite * gdb.python/python-frame.exp (gdb_py_test_silent_cmd): Test != operator on Frame.
This commit is contained in:
parent
168a2f7744
commit
18e8c3bc8a
4 changed files with 23 additions and 9 deletions
|
@ -415,21 +415,23 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
frapy_richcompare (PyObject *self, PyObject *other, int op)
|
||||
{
|
||||
if (!PyObject_TypeCheck (other, &frame_object_type))
|
||||
int result;
|
||||
|
||||
if (!PyObject_TypeCheck (other, &frame_object_type)
|
||||
|| (op != Py_EQ && op != Py_NE))
|
||||
{
|
||||
PyErr_SetString (PyExc_TypeError, "Frame object expected in comparison.");
|
||||
return NULL;
|
||||
}
|
||||
else if (op != Py_EQ)
|
||||
{
|
||||
PyErr_SetString (PyExc_TypeError, "Invalid comparison for gdb.Frame.");
|
||||
return NULL;
|
||||
Py_INCREF (Py_NotImplemented);
|
||||
return Py_NotImplemented;
|
||||
}
|
||||
|
||||
if (frame_id_eq (((frame_object *) self)->frame_id,
|
||||
((frame_object *) other)->frame_id))
|
||||
Py_RETURN_TRUE;
|
||||
result = Py_EQ;
|
||||
else
|
||||
result = Py_NE;
|
||||
|
||||
if (op == result)
|
||||
Py_RETURN_TRUE;
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue