diff -r 024827a9db64 Lib/multiprocessing/pool.py --- a/Lib/multiprocessing/pool.py Fri Jun 24 20:52:27 2011 +0200 +++ b/Lib/multiprocessing/pool.py Sat Jun 25 15:11:48 2011 +0200 @@ -347,17 +347,16 @@ class Pool(object): if set_length: debug('doing set_length()') set_length(i+1) continue break else: debug('task handler got sentinel') - try: # tell result handler to finish when cache is empty debug('task handler sending sentinel to result handler') outqueue.put(None) # tell workers there is no more work debug('task handler sending sentinel to workers') for p in pool: @@ -575,16 +574,17 @@ class MapResult(ApplyResult): ApplyResult.__init__(self, cache, callback, error_callback=error_callback) self._success = True self._value = [None] * length self._chunksize = chunksize if chunksize <= 0: self._number_left = 0 self._ready = True + del cache[self._job] else: self._number_left = length//chunksize + bool(length % chunksize) def _set(self, i, success_result): success, result = success_result if success: self._value[i*self._chunksize:(i+1)*self._chunksize] = result self._number_left -= 1