summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/asyncio/subprocess.py3
-rw-r--r--Misc/NEWS.d/next/Library/2023-05-17-20-03-01.gh-issue-104340.kp_XmX.rst1
2 files changed, 4 insertions, 0 deletions
diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py
index 50727ca..c4e5ba2 100644
--- a/Lib/asyncio/subprocess.py
+++ b/Lib/asyncio/subprocess.py
@@ -81,6 +81,9 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
self._stdin_closed.set_result(None)
else:
self._stdin_closed.set_exception(exc)
+ # Since calling `wait_closed()` is not mandatory,
+ # we shouldn't log the traceback if this is not awaited.
+ self._stdin_closed._log_traceback = False
return
if fd == 1:
reader = self.stdout
diff --git a/Misc/NEWS.d/next/Library/2023-05-17-20-03-01.gh-issue-104340.kp_XmX.rst b/Misc/NEWS.d/next/Library/2023-05-17-20-03-01.gh-issue-104340.kp_XmX.rst
new file mode 100644
index 0000000..5b03622
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-05-17-20-03-01.gh-issue-104340.kp_XmX.rst
@@ -0,0 +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").