[Zope3-dev] Re: [Zope3-checkins] CVS: Zope3/src/zope/app/fssync -
syncer.py:1.5
Jeremy Hylton
jeremy@zope.com
Wed, 07 May 2003 09:09:48 -0400
On Tue, 6 May 2003 18:04:06 -0400
Guido van Rossum <guido@python.org> wrote:
> There was a problem with _p_serial being wiped out. As a
> temporary
> hack, save+restore it. XXX But really,
> Persistent.__setstate__ should
> preserve _p_serial.
A question I'm not sure how to answer it whether
__setstate__() should clear the previous state of the
object. I can make a special-case for _p_serial if it
should.
I implemented the current behavior because it seemed most
natural to think of a __setstate__ operation as setting new
state on an object. If the state no longer has a spam
attribute, then the old spam attribute shouldn't hang
around.
On the other hand, we can think of a __setstate__ operation
that is only invoked at special times in an object's
lifetime. Certainly, zodb only calls __setstate__ on a
ghost, where there is no state.
Anyone have other opinions? I'm leaning towards the 2nd
option.
Jeremy