diff --git a/tractor/_spawn.py b/tractor/_spawn.py index 859cc4e..2d8a4bf 100644 --- a/tractor/_spawn.py +++ b/tractor/_spawn.py @@ -24,10 +24,9 @@ def try_set_start_method(name: str) -> mp.context.BaseContext: global _ctx allowed = mp.get_all_start_methods() - assert name in allowed if name not in allowed: - name == 'spawn' + name = 'spawn' elif name == 'fork': raise ValueError( "`fork` is unsupported due to incompatibility with `trio`" @@ -35,6 +34,8 @@ def try_set_start_method(name: str) -> mp.context.BaseContext: elif name == 'forkserver': _forkserver_hackzorz.override_stdlib() + assert name in allowed + _ctx = mp.get_context(name) return _ctx