Skip to content

Commit b05dd79

Browse files
authored
gh-87597: Document TimeoutExpired.stdout & .stderr types (#97685)
This documents the behavior that has always been the case since timeout support was introduced in Python 3.3.
1 parent 1cc308d commit b05dd79

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
@@ -193,7 +193,10 @@ underlying :class:`Popen` interface can be used directly.
193193
.. attribute:: output
194194

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

198201
.. attribute:: stdout
199202

@@ -202,7 +205,9 @@ underlying :class:`Popen` interface can be used directly.
202205
.. attribute:: stderr
203206

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

207212
.. versionadded:: 3.3
208213

0 commit comments

Comments
 (0)