8000 gh-97725: Fix default file in `Task.print_stack` by megabug · Pull Request #97726 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-97725: Fix default file in Task.print_stack #97726

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

Closed
wants to merge 2 commits into from

Conversation

megabug
Copy link
@megabug megabug commented Oct 2, 2022

asyncio.Task.print_stack is described by documentation as having a default output file of sys.stderr. However, the default None is passed all the way to print statements, leading to an actual default of sys.stdout.

Fix by setting the file to sys.stderr when the default is used.

`Task.print_stack` is described by documentation as having a default output file of `sys.stderr`. However, instead the default `None` is passed all the way to `print` statements, leading to an actual default of `sys.stdout`.

Fix by setting the file to `sys.stderr` when the default is used.
@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@ghost
Copy link
ghost commented Oct 2, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

Copy link
Contributor
@kumaraditya303 kumaraditya303 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a regression test for this.

@kumaraditya303 kumaraditya303 added type-bug An unexpected behavior, bug, or error needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Oct 2, 2022
@gvanrossum
Copy link
Member

But do we want to fix the code to match the docs? In cases like this, where the docs and the code have always disagreed (or for many releases), we tend to prefer to fix the docs to match the code, since "fixing" the code may actually break apps that were expecting the observed behavior.

Also, print_* kind of suggests that it does the same thing as print(). More indication to me that the docs were just wrong (it happens :-).

@kumaraditya303
Copy link
Contributor

Superseded by #101652

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0