summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Herman <30265+zitterbewegung@users.noreply.github.com>2023-04-24 16:46:12 (GMT)
committerGitHub <noreply@github.com>2023-04-24 16:46:12 (GMT)
commit68f583658247ceced323d79e1cf775c91c53c019 (patch)
tree881b648e89e1700397a7bcca3e27885a3d9b56cf
parent385d8d2b6438c7825006df6106dab41a95332a6a (diff)
downloadcpython-68f583658247ceced323d79e1cf775c91c53c019.zip
cpython-68f583658247ceced323d79e1cf775c91c53c019.tar.gz
cpython-68f583658247ceced323d79e1cf775c91c53c019.tar.bz2
gh-87452: Improve the Popen.returncode docs
Clarifies that it remains None until a method checking the child process status has been called and noticed it has terminated.
-rw-r--r--Doc/library/subprocess.rst9
1 files changed, 6 insertions, 3 deletions
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index 2b5a82e..53dfbf8 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -919,9 +919,12 @@ Reassigning them to new values is unsupported:
.. attribute:: Popen.returncode
- The child return code, set by :meth:`poll` and :meth:`wait` (and indirectly
- by :meth:`communicate`). A ``None`` value indicates that the process
- hasn't terminated yet.
+ The child return code. Initially ``None``, :attr:`returncode` is set by
+ a call to the :meth:`poll`, :meth:`wait`, or :meth:`communicate` methods
+ if they detect that the process has terminated.
+
+ A ``None`` value indicates that the process hadn't yet terminated at the
+ time of the last method call.
A negative value ``-N`` indicates that the child was terminated by signal
``N`` (POSIX only).