Message377104
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())
============================================= |
|
Date |
User |
Action |
Args |
2020-09-18 10:56:44 | salgado | set | recipients:
+ salgado, socketpair, yselivanov |
2020-09-18 10:56:44 | salgado | set | messageid: <1600426604.68.0.755964155928.issue30083@roundup.psfhosted.org> |
2020-09-18 10:56:44 | salgado | link | issue30083 messages |
2020-09-18 10:56:43 | salgado | create | |
|