forked from goodboy/tractor
moved assert statement for name on try_set_start_method after its autoset
parent
efffca371a
commit
b992dc19e3
|
@ -24,10 +24,9 @@ def try_set_start_method(name: str) -> mp.context.BaseContext:
|
||||||
global _ctx
|
global _ctx
|
||||||
|
|
||||||
allowed = mp.get_all_start_methods()
|
allowed = mp.get_all_start_methods()
|
||||||
assert name in allowed
|
|
||||||
|
|
||||||
if name not in allowed:
|
if name not in allowed:
|
||||||
name == 'spawn'
|
name = 'spawn'
|
||||||
elif name == 'fork':
|
elif name == 'fork':
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"`fork` is unsupported due to incompatibility with `trio`"
|
"`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':
|
elif name == 'forkserver':
|
||||||
_forkserver_hackzorz.override_stdlib()
|
_forkserver_hackzorz.override_stdlib()
|
||||||
|
|
||||||
|
assert name in allowed
|
||||||
|
|
||||||
_ctx = mp.get_context(name)
|
_ctx = mp.get_context(name)
|
||||||
return _ctx
|
return _ctx
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue