[ZODB-Dev] BTree corrupted after conflict resolution

Jeremy Hylton jeremy at zope.com
Mon Mar 8 10:13:49 EST 2004


On Sat, 2004-03-06 at 00:32, Tim Peters wrote:
> [Toby Dickenson]
> >> Sould we break "a == b" equality tests on these stub objects too? I
> >> can imagine that being broadly safe today, and I think I remember
> >> someone using it.
> >>
> >> "a is b" better anyway.....
> 
> [Dieter Maurer]
> > I do not think so.
> >
> >   *  I do not expect that PersistentReferences to the same
> >      peristent object are identical but they should be equal
> 
> Nevertheless, it appears that in the current implementation object identity
> is preserved by PersistentReference.  Precisely, in the three states passed
> to one invocation of conflict resolution, a persisent reference A in one of
> them stubs the same oid as a persistent reference B (whether in the same
> state or in the other two) if and only if "A is B" holds.  Because the
> default __cmp__ is used, a consequence is that "A == B" holds for two
> PersistentReferences found in these states today if and only if "A is B"
> holds.

It is by design that object identity is preserved by PersistentReference
objects.  It doesn't sound too hard to add an __cmp__(), but I'm not
sure how useful it is.  Is it possible to define an __cmp__() that
raises an exception and then add __ne__ and __eq__ methods that don't
raise an exception?

Jeremy





More information about the ZODB-Dev mailing list