From 8808e3afe00f74d61f190beaaccdc7b2cb8fcb29 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 17 Feb 2020 15:20:30 +0100 Subject: [PATCH] policies/engine: set mp start method to fork to fix issues under macOS --- passbook/policies/engine.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/passbook/policies/engine.py b/passbook/policies/engine.py index e94451870..f76570757 100644 --- a/passbook/policies/engine.py +++ b/passbook/policies/engine.py @@ -1,5 +1,5 @@ """passbook policy engine""" -from multiprocessing import Pipe +from multiprocessing import Pipe, set_start_method from multiprocessing.connection import Connection from typing import List, Optional, Tuple @@ -12,7 +12,9 @@ from passbook.policies.process import PolicyProcess, cache_key from passbook.policies.struct import PolicyRequest, PolicyResult LOGGER = get_logger() - +# This is only really needed for macOS, because Python 3.8 changed the default to spawn +# spawn causes issues with objects that aren't picklable, and also the django setup +set_start_method("fork") class PolicyProcessInfo: """Dataclass to hold all information and communication channels to a process"""