bpo-47039: Normalize repr() of asyncio future and task objects (GH-31950)

This commit is contained in:
Andrew Svetlov 2022-03-17 03:03:09 +02:00 committed by GitHub
parent a7c5414832
commit 30b5d41fab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 118 deletions

View file

@ -1,4 +1,5 @@
import linecache
import reprlib
import traceback
from . import base_futures
@ -22,6 +23,12 @@ def _task_repr_info(task):
return info
@reprlib.recursive_repr()
def _task_repr(task):
info = ' '.join(_task_repr_info(task))
return f'<{task.__class__.__name__} {info}>'
def _task_get_stack(task, limit):
frames = []
if hasattr(task._coro, 'cr_frame'):