summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-12-01 16:36:22 (GMT)
committerYury Selivanov <yury@magic.io>2016-12-01 16:36:22 (GMT)
commitc2c8fe1252dda7dd973a1da440607a1d9a9638f0 (patch)
treec1570df14ae72f89eea0cecb61c6c1dbf77ae10d /Lib/test/test_asyncio
parentc349374ee6309a9e85d98c2c9c22b9ce0e48bdfc (diff)
downloadcpython-c2c8fe1252dda7dd973a1da440607a1d9a9638f0.zip
cpython-c2c8fe1252dda7dd973a1da440607a1d9a9638f0.tar.gz
cpython-c2c8fe1252dda7dd973a1da440607a1d9a9638f0.tar.bz2
Issue #28843: Fix asyncio C Task to handle exceptions __traceback__.
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_tasks.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index e048380..a18d49a 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -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):