From d014f88349a568bebc4a02605b2b15ef958410b8 Mon Sep 17 00:00:00 2001 From: Jim Witschey Date: Thu, 4 May 2017 09:37:18 -0700 Subject: [PATCH] remove uses of map that don't work in py3 --- cassandra/io/libevreactor.py | 4 +++- tests/unit/test_policies.py | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cassandra/io/libevreactor.py b/cassandra/io/libevreactor.py index 5d163484..aadbe3a5 100644 --- a/cassandra/io/libevreactor.py +++ b/cassandra/io/libevreactor.py @@ -121,7 +121,9 @@ class LibevLoop(object): for conn in self._live_conns | self._new_conns | self._closed_conns: conn.close() - map(lambda w: w.stop(), (w for w in (conn._write_watcher, conn._read_watcher) if w)) + for watcher in (conn._write_watcher, conn._read_watcher): + if watcher: + watcher.stop() self.notify() # wake the timer watcher log.debug("Waiting for event loop thread to join...") diff --git a/tests/unit/test_policies.py b/tests/unit/test_policies.py index 4a79e0f6..e2df3056 100644 --- a/tests/unit/test_policies.py +++ b/tests/unit/test_policies.py @@ -108,8 +108,10 @@ class RoundRobinPolicyTest(unittest.TestCase): self.assertEqual(sorted(qplan), hosts) threads = [Thread(target=check_query_plan) for i in range(4)] - map(lambda t: t.start(), threads) - map(lambda t: t.join(), threads) + for t in threads: + t.start() + for t in threads: + t.join() def test_thread_safety_during_modification(self): hosts = range(100)