diff options
author | Tom Tromey <tromey@redhat.com> | 2009-04-13 20:54:59 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2009-04-13 20:54:59 +0000 |
commit | 18e8c3bc8aea1c1eefa888ab34832abce1898a9d (patch) | |
tree | 65a07764603c1a1d54f1a5ac9852dca21932204d /gdb/python/python-frame.c | |
parent | 168a2f7744f9a9cdcb53b1861a941cc40291102f (diff) | |
download | gdb-18e8c3bc8aea1c1eefa888ab34832abce1898a9d.zip gdb-18e8c3bc8aea1c1eefa888ab34832abce1898a9d.tar.gz gdb-18e8c3bc8aea1c1eefa888ab34832abce1898a9d.tar.bz2 |
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.
Diffstat (limited to 'gdb/python/python-frame.c')
-rw-r--r-- | gdb/python/python-frame.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c index 8d6127e..a97009f 100644 --- a/gdb/python/python-frame.c +++ b/gdb/python/python-frame.c @@ -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)) - { - PyErr_SetString (PyExc_TypeError, "Frame object expected in comparison."); - return NULL; - } - else if (op != Py_EQ) + int result; + + if (!PyObject_TypeCheck (other, &frame_object_type) + || (op != Py_EQ && op != Py_NE)) { - 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; } |