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
|
@ -1,3 +1,8 @@
|
||||||
|
2009-04-13 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* python/python-frame.c (frapy_richcompare): Return
|
||||||
|
Py_NotImplemented, not an error. Handle Py_NE as well.
|
||||||
|
|
||||||
2009-04-13 Eli Zaretskii <eliz@gnu.org>
|
2009-04-13 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
* charset.c (EILSEQ): Define if not defined by system headers.
|
* charset.c (EILSEQ): Define if not defined by system headers.
|
||||||
|
|
|
@ -415,21 +415,23 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
frapy_richcompare (PyObject *self, PyObject *other, int op)
|
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.");
|
Py_INCREF (Py_NotImplemented);
|
||||||
return NULL;
|
return Py_NotImplemented;
|
||||||
}
|
|
||||||
else if (op != Py_EQ)
|
|
||||||
{
|
|
||||||
PyErr_SetString (PyExc_TypeError, "Invalid comparison for gdb.Frame.");
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame_id_eq (((frame_object *) self)->frame_id,
|
if (frame_id_eq (((frame_object *) self)->frame_id,
|
||||||
((frame_object *) other)->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;
|
Py_RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2009-04-13 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* gdb.python/python-frame.exp (gdb_py_test_silent_cmd): Test !=
|
||||||
|
operator on Frame.
|
||||||
|
|
||||||
2009-04-03 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
|
2009-04-03 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
|
||||||
|
|
||||||
* gdb.base/attach.exp: Re-enable for spu*-*-* targets.
|
* gdb.base/attach.exp: Re-enable for spu*-*-* targets.
|
||||||
|
|
|
@ -70,6 +70,8 @@ gdb_py_test_silent_cmd "python f0 = f1.newer ()" "get first frame" 0
|
||||||
|
|
||||||
gdb_test "python print 'result =', f0 == f1" " = False" "test equality comparison (false)"
|
gdb_test "python print 'result =', f0 == f1" " = False" "test equality comparison (false)"
|
||||||
gdb_test "python print 'result =', f0 == f0" " = True" "test equality comparison (true)"
|
gdb_test "python print 'result =', f0 == f0" " = True" "test equality comparison (true)"
|
||||||
|
gdb_test "python print 'result =', f0 != f1" " = True" "test inequality comparison (true)"
|
||||||
|
gdb_test "python print 'result =', f0 != f0" " = False" "test inequality comparison (false)"
|
||||||
gdb_test "python print 'result =', f0.is_valid ()" " = True" "test Frame.is_valid"
|
gdb_test "python print 'result =', f0.is_valid ()" " = True" "test Frame.is_valid"
|
||||||
gdb_test "python print 'result =', f0.name ()" " = f2" "test Frame.name"
|
gdb_test "python print 'result =', f0.name ()" " = f2" "test Frame.name"
|
||||||
gdb_test "python print 'result =', f0.type () == gdb.NORMAL_FRAME" " = True" "test Frame.type"
|
gdb_test "python print 'result =', f0.type () == gdb.NORMAL_FRAME" " = True" "test Frame.type"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue