1385746
From a508ebafadcfe2e25554b029593f3e66d01ede6c Mon Sep 17 00:00:00 2001
1385746
From: Victor Stinner <vstinner@python.org>
1385746
Date: Mon, 16 Mar 2020 21:50:36 +0100
1385746
Subject: [PATCH] Issue #309: Add Python 3.9 support to spawnv_passfds()
1385746
1385746
Python 3.9 added (umask, user, group, extra_groups) parameters to
1385746
_posixsubprocess.fork_exec().
1385746
---
1385746
 billiard/compat.py | 8 ++++++--
1385746
 tox.ini            | 2 +-
1385746
 2 files changed, 7 insertions(+), 3 deletions(-)
1385746
1385746
diff --git a/billiard/compat.py b/billiard/compat.py
1385746
index b172d9a..b5ce7c7 100644
1385746
--- a/billiard/compat.py
1385746
+++ b/billiard/compat.py
1385746
@@ -220,10 +220,14 @@ def spawnv_passfds(path, args, passfds):
1385746
         passfds = sorted(passfds)
1385746
         errpipe_read, errpipe_write = os.pipe()
1385746
         try:
1385746
-            return _posixsubprocess.fork_exec(
1385746
+            args = [
1385746
                 args, [fsencode(path)], True, tuple(passfds), None, None,
1385746
                 -1, -1, -1, -1, -1, -1, errpipe_read, errpipe_write,
1385746
-                False, False, None)
1385746
+                False, False]
1385746
+            if sys.version_info >= (3, 9):
1385746
+                args.extend((None, None, None, -1))  # group, extra_groups, user, umask
1385746
+            args.append(None)  # preexec_fn
1385746
+            return _posixsubprocess.fork_exec(*args)
1385746
         finally:
1385746
             os.close(errpipe_read)
1385746
             os.close(errpipe_write)