[Python-modules-commits] [python-zeroconf] 06/08: resolve issue #38: size change during iteration

Ruben Undheim rubund-guest at moszumanska.debian.org
Wed Apr 13 19:10:13 UTC 2016


This is an automated email from the git hooks/post-receive script.

rubund-guest pushed a commit to branch upstream
in repository python-zeroconf.

commit fd9d531f294e7fa5b9b934f192b061f56eaf1d37
Author: Giles <gbiddison at synthego.com>
Date:   Mon Mar 14 09:01:16 2016 -0700

    resolve issue #38: size change during iteration
---
 zeroconf.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/zeroconf.py b/zeroconf.py
index b5dfb95..24f5a34 100644
--- a/zeroconf.py
+++ b/zeroconf.py
@@ -790,7 +790,9 @@ class DNSCache(object):
         if not self.cache:
             return []
         else:
-            return reduce(lambda a, b: a + b, self.cache.values())
+            # copy the cache before running the reduce, to avoid size change during iteration
+            values = list(self.cache.values())
+            return reduce(lambda a, b: a + b, values)
 
 
 class Engine(threading.Thread):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-zeroconf.git



More information about the Python-modules-commits mailing list