"RuntimeError: dictionary changed size during iteration" ; Good atomic copy operations?

robert no-spam at no-spam-no-spam.com
Sat Mar 11 06:26:49 EST 2006


> Is a copy.deepcopy  ( -> "cPickle.dump(copy.deepcopy(obj),f)" ) an 
> atomic opertion with a guarantee to not fail?
> 
> Or can I only retry several times in case of RuntimeError?  (which would 
> apears to me as odd gambling; retry how often?)

For an intermediate solution, I'm playing roulette:

     for i in 1,2,3:
         try:
             cPickle.dump(obj, f)
             break
         except RuntimeError,v:
             pass


I hope this works for some million years ...



> PS: Zope dumps thread exposed data structes regularly. How does the ZODB 
> in Zope handle dict/list changes during its pickling operations?



More information about the Python-list mailing list