Unset debug-mode on root actor exit
Discovered this bug while testing `modden`'s daemon under various cancelled-while-booting race conditions where sequential tests would fail a lingering `assert 0` inside `.to_asyncio.run_as_asyncio_guest()` to (oddly) catch redundant greenback-re-inits.. XD Needs a test likely ;Ppytest_pluginize
parent
8c8d79e475
commit
a92d0ebf02
|
@ -276,7 +276,8 @@ async def open_root_actor(
|
|||
|
||||
if (
|
||||
debug_mode
|
||||
and _spawn._spawn_method == 'trio'
|
||||
and
|
||||
_spawn._spawn_method == 'trio'
|
||||
):
|
||||
_state._runtime_vars['_debug_mode'] = True
|
||||
|
||||
|
@ -512,8 +513,17 @@ async def open_root_actor(
|
|||
)
|
||||
await actor.cancel(None) # self cancel
|
||||
finally:
|
||||
# revert all process-global runtime state
|
||||
if (
|
||||
debug_mode
|
||||
and
|
||||
_spawn._spawn_method == 'trio'
|
||||
):
|
||||
_state._runtime_vars['_debug_mode'] = False
|
||||
|
||||
_state._current_actor = None
|
||||
_state._last_actor_terminated = actor
|
||||
|
||||
logger.runtime(
|
||||
f'Root actor terminated\n'
|
||||
f')>\n'
|
||||
|
|
Loading…
Reference in New Issue