diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2022-03-17 01:03:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-17 01:03:09 (GMT) |
commit | 30b5d41fabad04f9f34d603f1ce2249452c18c71 (patch) | |
tree | 7eed9b2cc60f96768193498b051583dd733e2a40 /Lib/asyncio/base_tasks.py | |
parent | a7c54148322781cb0f332d440a3454d550ef6414 (diff) | |
download | cpython-30b5d41fabad04f9f34d603f1ce2249452c18c71.zip cpython-30b5d41fabad04f9f34d603f1ce2249452c18c71.tar.gz cpython-30b5d41fabad04f9f34d603f1ce2249452c18c71.tar.bz2 |
bpo-47039: Normalize repr() of asyncio future and task objects (GH-31950)
Diffstat (limited to 'Lib/asyncio/base_tasks.py')
-rw-r--r-- | Lib/asyncio/base_tasks.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/asyncio/base_tasks.py b/Lib/asyncio/base_tasks.py index 1d62389..26298e6 100644 --- a/Lib/asyncio/base_tasks.py +++ b/Lib/asyncio/base_tasks.py @@ -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'): |