You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bisect insort C implementation ignores methods on list subclasses #48185
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/birkenfeld'closed_at=<Date2008-10-08.18:47:48.025>created_at=<Date2008-09-22.18:53:44.168>labels= ['type-bug', 'library']
title='bisect insort C implementation ignores methods on list subclasses'updated_at=<Date2008-10-08.18:47:48.023>user='https://bugs.python.org/jek'
Activity
jek commentedon Sep 22, 2008
The C implementation (only) of bisect does not invoke list subclass
methods when insorting. Code like this will not trigger the assert:
bisect.insort(Boom(), 123)
object-derived classes are OK.
hdima commentedon Sep 26, 2008
Actually it was an optimization. PyList_Insert() was used for list and
list-derived objects.
I've attached the patch which fix the issue and for me the new code
looks even cleaner than the original code.
amauryfa commentedon Sep 26, 2008
We could keep the optimization for the standard case:
What about simply replacing PyList_Check with PyList_CheckExact?
hdima commentedon Sep 26, 2008
Good idea! Don't know why I didn't use it in the very first version. :-)
New patch attached.
rhettinger commentedon Oct 5, 2008
Don't think this is too late for Py3.0.
birkenfeld commentedon Oct 8, 2008
OK, committed as r66856, should get merged to 3.0 soon.