[Python-checkins] gh-87597: Document TimeoutExpired.stdout & .stderr types (GH-97685)

miss-islington webhook-mailer at python.org
Fri Sep 30 13:54:18 EDT 2022


https://github.com/python/cpython/commit/cdc01eaed9d19c17b4f01c3da3ca125c49fdffa5
commit: cdc01eaed9d19c17b4f01c3da3ca125c49fdffa5
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-09-30T10:54:12-07:00
summary:

gh-87597: Document TimeoutExpired.stdout & .stderr types (GH-97685)


This documents the behavior that has always been the case since timeout
support was introduced in Python 3.3.
(cherry picked from commit b05dd796492160c37c9e15e3882f699f411b3461)

Co-authored-by: Gregory P. Smith <greg at krypto.org>

files:
M Doc/library/subprocess.rst

diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index 43d6ffceee8f..dee5bd879db5 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -193,7 +193,10 @@ underlying :class:`Popen` interface can be used directly.
     .. attribute:: output
 
         Output of the child process if it was captured by :func:`run` or
-        :func:`check_output`.  Otherwise, ``None``.
+        :func:`check_output`.  Otherwise, ``None``.  This is always
+        :class:`bytes` when any output was captured regardless of the
+        ``text=True`` setting.  It may remain ``None`` instead of ``b''``
+        when no output was observed.
 
     .. attribute:: stdout
 
@@ -202,7 +205,9 @@ underlying :class:`Popen` interface can be used directly.
     .. attribute:: stderr
 
         Stderr output of the child process if it was captured by :func:`run`.
-        Otherwise, ``None``.
+        Otherwise, ``None``.  This is always :class:`bytes` when stderr output
+        was captured regardless of the ``text=True`` setting.  It may remain
+        ``None`` instead of ``b''`` when no stderr output was observed.
 
     .. versionadded:: 3.3
 



More information about the Python-checkins mailing list