]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-87452: Improve the Popen.returncode docs
authorJoshua Herman <30265+zitterbewegung@users.noreply.github.com>
Mon, 24 Apr 2023 16:46:12 +0000 (10:46 -0600)
committerGitHub <noreply@github.com>
Mon, 24 Apr 2023 16:46:12 +0000 (09:46 -0700)
Clarifies that it remains None until a method checking the child process status has been called and noticed it has terminated.

Doc/library/subprocess.rst

index 2b5a82e0107fb6a084a6984b0a8455ed1e45d5d2..53dfbf827260c910c11574e082239089055285d7 100644 (file)
@@ -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).