From f791e3dc60143570264771f9907e703d2d0b320e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Tue, 19 Nov 2024 02:33:44 +0200 Subject: [PATCH] Unconditionally set mp_context for ProcessPoolExecutor --- apscheduler/executors/pool.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/apscheduler/executors/pool.py b/apscheduler/executors/pool.py index aa2d4973..146978bb 100644 --- a/apscheduler/executors/pool.py +++ b/apscheduler/executors/pool.py @@ -1,5 +1,5 @@ import concurrent.futures -import sys +import multiprocessing from abc import abstractmethod from concurrent.futures.process import BrokenProcessPool @@ -73,12 +73,6 @@ class ProcessPoolExecutor(BasePoolExecutor): def __init__(self, max_workers=10, pool_kwargs=None): pool_kwargs = pool_kwargs or {} - - # On Python 3.14, "spawn" is the default mp_context - if sys.version_info < (3, 14): - import multiprocessing - - pool_kwargs.setdefault("mp_context", multiprocessing.get_context("spawn")) - + pool_kwargs.setdefault("mp_context", multiprocessing.get_context("spawn")) pool = concurrent.futures.ProcessPoolExecutor(int(max_workers), **pool_kwargs) super().__init__(pool)