Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d097b6

Browse files
committed
Issue #18865: PEP 446 makes multiprocessing.util.pipe() unnecessary.
1 parent 1fa174a commit 0d097b6

2 files changed

Lines changed: 1 addition & 21 deletions

File tree

Lib/multiprocessing/forkserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def ensure_running():
108108

109109
# all client processes own the write end of the "alive" pipe;
110110
# when they all terminate the read end becomes ready.
111-
alive_r, alive_w = util.pipe()
111+
alive_r, alive_w = os.pipe()
112112
try:
113113
fds_to_pass = [listener.fileno(), alive_r]
114114
cmd %= (listener.fileno(), alive_r, _preload_modules, data)

Lib/multiprocessing/util.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,6 @@ def close_all_fds_except(fds):
358358
def spawnv_passfds(path, args, passfds):
359359
import _posixsubprocess, fcntl
360360
passfds = sorted(passfds)
361-
tmp = []
362-
# temporarily unset CLOEXEC on passed fds
363-
for fd in passfds:
364-
flag = fcntl.fcntl(fd, fcntl.F_GETFD)
365-
if flag & fcntl.FD_CLOEXEC:
366-
fcntl.fcntl(fd, fcntl.F_SETFD, flag & ~fcntl.FD_CLOEXEC)
367-
tmp.append((fd, flag))
368361
errpipe_read, errpipe_write = os.pipe()
369362
try:
370363
return _posixsubprocess.fork_exec(
@@ -374,16 +367,3 @@ def spawnv_passfds(path, args, passfds):
374367
finally:
375368
os.close(errpipe_read)
376369
os.close(errpipe_write)
377-
# reset CLOEXEC where necessary
378-
for fd, flag in tmp:
379-
fcntl.fcntl(fd, fcntl.F_SETFD, flag)
380-
381-
#
382-
# Return pipe with CLOEXEC set on fds
383-
#
384-
# Deprecated: os.pipe() creates non-inheritable file descriptors
385-
# since Python 3.4
386-
#
387-
388-
def pipe():
389-
return os.pipe()

0 commit comments

Comments
 (0)