mirror of
https://github.com/python/cpython.git
synced 2025-09-14 20:56:06 +00:00
Issue #28843: Fix asyncio C Task to handle exceptions __traceback__.
This commit is contained in:
parent
c349374ee6
commit
c2c8fe1252
3 changed files with 22 additions and 0 deletions
|
@ -1952,6 +1952,21 @@ class BaseTaskTests:
|
|||
self.assertFalse(gather_task.cancelled())
|
||||
self.assertEqual(gather_task.result(), [42])
|
||||
|
||||
def test_exception_traceback(self):
|
||||
# See http://bugs.python.org/issue28843
|
||||
|
||||
@asyncio.coroutine
|
||||
def foo():
|
||||
1 / 0
|
||||
|
||||
@asyncio.coroutine
|
||||
def main():
|
||||
task = self.new_task(self.loop, foo())
|
||||
yield # skip one loop iteration
|
||||
self.assertIsNotNone(task.exception().__traceback__)
|
||||
|
||||
self.loop.run_until_complete(main())
|
||||
|
||||
@mock.patch('asyncio.base_events.logger')
|
||||
def test_error_in_call_soon(self, m_log):
|
||||
def call_soon(callback, *args):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue