fiete added the comment:

Since the only thing I know about the multiprocessing internals is what I just 
read in the source code trying to debug my imap_unordered call, I'll add the 
following example, not knowing whether this is already covered by everything 
you have until now.

import multiprocessing.pool

def gen():
    raise Exception('generator exception')
    yield 1
    yield 2

for i in range(3):
    with multiprocessing.pool.ThreadPool(3) as pool:
            print(list(pool.imap_unordered(lambda x: x*2, gen())))
        except Exception as e:

This only prints 'generator exception' once for the first iteration. For the 
following iterations imap_unordered returns an empty list. This is the case for 
both Pool and ThreadPool.

nosy: +fiete

Python tracker <>
Python-bugs-list mailing list

Reply via email to