Commit 3e57b52b authored by Thomas Wouters's avatar Thomas Wouters

Fix buglet in sliceobjects, they were not returning Py_NotImplemented when

compared against something other than sliceobjects.
parent ed03b412
......@@ -26,6 +26,9 @@ class SliceTest(unittest.TestCase):
s3 = slice(1, 2, 4)
self.assertEqual(s1, s2)
self.assertNotEqual(s1, s3)
self.assertNotEqual(s1, None)
self.assertNotEqual(s1, (1, 2, 3))
self.assertNotEqual(s1, "")
class Exc(Exception):
pass
......
......@@ -286,6 +286,11 @@ slice_richcompare(PyObject *v, PyObject *w, int op)
PyObject *t2;
PyObject *res;
if (!PySlice_Check(v) || !PySlice_Check(w)) {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
if (v == w) {
/* XXX Do we really need this shortcut?
There's a unit test for it, but is that fair? */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment