Changes between Version 2 and Version 3 of Ticket #14471, comment 11


Ignore:
Timestamp:
04/22/13 20:37:42 (9 years ago)
Author:
nbruin
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14471, comment 11

    v2 v3  
    3737One difference between `data.keys()` and `__contains__` is that `dictobject.c/dict_keys` just iterates over the table storing the dict and extracts the keys of all dictentries that have a non-NULL value field, whereas `__contains__` will go through a `dictlookup`.
    3838Given that some of the key components may well be in the process of being torn down, could it be that their hash is broken? One would still be able to find the corresponding key by iterating through all of them (as `wr.key in data.keys()` does), but finding it by hash would not work. Both `__contains__` and `__delitem__` would suffer from that.
     39
     40This could happen if the MRO of some class changed to insert/remove `WithEqualityById` in it. Changing the hash on a key component for which a callback happens would have exactly this effect. So my bet is that it's an artifact of the mro voodoo the dynamical category stuff does or it's an unfortunate clearing/changing of a cached hash value somewhere due to a deletion-in-progress.