-
-
Notifications
You must be signed in to change notification settings - Fork 42
Closed
Description
I was having a hard time figuring out why my program suddenly stopped working without any errors and without keyboard interrupts working. After a lot of digging, I found that there was a simple AttributeError but it wasn't being raised. And it only happened with trio-asyncio running. I managed to come up with this minimal example:
import trio
import trio_asyncio
async def foo():
async with trio_asyncio.open_loop():
await trio.sleep(0)
async def main():
async with trio.open_nursery() as nursery:
nursery.start_soon(foo)
raise RuntimeError('error!')
if __name__ == '__main__':
trio.run(main)Digging further, I found this bit in the _base.py module is to blame:
with trio.CancelScope(shield=True):
while not self._stopped.is_set():
await self._main_loop_one()I'm not familiar with trio_asyncio internals, so I don't know why the shield=True is necessary, but it can clearly cause issues like the one I was experiencing.
Metadata
Metadata
Assignees
Labels
No labels