From: Antoine Pitrou Date: Mon, 9 May 2011 19:00:28 +0000 (+0200) Subject: os.dup()-then-close() can be replaced with detach() X-Git-Tag: v3.3.0a1~2331 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5aa878c61a7ecf043ac390672b997adbe7e340d0;p=python os.dup()-then-close() can be replaced with detach() --- diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py index afd580bff2..415e21066a 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)