Skip to content

Commit a8fc8b7

Browse files
miss-islingtongvanrossum
andauthoredMay 18, 2023
[3.11] gh-104340: Suppress warning about unawaited exception for closed pipe stdin (GH-104586) (#104594)
(cherry picked from commit 7fc8e2d) Co-authored-by: Guido van Rossum <guido@python.org>
1 parent 610cc0a commit a8fc8b7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed
 

‎Lib/asyncio/subprocess.py

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ def pipe_connection_lost(self, fd, exc):
8181
self._stdin_closed.set_result(None)
8282
else:
8383
self._stdin_closed.set_exception(exc)
84+
# Since calling `wait_closed()` is not mandatory,
85+
# we shouldn't log the traceback if this is not awaited.
86+
self._stdin_closed._log_traceback = False
8487
return
8588
if fd == 1:
8689
reader = self.stdout
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
When an ``asyncio`` pipe protocol loses its connection due to an error, and the caller doesn't await ``wait_closed()`` on the corresponding ``StreamWriter``, don't log a warning about an exception that was never retrieved. After all, according to the ``StreamWriter.close()`` docs, the ``wait_closed()`` call is optional ("not mandatory").

0 commit comments

Comments
 (0)
Please sign in to comment.