Issue #20980: Stop wrapping exception when using ThreadPool.

This commit is contained in:
Richard Oudkerk 2014-03-23 12:30:54 +00:00
parent a40675a1a2
commit 80a5be1d84
4 changed files with 30 additions and 6 deletions

View file

@ -1810,6 +1810,17 @@ class _TestPool(BaseTestCase):
self.assertIn('raise RuntimeError(123) # some comment',
f1.getvalue())
@classmethod
def _test_wrapped_exception(cls):
raise RuntimeError('foo')
def test_wrapped_exception(self):
# Issue #20980: Should not wrap exception when using thread pool
with self.Pool(1) as p:
with self.assertRaises(RuntimeError):
p.apply(self._test_wrapped_exception)
def raising():
raise KeyError("key")