gh-103847: fix some asyncio subprocess cancellation bugs (#146571) · python/cpython@f429fb3 · GitHub
Skip to content

Commit f429fb3

Browse files
gh-103847: fix some asyncio subprocess cancellation bugs (#146571)
1 parent c76fb91 commit f429fb3

4 files changed

Lines changed: 18 additions & 9 deletions

File tree

Lib/asyncio/base_subprocess.py

Lines changed: 15 additions & 3 deletions

Lib/asyncio/unix_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ async def _make_subprocess_transport(self, protocol, args, shell,
213213
raise
214214
except BaseException:
215215
transp.close()
216-
await transp._wait()
216+
await tasks.shield(transp._wait())
217217
raise
218218

219219
return transp

Lib/asyncio/windows_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ async def _make_subprocess_transport(self, protocol, args, shell,
406406
raise
407407
except BaseException:
408408
transp.close()
409-
await transp._wait()
409+
await tasks.shield(transp._wait())
410410
raise
411411

412412
return transp

Lib/test/test_asyncio/test_subprocess.py

Lines changed: 1 addition & 4 deletions

0 commit comments

Comments
 (0)