From 9054b60a8318ce73fb344d85e6155874473628a7 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sat, 29 Nov 2025 21:24:31 +0000 Subject: [PATCH] Document not calling Popen.wait after Popen.communicate times out. --- Doc/library/subprocess.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 43da804b62beb1..b8dfcc310771fe 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