Fix problem in Queuing odict/HookeConfigParser.
authorW. Trevor King <wking@drexel.edu>
Wed, 12 May 2010 15:03:46 +0000 (11:03 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 12 May 2010 15:03:46 +0000 (11:03 -0400)
I'm not sure why odict.__setstate__() is not being called before
.__setitem__(), but this hack seems to be a valid workaround.

hooke/compat/odict.py

index 22de85c2aef9eacb2fd691f325e086f7303b27be..d204c6d8b5956630b1d63bbc2a98a8d3d77e538a 100644 (file)
@@ -208,6 +208,8 @@ class odict(dict):
         self._keys.remove(key)
 
     def __setitem__(self, key, item):
+        if not hasattr(self, '_keys'):
+            self._keys = [] # work around multiprocessing.Queue rebuild
         if key not in self:
             self._keys.append(key)
         dict.__setitem__(self, key, item)