mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
Issue #18865: PEP 446 makes multiprocessing.util.pipe() unnecessary.
This commit is contained in:
parent
1fa174a418
commit
0d097b6299
2 changed files with 1 additions and 21 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue