File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -360,7 +360,10 @@ def accept(self):
360360 try :
361361 win32 .ConnectNamedPipe (handle , win32 .NULL )
362362 except WindowsError as e :
363- if e .args [0 ] != win32 .ERROR_PIPE_CONNECTED :
363+ # ERROR_NO_DATA can occur if a client has already connected,
364+ # written data and then disconnected -- see Issue 14725.
365+ if e .args [0 ] not in (win32 .ERROR_PIPE_CONNECTED ,
366+ win32 .ERROR_NO_DATA ):
364367 raise
365368 return _multiprocessing .PipeConnection (handle )
366369
Original file line number Diff line number Diff line change @@ -1732,6 +1732,23 @@ def test_listener_client(self):
17321732 self .assertEqual (conn .recv (), 'hello' )
17331733 p .join ()
17341734 l .close ()
1735+
1736+ def test_issue14725 (self ):
1737+ l = self .connection .Listener ()
1738+ p = self .Process (target = self ._test , args = (l .address ,))
1739+ p .daemon = True
1740+ p .start ()
1741+ time .sleep (1 )
1742+ # On Windows the client process should by now have connected,
1743+ # written data and closed the pipe handle by now. This causes
1744+ # ConnectNamdedPipe() to fail with ERROR_NO_DATA. See Issue
1745+ # 14725.
1746+ conn = l .accept ()
1747+ self .assertEqual (conn .recv (), 'hello' )
1748+ conn .close ()
1749+ p .join ()
1750+ l .close ()
1751+
17351752#
17361753# Test of sending connection and socket objects between processes
17371754#
Original file line number Diff line number Diff line change @@ -244,6 +244,7 @@ create_win32_namespace(void)
244244 Py_INCREF (& Win32Type );
245245
246246 WIN32_CONSTANT (F_DWORD , ERROR_ALREADY_EXISTS );
247+ WIN32_CONSTANT (F_DWORD , ERROR_NO_DATA );
247248 WIN32_CONSTANT (F_DWORD , ERROR_PIPE_BUSY );
248249 WIN32_CONSTANT (F_DWORD , ERROR_PIPE_CONNECTED );
249250 WIN32_CONSTANT (F_DWORD , ERROR_SEM_TIMEOUT );
You can’t perform that action at this time.
0 commit comments