From b992dc19e31d539dec7365d1a47501f7a582ae61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=B3pez=20Barr=C3=B3n?= Date: Sat, 9 Mar 2019 18:42:51 +1100 Subject: [PATCH] moved assert statement for name on try_set_start_method after its autoset --- tractor/_spawn.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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