On Mon, Aug 16, 2010 at 12:14 PM, Pedro Ferreira
<jose.pedro.ferre...@cern.ch> wrote:
> Could this be some problem with using persistent objects as keys in a BTree?
> Some comparison problem?

I'm not entirely sure about this, but I think using persistent objects
as keys isn't supported. Looking at the code, I doubt using anything
expect simple types like unicode strings or tuples of simple types
will work without further work.

>From what I can see in the code, BTree's use functions like
PyObject_Compare to compare different keys. Persistent doesn't
implement any special compare function and falls back to the standard
hash algorithm for an object. This happens to be its memory address.
The memory address obviously changes over time and the same address
gets reused for different objects.

I think implementing a stable hash function for your type could make
this work though.

The ZODB gods correct me please :)

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to