[issue39623] __str__ and __repr__ for asyncio.Task still omit arg values
Karthikeyan Singaravelan
report at bugs.python.org
Thu Feb 13 04:03:31 EST 2020
Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:
This could sometimes make the output verbose when the arguments themselves are tasks while including arguments in the signature in _format_coroutine.
$ cat /tmp/foo.py
import asyncio
async def foo(a, b): pass
async def main():
task = asyncio.create_task(foo(1, b=1))
task1 = asyncio.create_task(foo(1, b=task))
print(repr(task))
print(repr(task1))
asyncio.run(main())
$ python3.8 /tmp/foo.py
<Task pending name='Task-2' coro=<foo() running at /tmp/foo.py:3>>
<Task pending name='Task-3' coro=<foo() running at /tmp/foo.py:3>>
$ ./python.exe /tmp/foo.py
<Task pending name='Task-2' coro=<foo(a=1, b=1) running at /tmp/foo.py:3>>
<Task pending name='Task-3' coro=<foo(a=1, b=<Task pending name='Task-2' coro=<foo(a=1, b=1) running at /tmp/foo.py:3>>) running at /tmp/foo.py:3>>
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39623>
_______________________________________
More information about the Python-bugs-list
mailing list