mouad <mouad...@gmail.com> added the comment:

Hello,

This is my first patch to cpython, hope it will be accepted :)

The fix that i did is to remove the ResultMap instance from the pool cache when 
the iterable is empty. 

In general here is what happen: The "map" method create a MapResult instance, 
which add it self automatically to the pool._cache and this ResultMap instance 
will be used by the task that will be created and added after in the 
"pool._taskqueue" to communicate the task result, but in case of an empty 
iterable the task will not be created and we will end up with a MapResult with 
no task and when we will try to join the pool, it will hang waiting for the 
task to set the result in the MapResult instance.

For the test i created a new helper `operation_timeout` that is used as a 
contextmanager to make sure that the test will not hang for ever, i don't know 
if it's useful maybe just running the test without checking for any timeout is 
more *realistic*.

----------
nosy: +mouad

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12157>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to