]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-139452: Clarify redirect_stdout, stderr behavior (gh-139490)
authorCody Maloney <cmaloney@users.noreply.github.com>
Wed, 8 Oct 2025 13:28:29 +0000 (06:28 -0700)
committerGitHub <noreply@github.com>
Wed, 8 Oct 2025 13:28:29 +0000 (08:28 -0500)
Doc/library/contextlib.rst

index 176be4ff33395554f18404e4a1d82ea88c5c2815..d0fa645093a3e96493cb4b6f26dc0364ea4e5a62 100644 (file)
@@ -327,10 +327,10 @@ Functions and classes provided:
 .. function:: redirect_stdout(new_target)
 
    Context manager for temporarily redirecting :data:`sys.stdout` to
-   another file or file-like object.
+   another :term:`file object`.
 
    This tool adds flexibility to existing functions or classes whose output
-   is hardwired to stdout.
+   is hardwired to :data:`sys.stdout`.
 
    For example, the output of :func:`help` normally is sent to *sys.stdout*.
    You can capture that output in a string by redirecting the output to an
@@ -366,8 +366,8 @@ Functions and classes provided:
 
 .. function:: redirect_stderr(new_target)
 
-   Similar to :func:`~contextlib.redirect_stdout` but redirecting
-   :data:`sys.stderr` to another file or file-like object.
+   Similar to :func:`~contextlib.redirect_stdout` but redirecting the global
+   :data:`sys.stderr` to another :term:`file object`.
 
    This context manager is :ref:`reentrant <reentrant-cms>`.