Guilherme Salgado <[email protected]> added the comment:
I've also been affected by this and found that if you use asyncio.run() the
coroutine is interrupted with a CancelledError as you'd expect. The following
script shows that
=======================
import asyncio
async def handle_connection(reader, writer):
try:
await reader.readexactly(42)
except BaseException as err:
print('Interesting: %r.' % err)
raise
finally:
writer.close()
async def main():
listener = await asyncio.start_server(handle_connection, '127.0.0.1', 8888)
try:
async with listener:
await listener.serve_forever()
except KeyboardInterrupt:
print('KeyboardInterrupt')
asyncio.run(main())
=============================================
----------
nosy: +salgado
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue30083>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com