Skip to content

Commit 3422473

Browse files
authored
Fix default file in Task.print_stack
`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.
1 parent e8165d4 commit 3422473

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/asyncio/tasks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import functools
1515
import inspect
1616
import itertools
17+
import sys
1718
import types
1819
import warnings
1920
import weakref
@@ -183,6 +184,8 @@ def print_stack(self, *, limit=None, file=None):
183184
to which the output is written; by default output is written
184185
to sys.stderr.
185186
"""
187+
if file is None:
188+
file = sys.stderr
186189
return base_tasks._task_print_stack(self, limit, file)
187190

188191
def cancel(self, msg=None):

0 commit comments

Comments
 (0)