diff --git a/apscheduler/executors/pool.py b/apscheduler/executors/pool.py index 146978bb..aa2d4973 100644 --- a/apscheduler/executors/pool.py +++ b/apscheduler/executors/pool.py @@ -1,5 +1,5 @@ import concurrent.futures -import multiprocessing +import sys from abc import abstractmethod from concurrent.futures.process import BrokenProcessPool @@ -73,6 +73,12 @@ class ProcessPoolExecutor(BasePoolExecutor): def __init__(self, max_workers=10, pool_kwargs=None): pool_kwargs = pool_kwargs or {} - pool_kwargs.setdefault("mp_context", multiprocessing.get_context("spawn")) + + # 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 = concurrent.futures.ProcessPoolExecutor(int(max_workers), **pool_kwargs) super().__init__(pool) diff --git a/pyproject.toml b/pyproject.toml index 66418233..ae85f102 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,10 +50,12 @@ tornado = ["tornado >= 4.3"] twisted = ["twisted"] zookeeper = ["kazoo"] test = [ - "APScheduler[gevent,mongodb,redis,rethinkdb,sqlalchemy,tornado,twisted,zookeeper,etcd]", + "APScheduler[mongodb,redis,rethinkdb,sqlalchemy,tornado,zookeeper,etcd]", "pytest", "pytest-asyncio >= 0.24.0", - "PySide6; python_implementation == 'CPython'", + "PySide6; python_implementation == 'CPython' and python_version < '3.14'", + "gevent; python_version < '3.14'", + "twisted; python_version < '3.14'", ] doc = [ "APScheduler[gevent,mongodb,redis,rethinkdb,sqlalchemy,tornado,twisted,zookeeper,etcd]", @@ -134,7 +136,7 @@ ignore = [ known-first-party = ["apscheduler"] [tool.tox] -env_list = ["py38", "py39", "py310", "py311", "py312", "py313", "pypy3"] +env_list = ["py38", "py39", "py310", "py311", "py312", "py313", "py314", "pypy3"] skip_missing_interpreters = true [tool.tox.env_run_base]