diff options
| author | Yury Selivanov <yselivanov@sprymix.com> | 2015-08-17 18:46:51 (GMT) |
|---|---|---|
| committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-08-17 18:46:51 (GMT) |
| commit | 7ca6c55a4e2655dc0e5d780c3cc2ed7234edd72f (patch) | |
| tree | af6e7b6ff99ddd68a19f3eb32d40754038063e71 /Lib/test/test_asyncio/test_pep492.py | |
| parent | 6707906ea5e0df1132d3cd0c77707ccc19948341 (diff) | |
| download | cpython-7ca6c55a4e2655dc0e5d780c3cc2ed7234edd72f.zip cpython-7ca6c55a4e2655dc0e5d780c3cc2ed7234edd72f.tar.gz cpython-7ca6c55a4e2655dc0e5d780c3cc2ed7234edd72f.tar.bz2 | |
Issue #24867: Fix asyncio.Task.get_stack() for 'async def' coroutines
Diffstat (limited to 'Lib/test/test_asyncio/test_pep492.py')
| -rw-r--r-- | Lib/test/test_asyncio/test_pep492.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_pep492.py b/Lib/test/test_asyncio/test_pep492.py index b702efc..41e1b8a 100644 --- a/Lib/test/test_asyncio/test_pep492.py +++ b/Lib/test/test_asyncio/test_pep492.py @@ -186,6 +186,23 @@ class CoroutineTests(BaseTest): data = self.loop.run_until_complete(coro()) self.assertEqual(data, 'spam') + def test_task_print_stack(self): + T = None + + async def foo(): + f = T.get_stack(limit=1) + try: + self.assertEqual(f[0].f_code.co_name, 'foo') + finally: + f = None + + async def runner(): + nonlocal T + T = asyncio.ensure_future(foo(), loop=self.loop) + await T + + self.loop.run_until_complete(runner()) + if __name__ == '__main__': unittest.main() |
