[issue35629] hang and/or leaked processes with multiprocessing.Pool(...).imap(...)

STINNER Victor report at bugs.python.org
Fri Jan 4 17:40:33 EST 2019


STINNER Victor <vstinner at redhat.com> added the comment:

I suggest you to write:

with multiprocessing.Pool(4) as pool: result = tuple(pool.imap(print, (1, 2, 3)))

On Python 3.8, your example will now log a resource warning since you don't close/terminate explicitly the pool.

----------
nosy: +vstinner

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35629>
_______________________________________


More information about the Python-bugs-list mailing list