Support debug mode only on the trio backend

bug_in_debug
Tyler Goodlet 2020-10-13 14:20:44 -04:00
parent ba52de79e1
commit e3c26943ba
1 changed files with 3 additions and 1 deletions

View File

@ -63,11 +63,13 @@ async def _main(
if start_method is not None: if start_method is not None:
_spawn.try_set_start_method(start_method) _spawn.try_set_start_method(start_method)
if debug_mode: if debug_mode and _spawn._spawn_method == 'trio':
_state._runtime_vars['_debug_mode'] = True _state._runtime_vars['_debug_mode'] = True
# expose internal debug module to every actor allowing # expose internal debug module to every actor allowing
# for use of ``await tractor.breakpoint()`` # for use of ``await tractor.breakpoint()``
kwargs.setdefault('rpc_module_paths', []).append('tractor._debug') kwargs.setdefault('rpc_module_paths', []).append('tractor._debug')
elif debug_mode:
raise RuntimeError("Debug mode is only supported for the `trio` backend!")
main = partial(async_fn, *args) main = partial(async_fn, *args)