mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
os.dup()-then-close() can be replaced with detach()
This commit is contained in:
parent
2341f9ba00
commit
5aa878c61a
1 changed files with 2 additions and 4 deletions
|
@ -469,10 +469,8 @@ if sys.platform != 'win32':
|
|||
'''
|
||||
if duplex:
|
||||
s1, s2 = socket.socketpair()
|
||||
c1 = Connection(os.dup(s1.fileno()))
|
||||
c2 = Connection(os.dup(s2.fileno()))
|
||||
s1.close()
|
||||
s2.close()
|
||||
c1 = Connection(s1.detach())
|
||||
c2 = Connection(s2.detach())
|
||||
else:
|
||||
fd1, fd2 = os.pipe()
|
||||
c1 = Connection(fd1, writable=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue