Author: thomas.wouters
Date: Wed Aug 29 01:07:26 2007
New Revision: 57625
Modified:
python/branches/py3k/Lib/test/test_slice.py
python/branches/py3k/Objects/sliceobject.c
Log:
Fix buglet in sliceobjects, they were not returning Py_NotImplemented when
compared against something other than sliceobjects.
Modified: python/branches/py3k/Lib/test/test_slice.py
==============================================================================
--- python/branches/py3k/Lib/test/test_slice.py (original)
+++ python/branches/py3k/Lib/test/test_slice.py Wed Aug 29 01:07:26 2007
@@ -26,6 +26,9 @@
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
Modified: python/branches/py3k/Objects/sliceobject.c
==============================================================================
--- python/branches/py3k/Objects/sliceobject.c (original)
+++ python/branches/py3k/Objects/sliceobject.c Wed Aug 29 01:07:26 2007
@@ -286,6 +286,11 @@
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? */
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins