summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/base_tasks.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2017-12-10 23:36:12 (GMT)
committerGitHub <noreply@github.com>2017-12-10 23:36:12 (GMT)
commit6370f345e1d5829e1fba59cd695c8b82c5a8c620 (patch)
treeba648772068abc784cef9e7b2e0be159646d7514 /Lib/asyncio/base_tasks.py
parentc4d9df5fd719ad08e68e0950ce22a80f43e4f35d (diff)
downloadcpython-6370f345e1d5829e1fba59cd695c8b82c5a8c620.zip
cpython-6370f345e1d5829e1fba59cd695c8b82c5a8c620.tar.gz
cpython-6370f345e1d5829e1fba59cd695c8b82c5a8c620.tar.bz2
bpo-32262: Fix codestyle; use f-strings formatting where necessary. (#4775)
Diffstat (limited to 'Lib/asyncio/base_tasks.py')
-rw-r--r--Lib/asyncio/base_tasks.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/asyncio/base_tasks.py b/Lib/asyncio/base_tasks.py
index 5f34434..3ce51f6 100644
--- a/Lib/asyncio/base_tasks.py
+++ b/Lib/asyncio/base_tasks.py
@@ -13,10 +13,10 @@ def _task_repr_info(task):
info[0] = 'cancelling'
coro = coroutines._format_coroutine(task._coro)
- info.insert(1, 'coro=<%s>' % coro)
+ info.insert(1, f'coro=<{coro}>')
if task._fut_waiter is not None:
- info.insert(2, 'wait_for=%r' % task._fut_waiter)
+ info.insert(2, f'wait_for={task._fut_waiter!r}')
return info
@@ -61,15 +61,15 @@ def _task_print_stack(task, limit, file):
linecache.checkcache(filename)
line = linecache.getline(filename, lineno, f.f_globals)
extracted_list.append((filename, lineno, name, line))
+
exc = task._exception
if not extracted_list:
- print('No stack for %r' % task, file=file)
+ print(f'No stack for {task!r}', file=file)
elif exc is not None:
- print('Traceback for %r (most recent call last):' % task,
- file=file)
+ print(f'Traceback for {task!r} (most recent call last):', file=file)
else:
- print('Stack for %r (most recent call last):' % task,
- file=file)
+ print(f'Stack for {task!r} (most recent call last):', file=file)
+
traceback.print_list(extracted_list, file=file)
if exc is not None:
for line in traceback.format_exception_only(exc.__class__, exc):