This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mouad
Recipients gkcn, jnoller, mouad, neologix, petri.lehtinen, terry.reedy
Date 2011-06-25.13:39:07
SpamBayes Score 5.289384e-07
Marked as misclassified No
Message-id <1309009147.76.0.823178137725.issue12157@psf.upfronthosting.co.za>
In-reply-to
Content
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*.
History
Date User Action Args
2011-06-25 13:39:07mouadsetrecipients: + mouad, terry.reedy, jnoller, neologix, gkcn, petri.lehtinen
2011-06-25 13:39:07mouadsetmessageid: <1309009147.76.0.823178137725.issue12157@psf.upfronthosting.co.za>
2011-06-25 13:39:07mouadlinkissue12157 messages
2011-06-25 13:39:07mouadcreate