]> granicus.if.org Git - python/commitdiff
Issue #18865: PEP 446 makes multiprocessing.util.pipe() unnecessary.
authorRichard Oudkerk <shibturn@gmail.com>
Wed, 28 Aug 2013 10:25:34 +0000 (11:25 +0100)
committerRichard Oudkerk <shibturn@gmail.com>
Wed, 28 Aug 2013 10:25:34 +0000 (11:25 +0100)
Lib/multiprocessing/forkserver.py
Lib/multiprocessing/util.py

index 11df38285c6d82c9162df3c4b195fbc22c598c4b..975b15aef8fde9cd8f839a910e901d7d84301dc3 100644 (file)
@@ -108,7 +108,7 @@ def ensure_running():
 
             # 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)
index ac8e9136c1133e089b17b0a4d3af24ebb93c747b..0aeb1018faf5425d1cb193f010efe1d6b91721a4 100644 (file)
@@ -358,13 +358,6 @@ def close_all_fds_except(fds):
 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 @@ def spawnv_passfds(path, args, passfds):
     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()