python-trio / trio-asyncio

a re-implementation of the asyncio mainloop on top of Trio
Other
188 stars 38 forks source link

KeyboardInterrupt causes AttributeError: 'NoneType' object has no attribute 'start_soon' #134

Closed DRMacIver closed 8 months ago

DRMacIver commented 8 months ago

Running on trio-asyncio==0.13.0, a badly timed Ctrl-C can cause the following output:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f67a0b53970>
Exception in default exception handler
Traceback (most recent call last):
  File "/usr/lib64/python3.9/asyncio/base_events.py", line 1779, in call_exception_handler
    self.default_exception_handler(context)
  File "/home/ec2-user/.local/lib/python3.9/site-packages/trio_asyncio/_async.py", line 50, in default_exception_handler
    self._nursery.start_soon(propagate_asyncio_error)
AttributeError: 'NoneType' object has no attribute 'start_soon'

I'm aware that tracking down every way a badly timed signal can break your code is a thankless task, and this doesn't matter very much to me at all, just mentioning this in case it's of interest. As far as I'm concerned, please feel free to ignore this report.