Skip to content

Commit 68f5836

Browse files
authoredApr 24, 2023
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.
1 parent 385d8d2 commit 68f5836

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎Doc/library/subprocess.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -919,9 +919,12 @@ Reassigning them to new values is unsupported:
919919

920920
.. attribute:: Popen.returncode
921921

922-
The child return code, set by :meth:`poll` and :meth:`wait` (and indirectly
923-
by :meth:`communicate`). A ``None`` value indicates that the process
924-
hasn't terminated yet.
922+
The child return code. Initially ``None``, :attr:`returncode` is set by
923+
a call to the :meth:`poll`, :meth:`wait`, or :meth:`communicate` methods
924+
if they detect that the process has terminated.
925+
926+
A ``None`` value indicates that the process hadn't yet terminated at the
927+
time of the last method call.
925928

926929
A negative value ``-N`` indicates that the child was terminated by signal
927930
``N`` (POSIX only).

0 commit comments

Comments
 (0)
Please sign in to comment.