[New-bugs-announce] [issue32684] asyncio.gather(..., return_exceptions=True) swallows cancellation
Марк Коренберг
report at bugs.python.org
Sat Jan 27 00:38:11 EST 2018
New submission from Марк Коренберг <socketpair at gmail.com>:
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 <report at bugs.python.org>
<https://bugs.python.org/issue32684>
_______________________________________
More information about the New-bugs-announce
mailing list