[spambayes-dev] Re: Pickle vs DB inconsistencies

Meyer, Tony T.A.Meyer at massey.ac.nz
Thu Jun 26 16:47:23 EDT 2003


> You're saying that if d is an open Shelf object, then after
> 
>     d[string] = whatever
> 
> the value of the access expression
> 
>     d[string]
> 
> is unreliable unless a
> 
>     d.sync()
> 
> call intervenes?  That's scary, if so -- or a bug.

I believe so.  It's reliable as long as 'string' was already a token,
but not otherwise.  It doesn't give a random value, at least, it just
fails to update it.  (So d[string] would return whatever value it had
before the d[string] = whatever line).

> I haven't used this part of the code in real life.

You and your pickles ;)

> Other questions that pop up:
> 
> + Why does _wordinfoset() start with
> 
>     if record and ...
> 
>   ?  For example, how could record==None possibly arise?

I wondered this too.  I think it was Mark coding for all possible
situations.

> + If a word is deleted, what's stopping _wordinfoget() from sucking it
>   out of the database anyway?  That is, I believe the except clause in
>   _wordinfoget() should start with:
> 
>       if self.changed_words.get(word) is WORD_DELETED:
>           return None

I didn't notice this, but your logic makes sense to me.

=Tony Meyer



More information about the spambayes-dev mailing list