Xiang Zhang added the comment: I think your expiringdict seems not work with the C version OrderedDict, you may need to change your implementation or clarify that :(.
The C version's OrderedDict.popitem may call your __getitem__ which then does deletion and emit KeyError when expires. I think the new OrderedDict may call your __getitem__ even in iteration which leads to the 'RuntimeError: OrderedDict mutated during iteration'. I haven't checked that. So a simple working example in Py3.4: d = ExpiringDict(max_len=3, max_age_seconds=0.01) d['a'] = 'z' sleep(1) d.popitem() will fail in Py3.5+. ---------- nosy: +xiang.zhang _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27275> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com