From: Gregory P. Smith <68491+gpshead@users.noreply.github.com> Date: Mon, 1 Dec 2025 02:50:05 +0000 (-0800) Subject: gh-141473: Document not calling Popen.wait after Popen.communicate times out. (GH... X-Git-Tag: v3.15.0a3~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e2c55749326809a2fc76b9f2cb87a6f89037ebe;p=thirdparty%2FPython%2Fcpython.git gh-141473: Document not calling Popen.wait after Popen.communicate times out. (GH-142101) Document not calling Popen.wait after Popen.communicate times out. Closes #141473 --- diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 43da804b62be..b8dfcc310771 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -846,6 +846,11 @@ Instances of the :class:`Popen` class have the following methods: proc.kill() outs, errs = proc.communicate() + After a call to :meth:`~Popen.communicate` raises :exc:`TimeoutExpired`, do + not call :meth:`~Popen.wait`. Use an additional :meth:`~Popen.communicate` + call to finish handling pipes and populate the :attr:`~Popen.returncode` + attribute. + .. note:: The data read is buffered in memory, so do not use this method if the data