Message281847
> 4. Guard against misbehaving generators/iterables *before* they are put into the taskqueue.
This approach is good. 2 points about the patch:
1. How about _map_async(map)? Does it need the same strategy? For an iterator with __len__ defined it seems to get the same issue as here.
from multiprocessing import Pool
def double(x):
return 2 * x
class buggy:
def __iter__(self):
return self
def __next__(self):
raise Exception('oops')
def __len__(self):
return 1
list(Pool(processes=2).map(double, buggy()))
list(Pool(processes=2).map(double, buggy())) # hangs
2. The logic in _handle_tasks to handle task, i to could be removed I think. With _guarded_task_generation the for loop cannot fail and the logic itself is buggy now. |
|
Date |
User |
Action |
Args |
2016-11-28 08:22:21 | xiang.zhang | set | recipients:
+ xiang.zhang, elias, davin, lev-veshnyakov |
2016-11-28 08:22:21 | xiang.zhang | set | messageid: <1480321341.87.0.5422627059.issue28699@psf.upfronthosting.co.za> |
2016-11-28 08:22:21 | xiang.zhang | link | issue28699 messages |
2016-11-28 08:22:21 | xiang.zhang | create | |
|