[Python-checkins] cpython: Issue #18865: PEP 446 makes multiprocessing.util.pipe() unnecessary.

richard.oudkerk python-checkins at python.org
Wed Aug 28 12:27:33 CEST 2013


http://hg.python.org/cpython/rev/38f028939028
changeset:   85427:38f028939028
user:        Richard Oudkerk <shibturn at gmail.com>
date:        Wed Aug 28 11:25:34 2013 +0100
summary:
  Issue #18865: PEP 446 makes multiprocessing.util.pipe() unnecessary.

files:
  Lib/multiprocessing/forkserver.py |   2 +-
  Lib/multiprocessing/util.py       |  20 -------------------
  2 files changed, 1 insertions(+), 21 deletions(-)


diff --git a/Lib/multiprocessing/forkserver.py b/Lib/multiprocessing/forkserver.py
--- a/Lib/multiprocessing/forkserver.py
+++ b/Lib/multiprocessing/forkserver.py
@@ -108,7 +108,7 @@
 
             # all client processes own the write end of the "alive" pipe;
             # when they all terminate the read end becomes ready.
-            alive_r, alive_w = util.pipe()
+            alive_r, alive_w = os.pipe()
             try:
                 fds_to_pass = [listener.fileno(), alive_r]
                 cmd %= (listener.fileno(), alive_r, _preload_modules, data)
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py
--- a/Lib/multiprocessing/util.py
+++ b/Lib/multiprocessing/util.py
@@ -358,13 +358,6 @@
 def spawnv_passfds(path, args, passfds):
     import _posixsubprocess, fcntl
     passfds = sorted(passfds)
-    tmp = []
-    # temporarily unset CLOEXEC on passed fds
-    for fd in passfds:
-        flag = fcntl.fcntl(fd, fcntl.F_GETFD)
-        if flag & fcntl.FD_CLOEXEC:
-            fcntl.fcntl(fd, fcntl.F_SETFD, flag & ~fcntl.FD_CLOEXEC)
-            tmp.append((fd, flag))
     errpipe_read, errpipe_write = os.pipe()
     try:
         return _posixsubprocess.fork_exec(
@@ -374,16 +367,3 @@
     finally:
         os.close(errpipe_read)
         os.close(errpipe_write)
-        # reset CLOEXEC where necessary
-        for fd, flag in tmp:
-            fcntl.fcntl(fd, fcntl.F_SETFD, flag)
-
-#
-# Return pipe with CLOEXEC set on fds
-#
-# Deprecated: os.pipe() creates non-inheritable file descriptors
-# since Python 3.4
-#
-
-def pipe():
-    return os.pipe()

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list