summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-05-09 19:00:28 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-05-09 19:00:28 (GMT)
commit5aa878c61a7ecf043ac390672b997adbe7e340d0 (patch)
treed8d7ac38b87549c53b02b81cc780c95ceab2ff1f /Lib/multiprocessing
parent2341f9ba009acad731cf34d8503c7a8f85ebf330 (diff)
downloadcpython-5aa878c61a7ecf043ac390672b997adbe7e340d0.zip
cpython-5aa878c61a7ecf043ac390672b997adbe7e340d0.tar.gz
cpython-5aa878c61a7ecf043ac390672b997adbe7e340d0.tar.bz2
os.dup()-then-close() can be replaced with detach()
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/connection.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py
index afd580b..415e210 100644
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -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)