summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/pool.py
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2013-10-28 23:23:04 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2013-10-28 23:23:04 (GMT)
commit33aaa73cade0acee374139f855af2a167d139d89 (patch)
treeac8f49ff500cd706744d490c86f83f48f6e77b0e /Lib/multiprocessing/pool.py
parente6514f533efba25e5aeba50208515d02d528995a (diff)
parente90cedb71102c78b93839fd282f53c618defc023 (diff)
downloadcpython-33aaa73cade0acee374139f855af2a167d139d89.zip
cpython-33aaa73cade0acee374139f855af2a167d139d89.tar.gz
cpython-33aaa73cade0acee374139f855af2a167d139d89.tar.bz2
Merge.
Diffstat (limited to 'Lib/multiprocessing/pool.py')
-rw-r--r--Lib/multiprocessing/pool.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
index 4be00d5..1cb2d95 100644
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -174,7 +174,8 @@ class Pool(object):
self._task_handler = threading.Thread(
target=Pool._handle_tasks,
- args=(self._taskqueue, self._quick_put, self._outqueue, self._pool)
+ args=(self._taskqueue, self._quick_put, self._outqueue,
+ self._pool, self._cache)
)
self._task_handler.daemon = True
self._task_handler._state = RUN
@@ -364,7 +365,7 @@ class Pool(object):
util.debug('worker handler exiting')
@staticmethod
- def _handle_tasks(taskqueue, put, outqueue, pool):
+ def _handle_tasks(taskqueue, put, outqueue, pool, cache):
thread = threading.current_thread()
for taskseq, set_length in iter(taskqueue.get, None):
@@ -375,9 +376,12 @@ class Pool(object):
break
try:
put(task)
- except OSError:
- util.debug('could not put task on queue')
- break
+ except Exception as e:
+ job, ind = task[:2]
+ try:
+ cache[job]._set(ind, (False, e))
+ except KeyError:
+ pass
else:
if set_length:
util.debug('doing set_length()')