[issue26333] Multiprocessing imap hangs when generator input errors
Terry J. Reedy
report at bugs.python.org
Fri Feb 12 18:16:53 EST 2016
Terry J. Reedy added the comment:
If you add the "if __name__ == '__main__':" guard after defining the target function, as specified in the multiprocessing doc, you will get a traceback much as you expect:
Traceback (most recent call last):
File "F:\Python\mypy\tem.py", line 12, in <module>
for new_val in pool.imap(add_one, value_iter):
File "C:\Programs\Python35\lib\multiprocessing\pool.py", line 695, in next
raise value
File "C:\Programs\Python35\lib\multiprocessing\pool.py", line 380, in _handle_tasks
for i, task in enumerate(taskseq):
File "C:\Programs\Python35\lib\multiprocessing\pool.py", line 286, in <genexpr>
self._taskqueue.put((((result._job, i, func, (x,), {})
File "F:\Python\mypy\tem.py", line 10, in <genexpr>
value_iter = (int(v) for v in values)
ValueError: invalid literal for int() with base 10: 'foo'
I have seem this bug of omission multiple times on Stackoverflow.
----------
nosy: +terry.reedy
resolution: -> not a bug
stage: -> resolved
status: open -> closed
versions: +Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26333>
_______________________________________
More information about the Python-bugs-list
mailing list