=== modified file 'Lib/test/test_bisect.py' --- Lib/test/test_bisect.py 2008-07-10 14:03:19 +0000 +++ Lib/test/test_bisect.py 2008-09-26 17:00:22 +0000 @@ -196,6 +196,17 @@ def test_backcompatibility(self): self.assertEqual(self.module.insort, self.module.insort_right) + def test_listDerived(self): + class List(list): + data = [] + def insert(self, index, item): + self.data.insert(index, item) + + lst = List() + self.module.insort_left(lst, 10) + self.module.insort_right(lst, 5) + self.assertEqual([5, 10], lst.data) + class TestInsortPython(TestInsort): module = py_bisect === modified file 'Modules/_bisectmodule.c' --- Modules/_bisectmodule.c 2008-07-24 05:38:48 +0000 +++ Modules/_bisectmodule.c 2008-09-26 19:37:13 +0000 @@ -82,7 +82,7 @@ index = internal_bisect_right(list, item, lo, hi); if (index < 0) return NULL; - if (PyList_Check(list)) { + if (PyList_CheckExact(list)) { if (PyList_Insert(list, index, item) < 0) return NULL; } else { @@ -183,7 +183,7 @@ index = internal_bisect_left(list, item, lo, hi); if (index < 0) return NULL; - if (PyList_Check(list)) { + if (PyList_CheckExact(list)) { if (PyList_Insert(list, index, item) < 0) return NULL; } else {