New submission from Марк Коренберг <[email protected]>:
Proof:
================
import asyncio
async def test():
while True:
print('sleeping 1')
await asyncio.gather(asyncio.sleep(1), return_exceptions=True)
async def amain():
print('creating task')
qwe = asyncio.Task(test())
print('sleeping 2')
await asyncio.sleep(2)
print('cancelling task')
qwe.cancel()
print('waiting task for completion')
try:
await qwe
except Exception as e:
print('task complete: %r', e)
loop = asyncio.get_event_loop()
loop.run_until_complete(amain())
================
This program will never complete.
This case should be either fixed, or documented.
----------
components: asyncio
messages: 310843
nosy: asvetlov, socketpair, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.gather(..., return_exceptions=True) swallows cancellation
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32684>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com