Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
485b26b
bpo-43884: Fix asyncio subprocess kill process cleanly when process i…
kumaraditya303 Mar 23, 2022
7c10817
Merge branch 'main' of https://github.com/python/cpython into fix-asy…
kumaraditya303 Mar 24, 2022
0b87f8d
rework
kumaraditya303 Mar 24, 2022
2bd08cf
start from scratch
kumaraditya303 Mar 28, 2022
6afa6df
Merge branch 'main' of https://github.com/python/cpython into fix-asy…
kumaraditya303 Mar 28, 2022
a2a3a1d
rework
kumaraditya303 Mar 28, 2022
e325b6c
remove script
kumaraditya303 Mar 28, 2022
6a37501
Merge branch 'main' into fix-asyncio-subprocess
kumaraditya303 Apr 17, 2022
5fa81d6
Merge branch 'main' into fix-asyncio-subprocess
kumaraditya303 May 4, 2022
74e42a7
Merge branch 'main' into fix-asyncio-subprocess
kumaraditya303 May 27, 2022
7946267
another try
kumaraditya303 May 27, 2022
4f18b7d
Merge branch 'main' into fix-asyncio-subprocess
kumaraditya303 Jul 7, 2022
d896e0b
skip unless sleep
kumaraditya303 Jul 8, 2022
b5de374
📜🤖 Added by blurb_it.
blurb-it[bot] Jul 8, 2022
727bb9e
Merge branch 'main' into fix-asyncio-subprocess
kumaraditya303 Jul 21, 2022
e7eca7a
Merge branch 'main' into fix-asyncio-subprocess
kumaraditya303 Sep 12, 2022
8b2cee6
fix test on windows
kumaraditya303 Oct 1, 2022
53fbc9a
fix comment
kumaraditya303 Oct 1, 2022
77c76dd
Merge branch 'main' of https://github.com/python/cpython into fix-asy…
kumaraditya303 Oct 1, 2022
e223141
Update Misc/NEWS.d/next/Library/2022-07-08-08-39-35.gh-issue-88050.0a…
kumaraditya303 Oct 5, 2022
4ac1184
Merge branch 'main' into fix-asyncio-subprocess
kumaraditya303 Oct 5, 2022
69a9fda
fixup test as Guido suggested
kumaraditya303 Oct 5, 2022
678cc76
Merge branch 'main' into fix-asyncio-subprocess
kumaraditya303 Oct 5, 2022
ba0382d
fix killing on windows
kumaraditya303 Oct 5, 2022
90e7ac5
Merge branch 'fix-asyncio-subprocess' of https://github.com/kumaradit…
kumaraditya303 Oct 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rework
  • Loading branch information
kumaraditya303 authored Mar 24, 2022
commit 0b87f8d2d9a84bf89bbf174a71e638615b1db43c
23 changes: 7 additions & 16 deletions Lib/asyncio/base_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,23 +214,15 @@ def _process_exited(self, returncode):
# asyncio uses a child watcher: copy the status into the Popen
# object. On Python 3.6, it is required to avoid a ResourceWarning.
self._proc.returncode = returncode

def __process_exited():
self._protocol.process_exited()
# Since process exited, clear all pipes
for proto in self._pipes.values():
if proto is None:
continue
proto.pipe.close()
# Call _wait waiters
for waiter in self._exit_waiters:
if not waiter.cancelled():
waiter.set_result(self._returncode)
self._exit_waiters = None

self._call(__process_exited)
self._call(self._protocol.process_exited)
self._try_finish()

# wake up futures waiting for wait()
for waiter in self._exit_waiters:
if not waiter.cancelled():
waiter.set_result(returncode)
self._exit_waiters = None

async def _wait(self):
"""Wait until the process exit and return the process return code.

Expand Down Expand Up @@ -260,7 +252,6 @@ def _call_connection_lost(self, exc):
self._protocol = None



class WriteSubprocessPipeProto(protocols.BaseProtocol):

def __init__(self, proc, fd):
Expand Down
4 changes: 3 additions & 1 deletion Lib/asyncio/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def process_exited(self):
self._maybe_close_transport()

def _maybe_close_transport(self):
if len(self._pipe_fds) == 0 and self._process_exited:
# Since process already exited
# clear all the pipes and close transport
if self._process_exited and self._transport:
self._transport.close()
self._transport = None

Expand Down