https://github.com/python/cpython/commit/8b9606a2c577b0a0f7f425959a27a8554a9b474f
commit: 8b9606a2c577b0a0f7f425959a27a8554a9b474f
branch: main
author: Cody Maloney <[email protected]>
committer: rhettinger <[email protected]>
date: 2025-10-08T08:28:29-05:00
summary:
gh-139452: Clarify redirect_stdout, stderr behavior (gh-139490)
files:
M Doc/library/contextlib.rst
diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst
index 176be4ff333955..d0fa645093a3e9 100644
--- a/Doc/library/contextlib.rst
+++ b/Doc/library/contextlib.rst
@@ -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>`.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]