Closed
Description
- uvloop version: 0.14.0
- Python version: 3.8.2
- Platform: Ubuntu 18.04
- Can you reproduce the bug with
PYTHONASYNCIODEBUG
in env?: Yes - Does uvloop behave differently from vanilla asyncio? How?: Yes, vanilla
asyncio
doesn't raise for this code
Reproduction code:
import asyncio
import sys
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
loop = asyncio.new_event_loop()
async def x():
sys.exit(1)
return_code = 0
try:
loop.run_until_complete(x())
except SystemExit as exc:
return_code = exc.code
finally:
loop.run_until_complete(asyncio.sleep(1))
sys.exit(return_code)
Traceback:
Traceback (most recent call last):
File "test.py", line 17, in <module>
loop.run_until_complete(asyncio.sleep(1))
File "uvloop/loop.pyx", line 1454, in uvloop.loop.Loop.run_until_complete
RuntimeError: Event loop stopped before Future completed.
Same happens when KeyboardInterrupt
is raised - vanilla asyncio
handles both of these here: https://github.com/python/cpython/blob/master/Lib/asyncio/base_events.py#L187-L190
Metadata
Metadata
Assignees
Labels
No labels