From ced6924630037f1e5b3d1dbef2b600152fb07fbb Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 20 Sep 2023 15:54:19 +0200 Subject: gh-108973: Fix asyncio test_subprocess_consistent_callbacks() (#109431) SubprocessProtocol process_exited() method can be called before pipe_data_received() and pipe_connection_lost() methods. Document it and adapt the test for that. Revert commit 282edd7b2a74c4dfe1bfe3c5b1d30f9c21d554d6. _child_watcher_callback() calls immediately _process_exited(): don't add an additional delay with call_soon(). The reverted change didn't make _process_exited() more determistic: it can still be called before pipe_connection_lost() for example. Co-authored-by: Davide Rizzo --- Lib/asyncio/unix_events.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Lib/asyncio/unix_events.py') diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index a2680865ed9..28cef964deb 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -226,8 +226,7 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): return transp def _child_watcher_callback(self, pid, returncode, transp): - # Skip one iteration for callbacks to be executed - self.call_soon_threadsafe(self.call_soon, transp._process_exited, returncode) + self.call_soon_threadsafe(transp._process_exited, returncode) async def create_unix_connection( self, protocol_factory, path=None, *, -- cgit v1.2.3