Skip to content

Commit c0ef30e

Browse files
authored
MNT Fix _posixsubprocess.fork_exec arguments for Python 3.10 and Python 3.14 (#445)
1 parent c16a999 commit c0ef30e

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
### 3.6.0 - in development
22

3+
### 3.5.1 - 2025-03-18
4+
5+
- Fix a regression to support Python 3.10 (and Python 3.14 dev) by passing
6+
version-specific `allow_vfork` and `pgid_to_set` arguments to
7+
`_posixsubprocess.fork_exec`. (#445)
8+
39
### 3.5.0 - 2025-03-14
410

511
- Avoid raising `DeprecationWarning` related to `os.fork` when running in a

loky/backend/fork_exec.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@ def fork_exec(cmd, keep_fds, env=None):
2828
keep_fds = tuple(sorted(map(int, keep_fds)))
2929
errpipe_read, errpipe_write = os.pipe()
3030

31-
# VFORK is not supported on older Python versions.
32-
if hasattr(subprocess, "_USE_VFORK"):
33-
# Python 3.11 and later
31+
if sys.version_info >= (3, 14):
32+
# Python >= 3.14 removed allow_vfork from _posixsubprocess.fork_exec,
33+
# see https://github.com/python/cpython/pull/121383
34+
pgid_to_set = [-1]
35+
allow_vfork = []
36+
elif sys.version_info >= (3, 11):
37+
# Python 3.11 - 3.13 has allow_vfork in _posixsubprocess.fork_exec
3438
pgid_to_set = [-1]
3539
allow_vfork = [subprocess._USE_VFORK]
3640
else:
41+
# Python < 3.11
3742
pgid_to_set = []
3843
allow_vfork = []
3944

0 commit comments

Comments
 (0)