On macOS (I tested 11.3.1 with Python version 3.9.5), child processes seem to
be spawned instead of forked by default:
>>> import multiprocessing
>>> multiprocessing.get_context()
<multiprocessing.context.SpawnContext object at 0x104092280>
This causes issues with global variables such as __TMPDIR in tmpfiles.py,
which is None for children when the process is spawned instead of forked.
This commit fixes the issue by setting the multiprocessing context explicitly.
The commit also moves the manipulation of sys.path and the import of the
ddsmt module after changing the context. Otherwise, the context is already
implicitly set when we get to if __name__ == '__main__'.
On macOS (I tested 11.3.1 with Python version 3.9.5), child processes seem to be spawned instead of forked by default:
This causes issues with global variables such as
__TMPDIR
in tmpfiles.py, which isNone
for children when the process is spawned instead of forked. This commit fixes the issue by setting the multiprocessing context explicitly. The commit also moves the manipulation ofsys.path
and the import of theddsmt
module after changing the context. Otherwise, the context is already implicitly set when we get toif __name__ == '__main__'
.