[issue27275] KeyError thrown by optimised collections.OrderedDict.popitem()

2016-06-10 Thread William Pitcock
William Pitcock added the comment: It seems to me that calling __contains__() (PySequence_Contains()) isn't necessary, as the first and last elements of the list are already known, and therefore known to be in the list. Revising the behaviour of popitem() to avoid calling _odict_popkey

[issue27275] KeyError thrown by optimised collections.OrderedDict.popitem()

2016-06-10 Thread William Pitcock
William Pitcock added the comment: At least in my case, the application is single-threaded. I don't think this is a locking-related issue as the expiringdict test case itself fails which is also single-threaded. -- ___ Python tracker

[issue27275] KeyError thrown by optimised collections.OrderedDict.popitem()

2016-06-09 Thread William Pitcock
William Pitcock added the comment: A frequent reproducer is to run the expiringdict tests on Python 3.5.1, unfortunately I cannot come up with a testcase. Replacing use of popitem() with "del self[next(OrderedDict.__iter__(self))]" removes the KeyErrors and the structure otherwise

[issue27275] KeyError thrown by optimised collections.OrderedDict.popitem()

2016-06-08 Thread William Pitcock
New submission from William Pitcock: The C-based optimised version of collections.OrderedDict occasionally throws KeyErrors when deleting items. See https://github.com/mailgun/expiringdict/issues/16 for an example of this regression. Backporting 3.6's patches to 3.5.1 does not resolv