Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5804ee7

Browse filesBrowse files
gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (#134508)
1 parent 8dbc119 commit 5804ee7
Copy full SHA for 5804ee7

File tree

Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed

‎Lib/asyncio/base_subprocess.py

Copy file name to clipboardExpand all lines: Lib/asyncio/base_subprocess.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ def close(self):
104104
for proto in self._pipes.values():
105105
if proto is None:
106106
continue
107-
proto.pipe.close()
107+
# See gh-114177
108+
# skip closing the pipe if loop is already closed
109+
# this can happen e.g. when loop is closed immediately after
110+
# process is killed
111+
if self._loop and not self._loop.is_closed():
112+
proto.pipe.close()
108113

109114
if (self._proc is not None and
110115
# has the child process finished?
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix :mod:`asyncio` to not close subprocess pipes which would otherwise error out when the event loop is already closed.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.