Re: "RuntimeError: dictionary changed size during iteration" ; Good atomic copy operations?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

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

From: robert <no-spam@no-spam-no-spam.com>
Date: Sat Mar 11 2006 - 12:26:49 CET

> 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?
Received on Sun Apr 30 11:33:36 2006