@@ -1178,6 +1178,18 @@ def test_terminate(self):
11781178 join ()
11791179 self .assertLess (join .elapsed , 0.5 )
11801180
1181+ def test_empty_iterable (self ):
1182+ # See Issue 12157
1183+ p = self .Pool (1 )
1184+
1185+ self .assertEqual (p .map (sqr , []), [])
1186+ self .assertEqual (list (p .imap (sqr , [])), [])
1187+ self .assertEqual (list (p .imap_unordered (sqr , [])), [])
1188+ self .assertEqual (p .map_async (sqr , []).get (), [])
1189+
1190+ p .close ()
1191+ p .join ()
1192+
11811193def raising ():
11821194 raise KeyError ("key" )
11831195
@@ -2176,7 +2188,7 @@ class ProcessesMixin(object):
21762188 'Queue' , 'Lock' , 'RLock' , 'Semaphore' , 'BoundedSemaphore' ,
21772189 'Condition' , 'Event' , 'Value' , 'Array' , 'RawValue' ,
21782190 'RawArray' , 'current_process' , 'active_children' , 'Pipe' ,
2179- 'connection' , 'JoinableQueue'
2191+ 'connection' , 'JoinableQueue' , 'Pool'
21802192 )))
21812193
21822194testcases_processes = create_test_cases (ProcessesMixin , type = 'processes' )
@@ -2190,7 +2202,7 @@ class ManagerMixin(object):
21902202 locals ().update (get_attributes (manager , (
21912203 'Queue' , 'Lock' , 'RLock' , 'Semaphore' , 'BoundedSemaphore' ,
21922204 'Condition' , 'Event' , 'Value' , 'Array' , 'list' , 'dict' ,
2193- 'Namespace' , 'JoinableQueue'
2205+ 'Namespace' , 'JoinableQueue' , 'Pool'
21942206 )))
21952207
21962208testcases_manager = create_test_cases (ManagerMixin , type = 'manager' )
@@ -2204,7 +2216,7 @@ class ThreadsMixin(object):
22042216 'Queue' , 'Lock' , 'RLock' , 'Semaphore' , 'BoundedSemaphore' ,
22052217 'Condition' , 'Event' , 'Value' , 'Array' , 'current_process' ,
22062218 'active_children' , 'Pipe' , 'connection' , 'dict' , 'list' ,
2207- 'Namespace' , 'JoinableQueue'
2219+ 'Namespace' , 'JoinableQueue' , 'Pool'
22082220 )))
22092221
22102222testcases_threads = create_test_cases (ThreadsMixin , type = 'threads' )
0 commit comments