Matthew Barnett added the comment:

First some background: when you put a new entry into a dict, it looks for an 
empty slot, the key's hash determining the initial choice, but if that slot's 
occupied, it picks another, etc, so the key might not be in the slot of first 
choice.

In "PyODict_DelItem", it deletes the key from the dict and then calls 
"_odict_clear_node" to delete the node.

If the key that it's looking for wasn't in the slot of first choice, but that 
slot is empty, that'll be the one it'll return, ie, the wrong one.

The solution, therefore, is to delete the node _before_ deleting the key from 
the dict.

When I tried that, the test ran to completion.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16991>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to