From 6742d637721530b86819e387e4a2484017fec8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Michel=20De=20Rainville?= Date: Thu, 12 Jul 2012 22:43:24 -0400 Subject: [PATCH] Corrected a bug in map and map_async that when providing empty iterables the result should be an empty list --- deap/dtm/manager.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deap/dtm/manager.py b/deap/dtm/manager.py index d9982ac9b..c38616fe8 100644 --- a/deap/dtm/manager.py +++ b/deap/dtm/manager.py @@ -1053,6 +1053,9 @@ def map(self, function, *iterables, **kwargs): listTasks.append(task) listTids.append(task.tid) + if len(listTids) == 0: + return [] + if self.traceMode: self.traceLock.acquire() newTaskElem = etree.SubElement(cThread.xmlTrace, "event", @@ -1146,6 +1149,9 @@ def map_async(self, function, *iterables, **kwargs): listTasks.append(task) listTids.append(task.tid) + if len(listTids) == 0: + return [] + resultKey = listTids[0] if self.traceMode: