moved assert statement for name on try_set_start_method after its autoset

propagate_loglevel
Christian López Barrón 2019-03-09 18:42:51 +11:00
parent efffca371a
commit b992dc19e3
1 changed files with 3 additions and 2 deletions

View File

@ -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