Skip to content

Commit 6d7dbcc

Browse files
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 b05dd79) Co-authored-by: Gregory P. Smith <[email protected]>
1 parent b61a51a commit 6d7dbcc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Doc/library/subprocess.rst

+7-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ underlying :class:`Popen` interface can be used directly.
192192
.. attribute:: output
193193

194194
Output of the child process if it was captured by :func:`run` or
195-
:func:`check_output`. Otherwise, ``None``.
195+
:func:`check_output`. Otherwise, ``None``. This is always
196+
:class:`bytes` when any output was captured regardless of the
197+
``text=True`` setting. It may remain ``None`` instead of ``b''``
198+
when no output was observed.
196199

197200
.. attribute:: stdout
198201

@@ -201,7 +204,9 @@ underlying :class:`Popen` interface can be used directly.
201204
.. attribute:: stderr
202205

203206
Stderr output of the child process if it was captured by :func:`run`.
204-
Otherwise, ``None``.
207+
Otherwise, ``None``. This is always :class:`bytes` when stderr output
208+
was captured regardless of the ``text=True`` setting. It may remain
209+
``None`` instead of ``b''`` when no stderr output was observed.
205210

206211
.. versionadded:: 3.3
207212

0 commit comments

Comments
 (0)