-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-139452: Clarify redirect_stdout, stderr behavior #139490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
These don't "redirect" like a terminal where typically the file pointed to by fd 1 and 2 are made the "same" by the preparing process (ex. by `dup2` the given fd into that specific fd number). Rather, these context managers set the respective globals to the provided value. In most cases that should be a "file object".
@wolfgang-eder how does this look to you? |
Please limit the edit to just |
Thank you for improving the documentation. I am happy with the changes |
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 value, typically a :term:`file object`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "another target" would be better here than "another value"?
@rhettinger to check my understanding: reduce to just the "file or file-like object." -> |
These don't "redirect" like a terminal where typically the file pointed to by fd 1 and 2 are made the "same" (ex. by
dup2
the given fd into that specific fd number). Rather, these context managers set the respective globals to the provided value. In most cases that should be a "file object".contextlib.redirect_stderr()
#139452📚 Documentation preview 📚: https://cpython-previews--139490.org.readthedocs.build/