Patch reviewed by Raymond.
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
Library
-------
+- Issue #3935: Properly support list subclasses in bisect's C implementation.
+
- Issue #4014: Don't claim that Python has an Alpha release status, in addition
to claiming it is Mature.
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 {
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 {