[ZODB-Dev] Corrupted OOTreeSet - strange behavior

Pedro Ferreira jose.pedro.ferreira at cern.ch
Mon Jul 18 08:08:22 EDT 2011


> TreeSets are essentially BTrees with only keys. This means that the
> members of a TreeSet must have a stable ordering. I suspect that that
> c's class does not define the comparison methods (such as __lt__)
> which means under Python 2 it falls back to the default ordering based
> on object id (Python 3 will raise a TypeError instead, avoiding this
> problem.) With ZODB an object's Python id (the memory address of the
> object) will change whenever it is reloaded, i.e. across restarts,
> after invalidation or removal from the cache.

Yes, I know that. But I have a __cmp__ function defined, based on an
object property that never changes. That should be enough, no?

> The _check() method only confirms that the BTree/TreeSets's internal
> data structure is consistent. It does not check every item. So it does
> not show an error in this case.

I see. I thought it did some order checking as well.

Thanks,

Pedro
-- 
José Pedro Ferreira

Software Developer, Indico Project
http://indico-software.org

+-----------+
+  '``'--- `+  CERN - European Organization for Nuclear Research
+ |CERN|  / +  1211 Geneve 23, Switzerland
+ ..__. \.  +  IT-UDS-AVC
+  \\___.\  +  Office: 513-1-005
+      /    +  Tel. +41227677159
+-----------+


More information about the ZODB-Dev mailing list