]> granicus.if.org Git - python/commitdiff
os.dup()-then-close() can be replaced with detach()
authorAntoine Pitrou <solipsis@pitrou.net>
Mon, 9 May 2011 19:00:28 +0000 (21:00 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Mon, 9 May 2011 19:00:28 +0000 (21:00 +0200)
Lib/multiprocessing/connection.py

index afd580bff2b359b435a3d35e90aef445ea136415..415e21066ae58b9b78627020d950c6e1fbe21334 100644 (file)
@@ -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)