[issue28014] Strange interaction between methods in subclass of C OrderedDict

2016-10-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: Note: This class doesn't actually work on 3.4 in other ways (because __getitem__ is not idempotent, while OrderedDict assumes it is): >>> s = SimpleLRUCache(2) >>> s['t1'] = 1 >>> s SimpleLRUCache([('t1', 1)]) >>> s['t2'] = 2 >>> s SimpleLRUCache([('t1', 1)])

[issue28014] Strange interaction between methods in subclass of C OrderedDict

2016-09-07 Thread Zachary Ware
Changes by Zachary Ware : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> KeyError thrown by optimised collections.OrderedDict.popitem() ___ Python tracker

[issue28014] Strange interaction between methods in subclass of C OrderedDict

2016-09-07 Thread Xiang Zhang
Xiang Zhang added the comment: Please see issue27275. Someone has already complained about this. And I think the cause is the gap between Pure Python implementation and C implementation when it comes to subclasses. -- nosy: +xiang.zhang ___ Python

[issue28014] Strange interaction between methods in subclass of C OrderedDict

2016-09-07 Thread Zachary Ware
New submission from Zachary Ware: I'm not certain that the implementation of this subclass of OrderedDict is actually sane, but it works in 3.4 and fails in 3.5+. The buggy implementation: class SimpleLRUCache(OrderedDict): def __init__(self, size): super().__init__()