[Zope-dev] Help: __getstate__ overriding
Dieter Maurer
dieter at handshake.de
Mon May 31 13:30:54 EDT 2004
Tim Peters wrote at 2004-5-30 14:49 -0400:
>[Dieter Maurer]
>> I think, this is a ZODB buglet:
>>
>> It should set "_p_changed = 0" before it calls "__setstate__"
>> and not afterwards...
>
>I don't know; Jim (or Jeremy) may know the reasoning here, but I don't.
>
>Activation currently sets the state to changed *before* calling __setstate__
>too. A comment says this is to prevent recursively calling _PyPersist_Load,
>and that makes sense to me, else unbounded recursion could occur.
I see...
> ...
>On ZODB head, Jeremy also documented that __setstate__ can't affect the
>persistent state (in persistent/interfaces.py's IPersistent). Whether this
>is deliberate design, or a consequence of the current implementation, I
>can't say.
A potential problem: it *can* change the persistent state but
it does not do it reliably. It does precisely when the object
is later modified again: in this case modifications made
in "__setstate__" become persistent, otherwise, they do not.
--
Dieter
More information about the Zope-Dev
mailing list