Author xiang.zhang
Recipients eric.snow, kaniini, rhettinger, serhiy.storchaka, xiang.zhang
Date 2016-06-10.18:31:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1465583515.49.0.5115414131.issue27275@psf.upfronthosting.co.za>
In-reply-to
Content
Raymond, In single threaded case popitem may still fail.

I want to correct my last message that popitem does not fail in this case because it calls __getitem__ but instead it calls __contains__[1]. In __contains__ it deletes the item since it expires, and finally emit a KeyError[2]. Even if it passes __contains__, it will call __getitem__[3].

[1] https://hg.python.org/cpython/file/tip/Objects/odictobject.c#l1115
[2] https://hg.python.org/cpython/file/tip/Objects/odictobject.c#l1135
[3] https://hg.python.org/cpython/file/tip/Objects/odictobject.c#l1119
History
Date User Action Args
2016-06-10 18:31:55xiang.zhangsetrecipients: + xiang.zhang, rhettinger, eric.snow, serhiy.storchaka, kaniini
2016-06-10 18:31:55xiang.zhangsetmessageid: <1465583515.49.0.5115414131.issue27275@psf.upfronthosting.co.za>
2016-06-10 18:31:55xiang.zhanglinkissue27275 messages
2016-06-10 18:31:55xiang.zhangcreate