From: david-sarah Date: Sat, 24 Sep 2011 21:12:08 +0000 (-0700) Subject: mutable/publish.py: copy the self.writers dict before iterating over it, since we... X-Git-Url: https://git.rkrishnan.org/pf/frontends/nxhtml.html?a=commitdiff_plain;h=1fa5c729b758776bbb2f45b422c33930444b2cf0;p=tahoe-lafs%2Ftahoe-lafs.git mutable/publish.py: copy the self.writers dict before iterating over it, since we remove elements from it during the iteration. refs #393 --- diff --git a/src/allmydata/mutable/publish.py b/src/allmydata/mutable/publish.py index a20ab15e..0eceedb1 100644 --- a/src/allmydata/mutable/publish.py +++ b/src/allmydata/mutable/publish.py @@ -861,10 +861,7 @@ class Publish: ds = [] verification_key = self._pubkey.serialize() - - # TODO: Bad, since we remove from this same dict. We need to - # make a copy, or just use a non-iterated value. - for (shnum, writer) in self.writers.iteritems(): + for (shnum, writer) in self.writers.copy().iteritems(): writer.put_verification_key(verification_key) self.num_outstanding += 1 def _no_longer_outstanding(res):